@libxai/board 0.17.89 → 0.17.90
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 +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +7 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),Jl=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),Ym=require('react-markdown'),qm=require('remark-gfm'),Xm=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Jl__default=/*#__PURE__*/_interopDefault(Jl);var Ym__default=/*#__PURE__*/_interopDefault(Ym);var qm__default=/*#__PURE__*/_interopDefault(qm);var Xm__default=/*#__PURE__*/_interopDefault(Xm);var Qr=(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 eo=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 [eo.Translate.toString(e),eo.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function S(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function to(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 Lc(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Qo(e,t){return e.length===0?1e3:t===0?to(null,e[0].position):t>=e.length?to(e[e.length-1].position,null):to(e[t-1].position,e[t].position)}function ni(e,t=100){return e>t}var Fc=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 Bc(e,t,a,r){let o=t*Math.pow(a,e-1),n=o*.2*Math.random();return Math.min(o+n,r)}async function ao(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:n=1e4,shouldRetry:d=Fc,onRetry:c}=t,m,s=0;for(let p=1;p<=a;p++){s=p;try{return {data:await e(),attempts:s,success:!0}}catch(i){if(m=i,p===a||!d(m,p))return {error:m,attempts:s,success:false};let u=Bc(p,r,o,n);if(c)try{c(m,p,u);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,u));}}return {error:m||new Error("Unknown error"),attempts:s,success:false}}function Rc(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 Oc(e,t={}){return async(...a)=>ao(()=>e(...a),t)}var en=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 si=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.NONE=4]="NONE",n))(si||{}),Ga=class Ga{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:n,...d}=t,c=`[${a}] [${r}] [${n}]`,m=Object.keys(d).length>0;switch(r){case "DEBUG":console.debug(c,o,m?d:"");break;case "INFO":console.info(c,o,m?d:"");break;case "WARN":console.warn(c,o,m?d:"");break;case "ERROR":console.error(c,o,m?d:""),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",...Ga.globalOptions};}static configure(t){Ga.globalOptions={...Ga.globalOptions,...t};}child(t){return new Ga({...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 ro((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new ro(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:si[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Ga.globalOptions={};var tn=Ga,ro=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}},ii=new tn;function zc(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 Uc(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(n=>{let d=e.columns.find(c=>c.id===n.columnId);return [n.id,an(n.title),an(n.description||""),an(d?.title||""),n.priority||"",(n.labels||[]).join(";"),(n.assignedUserIds||[]).join(";"),n.startDate||"",n.endDate||"",n.createdAt||"",n.updatedAt||""]});return [a.join(","),...r.map(n=>n.join(","))].join(`
|
|
2
2
|
`)}async function Wc(e,t,a){let r=t;if(!r){let d=document.querySelector(".asakaa-board");d&&(r=d.parentElement||d);}if(r)try{let d=await Jl__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=d.toDataURL("image/png"),m=297,s=210,p=d.width/d.height,i=m-20,l=i/p;l>s-20&&(l=s-20,i=l*p);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,m,15,"F"),u.text(e.title||"Kanban Board",10,10);let y=(m-i)/2;return u.addImage(c,"PNG",y,20,i,l),u}catch(d){console.error("Error capturing board:",d);}let o=new jspdf.jsPDF,n=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,n),n+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,n),n+=15,o.setTextColor(0,0,0),e.columns.forEach(d=>{let c=e.cards.filter(m=>m.columnId===d.id);n>250&&(o.addPage(),n=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(d.title,20,n),n+=8,c.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,n),o.setTextColor(0,0,0),n+=10):c.forEach(m=>{if(n>260&&(o.addPage(),n=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,n),n+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(m.description,160);o.text(p,25,n),n+=p.length*5;}let s=[];if(m.priority&&s.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&s.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&s.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let p=[];m.startDate&&p.push(`Start: ${m.startDate}`),m.endDate&&p.push(`End: ${m.endDate}`),s.push(p.join(" \u2192 "));}s.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(s.join(" \u2022 "),25,n),o.setTextColor(0,0,0),n+=5),n+=5;}),n+=5;}),o}function an(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
3
|
`)?`"${e.replace(/"/g,'""')}"`:e}async function di(e,t,a,r){switch(t){case "json":return zc(e,r);case "csv":return Uc(e);case "pdf":return await Wc(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function ci(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let n=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,d={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:d[t]}),m=URL.createObjectURL(c),s=document.createElement("a");s.href=m,s.download=n,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(m);}function Gc(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 Hc(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=mi(t[0]),r=[],o=new Map,n=[];for(let d=1;d<t.length;d++)try{let c=mi(t[d]||"");if(c.length>a.length){n.push(`Line ${d+1}: Too many columns`);continue}if(a.length-c.length>3){n.push(`Line ${d+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let s={};a.forEach((u,y)=>{s[u]=c[y]||"";});let p=s.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let i=o.get(p),l={id:s["Card ID"]||`card-${d}`,title:s.Title||"Untitled",description:s.Description?s.Description:void 0,columnId:i.id,position:i.cardIds.length+1,priority:s.Priority||void 0,labels:s.Labels?s.Labels.split(";").filter(Boolean):void 0,assignedUserIds:s["Assigned Users"]?s["Assigned Users"].split(";").filter(Boolean):void 0,startDate:s["Start Date"]?s["Start Date"]:void 0,endDate:s["End Date"]?s["End Date"]:void 0,createdAt:s["Created At"]?s["Created At"]:void 0,updatedAt:s["Updated At"]?s["Updated At"]:void 0};r.push(l),i.cardIds.push(l.id);}catch(c){n.push(`Line ${d+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...n]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:n.length>0?n:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function mi(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],d=e[o+1];n==='"'&&r&&d==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function pi(e,t){switch(t){case "json":return Gc(e);case "csv":return Hc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ui(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 rn=react.createContext(null);function gi(){return react.useContext(rn)}var fi=react.createContext(null);function bi({children:e,themeName:t}){return jsxRuntime.jsx(fi.Provider,{value:{themeName:t},children:e})}function nr(){return react.useContext(fi)}function Ue({children:e,container:t}){let[a,r]=react.useState(false),o=gi(),n=nr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let d=t||(typeof document<"u"?document.body:null);if(!d)return null;if(o){let{theme:c,themeName:m}=o,s={"--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":m,"data-gantt-portal":"true",style:s,children:e}),d)}return n?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":n.themeName,"data-kanban-portal":"true",children:e}),d):reactDom.createPortal(e,d)}var ki={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Jc="#BDC3C7",Zc=({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 Ha({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,d]=react.useState({top:0,left:0}),c=react.useRef(null),m=react.useRef(null),s=()=>{if(!m.current)return;let u=m.current.getBoundingClientRect(),y=window.innerHeight,v=window.innerWidth,h=160,k=220,g=4,f=u.right-h;f<10&&(f=u.left),f+h>v-10&&(f=v-h-10);let T=y-u.bottom,N=u.top,b;T>=k+g?b=u.bottom+g:N>=k+g?b=u.top-k-g:b=T>=N?u.bottom+g:Math.max(10,u.top-k-g),d({top:b,left:f}),o(true);};react.useEffect(()=>{let u=y=>{c.current&&!c.current.contains(y.target)&&!m.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let p=u=>{t(u),o(false);},i=e?ki[e]:null,l=i?.color||Jc;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):s(),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?`${l}10`:"transparent",boxShadow:e?`0 0 0 2px ${l}30 inset`:"none"},title:i?.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:l,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:l,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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(ki).map(([u,y])=>jsxRuntime.jsxs("button",{onClick:()=>p(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:y.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Zc,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.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:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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 Qc=[{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 Dr({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[d,c]=react.useState({top:0,left:0}),m=react.useRef(null),s=react.useRef(null),l=(nr()?.themeName||"dark")==="dark",u=()=>{if(!s.current)return;let f=s.current.getBoundingClientRect(),T=window.innerHeight,N=window.innerWidth,b=320,x=380,w=4,A=f.left;A+b>N-10&&(A=N-b-10),A<10&&(A=10);let C=T-f.bottom,B=f.top,$;C>=x+w?$=f.bottom+w:B>=x+w?$=f.top-x-w:$=C>=B?f.bottom+w:Math.max(10,f.top-x-w),c({top:$,left:A}),n(true);};react.useEffect(()=>{let f=T=>{m.current&&!m.current.contains(T.target)&&!s.current?.contains(T.target)&&n(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let y=f=>{let T=new Date,N=A=>{let C=A.getFullYear(),B=String(A.getMonth()+1).padStart(2,"0"),$=String(A.getDate()).padStart(2,"0");return `${C}-${B}-${$}`},b=N(T),x=new Date(T);x.setDate(x.getDate()+f);let w=N(x);a(b,w),n(false);},v=()=>{if(!e||!t)return "Set date";let f=x=>{if(x instanceof Date)return x;if(typeof x!="string"||!x.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=x.split("-").map(Number);if(w.length!==3||w.some($=>isNaN($)))return null;let A=w[0],C=w[1],B=w[2];return A===void 0||C===void 0||B===void 0?null:new Date(A,C-1,B)},T=f(e),N=f(t);if(!T||!N||isNaN(T.getTime())||isNaN(N.getTime()))return "Set date";let b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${b[T.getMonth()]} ${T.getDate()} \u2013 ${b[N.getMonth()]} ${N.getDate()}`},h=e&&t,g=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,T=new Date;return T.setHours(0,0,0,0),f<T})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>o?n(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${g?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${v()}`:"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:v()})]}),o&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,background:l?"#1A1D25":"#FFFFFF",border:`1px solid ${l?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:l?"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:l?"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:l?"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:Qc.map(f=>jsxRuntime.jsx("button",{onClick:()=>y(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=l?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",T.currentTarget.style.border=`1px solid ${l?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",T.currentTarget.style.border=`1px solid ${l?"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:l?"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:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:l?"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:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:l?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),n(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 Va({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,d]=react.useState(false),[c,m]=react.useState(""),[s,p]=react.useState({top:0,left:0}),i=react.useRef(null),l=react.useRef(null),u=()=>{if(!l.current)return;let g=l.current.getBoundingClientRect(),f=window.innerHeight,T=window.innerWidth,N=300,b=380,x=4,w=g.right-N;w<10&&(w=g.left),w+N>T-10&&(w=T-N-10);let A=f-g.bottom,C=g.top,B;A>=b+x?B=g.bottom+x:C>=b+x?B=g.top-b-x:B=A>=C?g.bottom+x:Math.max(10,g.top-b-x),p({top:B,left:w}),d(true);};react.useEffect(()=>{let g=f=>{i.current&&!i.current.contains(f.target)&&!l.current?.contains(f.target)&&(d(false),m(""));};if(n)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[n]),react.useEffect(()=>{let g=f=>{f.key==="Escape"&&(d(false),m(""));};if(n)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]);let y=g=>{let f=e.some(T=>T.id===g.id);a(f?e.filter(T=>T.id!==g.id):[...e,g]);},v=t.filter(g=>g.name.toLowerCase().includes(c.toLowerCase())),h=e.slice(0,o),k=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>n?d(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:[h.map(g=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:g.name,children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"asakaa-avatar-img"}):g.initials},g.id)),k>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",k]})]}):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"})]})})}),n&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsxs("div",{ref:i,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${s.top}px`,left:`${s.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:g=>m(g.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:v.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"}):v.map(g=>{let f=e.some(T=>T.id===g.id);return jsxRuntime.jsxs("button",{onClick:()=>y(g),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:g.color,color:"#fff"},children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:g.name}),f&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},g.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(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 oo(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let s=m.dependencies.map(p=>{if(typeof p=="string")return p;let i=p;return i.taskId||i.targetId||""}).filter(Boolean);r.set(m.id,s);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,d=new Set,c=m=>{if(!n.has(m)){n.add(m),d.add(m);let s=r.get(m)||[];for(let p of s){if(!n.has(p)&&c(p))return true;if(d.has(p))return true}}return d.delete(m),false};return c(a)}function Er({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:d}){let[c,m]=react.useState(false),[s,p]=react.useState(""),[i,l]=react.useState(t.length>0),[u,y]=react.useState({top:0,left:0}),[v,h]=react.useState(null),k=react.useRef(null),g=react.useRef(null),f=()=>{if(!g.current)return;let w=g.current.getBoundingClientRect(),A=window.innerHeight,C=window.innerWidth,B=300,$=i?380:120,R=4,E=w.right-B;E<10&&(E=w.left),E+B>C-10&&(E=C-B-10);let H=A-w.bottom,re=w.top,oe;H>=$+R?oe=w.bottom+R:re>=$+R?oe=w.top-$-R:oe=H>=re?w.bottom+R:Math.max(10,w.top-$-R),y({top:oe,left:E}),m(true);};react.useEffect(()=>{if(!c||!g.current)return;let w=g.current.getBoundingClientRect(),A=window.innerHeight,C=window.innerWidth,B=300,$=i?380:120,R=4,E=w.right-B;E<10&&(E=w.left),E+B>C-10&&(E=C-B-10);let H=A-w.bottom,re=w.top,oe;H>=$+R?oe=w.bottom+R:re>=$+R?oe=w.top-$-R:oe=H>=re?w.bottom+R:Math.max(10,w.top-$-R),y({top:oe,left:E});},[i,c]),react.useEffect(()=>{let w=A=>{k.current&&!k.current.contains(A.target)&&!g.current?.contains(A.target)&&(m(false),p(""));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{let w=A=>{A.key==="Escape"&&(m(false),p(""));};if(c)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);let T=w=>{let A=t.includes(w),C=a.find(B=>B.id===w);if(h(null),A){let B=t.filter($=>$!==w);r(B),B.length===0&&l(false);}else {if(n&&oo(a,w,e)){let $=`Cannot add "${C?.title||w}" as dependency - would create circular reference`;h($),d?.(w,C?.title||w),setTimeout(()=>h(null),3e3);return}r([...t,w]),l(true);}},N=()=>{let w=!i;l(w),w||r([]);},b=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(s.toLowerCase())||w.id.toLowerCase().includes(s.toLowerCase())),x=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:g,onClick:()=>c?m(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:x,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:x},children:t.length})]}),c&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsxs("div",{ref:k,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:[v&&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:v})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:i?"#3b82f6":"transparent",borderColor:i?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:i&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),i&&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:s,onChange:w=>p(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:b.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"}):b.map(w=>{let A=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>T(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:A?"#3b82f6":"transparent",borderColor:A?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:A&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),l(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Na=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:d,availableUsers:c=[],allCards:m=[]})=>{let{attributes:s,listeners:p,setNodeRef:i,transform:l,transition:u,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),v={transform:eo.Transform.toString(l),transition:u};if(t)return jsxRuntime.jsx("div",{ref:i,style:v,...s,...p,onClick:()=>a?.(e),children:t(e)});let h=c.filter(f=>e.assignedUserIds?.includes(f.id)),k=e.progress===100,g={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:i,style:g,className:S("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...s,...p,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:k?"line-through":"none",opacity:k?.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(Ha,{priority:e.priority,onChange:f=>d?.(e.id,{priority:f})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Dr,{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,T)=>d?.(e.id,{startDate:f,endDate:T})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Va,{assignedUsers:h,availableUsers:c,onChange:f=>d?.(e.id,{assignedUserIds:f.map(T=>T.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Er,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:m,onChange:f=>d?.(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));Na.displayName="Card";var no={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"}},Ii=({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 Ai({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=react.useState(false),[d,c]=react.useState({top:0,left:0}),m=react.useRef(null),s=react.useRef(null),p=[...Object.entries(no).map(([h,k])=>({id:h,label:k.label,color:k.color,icon:k.icon})),...r.filter(h=>!Object.keys(no).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],i=()=>{let h=no[e];if(h)return {...h,id:e};let k=r.find(g=>g.id===e);return k?{id:k.id,label:k.title,color:k.color||"#8B5CF6",icon:"circle-dot"}:{...no.todo,id:"todo"}},l=()=>{if(!s.current)return;let h=s.current.getBoundingClientRect(),k=window.innerHeight,g=window.innerWidth,f=180,T=280,N=4,b=h.right-f;b<10&&(b=h.left),b+f>g-10&&(b=g-f-10);let x=k-h.bottom,w=h.top,A;x>=T+N?A=h.bottom+N:w>=T+N?A=h.top-T-N:A=x>=w?h.bottom+N:Math.max(10,h.top-T-N),c({top:A,left:b}),n(true);};react.useEffect(()=>{let h=k=>{m.current&&!m.current.contains(k.target)&&!s.current?.contains(k.target)&&n(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=k=>{k.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let u=h=>{t(h),n(false);},y=i(),v=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:s,onClick:()=>o?n(false):l(),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:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:y.label,children:jsxRuntime.jsx(Ii,{icon:y.icon,color:v})}),o&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(h=>jsxRuntime.jsxs("button",{onClick:()=>u(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ii,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}function Li({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,d]=react.useState(false),[c,m]=react.useState(false),[s,p]=react.useState(e),[i,l]=react.useState({top:0,left:0}),u=react.useRef(null),y=react.useRef(null),v=react.useRef(null);react.useEffect(()=>{if(n&&y.current){let f=y.current.getBoundingClientRect();l({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[n]),react.useEffect(()=>{let f=T=>{u.current&&!u.current.contains(T.target)&&!y.current?.contains(T.target)&&(d(false),m(false));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&(d(false),m(false),p(e));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n,e]),react.useEffect(()=>{c&&v.current&&(v.current.focus(),v.current.select());},[c]);let h=()=>{m(true),p(e);},k=()=>{let f=s.trim();f&&f!==e&&t(f),m(false),d(false),p(e);},g=f=>{f.key==="Enter"?k():f.key==="Escape"&&(m(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>d(!n),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"})]})}),n&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${i.top}px`,left:`${i.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:v,type:"text",value:s,onChange:f=>p(f.target.value),onKeyDown:g,onBlur:k,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),d(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:n,onCardClick:d,onCardUpdate:c,availableUsers:m,allCards:s,enableVirtualization:p,cardHeight:i=120,isCollapsed:l,onToggleCollapse:u,onColumnRename:y,onColumnDelete:v,isDeletable:h=false,className:k})=>{let{setNodeRef:g,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),T=react.useRef(null),N=p??ni(t.length),b=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>i,enabled:N});if(a)return jsxRuntime.jsx("div",{ref:g,className:k,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let B=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:B}:B>=80?{state:"warning",percentage:B}:B>=60?{state:"approaching",percentage:B}:{state:"ok",percentage:B}})(),A=w.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:g,className:S("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",A&&"ring-2 ring-asakaa-accent-red",k),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:S(C()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),w.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),w.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||v)&&jsxRuntime.jsx(Li,{columnTitle:e.title,onRename:B=>y?.(e.id,B),onDelete:v?()=>v(e.id):void 0,isDeletable:h}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":l?"Expand column":"Collapse column",children:l?"\u25B6":"\u25BC"})]})]}),!l&&jsxRuntime.jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(B=>B.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?n?n(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):N?jsxRuntime.jsx("div",{style:{height:`${b.getTotalSize()}px`,position:"relative"},children:b.getVirtualItems().map(B=>{let $=t[B.index];return $?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${B.start}px)`},children:jsxRuntime.jsx(Na,{card:$,render:r,onClick:d,onUpdate:c,availableUsers:m,allCards:s})},$.id):null})}):t.map(B=>jsxRuntime.jsx(Na,{card:B,render:r,onClick:d,onUpdate:c,availableUsers:m,allCards:s},B.id))})})]})});lr.displayName="Column";function dn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,d]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let m=()=>{let p=n.trim();p&&p!==e?t(p):d(e),o(false);},s=p=>{p.key==="Enter"?m():p.key==="Escape"&&(d(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:n,onChange:p=>d(p.target.value),onBlur:m,onKeyDown:s,className:S("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:S("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function mn(){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 La({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:d,style:c,isLoading:m,error:s,children:p}){let[i,l]=mn(),u=o?.theme||"dark",v=u==="dark"||u==="neutral"?"dark":"",h=react.useCallback((C,B)=>{t.onCardUpdate?.(C,B);},[t]),k=react.useCallback((C,B)=>{t.onColumnUpdate?.(C,{title:B});},[t]),g=react.useCallback(C=>{t.onColumnDelete?.(C);},[t]),f=["todo","in-progress","completed"],T=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),N=react.useMemo(()=>{let C=new Map;return e.columns.forEach(B=>{let $=B.cardIds.map(R=>e.cards.find(E=>E.id===R)).filter(R=>R!==void 0).sort((R,E)=>R.position-E.position);C.set(B.id,$);}),C},[e.cards,e.columns]),b=react.useCallback(C=>{let{active:B}=C,$=e.cards.find(R=>R.id===B.id);$&&l({isDragging:true,draggedCardId:$.id,sourceColumnId:$.columnId,targetColumnId:$.columnId});},[e.cards,l]),x=react.useCallback(C=>{let{active:B,over:$}=C;if(!$||!e.cards.find(H=>H.id===B.id))return;let E=null;$.data.current?.type==="column"?E=$.id:$.data.current?.type==="card"&&(E=e.cards.find(re=>re.id===$.id)?.columnId||null),E&&E!==i.targetColumnId&&l({...i,targetColumnId:E});},[e.cards,i,l]),w=react.useCallback(async C=>{let{active:B,over:$}=C;if(l({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!$)return;let R=e.cards.find(oe=>oe.id===B.id);if(!R)return;let E,H;if($.data.current?.type==="column"){E=$.id;let oe=N.get(E)||[];H=Qo(oe,0);}else {let oe=e.cards.find(ce=>ce.id===$.id);if(!oe)return;E=oe.columnId;let Ae=N.get(E)||[],Se=Ae.findIndex(ce=>ce.id===$.id);H=Qo(Ae,Se);}let re=e.columns.find(oe=>oe.id===E);if(re&&re.wipLimit&&re.wipLimitType==="hard"){let oe=N.get(E)||[];if(R.columnId!==E&&oe.length>=re.wipLimit){t.onWipLimitExceeded?.(re,R);return}}(R.columnId!==E||R.position!==H)&&await t.onCardMove?.(R.id,E,H);},[e.cards,e.columns,N,t,l]),A=react.useCallback(C=>{a?.(C);},[a]);return m?jsxRuntime.jsx("div",{className:S("asakaa-board",v,d),style:c,children:jsxRuntime.jsx(Cm,{columnCount:3})}):s?jsxRuntime.jsx("div",{className:S("asakaa-board",v,d),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 s=="string"?s:s.message})]})})}):jsxRuntime.jsx(bi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:T,collisionDetection:core$1.closestCorners,onDragStart:b,onDragOver:x,onDragEnd:w,children:[jsxRuntime.jsxs("div",{className:S("asakaa-board",v,d),style:c,"data-theme":u,children:[e.columns.sort((C,B)=>C.position-B.position).map(C=>{let B=N.get(C.id)||[],$=!f.includes(C.id);return jsxRuntime.jsx(lr,{column:C,cards:B,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:A,onCardUpdate:h,onColumnRename:k,onColumnDelete:g,isDeletable:$,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},C.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:i.draggedCardId?jsxRuntime.jsx(Na,{card:e.cards.find(C=>C.id===i.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Cm({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 Em={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)"},Pm={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)"},Mm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Im={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[n,d]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let s=p=>{c.current&&!c.current.contains(p.target)&&d(false);};return n&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[n]);let m=s=>{t(s),d(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!n),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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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((s,p)=>s.position-p.position).map((s,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(s.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s.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:s.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[s.cardIds.length," ",s.cardIds.length===1?"tarea":"tareas"]})]})]},s.id))]})})})]})}function Lm({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,d]=react.useState(false),[c,m]=react.useState(null),s=react.useRef(null);if(react.useEffect(()=>{let u=y=>{s.current&&!s.current.contains(y.target)&&d(false);};return n&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]),!(a||r||o))return null;let i=[{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),l=async(u,y)=>{if(y){m(u);try{await y();}catch(v){console.error(`Export ${u} failed:`,v);}finally{m(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!n),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:n?e.accent:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?"#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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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:i.map((u,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(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:y<i.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children: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 Fm({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 un({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:n=false,onExportCSV:d,onExportJSON:c,onExportExcel:m,translations:s}){let p=r==="dark"?Em:Pm,i={...o==="es"?Mm:Im,...s},l=d||c||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Lm,{theme:p,t:i,onExportCSV:d,onExportJSON:c,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(n?jsxRuntime.jsx(Am,{columns:e,onSelect:t,theme:p,t:i,createTaskLabel:a}):jsxRuntime.jsx(Fm,{onClick:()=>t(),label:a||i.newTask}))]})})}function fn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,d]=react.useState(false),[c,m]=react.useState(""),s=react.useCallback(()=>{let l=c.trim();l&&(e(l),m(""),d(false));},[c,e]),p=react.useCallback(l=>{l.key==="Enter"?(l.preventDefault(),s()):l.key==="Escape"&&(m(""),d(false));},[s]),i=react.useCallback(()=>{setTimeout(()=>{c.trim()||d(false);},150);},[c]);return n?jsxRuntime.jsx("div",{className:S("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:l=>m(l.target.value),onKeyDown:p,onBlur:i,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:s,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:()=>{m(""),d(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:S("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>d(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 bn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:n,disabled:d=false,theme:c="dark",locale:m="es"}){let[s,p]=react.useState(false),[i,l]=react.useState(false),[u,y]=react.useState(""),[v,h]=react.useState([]),[k,g]=react.useState(""),[f,T]=react.useState(""),[N,b]=react.useState(""),[x,w]=react.useState(false),[A,C]=react.useState(false),[B,$]=react.useState(false),R=react.useRef(null),E=react.useRef(null),H={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},re=react.useCallback(()=>{y(""),h([]),g(""),T(""),b(""),w(false),C(false),$(false),p(false);},[]);react.useEffect(()=>{s&&R.current&&R.current.focus();},[s]),react.useEffect(()=>{if(!s)return;let P=M=>{E.current&&!E.current.contains(M.target)&&(u.trim()||re());};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[s,u,re]);let oe=react.useCallback(async()=>{let P=u.trim();if(!(!P||i)){l(true);try{await t({name:P,columnId:e,assigneeIds:v.length>0?v:void 0,startDate:k?new Date(k):void 0,endDate:f?new Date(f):void 0,priority:N||void 0}),y(""),h([]),g(""),T(""),b(""),w(!1),C(!1),$(!1),R.current?.focus();}catch(M){console.error("Error creating card:",M);}finally{l(false);}}},[u,e,v,k,f,N,t,i]),Ae=react.useCallback(P=>{P.key==="Enter"&&!P.shiftKey?(P.preventDefault(),oe()):P.key==="Escape"&&re();},[oe,re]),Se=react.useCallback(P=>{h(M=>M.includes(P)?M.filter(I=>I!==P):[...M,P]);},[]),ce=c==="dark";return s?jsxRuntime.jsxs("div",{ref:E,className:S("rounded-lg overflow-hidden shadow-lg",ce?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:R,type:"text",value:u,onChange:P=>y(P.target.value),onKeyDown:Ae,placeholder:H.placeholder,disabled:i,className:S("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",ce?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>w(!x),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",x||v.length>0?"bg-emerald-500/20 text-emerald-400":ce?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:H.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"})]}),v.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:v.length})]}),jsxRuntime.jsx("button",{onClick:()=>C(!A),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||k||f?"bg-blue-500/20 text-blue-400":ce?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:H.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:()=>$(!B),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":ce?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:H.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:oe,disabled:!u.trim()||i,className:S("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:i?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):H.save})]})]}),x&&a.length>0&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",ce?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(P=>jsxRuntime.jsxs("button",{onClick:()=>Se(P.id),className:S("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",v.includes(P.id)?"bg-emerald-500 text-white":ce?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[P.avatar?jsxRuntime.jsx("img",{src:P.avatar,alt:P.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:S("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",v.includes(P.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:P.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:P.name.split(" ")[0]})]},P.id))})}),A&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",ce?"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:S("block text-[10px] uppercase tracking-wide mb-1",ce?"text-gray-500":"text-gray-400"),children:H.startDate}),jsxRuntime.jsx("input",{type:"date",value:k,onChange:P=>g(P.target.value),className:S("w-full px-2 py-1.5 rounded text-xs border",ce?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:S("block text-[10px] uppercase tracking-wide mb-1",ce?"text-gray-500":"text-gray-400"),children:H.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:P=>T(P.target.value),className:S("w-full px-2 py-1.5 rounded text-xs border",ce?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),B&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",ce?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(P=>jsxRuntime.jsx("button",{onClick:()=>b(N===P?"":P),className:S("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===P?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[P]} text-white`:ce?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:H[P]},P))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:d,className:S("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",ce?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",d&&"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:H.buttonLabel})]})}var Lr=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(La,{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(n=>n.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,n)=>{r.toBlob(d=>{d?o(d):n(new Error("Failed to create PNG blob"));},"image/png");})}};function ji(e={}){return new Lr(e)}var dr=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:n}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${n||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(d){console.error("Error in error handler:",d);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:n,componentName:d}=this.props;return a&&r?n?n(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:d?`Error in ${d}`:"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 hn(e,t){let a=r=>jsxRuntime.jsx(dr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function yn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:d,onPredictRisks:c,onOpenAIUsage:m,shortcut:s="k",className:p=""}){let[i,l]=react.useState(false),[u,y]=react.useState(""),[v,h]=react.useState("home"),[k,g]=react.useState(""),[f,T]=react.useState("");react.useEffect(()=>{let w=A=>{(A.metaKey||A.ctrlKey)&&A.key===s&&(A.preventDefault(),l(C=>!C)),A.key==="Escape"&&(l(false),h("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[s]),react.useEffect(()=>{i||(h("home"),y(""),g(""),T(""));},[i]);let N=react.useCallback(()=>{l(false);},[]),b=react.useCallback(w=>{let[A,C]=w.split(":");switch(A){case "create-card":h("create-card");break;case "create-card-in":g(C||"");break;case "navigate":C?(a?.(C),N()):h("navigate");break;case "search":r?.(u),N();break;case "priority":h("priority");break;case "set-priority":f&&C&&(o?.(f,C),N());break;case "assign":h("assign");break;case "assign-user":f&&C&&(n?.(f,C),N());break;case "ai":h("ai");break;case "ai-generate-plan":d?.(),N();break;case "ai-predict-risks":c?.(),N();break;case "ai-usage":m?.(),N();break;case "back":h("home");break;}},[u,f,t,a,r,o,n,d,c,m,N]),x=react.useCallback(()=>{k&&u.trim()&&(t?.(k,u.trim()),N());},[k,u,t,N]);return i?jsxRuntime.jsx(Ue,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:v==="create-card"&&k?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&v==="create-card"&&k&&x();}}),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."}),v==="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:b,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:b,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:b,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:b,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(A=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:A},A))})]},w.id))})]}),v==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),v==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let A=e.columns.find(C=>C.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:b,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:A?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:C},C))})]},w.id)})})]}),v==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,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:b,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:b,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:b,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 Wm(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 Hm(e){return e.startsWith("image/")}function Br({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[d,c]=react.useState(false),[m,s]=react.useState(false),[p,i]=react.useState(null),l=react.useRef(null),u=react.useCallback(b=>{let x=[],w=[];return e.length+b.length>n?(w.push(`Maximum ${n} files allowed`),{valid:x,errors:w}):(b.forEach(A=>{if(A.size/1048576>r){w.push(`${A.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>A.type.match(B))){w.push(`${A.name} has invalid file type`);return}x.push(A);}),{valid:x,errors:w})},[e.length,n,r,o]),y=react.useCallback(async b=>{let{valid:x,errors:w}=u(b);if(w.length>0){i(w.join(", ")),setTimeout(()=>i(null),5e3);return}if(x.length!==0){s(true),i(null);try{await t?.(x);}catch(A){i(A instanceof Error?A.message:"Upload failed"),setTimeout(()=>i(null),5e3);}finally{s(false);}}},[u,t]),v=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),c(true);},[]),h=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),c(false);},[]),k=react.useCallback(b=>{b.preventDefault(),b.stopPropagation();},[]),g=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),c(false);let x=Array.from(b.dataTransfer.files);y(x);},[y]),f=react.useCallback(b=>{let x=b.target.files?Array.from(b.target.files):[];y(x),l.current&&(l.current.value="");},[y]),T=react.useCallback(()=>{l.current?.click();},[]),N=react.useCallback(b=>{confirm("Are you sure you want to delete this attachment?")&&a?.(b);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${d?"dragging":""} ${m?"uploading":""}`,onDragEnter:v,onDragLeave:h,onDragOver:k,onDrop:g,onClick:T,children:[jsxRuntime.jsx("input",{ref:l,type:"file",multiple:true,onChange:f,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:d?"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,"/",n," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(b=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Hm(b.type)&&b.url?jsxRuntime.jsx("img",{src:b.thumbnailUrl||b.url,alt:b.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Gm(b.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:b.name,children:b.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Wm(b.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(b.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>N(b.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"})})})]},b.id))})]})}function kn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:d=[],activities:c=[],aiInsights:m=[],attachments:s=[],onAddComment:p,onDeleteComment:i,onUploadAttachments:l,onDeleteAttachment:u,onSuggestAssignee:y,onGenerateSubtasks:v,onEstimateEffort:h,currentUserId:k="user-1"}){let[g,f]=react.useState("details"),[T,N]=react.useState(false),[b,x]=react.useState({}),[w,A]=react.useState(""),[C,B]=react.useState(false),[$,R]=react.useState({});if(!t||!e)return null;let E=react.useCallback(()=>{N(false),x({}),f("details"),A(""),R({}),a();},[a]),H=react.useCallback(()=>{r&&Object.keys(b).length>0&&(r(e.id,b),x({}),N(false));},[e.id,b,r]),re=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),E());},[e.id,o,E]),oe=react.useCallback(()=>{p&&w.trim()&&(p(e.id,w.trim()),A(""));},[e.id,w,p]),Ae=react.useCallback(async()=>{if(y){B(true);try{let I=await y(e);R(_=>({..._,assignees:I}));}catch(I){console.error("Failed to suggest assignee:",I);}finally{B(false);}}},[e,y]),Se=react.useCallback(async()=>{if(v){B(true);try{let I=await v(e);R(_=>({..._,subtasks:I}));}catch(I){console.error("Failed to generate subtasks:",I);}finally{B(false);}}},[e,v]),ce=react.useCallback(async()=>{if(h){B(true);try{let I=await h(e);R(_=>({..._,effort:I}));}catch(I){console.error("Failed to estimate effort:",I);}finally{B(false);}}},[e,h]),P={...e,...b},M=n.filter(I=>P.assignedUserIds?.includes(I.id));return jsxRuntime.jsx(Ue,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:E,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:I=>I.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:P.priority==="URGENT"?"#EF4444":P.priority==="HIGH"?"#F59E0B":P.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),T?jsxRuntime.jsx("input",{type:"text",value:b.title??P.title,onChange:I=>x({...b,title:I.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:P.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:H,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),x({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:re,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:E,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 ${g==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>f("comments"),className:`card-detail-tab ${g==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${g==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("attachments"),className:`card-detail-tab ${g==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("ai"),className:`card-detail-tab ${g==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[g==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),T?jsxRuntime.jsx("textarea",{value:b.description??P.description??"",onChange:I=>x({...b,description:I.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:P.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),T?jsxRuntime.jsx("select",{multiple:true,value:b.assignedUserIds??P.assignedUserIds??[],onChange:I=>{let _=Array.from(I.target.selectedOptions,K=>K.value);x({...b,assignedUserIds:_});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(I=>jsxRuntime.jsx("option",{value:I.id,children:I.name},I.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:M.length>0?M.map(I=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:I.color},children:I.initials}),jsxRuntime.jsx("span",{children:I.name})]},I.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"}),T?jsxRuntime.jsxs("select",{value:b.priority??P.priority??"",onChange:I=>x({...b,priority:I.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:P.priority==="URGENT"?"#EF4444":P.priority==="HIGH"?"#F59E0B":P.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:P.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:P.labels&&P.labels.length>0?P.labels.map(I=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:I},I)):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"}),T?jsxRuntime.jsx("input",{type:"date",value:b.startDate?new Date(b.startDate).toISOString().split("T")[0]:P.startDate?new Date(P.startDate).toISOString().split("T")[0]:"",onChange:I=>x({...b,startDate:I.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:P.startDate?new Date(P.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),T?jsxRuntime.jsx("input",{type:"date",value:b.endDate?new Date(b.endDate).toISOString().split("T")[0]:P.endDate?new Date(P.endDate).toISOString().split("T")[0]:"",onChange:I=>x({...b,endDate:I.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:P.endDate?new Date(P.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),T?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:b.estimatedTime??P.estimatedTime??"",onChange:I=>x({...b,estimatedTime:I.target.value?parseFloat(I.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:P.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:P.dependencies&&P.dependencies.length>0?P.dependencies.map(I=>{let _=typeof I=="string"?I:I.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",_.slice(-4)]},_)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:P.createdAt?new Date(P.createdAt).toLocaleString():"Unknown"})]})]}),g==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:I=>A(I.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:oe,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:d.length>0?d.map(I=>{let _=n.find(K=>K.id===I.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[_&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:_.color},children:_.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:_?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(I.createdAt).toLocaleString()})]})]}),i&&jsxRuntime.jsx("button",{onClick:()=>i(I.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:I.content})]},I.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),g==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(I=>{let _=n.find(K=>K.id===I.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[I.type.includes("CREATED")&&"\u2795",I.type.includes("UPDATED")&&"\u270F\uFE0F",I.type.includes("MOVED")&&"\u27A1\uFE0F",I.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",I.type.includes("COMMENT")&&"\u{1F4AC}",I.type.includes("ASSIGNED")&&"\u{1F464}",I.type.includes("PRIORITY")&&"\u{1F3AF}",I.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",I.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:_?.name||"Unknown"})," ",I.type.replace(/_/g," ").toLowerCase(),I.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:I.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(I.timestamp).toLocaleString()})]})]},I.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),g==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Br,{cardId:e.id,attachments:s,onUpload:l?I=>l(e.id,I):void 0,onDelete:u,currentUserId:k,maxSizeMB:10,maxFiles:20})}),g==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ae,disabled:C||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:Se,disabled:C||!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("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:ce,disabled:C||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),$.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),$.assignees.map((I,_)=>{let K=n.find(j=>j.id===I.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[K&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:K?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:I.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(I.confidence*100).toFixed(0),"%"]})]})]},_)})]}),$.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),$.subtasks.map((I,_)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:I.title}),I.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:I.description}),I.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",I.estimatedTime,"h"]})]},_))]}),$.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[$.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",($.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(I=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${I.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:I.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:I.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:I.description}),I.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",I.suggestedAction]})]},I.id))]}),!$.assignees&&!$.subtasks&&!$.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Rr({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:n=300,className:d=""}){let[c,m]=react.useState({top:0,left:0}),s=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let i=e.current.getBoundingClientRect(),l=window.innerHeight,u=window.innerWidth,y=4,v=i.left;v+o>u-10&&(v=u-o-10),v<10&&(v=10);let h=l-i.bottom,k=i.top,g;return h>=n+y?g=i.bottom+y:k>=n+y?g=i.top-n-y:h>=k?g=i.bottom+y:g=Math.max(10,i.top-n-y),{top:g,left:v}},[e,o,n]);return react.useEffect(()=>{t&&m(p());},[t,p]),react.useEffect(()=>{if(!t)return;let i=u=>{let y=u.target;s.current&&!s.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},l=setTimeout(()=>{document.addEventListener("mousedown",i);},0);return ()=>{clearTimeout(l),document.removeEventListener("mousedown",i);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let i=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),a());};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),t?jsxRuntime.jsx(Ue,{children:jsxRuntime.jsx("div",{ref:s,className:`smart-popover ${d}`,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 Jm=["LOW","MEDIUM","HIGH","URGENT"],Zm=["todo","in-progress","review","done"];function Tn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:d=[],activities:c=[],onAddComment:m,onDeleteComment:s,currentUser:p,onAIGenerateDescription:i,onAICreateSubtasks:l,onAIFindSimilar:u,availableColumns:y=[],availableLabels:v=[],onUploadCoverImage:h,unsplashAccessKey:k,theme:g,onSubtasksChange:f}){let T=nr(),N=g||T?.themeName||"dark",[b,x]=react.useState(e),[w,A]=react.useState(false),[C,B]=react.useState(e?.subtasks||[]),[$,R]=react.useState(false),[E,H]=react.useState(""),[re,oe]=react.useState(""),[Ae,Se]=react.useState("all"),[ce,P]=react.useState(false),[M,I]=react.useState(false),[_,K]=react.useState(false),[j,le]=react.useState(false),[ne,Le]=react.useState(false),[be,Xe]=react.useState(false),Ye=react.useRef(null),Mt=react.useRef(null),Jt=react.useRef(null),zt=react.useRef(null),It=react.useRef(null),At=react.useRef(null),St=react.useRef(null),fa=react.useRef(null),pt=react.useRef(null),ot=react.useRef(null),Lt=react.useRef(null),Ca=react.useRef(null);react.useEffect(()=>{e&&!b?(x({...e}),B(e.subtasks||[])):e&&b&&e.id!==b.id&&(x({...e}),B(e.subtasks||[]));},[e,b]),react.useEffect(()=>{let L=J=>{let Ne=J.target;zt.current&&!zt.current.contains(Ne)&&P(false),It.current&&!It.current.contains(Ne)&&I(false),At.current&&!At.current.contains(Ne)&&K(false),St.current&&!St.current.contains(Ne)&&le(false);};if(ce||M||_||j)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[ce,M,_,j]),react.useEffect(()=>{if(!t)return;let L=J=>{let Ne=J.target,qe=Ne.tagName==="INPUT"||Ne.tagName==="TEXTAREA"||Ne.isContentEditable;if(J.key==="Escape"){J.preventDefault(),ce||M||_||j||ne||be?(P(false),I(false),K(false),le(false),Le(false),Xe(false)):qe||a();return}if(qe&&J.key!=="Escape")return;let ue=J.metaKey||J.ctrlKey;switch(J.key.toLowerCase()){case "s":J.preventDefault(),P(true);break;case "a":J.preventDefault(),K(true);break;case "p":J.preventDefault(),I(true);break;case "l":J.preventDefault(),le(true);break;case "d":ue||(J.preventDefault(),Le(true),setTimeout(()=>fa.current?.focus(),0));break;case "e":ue||(J.preventDefault(),Xe(true));break;case "i":J.preventDefault(),A(true),setTimeout(()=>Mt.current?.focus(),0);break;case "t":J.preventDefault(),R(true);break;case "c":J.preventDefault(),Jt.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,ce,M,_,j,ne,be]);let de=react.useCallback(L=>{let J=L.currentTarget.textContent?.trim()||"";if(b&&J!==b.title){let Ne={...b,title:J};x(Ne),r?.(b.id,{title:J});}},[b,r]),xe=react.useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=b?.title||"",L.currentTarget.blur());},[b]),_t=react.useCallback(()=>{b&&e&&b.description!==e.description&&r?.(b.id,{description:b.description}),A(false);},[b,e,r]),ba=react.useCallback(L=>{if(b){let J={...b,columnId:L};x(J),r?.(b.id,{columnId:L}),P(false);}},[b,r]),xt=react.useCallback(L=>{if(b){let J={...b,priority:L};x(J),r?.(b.id,{priority:L}),I(false);}},[b,r]),ha=react.useCallback(L=>{if(b){let J=b.assignedUserIds||[],Ne=J.includes(L)?J.filter(ue=>ue!==L):[...J,L],qe={...b,assignedUserIds:Ne};x(qe),r?.(b.id,{assignedUserIds:Ne});}},[b,r]),va=react.useCallback(L=>{if(b){let J=b.labels||[],Ne=J.includes(L)?J.filter(ue=>ue!==L):[...J,L],qe={...b,labels:Ne};x(qe),r?.(b.id,{labels:Ne});}},[b,r]),Ce=react.useCallback(L=>{if(b){let J=L.target.value,Ne={...b,endDate:J};x(Ne),r?.(b.id,{endDate:J}),Le(false);}},[b,r]),Te=react.useCallback(L=>{if(b){let J={...b,estimatedTime:parseFloat(L)||0};x(J),r?.(b.id,{estimatedTime:parseFloat(L)||0});}},[b,r]),ut=react.useCallback(()=>{if(E.trim()&&b){let L={id:`subtask-${Date.now()}`,title:E.trim(),completed:false,createdAt:new Date},J=[...C,L];B(J),H(""),R(false),f?.(b.id,J);}},[E,C,b,f]),te=react.useCallback(L=>{let J=C.map(Ne=>Ne.id===L?{...Ne,completed:!Ne.completed,updatedAt:new Date}:Ne);B(J),b&&f?.(b.id,J);},[C,b,f]),ke=react.useCallback(L=>{let J=C.filter(Ne=>Ne.id!==L);B(J),b&&f?.(b.id,J);},[C,b,f]),F=react.useCallback(()=>{re.trim()&&b&&m&&(m(b.id,re.trim()),oe(""));},[re,b,m]),U=react.useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),F());},[F]),me=L=>jsxRuntime.jsx(Ym__default.default,{remarkPlugins:[qm__default.default],rehypePlugins:[Xm__default.default],components:{a:({node:J,...Ne})=>jsxRuntime.jsx("a",{...Ne,target:"_blank",rel:"noopener noreferrer"})},children:L}),ge=c.filter(L=>Ae==="comments"?L.type.includes("COMMENT"):Ae==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let q=b||e,pe=n.filter(L=>q.assignedUserIds?.includes(L.id)),X=C.filter(L=>L.completed).length;return jsxRuntime.jsx(Ue,{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:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":N,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ye,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:de,onKeyDown:xe,children:q.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:zt,children:[jsxRuntime.jsxs("button",{ref:pt,className:"modal-v2-field",onClick:()=>P(!ce),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:q.columnId||"No status"})]}),jsxRuntime.jsx(Rr,{triggerRef:pt,isOpen:ce,onClose:()=>P(false),width:250,estimatedHeight:200,children:(y.length>0?y:Zm.map(L=>({id:L,title:L}))).map(L=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${q.columnId===L.id?"active":""}`,onClick:()=>ba(L.id),children:L.title},L.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:At,children:[jsxRuntime.jsxs("button",{ref:ot,className:"modal-v2-field",onClick:()=>K(!_),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:pe.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:pe.map(L=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:L.color},title:L.name,children:L.initials},L.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Rr,{triggerRef:ot,isOpen:_,onClose:()=>K(false),width:280,estimatedHeight:300,children:n.map(L=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>ha(L.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,q.assignedUserIds?.includes(L.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"})})]},L.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:It,children:[jsxRuntime.jsxs("button",{ref:Lt,className:"modal-v2-field",onClick:()=>I(!M),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:q.priority||"None"})]}),jsxRuntime.jsxs(Rr,{triggerRef:Lt,isOpen:M,onClose:()=>I(false),width:180,estimatedHeight:220,children:[Jm.map(L=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${q.priority===L?"active":""}`,onClick:()=>xt(L),children:L},L)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>xt(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:St,children:[jsxRuntime.jsxs("button",{ref:Ca,className:"modal-v2-field",onClick:()=>le(!j),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:q.labels&&q.labels.length>0?jsxRuntime.jsx("span",{children:q.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Rr,{triggerRef:Ca,isOpen:j,onClose:()=>le(false),width:220,estimatedHeight:200,children:(v.length>0?v:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.labels?.includes(L)?"active":""}`,onClick:()=>va(L),children:[L,q.labels?.includes(L)&&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"})})]},L))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Le(!ne),setTimeout(()=>fa.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:q.endDate?new Date(q.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:fa,type:"date",value:typeof q.endDate=="string"?q.endDate.split("T")[0]:q.endDate?(()=>{let L=new Date(q.endDate),J=L.getUTCFullYear(),Ne=String(L.getUTCMonth()+1).padStart(2,"0"),qe=String(L.getUTCDate()).padStart(2,"0");return `${J}-${Ne}-${qe}`})():"",onChange:Ce,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Xe(!be),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:q.estimatedTime?`${q.estimatedTime}h`:"Not set"})]}),be&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:q.estimatedTime||"",onChange:L=>Te(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Xe(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"})]}),w?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:q.description||"",onChange:L=>{if(b){let J={...b,description:L.target.value};x(J);}},onBlur:_t,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>A(true),children:q.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:me(q.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"}),C.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[X,"/",C.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>R(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:[C.map(L=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${L.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>te(L.id),children:L.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:L.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>ke(L.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"})]})})]},L.id)),$&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:E,onChange:L=>H(L.target.value),onKeyDown:L=>{L.key==="Enter"&&ut(),L.key==="Escape"&&(R(false),H(""));},onBlur:ut,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),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 ${Ae==="all"?"active":""}`,onClick:()=>Se("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ae==="comments"?"active":""}`,onClick:()=>Se("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ae==="history"?"active":""}`,onClick:()=>Se("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Jt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:re,onChange:L=>oe(L.target.value),onKeyDown:U,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:F,disabled:!re.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ge.map(L=>{let J=n.find(qe=>qe.id===L.userId);if(L.type.includes("COMMENT")){let qe=d.find(ue=>ue.id===L.metadata?.commentId);return qe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[J&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:J.color},children:J.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:J?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:qe.content})]})]},L.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.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:J?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:L.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.id)}),ge.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 ip({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 Dn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(d=>({...d,average:d.average??e.reduce((c,m)=>c+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"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(ip,{})}),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((d,c)=>d+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((d,c)=>d+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(d=>d.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((d,c)=>d+(c.planned||0),0)})]})]})]})}function bp({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 Sn({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),d=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,m=n>0?(n-d)/n*100:0,s=d<=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(bp,{})}),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:s?"#10B981":"#EF4444",fill:s?"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:s?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:s?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:s?"#10B981":"#EF4444"},children:d})]}),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:s?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:s?"#10B981":"#EF4444"},children:s?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Np={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},al=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Dp({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let d=r+(o-r)*.5,c=e+d*Math.cos(-a*(Math.PI/180)),m=t+d*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:c,y:m,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function rl({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 En({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((m,s)=>m+s.value,0),d=e.map(m=>({...m,totalValue:n,color:m.color||Np[m.name]||al[e.indexOf(m)%al.length]})),c=d.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:d,cx:"50%",cy:"50%",labelLine:false,label:o?Dp:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:d.map((m,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[s]},`cell-${s}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(rl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,s)=>{let p=s.payload,i=n>0?(p.value/n*100).toFixed(0):"0";return `${m} (${p.value} - ${i}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:d,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(rl,{})}),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:d.map((m,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[s]},`cell-${s}`))})]})}),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:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,s)=>s.value>m.value?s:m).name})]})]})]})}var uo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[d,c]=react.useState(false),[m,s]=react.useState(false),[p,i]=react.useState(false),[l,u]=react.useState(false);if(e.length===0)return null;let y=e.map(T=>T.id),v=T=>{r.onBulkUpdate?.(y,{priority:T}),c(false);},h=T=>{r.onBulkMove?.(y,T),s(false),a();},k=T=>{r.onBulkUpdate?.(y,{assignedUserIds:T}),i(false);},g=T=>{let N=new Set;e.forEach(x=>{x.labels?.forEach(w=>N.add(w));});let b=Array.from(new Set([...N,...T]));r.onBulkUpdate?.(y,{labels:b}),u(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!d),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(T),children:[jsxRuntime.jsx("span",{className:S("asakaa-priority-dot",T==="LOW"&&"bg-asakaa-priority-low",T==="MEDIUM"&&"bg-asakaa-priority-medium",T==="HIGH"&&"bg-asakaa-priority-high",T==="URGENT"&&"bg-asakaa-priority-urgent")}),T]},T))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>s(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(T.id),children:T.title},T.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k([T.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:T.color},children:T.initials}),T.name]},T.id))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!l),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([T]),children:T},T))})]}),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"})})]})]})})});uo.displayName="BulkOperationsToolbar";function Ip(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,d,c,m,s;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(u=>{let y=a?.find(v=>v.id===u);d=`assignee-${u}`,c=y?.name||`User ${u}`,m=y?.color,s=y?.avatar,r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:m,icon:s}),r.get(d).cardIds.push(o.id);}):(d="assignee-unassigned",c="Unassigned",m="#6b7280",s="\u{1F464}",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:m,icon:s}),r.get(d).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",d=`priority-${n}`;let l={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"}}[n];c=l.title,m=l.color,r.has(d)||r.set(d,{id:d,title:c,groupValue:n,cardIds:[],color:m}),r.get(d).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{d=`label-${u}`,c=u,m="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:m}),r.get(d).cardIds.push(o.id);}):(d="label-none",c="No Labels",m="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:m}),r.get(d).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function Pn({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,d]=react.useState(new Set),c=react.useMemo(()=>Ip(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(s=>{d(p=>{let i=new Set(p);return i.has(s)?i.delete(s):i.add(s),i});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(La,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:S("asakaa-swimlane-view",o),children:[c.map(s=>{let p=n.has(s.id),i=e.cards.filter(u=>s.cardIds.includes(u.id)),l={...e,cards:i};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(s.id),style:{borderLeft:s.color?`4px solid ${s.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[s.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:s.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:s.color},children:s.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",s.cardIds.length," ",s.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(La,{board:l,callbacks:r,availableUsers:a})})]},s.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 Mn=[{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 In({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),d=react.useRef(null),c=Mn.find(s=>s.value===e)||Mn[0];react.useEffect(()=>{function s(p){n.current&&!n.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let m=s=>{t(s),o(false);};return jsxRuntime.jsxs("div",{className:S("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,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:S("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:n,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:Mn.map(s=>jsxRuntime.jsxs("button",{onClick:()=>m(s.value),className:S("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===s.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:s.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:s.label}),e===s.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:s.description})]})]},s.value))})]})]})}var Or=[{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 Fp(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(s=>e.key===s||e.code===s))return false;let o=t.modifiers||{},n=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,d=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return n&&d&&c&&m}function ll(e={}){let{shortcuts:t=Or,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),n=react.useRef(a);react.useEffect(()=>{o.current=t,n.current=a;},[t,a]);let d=react.useCallback(m=>{o.current=[...o.current,m];},[]),c=react.useCallback(m=>{o.current=o.current.filter(s=>s.action!==m);},[]);return react.useEffect(()=>{function m(s){if(!n.current)return;let p=s.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&s.key!=="Escape"&&!s.ctrlKey&&!s.metaKey)){for(let i of o.current)if(Fp(s,i)){r&&s.preventDefault();let l=new CustomEvent("keyboard-action",{detail:i.action,bubbles:true,cancelable:true});window.dispatchEvent(l);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:d,unregisterShortcut:c,isEnabled:a}}function Rp(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Op(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 $p(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Op(e),r=t?Rp(t):"";return a?`${a} + ${r}`:r}function zp(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 An({shortcuts:e=Or,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function c(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let d=zp(e);return jsxRuntime.jsxs("div",{className:S("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(d).map(([c,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(s=>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:s.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:$p(s)})]},s.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 Ln=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=mi(t[0]),r=[],o=new Map,n=[];for(let d=1;d<t.length;d++)try{let c=mi(t[d]||"");if(c.length>a.length){n.push(`Line ${d+1}: Too many columns`);continue}if(a.length-c.length>3){n.push(`Line ${d+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let s={};a.forEach((u,y)=>{s[u]=c[y]||"";});let p=s.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let i=o.get(p),l={id:s["Card ID"]||`card-${d}`,title:s.Title||"Untitled",description:s.Description?s.Description:void 0,columnId:i.id,position:i.cardIds.length+1,priority:s.Priority||void 0,labels:s.Labels?s.Labels.split(";").filter(Boolean):void 0,assignedUserIds:s["Assigned Users"]?s["Assigned Users"].split(";").filter(Boolean):void 0,startDate:s["Start Date"]?s["Start Date"]:void 0,endDate:s["End Date"]?s["End Date"]:void 0,createdAt:s["Created At"]?s["Created At"]:void 0,updatedAt:s["Updated At"]?s["Updated At"]:void 0};r.push(l),i.cardIds.push(l.id);}catch(c){n.push(`Line ${d+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...n]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:n.length>0?n:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function mi(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],d=e[o+1];n==='"'&&r&&d==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function pi(e,t){switch(t){case "json":return Gc(e);case "csv":return Hc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ui(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 rn=react.createContext(null);function gi(){return react.useContext(rn)}var fi=react.createContext(null);function bi({children:e,themeName:t}){return jsxRuntime.jsx(fi.Provider,{value:{themeName:t},children:e})}function nr(){return react.useContext(fi)}function Ue({children:e,container:t}){let[a,r]=react.useState(false),o=gi(),n=nr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let d=t||(typeof document<"u"?document.body:null);if(!d)return null;if(o){let{theme:c,themeName:m}=o,s={"--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":m,"data-gantt-portal":"true",style:s,children:e}),d)}return n?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":n.themeName,"data-kanban-portal":"true",children:e}),d):reactDom.createPortal(e,d)}var ki={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Jc="#BDC3C7",Zc=({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 Ha({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,d]=react.useState({top:0,left:0}),c=react.useRef(null),m=react.useRef(null),s=()=>{if(!m.current)return;let u=m.current.getBoundingClientRect(),y=window.innerHeight,v=window.innerWidth,h=160,k=220,g=4,f=u.right-h;f<10&&(f=u.left),f+h>v-10&&(f=v-h-10);let T=y-u.bottom,N=u.top,b;T>=k+g?b=u.bottom+g:N>=k+g?b=u.top-k-g:b=T>=N?u.bottom+g:Math.max(10,u.top-k-g),d({top:b,left:f}),o(true);};react.useEffect(()=>{let u=y=>{c.current&&!c.current.contains(y.target)&&!m.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let p=u=>{t(u),o(false);},i=e?ki[e]:null,l=i?.color||Jc;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):s(),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?`${l}10`:"transparent",boxShadow:e?`0 0 0 2px ${l}30 inset`:"none"},title:i?.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:l,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:l,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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(ki).map(([u,y])=>jsxRuntime.jsxs("button",{onClick:()=>p(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:y.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Zc,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.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:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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 Qc=[{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 Dr({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[d,c]=react.useState({top:0,left:0}),m=react.useRef(null),s=react.useRef(null),l=(nr()?.themeName||"dark")==="dark",u=()=>{if(!s.current)return;let f=s.current.getBoundingClientRect(),T=window.innerHeight,N=window.innerWidth,b=320,x=380,w=4,A=f.left;A+b>N-10&&(A=N-b-10),A<10&&(A=10);let C=T-f.bottom,B=f.top,$;C>=x+w?$=f.bottom+w:B>=x+w?$=f.top-x-w:$=C>=B?f.bottom+w:Math.max(10,f.top-x-w),c({top:$,left:A}),n(true);};react.useEffect(()=>{let f=T=>{m.current&&!m.current.contains(T.target)&&!s.current?.contains(T.target)&&n(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let y=f=>{let T=new Date,N=A=>{let C=A.getFullYear(),B=String(A.getMonth()+1).padStart(2,"0"),$=String(A.getDate()).padStart(2,"0");return `${C}-${B}-${$}`},b=N(T),x=new Date(T);x.setDate(x.getDate()+f);let w=N(x);a(b,w),n(false);},v=()=>{if(!e||!t)return "Set date";let f=x=>{if(x instanceof Date)return x;if(typeof x!="string"||!x.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=x.split("-").map(Number);if(w.length!==3||w.some($=>isNaN($)))return null;let A=w[0],C=w[1],B=w[2];return A===void 0||C===void 0||B===void 0?null:new Date(A,C-1,B)},T=f(e),N=f(t);if(!T||!N||isNaN(T.getTime())||isNaN(N.getTime()))return "Set date";let b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${b[T.getMonth()]} ${T.getDate()} \u2013 ${b[N.getMonth()]} ${N.getDate()}`},h=e&&t,g=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,T=new Date;return T.setHours(0,0,0,0),f<T})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>o?n(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${g?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${v()}`:"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:v()})]}),o&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,background:l?"#1A1D25":"#FFFFFF",border:`1px solid ${l?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:l?"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:l?"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:l?"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:Qc.map(f=>jsxRuntime.jsx("button",{onClick:()=>y(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=l?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",T.currentTarget.style.border=`1px solid ${l?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",T.currentTarget.style.border=`1px solid ${l?"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:l?"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:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:l?"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:l?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:l?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:l?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:l?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),n(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 Va({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,d]=react.useState(false),[c,m]=react.useState(""),[s,p]=react.useState({top:0,left:0}),i=react.useRef(null),l=react.useRef(null),u=()=>{if(!l.current)return;let g=l.current.getBoundingClientRect(),f=window.innerHeight,T=window.innerWidth,N=300,b=380,x=4,w=g.right-N;w<10&&(w=g.left),w+N>T-10&&(w=T-N-10);let A=f-g.bottom,C=g.top,B;A>=b+x?B=g.bottom+x:C>=b+x?B=g.top-b-x:B=A>=C?g.bottom+x:Math.max(10,g.top-b-x),p({top:B,left:w}),d(true);};react.useEffect(()=>{let g=f=>{i.current&&!i.current.contains(f.target)&&!l.current?.contains(f.target)&&(d(false),m(""));};if(n)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[n]),react.useEffect(()=>{let g=f=>{f.key==="Escape"&&(d(false),m(""));};if(n)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]);let y=g=>{let f=e.some(T=>T.id===g.id);a(f?e.filter(T=>T.id!==g.id):[...e,g]);},v=t.filter(g=>g.name.toLowerCase().includes(c.toLowerCase())),h=e.slice(0,o),k=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>n?d(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:[h.map(g=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:g.name,children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"asakaa-avatar-img"}):g.initials},g.id)),k>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",k]})]}):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"})]})})}),n&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsxs("div",{ref:i,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${s.top}px`,left:`${s.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:g=>m(g.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:v.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"}):v.map(g=>{let f=e.some(T=>T.id===g.id);return jsxRuntime.jsxs("button",{onClick:()=>y(g),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:g.color,color:"#fff"},children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:g.name}),f&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},g.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(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 oo(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let s=m.dependencies.map(p=>{if(typeof p=="string")return p;let i=p;return i.taskId||i.targetId||""}).filter(Boolean);r.set(m.id,s);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,d=new Set,c=m=>{if(!n.has(m)){n.add(m),d.add(m);let s=r.get(m)||[];for(let p of s){if(!n.has(p)&&c(p))return true;if(d.has(p))return true}}return d.delete(m),false};return c(a)}function Er({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:d}){let[c,m]=react.useState(false),[s,p]=react.useState(""),[i,l]=react.useState(t.length>0),[u,y]=react.useState({top:0,left:0}),[v,h]=react.useState(null),k=react.useRef(null),g=react.useRef(null),f=()=>{if(!g.current)return;let w=g.current.getBoundingClientRect(),A=window.innerHeight,C=window.innerWidth,B=300,$=i?380:120,R=4,E=w.right-B;E<10&&(E=w.left),E+B>C-10&&(E=C-B-10);let H=A-w.bottom,re=w.top,ie;H>=$+R?ie=w.bottom+R:re>=$+R?ie=w.top-$-R:ie=H>=re?w.bottom+R:Math.max(10,w.top-$-R),y({top:ie,left:E}),m(true);};react.useEffect(()=>{if(!c||!g.current)return;let w=g.current.getBoundingClientRect(),A=window.innerHeight,C=window.innerWidth,B=300,$=i?380:120,R=4,E=w.right-B;E<10&&(E=w.left),E+B>C-10&&(E=C-B-10);let H=A-w.bottom,re=w.top,ie;H>=$+R?ie=w.bottom+R:re>=$+R?ie=w.top-$-R:ie=H>=re?w.bottom+R:Math.max(10,w.top-$-R),y({top:ie,left:E});},[i,c]),react.useEffect(()=>{let w=A=>{k.current&&!k.current.contains(A.target)&&!g.current?.contains(A.target)&&(m(false),p(""));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{let w=A=>{A.key==="Escape"&&(m(false),p(""));};if(c)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);let T=w=>{let A=t.includes(w),C=a.find(B=>B.id===w);if(h(null),A){let B=t.filter($=>$!==w);r(B),B.length===0&&l(false);}else {if(n&&oo(a,w,e)){let $=`Cannot add "${C?.title||w}" as dependency - would create circular reference`;h($),d?.(w,C?.title||w),setTimeout(()=>h(null),3e3);return}r([...t,w]),l(true);}},N=()=>{let w=!i;l(w),w||r([]);},b=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(s.toLowerCase())||w.id.toLowerCase().includes(s.toLowerCase())),x=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:g,onClick:()=>c?m(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:x,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:x},children:t.length})]}),c&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsxs("div",{ref:k,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:[v&&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:v})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:i?"#3b82f6":"transparent",borderColor:i?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:i&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),i&&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:s,onChange:w=>p(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:b.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"}):b.map(w=>{let A=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>T(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:A?"#3b82f6":"transparent",borderColor:A?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:A&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),l(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Na=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:d,availableUsers:c=[],allCards:m=[]})=>{let{attributes:s,listeners:p,setNodeRef:i,transform:l,transition:u,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),v={transform:eo.Transform.toString(l),transition:u};if(t)return jsxRuntime.jsx("div",{ref:i,style:v,...s,...p,onClick:()=>a?.(e),children:t(e)});let h=c.filter(f=>e.assignedUserIds?.includes(f.id)),k=e.progress===100,g={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:i,style:g,className:S("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...s,...p,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:k?"line-through":"none",opacity:k?.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(Ha,{priority:e.priority,onChange:f=>d?.(e.id,{priority:f})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Dr,{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,T)=>d?.(e.id,{startDate:f,endDate:T})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Va,{assignedUsers:h,availableUsers:c,onChange:f=>d?.(e.id,{assignedUserIds:f.map(T=>T.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Er,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:m,onChange:f=>d?.(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));Na.displayName="Card";var no={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"}},Ii=({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 Ai({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=react.useState(false),[d,c]=react.useState({top:0,left:0}),m=react.useRef(null),s=react.useRef(null),p=[...Object.entries(no).map(([h,k])=>({id:h,label:k.label,color:k.color,icon:k.icon})),...r.filter(h=>!Object.keys(no).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],i=()=>{let h=no[e];if(h)return {...h,id:e};let k=r.find(g=>g.id===e);return k?{id:k.id,label:k.title,color:k.color||"#8B5CF6",icon:"circle-dot"}:{...no.todo,id:"todo"}},l=()=>{if(!s.current)return;let h=s.current.getBoundingClientRect(),k=window.innerHeight,g=window.innerWidth,f=180,T=280,N=4,b=h.right-f;b<10&&(b=h.left),b+f>g-10&&(b=g-f-10);let x=k-h.bottom,w=h.top,A;x>=T+N?A=h.bottom+N:w>=T+N?A=h.top-T-N:A=x>=w?h.bottom+N:Math.max(10,h.top-T-N),c({top:A,left:b}),n(true);};react.useEffect(()=>{let h=k=>{m.current&&!m.current.contains(k.target)&&!s.current?.contains(k.target)&&n(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=k=>{k.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let u=h=>{t(h),n(false);},y=i(),v=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:s,onClick:()=>o?n(false):l(),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:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:y.label,children:jsxRuntime.jsx(Ii,{icon:y.icon,color:v})}),o&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(h=>jsxRuntime.jsxs("button",{onClick:()=>u(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ii,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}function Li({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,d]=react.useState(false),[c,m]=react.useState(false),[s,p]=react.useState(e),[i,l]=react.useState({top:0,left:0}),u=react.useRef(null),y=react.useRef(null),v=react.useRef(null);react.useEffect(()=>{if(n&&y.current){let f=y.current.getBoundingClientRect();l({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[n]),react.useEffect(()=>{let f=T=>{u.current&&!u.current.contains(T.target)&&!y.current?.contains(T.target)&&(d(false),m(false));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),react.useEffect(()=>{let f=T=>{T.key==="Escape"&&(d(false),m(false),p(e));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n,e]),react.useEffect(()=>{c&&v.current&&(v.current.focus(),v.current.select());},[c]);let h=()=>{m(true),p(e);},k=()=>{let f=s.trim();f&&f!==e&&t(f),m(false),d(false),p(e);},g=f=>{f.key==="Enter"?k():f.key==="Escape"&&(m(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>d(!n),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"})]})}),n&&jsxRuntime.jsx(Ue,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${i.top}px`,left:`${i.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:v,type:"text",value:s,onChange:f=>p(f.target.value),onKeyDown:g,onBlur:k,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),d(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:n,onCardClick:d,onCardUpdate:c,availableUsers:m,allCards:s,enableVirtualization:p,cardHeight:i=120,isCollapsed:l,onToggleCollapse:u,onColumnRename:y,onColumnDelete:v,isDeletable:h=false,className:k})=>{let{setNodeRef:g,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),T=react.useRef(null),N=p??ni(t.length),b=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>i,enabled:N});if(a)return jsxRuntime.jsx("div",{ref:g,className:k,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let B=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:B}:B>=80?{state:"warning",percentage:B}:B>=60?{state:"approaching",percentage:B}:{state:"ok",percentage:B}})(),A=w.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:g,className:S("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",A&&"ring-2 ring-asakaa-accent-red",k),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:S(C()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),w.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),w.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||v)&&jsxRuntime.jsx(Li,{columnTitle:e.title,onRename:B=>y?.(e.id,B),onDelete:v?()=>v(e.id):void 0,isDeletable:h}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":l?"Expand column":"Collapse column",children:l?"\u25B6":"\u25BC"})]})]}),!l&&jsxRuntime.jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(B=>B.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?n?n(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):N?jsxRuntime.jsx("div",{style:{height:`${b.getTotalSize()}px`,position:"relative"},children:b.getVirtualItems().map(B=>{let $=t[B.index];return $?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${B.start}px)`},children:jsxRuntime.jsx(Na,{card:$,render:r,onClick:d,onUpdate:c,availableUsers:m,allCards:s})},$.id):null})}):t.map(B=>jsxRuntime.jsx(Na,{card:B,render:r,onClick:d,onUpdate:c,availableUsers:m,allCards:s},B.id))})})]})});lr.displayName="Column";function dn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,d]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let m=()=>{let p=n.trim();p&&p!==e?t(p):d(e),o(false);},s=p=>{p.key==="Enter"?m():p.key==="Escape"&&(d(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:n,onChange:p=>d(p.target.value),onBlur:m,onKeyDown:s,className:S("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:S("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function mn(){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 La({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:d,style:c,isLoading:m,error:s,children:p}){let[i,l]=mn(),u=o?.theme||"dark",v=u==="dark"||u==="neutral"?"dark":"",h=react.useCallback((C,B)=>{t.onCardUpdate?.(C,B);},[t]),k=react.useCallback((C,B)=>{t.onColumnUpdate?.(C,{title:B});},[t]),g=react.useCallback(C=>{t.onColumnDelete?.(C);},[t]),f=["todo","in-progress","completed"],T=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),N=react.useMemo(()=>{let C=new Map;return e.columns.forEach(B=>{let $=B.cardIds.map(R=>e.cards.find(E=>E.id===R)).filter(R=>R!==void 0).sort((R,E)=>R.position-E.position);C.set(B.id,$);}),C},[e.cards,e.columns]),b=react.useCallback(C=>{let{active:B}=C,$=e.cards.find(R=>R.id===B.id);$&&l({isDragging:true,draggedCardId:$.id,sourceColumnId:$.columnId,targetColumnId:$.columnId});},[e.cards,l]),x=react.useCallback(C=>{let{active:B,over:$}=C;if(!$||!e.cards.find(H=>H.id===B.id))return;let E=null;$.data.current?.type==="column"?E=$.id:$.data.current?.type==="card"&&(E=e.cards.find(re=>re.id===$.id)?.columnId||null),E&&E!==i.targetColumnId&&l({...i,targetColumnId:E});},[e.cards,i,l]),w=react.useCallback(async C=>{let{active:B,over:$}=C;if(l({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!$)return;let R=e.cards.find(ie=>ie.id===B.id);if(!R)return;let E,H;if($.data.current?.type==="column"){E=$.id;let ie=N.get(E)||[];H=Qo(ie,0);}else {let ie=e.cards.find(ce=>ce.id===$.id);if(!ie)return;E=ie.columnId;let Ae=N.get(E)||[],Se=Ae.findIndex(ce=>ce.id===$.id);H=Qo(Ae,Se);}let re=e.columns.find(ie=>ie.id===E);if(re&&re.wipLimit&&re.wipLimitType==="hard"){let ie=N.get(E)||[];if(R.columnId!==E&&ie.length>=re.wipLimit){t.onWipLimitExceeded?.(re,R);return}}(R.columnId!==E||R.position!==H)&&await t.onCardMove?.(R.id,E,H);},[e.cards,e.columns,N,t,l]),A=react.useCallback(C=>{a?.(C);},[a]);return m?jsxRuntime.jsx("div",{className:S("asakaa-board",v,d),style:c,children:jsxRuntime.jsx(Cm,{columnCount:3})}):s?jsxRuntime.jsx("div",{className:S("asakaa-board",v,d),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 s=="string"?s:s.message})]})})}):jsxRuntime.jsx(bi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:T,collisionDetection:core$1.closestCorners,onDragStart:b,onDragOver:x,onDragEnd:w,children:[jsxRuntime.jsxs("div",{className:S("asakaa-board",v,d),style:c,"data-theme":u,children:[e.columns.sort((C,B)=>C.position-B.position).map(C=>{let B=N.get(C.id)||[],$=!f.includes(C.id);return jsxRuntime.jsx(lr,{column:C,cards:B,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:A,onCardUpdate:h,onColumnRename:k,onColumnDelete:g,isDeletable:$,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},C.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:i.draggedCardId?jsxRuntime.jsx(Na,{card:e.cards.find(C=>C.id===i.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Cm({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 Em={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)"},Pm={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)"},Mm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Im={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[n,d]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let s=p=>{c.current&&!c.current.contains(p.target)&&d(false);};return n&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[n]);let m=s=>{t(s),d(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!n),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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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((s,p)=>s.position-p.position).map((s,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(s.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s.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:s.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[s.cardIds.length," ",s.cardIds.length===1?"tarea":"tareas"]})]})]},s.id))]})})})]})}function Lm({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,d]=react.useState(false),[c,m]=react.useState(null),s=react.useRef(null);if(react.useEffect(()=>{let u=y=>{s.current&&!s.current.contains(y.target)&&d(false);};return n&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]),!(a||r||o))return null;let i=[{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),l=async(u,y)=>{if(y){m(u);try{await y();}catch(v){console.error(`Export ${u} failed:`,v);}finally{m(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!n),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:n?e.accent:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?"#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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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:i.map((u,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(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:y<i.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children: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 Fm({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 un({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:n=false,onExportCSV:d,onExportJSON:c,onExportExcel:m,translations:s}){let p=r==="dark"?Em:Pm,i={...o==="es"?Mm:Im,...s},l=d||c||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Lm,{theme:p,t:i,onExportCSV:d,onExportJSON:c,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(n?jsxRuntime.jsx(Am,{columns:e,onSelect:t,theme:p,t:i,createTaskLabel:a}):jsxRuntime.jsx(Fm,{onClick:()=>t(),label:a||i.newTask}))]})})}function fn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,d]=react.useState(false),[c,m]=react.useState(""),s=react.useCallback(()=>{let l=c.trim();l&&(e(l),m(""),d(false));},[c,e]),p=react.useCallback(l=>{l.key==="Enter"?(l.preventDefault(),s()):l.key==="Escape"&&(m(""),d(false));},[s]),i=react.useCallback(()=>{setTimeout(()=>{c.trim()||d(false);},150);},[c]);return n?jsxRuntime.jsx("div",{className:S("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:l=>m(l.target.value),onKeyDown:p,onBlur:i,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:s,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:()=>{m(""),d(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:S("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>d(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 bn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:n,disabled:d=false,theme:c="dark",locale:m="es"}){let[s,p]=react.useState(false),[i,l]=react.useState(false),[u,y]=react.useState(""),[v,h]=react.useState([]),[k,g]=react.useState(""),[f,T]=react.useState(""),[N,b]=react.useState(""),[x,w]=react.useState(false),[A,C]=react.useState(false),[B,$]=react.useState(false),R=react.useRef(null),E=react.useRef(null),H={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},re=react.useCallback(()=>{y(""),h([]),g(""),T(""),b(""),w(false),C(false),$(false),p(false);},[]);react.useEffect(()=>{s&&R.current&&R.current.focus();},[s]),react.useEffect(()=>{if(!s)return;let P=M=>{E.current&&!E.current.contains(M.target)&&(u.trim()||re());};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[s,u,re]);let ie=react.useCallback(async()=>{let P=u.trim();if(!(!P||i)){l(true);try{await t({name:P,columnId:e,assigneeIds:v.length>0?v:void 0,startDate:k?new Date(k):void 0,endDate:f?new Date(f):void 0,priority:N||void 0}),y(""),h([]),g(""),T(""),b(""),w(!1),C(!1),$(!1),R.current?.focus();}catch(M){console.error("Error creating card:",M);}finally{l(false);}}},[u,e,v,k,f,N,t,i]),Ae=react.useCallback(P=>{P.key==="Enter"&&!P.shiftKey?(P.preventDefault(),ie()):P.key==="Escape"&&re();},[ie,re]),Se=react.useCallback(P=>{h(M=>M.includes(P)?M.filter(I=>I!==P):[...M,P]);},[]),ce=c==="dark";return s?jsxRuntime.jsxs("div",{ref:E,className:S("rounded-lg overflow-hidden shadow-lg",ce?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:R,type:"text",value:u,onChange:P=>y(P.target.value),onKeyDown:Ae,placeholder:H.placeholder,disabled:i,className:S("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",ce?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>w(!x),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",x||v.length>0?"bg-emerald-500/20 text-emerald-400":ce?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:H.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"})]}),v.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:v.length})]}),jsxRuntime.jsx("button",{onClick:()=>C(!A),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||k||f?"bg-blue-500/20 text-blue-400":ce?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:H.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:()=>$(!B),className:S("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":ce?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:H.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:ie,disabled:!u.trim()||i,className:S("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:i?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):H.save})]})]}),x&&a.length>0&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",ce?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(P=>jsxRuntime.jsxs("button",{onClick:()=>Se(P.id),className:S("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",v.includes(P.id)?"bg-emerald-500 text-white":ce?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[P.avatar?jsxRuntime.jsx("img",{src:P.avatar,alt:P.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:S("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",v.includes(P.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:P.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:P.name.split(" ")[0]})]},P.id))})}),A&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",ce?"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:S("block text-[10px] uppercase tracking-wide mb-1",ce?"text-gray-500":"text-gray-400"),children:H.startDate}),jsxRuntime.jsx("input",{type:"date",value:k,onChange:P=>g(P.target.value),className:S("w-full px-2 py-1.5 rounded text-xs border",ce?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:S("block text-[10px] uppercase tracking-wide mb-1",ce?"text-gray-500":"text-gray-400"),children:H.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:P=>T(P.target.value),className:S("w-full px-2 py-1.5 rounded text-xs border",ce?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),B&&jsxRuntime.jsx("div",{className:S("px-3 pb-3 pt-0","border-t",ce?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(P=>jsxRuntime.jsx("button",{onClick:()=>b(N===P?"":P),className:S("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===P?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[P]} text-white`:ce?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:H[P]},P))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:d,className:S("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",ce?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",d&&"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:H.buttonLabel})]})}var Lr=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(La,{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(n=>n.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,n)=>{r.toBlob(d=>{d?o(d):n(new Error("Failed to create PNG blob"));},"image/png");})}};function ji(e={}){return new Lr(e)}var dr=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:n}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${n||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(d){console.error("Error in error handler:",d);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:n,componentName:d}=this.props;return a&&r?n?n(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:d?`Error in ${d}`:"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 hn(e,t){let a=r=>jsxRuntime.jsx(dr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function yn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:d,onPredictRisks:c,onOpenAIUsage:m,shortcut:s="k",className:p=""}){let[i,l]=react.useState(false),[u,y]=react.useState(""),[v,h]=react.useState("home"),[k,g]=react.useState(""),[f,T]=react.useState("");react.useEffect(()=>{let w=A=>{(A.metaKey||A.ctrlKey)&&A.key===s&&(A.preventDefault(),l(C=>!C)),A.key==="Escape"&&(l(false),h("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[s]),react.useEffect(()=>{i||(h("home"),y(""),g(""),T(""));},[i]);let N=react.useCallback(()=>{l(false);},[]),b=react.useCallback(w=>{let[A,C]=w.split(":");switch(A){case "create-card":h("create-card");break;case "create-card-in":g(C||"");break;case "navigate":C?(a?.(C),N()):h("navigate");break;case "search":r?.(u),N();break;case "priority":h("priority");break;case "set-priority":f&&C&&(o?.(f,C),N());break;case "assign":h("assign");break;case "assign-user":f&&C&&(n?.(f,C),N());break;case "ai":h("ai");break;case "ai-generate-plan":d?.(),N();break;case "ai-predict-risks":c?.(),N();break;case "ai-usage":m?.(),N();break;case "back":h("home");break;}},[u,f,t,a,r,o,n,d,c,m,N]),x=react.useCallback(()=>{k&&u.trim()&&(t?.(k,u.trim()),N());},[k,u,t,N]);return i?jsxRuntime.jsx(Ue,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:v==="create-card"&&k?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&v==="create-card"&&k&&x();}}),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."}),v==="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:b,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:b,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:b,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:b,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(A=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:A},A))})]},w.id))})]}),v==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),v==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let A=e.columns.find(C=>C.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:b,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:A?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:C},C))})]},w.id)})})]}),v==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,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:b,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:b,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:b,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 Wm(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 Hm(e){return e.startsWith("image/")}function Br({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[d,c]=react.useState(false),[m,s]=react.useState(false),[p,i]=react.useState(null),l=react.useRef(null),u=react.useCallback(b=>{let x=[],w=[];return e.length+b.length>n?(w.push(`Maximum ${n} files allowed`),{valid:x,errors:w}):(b.forEach(A=>{if(A.size/1048576>r){w.push(`${A.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>A.type.match(B))){w.push(`${A.name} has invalid file type`);return}x.push(A);}),{valid:x,errors:w})},[e.length,n,r,o]),y=react.useCallback(async b=>{let{valid:x,errors:w}=u(b);if(w.length>0){i(w.join(", ")),setTimeout(()=>i(null),5e3);return}if(x.length!==0){s(true),i(null);try{await t?.(x);}catch(A){i(A instanceof Error?A.message:"Upload failed"),setTimeout(()=>i(null),5e3);}finally{s(false);}}},[u,t]),v=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),c(true);},[]),h=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),c(false);},[]),k=react.useCallback(b=>{b.preventDefault(),b.stopPropagation();},[]),g=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),c(false);let x=Array.from(b.dataTransfer.files);y(x);},[y]),f=react.useCallback(b=>{let x=b.target.files?Array.from(b.target.files):[];y(x),l.current&&(l.current.value="");},[y]),T=react.useCallback(()=>{l.current?.click();},[]),N=react.useCallback(b=>{confirm("Are you sure you want to delete this attachment?")&&a?.(b);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${d?"dragging":""} ${m?"uploading":""}`,onDragEnter:v,onDragLeave:h,onDragOver:k,onDrop:g,onClick:T,children:[jsxRuntime.jsx("input",{ref:l,type:"file",multiple:true,onChange:f,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:d?"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,"/",n," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(b=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Hm(b.type)&&b.url?jsxRuntime.jsx("img",{src:b.thumbnailUrl||b.url,alt:b.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Gm(b.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:b.name,children:b.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Wm(b.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(b.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>N(b.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"})})})]},b.id))})]})}function kn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:d=[],activities:c=[],aiInsights:m=[],attachments:s=[],onAddComment:p,onDeleteComment:i,onUploadAttachments:l,onDeleteAttachment:u,onSuggestAssignee:y,onGenerateSubtasks:v,onEstimateEffort:h,currentUserId:k="user-1"}){let[g,f]=react.useState("details"),[T,N]=react.useState(false),[b,x]=react.useState({}),[w,A]=react.useState(""),[C,B]=react.useState(false),[$,R]=react.useState({});if(!t||!e)return null;let E=react.useCallback(()=>{N(false),x({}),f("details"),A(""),R({}),a();},[a]),H=react.useCallback(()=>{r&&Object.keys(b).length>0&&(r(e.id,b),x({}),N(false));},[e.id,b,r]),re=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),E());},[e.id,o,E]),ie=react.useCallback(()=>{p&&w.trim()&&(p(e.id,w.trim()),A(""));},[e.id,w,p]),Ae=react.useCallback(async()=>{if(y){B(true);try{let I=await y(e);R(_=>({..._,assignees:I}));}catch(I){console.error("Failed to suggest assignee:",I);}finally{B(false);}}},[e,y]),Se=react.useCallback(async()=>{if(v){B(true);try{let I=await v(e);R(_=>({..._,subtasks:I}));}catch(I){console.error("Failed to generate subtasks:",I);}finally{B(false);}}},[e,v]),ce=react.useCallback(async()=>{if(h){B(true);try{let I=await h(e);R(_=>({..._,effort:I}));}catch(I){console.error("Failed to estimate effort:",I);}finally{B(false);}}},[e,h]),P={...e,...b},M=n.filter(I=>P.assignedUserIds?.includes(I.id));return jsxRuntime.jsx(Ue,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:E,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:I=>I.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:P.priority==="URGENT"?"#EF4444":P.priority==="HIGH"?"#F59E0B":P.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),T?jsxRuntime.jsx("input",{type:"text",value:b.title??P.title,onChange:I=>x({...b,title:I.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:P.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:H,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),x({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:re,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:E,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 ${g==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>f("comments"),className:`card-detail-tab ${g==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${g==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("attachments"),className:`card-detail-tab ${g==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("ai"),className:`card-detail-tab ${g==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[g==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),T?jsxRuntime.jsx("textarea",{value:b.description??P.description??"",onChange:I=>x({...b,description:I.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:P.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),T?jsxRuntime.jsx("select",{multiple:true,value:b.assignedUserIds??P.assignedUserIds??[],onChange:I=>{let _=Array.from(I.target.selectedOptions,K=>K.value);x({...b,assignedUserIds:_});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(I=>jsxRuntime.jsx("option",{value:I.id,children:I.name},I.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:M.length>0?M.map(I=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:I.color},children:I.initials}),jsxRuntime.jsx("span",{children:I.name})]},I.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"}),T?jsxRuntime.jsxs("select",{value:b.priority??P.priority??"",onChange:I=>x({...b,priority:I.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:P.priority==="URGENT"?"#EF4444":P.priority==="HIGH"?"#F59E0B":P.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:P.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:P.labels&&P.labels.length>0?P.labels.map(I=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:I},I)):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"}),T?jsxRuntime.jsx("input",{type:"date",value:b.startDate?new Date(b.startDate).toISOString().split("T")[0]:P.startDate?new Date(P.startDate).toISOString().split("T")[0]:"",onChange:I=>x({...b,startDate:I.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:P.startDate?new Date(P.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),T?jsxRuntime.jsx("input",{type:"date",value:b.endDate?new Date(b.endDate).toISOString().split("T")[0]:P.endDate?new Date(P.endDate).toISOString().split("T")[0]:"",onChange:I=>x({...b,endDate:I.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:P.endDate?new Date(P.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),T?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:b.estimatedTime??P.estimatedTime??"",onChange:I=>x({...b,estimatedTime:I.target.value?parseFloat(I.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:P.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:P.dependencies&&P.dependencies.length>0?P.dependencies.map(I=>{let _=typeof I=="string"?I:I.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",_.slice(-4)]},_)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:P.createdAt?new Date(P.createdAt).toLocaleString():"Unknown"})]})]}),g==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:I=>A(I.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ie,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:d.length>0?d.map(I=>{let _=n.find(K=>K.id===I.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[_&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:_.color},children:_.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:_?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(I.createdAt).toLocaleString()})]})]}),i&&jsxRuntime.jsx("button",{onClick:()=>i(I.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:I.content})]},I.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),g==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(I=>{let _=n.find(K=>K.id===I.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[I.type.includes("CREATED")&&"\u2795",I.type.includes("UPDATED")&&"\u270F\uFE0F",I.type.includes("MOVED")&&"\u27A1\uFE0F",I.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",I.type.includes("COMMENT")&&"\u{1F4AC}",I.type.includes("ASSIGNED")&&"\u{1F464}",I.type.includes("PRIORITY")&&"\u{1F3AF}",I.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",I.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:_?.name||"Unknown"})," ",I.type.replace(/_/g," ").toLowerCase(),I.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:I.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(I.timestamp).toLocaleString()})]})]},I.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),g==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Br,{cardId:e.id,attachments:s,onUpload:l?I=>l(e.id,I):void 0,onDelete:u,currentUserId:k,maxSizeMB:10,maxFiles:20})}),g==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ae,disabled:C||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:Se,disabled:C||!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("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:ce,disabled:C||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),$.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),$.assignees.map((I,_)=>{let K=n.find(j=>j.id===I.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[K&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:K?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:I.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(I.confidence*100).toFixed(0),"%"]})]})]},_)})]}),$.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),$.subtasks.map((I,_)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:I.title}),I.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:I.description}),I.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",I.estimatedTime,"h"]})]},_))]}),$.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[$.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",($.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(I=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${I.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:I.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:I.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:I.description}),I.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",I.suggestedAction]})]},I.id))]}),!$.assignees&&!$.subtasks&&!$.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Rr({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:n=300,className:d=""}){let[c,m]=react.useState({top:0,left:0}),s=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let i=e.current.getBoundingClientRect(),l=window.innerHeight,u=window.innerWidth,y=4,v=i.left;v+o>u-10&&(v=u-o-10),v<10&&(v=10);let h=l-i.bottom,k=i.top,g;return h>=n+y?g=i.bottom+y:k>=n+y?g=i.top-n-y:h>=k?g=i.bottom+y:g=Math.max(10,i.top-n-y),{top:g,left:v}},[e,o,n]);return react.useEffect(()=>{t&&m(p());},[t,p]),react.useEffect(()=>{if(!t)return;let i=u=>{let y=u.target;s.current&&!s.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},l=setTimeout(()=>{document.addEventListener("mousedown",i);},0);return ()=>{clearTimeout(l),document.removeEventListener("mousedown",i);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let i=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),a());};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),t?jsxRuntime.jsx(Ue,{children:jsxRuntime.jsx("div",{ref:s,className:`smart-popover ${d}`,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 Jm=["LOW","MEDIUM","HIGH","URGENT"],Zm=["todo","in-progress","review","done"];function Tn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:d=[],activities:c=[],onAddComment:m,onDeleteComment:s,currentUser:p,onAIGenerateDescription:i,onAICreateSubtasks:l,onAIFindSimilar:u,availableColumns:y=[],availableLabels:v=[],onUploadCoverImage:h,unsplashAccessKey:k,theme:g,onSubtasksChange:f}){let T=nr(),N=g||T?.themeName||"dark",[b,x]=react.useState(e),[w,A]=react.useState(false),[C,B]=react.useState(e?.subtasks||[]),[$,R]=react.useState(false),[E,H]=react.useState(""),[re,ie]=react.useState(""),[Ae,Se]=react.useState("all"),[ce,P]=react.useState(false),[M,I]=react.useState(false),[_,K]=react.useState(false),[j,le]=react.useState(false),[oe,Le]=react.useState(false),[fe,Xe]=react.useState(false),Ye=react.useRef(null),Mt=react.useRef(null),Jt=react.useRef(null),zt=react.useRef(null),It=react.useRef(null),At=react.useRef(null),St=react.useRef(null),fa=react.useRef(null),pt=react.useRef(null),ot=react.useRef(null),Lt=react.useRef(null),Ca=react.useRef(null);react.useEffect(()=>{e&&!b?(x({...e}),B(e.subtasks||[])):e&&b&&e.id!==b.id&&(x({...e}),B(e.subtasks||[]));},[e,b]),react.useEffect(()=>{let L=J=>{let Ne=J.target;zt.current&&!zt.current.contains(Ne)&&P(false),It.current&&!It.current.contains(Ne)&&I(false),At.current&&!At.current.contains(Ne)&&K(false),St.current&&!St.current.contains(Ne)&&le(false);};if(ce||M||_||j)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[ce,M,_,j]),react.useEffect(()=>{if(!t)return;let L=J=>{let Ne=J.target,qe=Ne.tagName==="INPUT"||Ne.tagName==="TEXTAREA"||Ne.isContentEditable;if(J.key==="Escape"){J.preventDefault(),ce||M||_||j||oe||fe?(P(false),I(false),K(false),le(false),Le(false),Xe(false)):qe||a();return}if(qe&&J.key!=="Escape")return;let ue=J.metaKey||J.ctrlKey;switch(J.key.toLowerCase()){case "s":J.preventDefault(),P(true);break;case "a":J.preventDefault(),K(true);break;case "p":J.preventDefault(),I(true);break;case "l":J.preventDefault(),le(true);break;case "d":ue||(J.preventDefault(),Le(true),setTimeout(()=>fa.current?.focus(),0));break;case "e":ue||(J.preventDefault(),Xe(true));break;case "i":J.preventDefault(),A(true),setTimeout(()=>Mt.current?.focus(),0);break;case "t":J.preventDefault(),R(true);break;case "c":J.preventDefault(),Jt.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,ce,M,_,j,oe,fe]);let de=react.useCallback(L=>{let J=L.currentTarget.textContent?.trim()||"";if(b&&J!==b.title){let Ne={...b,title:J};x(Ne),r?.(b.id,{title:J});}},[b,r]),xe=react.useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=b?.title||"",L.currentTarget.blur());},[b]),_t=react.useCallback(()=>{b&&e&&b.description!==e.description&&r?.(b.id,{description:b.description}),A(false);},[b,e,r]),ba=react.useCallback(L=>{if(b){let J={...b,columnId:L};x(J),r?.(b.id,{columnId:L}),P(false);}},[b,r]),xt=react.useCallback(L=>{if(b){let J={...b,priority:L};x(J),r?.(b.id,{priority:L}),I(false);}},[b,r]),ha=react.useCallback(L=>{if(b){let J=b.assignedUserIds||[],Ne=J.includes(L)?J.filter(ue=>ue!==L):[...J,L],qe={...b,assignedUserIds:Ne};x(qe),r?.(b.id,{assignedUserIds:Ne});}},[b,r]),va=react.useCallback(L=>{if(b){let J=b.labels||[],Ne=J.includes(L)?J.filter(ue=>ue!==L):[...J,L],qe={...b,labels:Ne};x(qe),r?.(b.id,{labels:Ne});}},[b,r]),Ce=react.useCallback(L=>{if(b){let J=L.target.value,Ne={...b,endDate:J};x(Ne),r?.(b.id,{endDate:J}),Le(false);}},[b,r]),Te=react.useCallback(L=>{if(b){let J={...b,estimatedTime:parseFloat(L)||0};x(J),r?.(b.id,{estimatedTime:parseFloat(L)||0});}},[b,r]),ut=react.useCallback(()=>{if(E.trim()&&b){let L={id:`subtask-${Date.now()}`,title:E.trim(),completed:false,createdAt:new Date},J=[...C,L];B(J),H(""),R(false),f?.(b.id,J);}},[E,C,b,f]),te=react.useCallback(L=>{let J=C.map(Ne=>Ne.id===L?{...Ne,completed:!Ne.completed,updatedAt:new Date}:Ne);B(J),b&&f?.(b.id,J);},[C,b,f]),ke=react.useCallback(L=>{let J=C.filter(Ne=>Ne.id!==L);B(J),b&&f?.(b.id,J);},[C,b,f]),F=react.useCallback(()=>{re.trim()&&b&&m&&(m(b.id,re.trim()),ie(""));},[re,b,m]),U=react.useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),F());},[F]),me=L=>jsxRuntime.jsx(Ym__default.default,{remarkPlugins:[qm__default.default],rehypePlugins:[Xm__default.default],components:{a:({node:J,...Ne})=>jsxRuntime.jsx("a",{...Ne,target:"_blank",rel:"noopener noreferrer"})},children:L}),ge=c.filter(L=>Ae==="comments"?L.type.includes("COMMENT"):Ae==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let q=b||e,pe=n.filter(L=>q.assignedUserIds?.includes(L.id)),X=C.filter(L=>L.completed).length;return jsxRuntime.jsx(Ue,{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:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":N,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ye,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:de,onKeyDown:xe,children:q.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:zt,children:[jsxRuntime.jsxs("button",{ref:pt,className:"modal-v2-field",onClick:()=>P(!ce),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:q.columnId||"No status"})]}),jsxRuntime.jsx(Rr,{triggerRef:pt,isOpen:ce,onClose:()=>P(false),width:250,estimatedHeight:200,children:(y.length>0?y:Zm.map(L=>({id:L,title:L}))).map(L=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${q.columnId===L.id?"active":""}`,onClick:()=>ba(L.id),children:L.title},L.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:At,children:[jsxRuntime.jsxs("button",{ref:ot,className:"modal-v2-field",onClick:()=>K(!_),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:pe.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:pe.map(L=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:L.color},title:L.name,children:L.initials},L.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Rr,{triggerRef:ot,isOpen:_,onClose:()=>K(false),width:280,estimatedHeight:300,children:n.map(L=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>ha(L.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,q.assignedUserIds?.includes(L.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"})})]},L.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:It,children:[jsxRuntime.jsxs("button",{ref:Lt,className:"modal-v2-field",onClick:()=>I(!M),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:q.priority||"None"})]}),jsxRuntime.jsxs(Rr,{triggerRef:Lt,isOpen:M,onClose:()=>I(false),width:180,estimatedHeight:220,children:[Jm.map(L=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${q.priority===L?"active":""}`,onClick:()=>xt(L),children:L},L)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>xt(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:St,children:[jsxRuntime.jsxs("button",{ref:Ca,className:"modal-v2-field",onClick:()=>le(!j),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:q.labels&&q.labels.length>0?jsxRuntime.jsx("span",{children:q.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Rr,{triggerRef:Ca,isOpen:j,onClose:()=>le(false),width:220,estimatedHeight:200,children:(v.length>0?v:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.labels?.includes(L)?"active":""}`,onClick:()=>va(L),children:[L,q.labels?.includes(L)&&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"})})]},L))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Le(!oe),setTimeout(()=>fa.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:q.endDate?new Date(q.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:fa,type:"date",value:typeof q.endDate=="string"?q.endDate.split("T")[0]:q.endDate?(()=>{let L=new Date(q.endDate),J=L.getUTCFullYear(),Ne=String(L.getUTCMonth()+1).padStart(2,"0"),qe=String(L.getUTCDate()).padStart(2,"0");return `${J}-${Ne}-${qe}`})():"",onChange:Ce,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Xe(!fe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:q.estimatedTime?`${q.estimatedTime}h`:"Not set"})]}),fe&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:q.estimatedTime||"",onChange:L=>Te(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Xe(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"})]}),w?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:q.description||"",onChange:L=>{if(b){let J={...b,description:L.target.value};x(J);}},onBlur:_t,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>A(true),children:q.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:me(q.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"}),C.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[X,"/",C.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>R(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:[C.map(L=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${L.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>te(L.id),children:L.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:L.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>ke(L.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"})]})})]},L.id)),$&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:E,onChange:L=>H(L.target.value),onKeyDown:L=>{L.key==="Enter"&&ut(),L.key==="Escape"&&(R(false),H(""));},onBlur:ut,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),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 ${Ae==="all"?"active":""}`,onClick:()=>Se("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ae==="comments"?"active":""}`,onClick:()=>Se("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Ae==="history"?"active":""}`,onClick:()=>Se("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Jt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:re,onChange:L=>ie(L.target.value),onKeyDown:U,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:F,disabled:!re.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ge.map(L=>{let J=n.find(qe=>qe.id===L.userId);if(L.type.includes("COMMENT")){let qe=d.find(ue=>ue.id===L.metadata?.commentId);return qe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[J&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:J.color},children:J.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:J?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:qe.content})]})]},L.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.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:J?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:L.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.id)}),ge.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 ip({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 Dn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(d=>({...d,average:d.average??e.reduce((c,m)=>c+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"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(ip,{})}),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((d,c)=>d+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((d,c)=>d+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(d=>d.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((d,c)=>d+(c.planned||0),0)})]})]})]})}function bp({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 Sn({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),d=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,m=n>0?(n-d)/n*100:0,s=d<=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(bp,{})}),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:s?"#10B981":"#EF4444",fill:s?"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:s?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:s?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:s?"#10B981":"#EF4444"},children:d})]}),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:s?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:s?"#10B981":"#EF4444"},children:s?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Np={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},al=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Dp({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let d=r+(o-r)*.5,c=e+d*Math.cos(-a*(Math.PI/180)),m=t+d*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:c,y:m,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function rl({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 En({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((m,s)=>m+s.value,0),d=e.map(m=>({...m,totalValue:n,color:m.color||Np[m.name]||al[e.indexOf(m)%al.length]})),c=d.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:d,cx:"50%",cy:"50%",labelLine:false,label:o?Dp:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:d.map((m,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[s]},`cell-${s}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(rl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,s)=>{let p=s.payload,i=n>0?(p.value/n*100).toFixed(0):"0";return `${m} (${p.value} - ${i}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:d,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(rl,{})}),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:d.map((m,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[s]},`cell-${s}`))})]})}),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:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,s)=>s.value>m.value?s:m).name})]})]})]})}var uo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[d,c]=react.useState(false),[m,s]=react.useState(false),[p,i]=react.useState(false),[l,u]=react.useState(false);if(e.length===0)return null;let y=e.map(T=>T.id),v=T=>{r.onBulkUpdate?.(y,{priority:T}),c(false);},h=T=>{r.onBulkMove?.(y,T),s(false),a();},k=T=>{r.onBulkUpdate?.(y,{assignedUserIds:T}),i(false);},g=T=>{let N=new Set;e.forEach(x=>{x.labels?.forEach(w=>N.add(w));});let b=Array.from(new Set([...N,...T]));r.onBulkUpdate?.(y,{labels:b}),u(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!d),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(T),children:[jsxRuntime.jsx("span",{className:S("asakaa-priority-dot",T==="LOW"&&"bg-asakaa-priority-low",T==="MEDIUM"&&"bg-asakaa-priority-medium",T==="HIGH"&&"bg-asakaa-priority-high",T==="URGENT"&&"bg-asakaa-priority-urgent")}),T]},T))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>s(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(T.id),children:T.title},T.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k([T.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:T.color},children:T.initials}),T.name]},T.id))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!l),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([T]),children:T},T))})]}),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"})})]})]})})});uo.displayName="BulkOperationsToolbar";function Ip(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,d,c,m,s;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(u=>{let y=a?.find(v=>v.id===u);d=`assignee-${u}`,c=y?.name||`User ${u}`,m=y?.color,s=y?.avatar,r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:m,icon:s}),r.get(d).cardIds.push(o.id);}):(d="assignee-unassigned",c="Unassigned",m="#6b7280",s="\u{1F464}",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:m,icon:s}),r.get(d).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",d=`priority-${n}`;let l={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"}}[n];c=l.title,m=l.color,r.has(d)||r.set(d,{id:d,title:c,groupValue:n,cardIds:[],color:m}),r.get(d).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{d=`label-${u}`,c=u,m="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:m}),r.get(d).cardIds.push(o.id);}):(d="label-none",c="No Labels",m="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:m}),r.get(d).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function Pn({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,d]=react.useState(new Set),c=react.useMemo(()=>Ip(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(s=>{d(p=>{let i=new Set(p);return i.has(s)?i.delete(s):i.add(s),i});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(La,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:S("asakaa-swimlane-view",o),children:[c.map(s=>{let p=n.has(s.id),i=e.cards.filter(u=>s.cardIds.includes(u.id)),l={...e,cards:i};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(s.id),style:{borderLeft:s.color?`4px solid ${s.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[s.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:s.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:s.color},children:s.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",s.cardIds.length," ",s.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(La,{board:l,callbacks:r,availableUsers:a})})]},s.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 Mn=[{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 In({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),d=react.useRef(null),c=Mn.find(s=>s.value===e)||Mn[0];react.useEffect(()=>{function s(p){n.current&&!n.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let m=s=>{t(s),o(false);};return jsxRuntime.jsxs("div",{className:S("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,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:S("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:n,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:Mn.map(s=>jsxRuntime.jsxs("button",{onClick:()=>m(s.value),className:S("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===s.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:s.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:s.label}),e===s.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:s.description})]})]},s.value))})]})]})}var Or=[{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 Fp(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(s=>e.key===s||e.code===s))return false;let o=t.modifiers||{},n=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,d=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return n&&d&&c&&m}function ll(e={}){let{shortcuts:t=Or,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),n=react.useRef(a);react.useEffect(()=>{o.current=t,n.current=a;},[t,a]);let d=react.useCallback(m=>{o.current=[...o.current,m];},[]),c=react.useCallback(m=>{o.current=o.current.filter(s=>s.action!==m);},[]);return react.useEffect(()=>{function m(s){if(!n.current)return;let p=s.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&s.key!=="Escape"&&!s.ctrlKey&&!s.metaKey)){for(let i of o.current)if(Fp(s,i)){r&&s.preventDefault();let l=new CustomEvent("keyboard-action",{detail:i.action,bubbles:true,cancelable:true});window.dispatchEvent(l);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:d,unregisterShortcut:c,isEnabled:a}}function Rp(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Op(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 $p(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Op(e),r=t?Rp(t):"";return a?`${a} + ${r}`:r}function zp(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 An({shortcuts:e=Or,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function c(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let d=zp(e);return jsxRuntime.jsxs("div",{className:S("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(d).map(([c,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(s=>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:s.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:$p(s)})]},s.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 Ln=[{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 Fn({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{function s(p){n.current&&!n.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let c=s=>{t(s),o(false);},m=e.reduce((s,p)=>{let i=p.category||"Other";return s[i]||(s[i]=[]),s[i].push(p),s},{});return jsxRuntime.jsxs("div",{className:S("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,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:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",s.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",s.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:S("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:n,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([s,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:s})}),jsxRuntime.jsx("div",{children:p.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i),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:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:i.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:i.name}),i.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:i.description})]})]},i.id))})]},s)),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 Rn({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[d,c]=react.useState("export"),[m,s]=react.useState("json"),[p,i]=react.useState(null),l=react.useRef(null);if(!t)return null;let u=async()=>{let v=o?.current||void 0,h=await di(e,m,v);ci(h,m);},y=async v=>{let h=v.target.files?.[0];if(h){try{let k=await ui(h),g=h.name.endsWith(".json")?"json":"csv",f=pi(k,g);i(f),f.success&&r&&r(f,k);}catch(k){i({success:false,errors:[`Failed to read file: ${k instanceof Error?k.message:"Unknown error"}`]});}l.current&&(l.current.value="");}};return jsxRuntime.jsxs("div",{className:S("fixed inset-0 z-[9999] flex items-center justify-center",n),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:S("flex-1 px-6 py-4 font-semibold transition-colors",d==="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:S("flex-1 px-6 py-4 font-semibold transition-colors",d==="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:[d==="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(v=>jsxRuntime.jsxs("button",{onClick:()=>s(v),className:S("p-4 rounded-lg border-2 transition-all text-center",m===v?"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:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),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"})]}),d==="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:l,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>l.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:S("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:S("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((v,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},h))})]})]})]})]})]})}var _p=["URGENT","HIGH","MEDIUM","LOW"],Vp=[{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"}],jp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function On({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:m=[],availableLabels:s=[],availableColumns:p=[],showQuickFilters:i=true,compact:l=false,groupBy:u="none",onGroupByChange:y}){let[v,h]=react.useState(true),k=react.useCallback(b=>{a({search:b.target.value});},[a]),g=react.useCallback(b=>{a({dateFilter:b.target.value});},[a]),f=react.useCallback(b=>{r({by:b.target.value});},[r]),T=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${l?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:v?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!v&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[i&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),d&&jsxRuntime.jsx("button",{onClick:d,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:k,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:g,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:b=>{let x=b.target.value;a({priorities:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),_p.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:b=>{let x=b.target.value;a({assignees:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(b=>jsxRuntime.jsx("option",{value:b.id,children:b.name},b.id))]})}),s.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:b=>{let x=b.target.value;a({labels:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),s.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),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:Vp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:T,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:b=>y(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:jp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function $n({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:m}){let[s,p]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let u=y=>{i.current&&!i.current.contains(y.target)&&p(false);};return s&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[s]);let l=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:S("relative",r),ref:i,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!s),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":s,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"})]}),s&&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:()=>l(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:()=>l(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>l(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>l(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:()=>l(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>l(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:()=>l(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 zn={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"}},Un={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"}},Wn={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"}},qa={dark:zn,light:Un,neutral:Wn},fo="dark";var bo=react.createContext(void 0),au="asakaa-theme";function ml({children:e,defaultTheme:t=fo,storageKey:a=au}){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}),n=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,m=qa[r];Object.entries(m.colors).forEach(([p,i])=>{i&&c.style.setProperty(`--theme-${ru(p)}`,i);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,i])=>{let l=m.colors[p];l&&c.style.setProperty(i,l);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:n,themes:qa};return jsxRuntime.jsx(bo.Provider,{value:d,children:e})}function ur(){let e=react.useContext(bo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ru(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Gn({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ur();return e?jsxRuntime.jsxs("div",{className:S("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(qa).map(([n,d])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:S("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:d.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&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"})})]},n))})]})]}):null}var Ie={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"}};function pl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ie[e]||Ie.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,d)=>a.getPropertyValue(n).trim()||d;return {bgPrimary:r("--theme-bg-primary",Ie[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ie[e].bgSecondary),bgGrid:r("--theme-bg-card",Ie[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ie[e].bgWeekend),border:r("--theme-border-primary",Ie[e].border),borderLight:r("--theme-border-subtle",Ie[e].borderLight),textPrimary:r("--theme-text-primary",Ie[e].textPrimary),textSecondary:r("--theme-text-secondary",Ie[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ie[e].textTertiary),accent:r("--theme-accent-primary",Ie[e].accent),accentHover:r("--theme-accent-hover",Ie[e].accentHover),accentLight:r("--theme-accent-primary",Ie[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ie[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ie[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ie[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ie[e].dependency),dependencyHover:r("--theme-border-secondary",Ie[e].dependencyHover),criticalPath:r("--theme-error",Ie[e].criticalPath),criticalPathLight:r("--theme-error",Ie[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ie[e].today):e==="neutral"?r("--theme-text-primary",Ie[e].today):r("--theme-error",Ie[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ie[e].todayLight):e==="neutral"?r("--theme-text-primary",Ie[e].todayLight):r("--theme-error",Ie[e].todayLight),milestone:r("--theme-warning",Ie[e].milestone),milestoneLight:r("--theme-warning",Ie[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ie[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ie[e].statusInProgress),statusCompleted:r("--theme-success",Ie[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ie[e].hoverBg),focusRing:r("--theme-accent-primary",Ie[e].focusRing)}}var ho={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"}},ul={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"}},Hn={en:ho,es:ul};function gl(e){return Hn[e]||Hn.en}function _n(e,t){let a=gl(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 fr=react.createContext(ho);function $r(){return react.useContext(fr)}function xu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:d}){let[c,m]=react.useState(false),[s,p]=react.useState(null),i=react.useRef(null),l=$r();if(react.useEffect(()=>{let h=k=>{i.current&&!i.current.contains(k.target)&&m(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||a||r||o||n||d))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(h=>h.handler),v=async(h,k)=>{if(k){p(h);try{await k();}catch(g){console.error(`Export ${h} failed:`,g);}finally{p(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!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:l.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:y.map((h,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(h.id,h.handler),disabled:s!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:k<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:s===h.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):h.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function ku({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(n=>{let d=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(n.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:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&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}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function wu({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=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:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),n&&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 Cu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),d=$r();react.useEffect(()=>{let s=p=>{n.current&&!n.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],m=c.find(s=>s.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:n,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:`${d.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((s,p)=>{let i=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(s.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:i?e.accentLight:"transparent",borderBottom:p<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:i?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:i?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:i?600:500},children:s.label}),i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},s.value)})})})})]})}function vo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:d,rowDensity:c,onRowDensityChange:m,showThemeSelector:s=false,showCreateTaskButton:p=false,createTaskLabel:i,onCreateTask:l,onExportPNG:u,onExportPDF:y,onExportExcel:v,onExportCSV:h,onExportJSON:k,onExportMSProject:g}){let f=$r(),T=u||y||v||h||k||g,N=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],b=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(wu,{options:N,value:t,onChange:x=>a(x),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(Cu,{theme:e,value:c,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:l,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:i||f.toolbar.createTask})]}),(T||s)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xu,{theme:e,onExportPNG:u,onExportPDF:y,onExportExcel:v,onExportCSV:h,onExportJSON:k,onExportMSProject:g}),s&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),s&&jsxRuntime.jsx(ku,{options:b,value:n,onChange:x=>d(x),theme:e})]})]})}function yo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,d]=react.useState({x:0,y:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=i=>{c.current&&!c.current.contains(i.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let s=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let p=m.current.getBoundingClientRect();d({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Ue,{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:`${n.x}px`,top:`${n.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"}),s.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function br({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let d=react.useRef(null),[c,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,i=r.length*36+8,l=8,u=window.innerWidth,y=window.innerHeight,v=t,h=a;t+p+l>u&&(v=t-p,v<l&&(v=l)),a+i+l>y&&(h=y-i-l,h<l&&(h=l)),m({x:v,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=l=>{d.current&&!d.current.contains(l.target)&&o();},i=l=>{l.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",i);}},[e,o]),!e)return null;let s=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:s(n.bgSecondary),border:`1px solid ${n.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:i=>{p.disabled||(i.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},p.id))})})})}var et={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 Sl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:d,onTaskIndent:c,onTaskOutdent:m,onTaskRename:s,onTaskToggleExpand:p,onOpenTaskModal:i,enableKeyboard:l=true}){let u=react.useRef(false),y=react.useCallback(f=>{u.current=f;},[]),v=react.useCallback(f=>{let T=[],N=b=>{for(let x of b)T.push(x),x.subtasks&&x.subtasks.length>0&&x.isExpanded&&N(x.subtasks);};return N(f),T},[]),h=react.useCallback(()=>{let f=v(e);for(let T of f)if(t.has(T.id))return T;return null},[e,t,v]),k=react.useCallback((f,T)=>{let N=v(e);if(N.length===0)return;let b=h();if(!b){a(N[0].id,false);return}let x=N.findIndex(C=>C.id===b.id);if(x===-1)return;let w=f==="up"?x-1:x+1;if(w<0||w>=N.length)return;let A=N[w];a(A.id,T);},[e,h,v,a]),g=react.useCallback(f=>{if(!l)return;let T=f.target;if(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||u.current){f.key==="Escape"&&(T.blur(),u.current=false);return}let x=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,w=Array.from(t),A=h();if(f.key==="ArrowUp"){f.preventDefault(),k("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),k("down",f.shiftKey);return}if(A&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){A.subtasks&&A.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!A.isExpanded||f.key==="ArrowLeft"&&A.isExpanded)&&p(A.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){w.length>0&&(f.preventDefault(),d(w,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){w.length>0&&(f.preventDefault(),c(w));return}if(f.key==="Tab"&&f.shiftKey){w.length>0&&(f.preventDefault(),m(w));return}if(f.key==="Enter"&&!f.shiftKey&&!x){A&&(f.preventDefault(),r(A.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!x){A&&(f.preventDefault(),r(A.id,"above"));return}if(f.key==="Enter"&&x){A&&(f.preventDefault(),i(A.id));return}if(f.key==="F2"){A&&(f.preventDefault(),s(A.id));return}if(f.key==="Delete"||f.key==="Backspace"&&x){w.length>0&&(f.preventDefault(),o(w));return}if(f.key==="d"&&x&&!f.shiftKey){w.length>0&&(f.preventDefault(),n(w));return}},[l,t,h,k,r,o,n,d,c,m,s,p,i]);return react.useEffect(()=>{if(l)return window.addEventListener("keydown",g),()=>{window.removeEventListener("keydown",g);}},[l,g]),{setIsEditing:y}}function Pl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(i=>{t(new Set([i])),r(i);},[]),n=react.useCallback(i=>{t(l=>{let u=new Set(l);return u.has(i)?u.delete(i):u.add(i),u}),r(i);},[]),d=react.useCallback((i,l)=>{if(!a){o(i);return}let u=l.indexOf(a),y=l.indexOf(i);if(u===-1||y===-1){o(i);return}let v=Math.min(u,y),h=Math.max(u,y),k=l.slice(v,h+1);t(new Set(k)),r(i);},[a,o]),c=react.useCallback((i,l,u,y)=>{y?d(i,l):u?n(i):o(i);},[o,n,d]),m=react.useCallback((i,l)=>{l?t(u=>{let y=new Set(u);return y.add(i),y}):o(i);},[o]),s=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(i=>e.has(i),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:m,clearSelection:s,isTaskSelected:p}}function hr(e){let t=[],a=(r,o,n=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:n,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,n+1);}};return a(e),t}function Ml(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ml(a.subtasks,t);if(r)return r}}return null}function Kn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Kn(a.subtasks,t);if(r)return r}return null}function Yn(e,t){if(t.length===0)return e;let a=hr(e),r=t[0],o=a.findIndex(i=>i.id===r);if(o<=0)return e;let n=a[o-1],d=(i,l)=>{let u=[];return {tasks:i.filter(v=>{if(l.has(v.id))return u.push(v),false;if(v.subtasks){let h=d(v.subtasks,l);v.subtasks=h.tasks,u.push(...h.removed);}return true}),removed:u}},c=(i,l,u)=>i.map(y=>y.id===l?{...y,subtasks:[...y.subtasks||[],...u],isExpanded:true}:y.subtasks?{...y,subtasks:c(y.subtasks,l,u)}:y),m=new Set(t),{tasks:s,removed:p}=d(e,m);return c(s,n.id,p)}function qn(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Kn(a,r);if(!o)continue;let n=Kn(a,o.id),d=(s,p,i)=>{for(let l=0;l<s.length;l++){let u=s[l];if(u.id===p&&u.subtasks){let y=u.subtasks.findIndex(v=>v.id===i);if(y!==-1){let[v]=u.subtasks.splice(y,1);return v}}if(u.subtasks){let y=d(u.subtasks,p,i);if(y)return y}}return null},c=(s,p,i)=>{let l=s.findIndex(u=>u.id===p);if(l!==-1)return s.splice(l+1,0,i),s;for(let u of s)u.subtasks&&c(u.subtasks,p,i);return s},m=d(a,o.id,r);m&&(n&&n.subtasks?c(n.subtasks,o.id,m):c(a,o.id,m));}return a}function Xn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(d,c,m)=>{let s=d.findIndex(i=>i.id===c);if(s===-1){for(let i of d)if(i.subtasks&&n(i.subtasks,c,m))return true;return false}let p=m==="up"?s-1:s+1;return p<0||p>=d.length?false:([d[s],d[p]]=[d[p],d[s]],true)};return n(r,o,a),r}function Jn(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function Zn(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(p=>p.id===r);if(c===-1){for(let p of d)if(p.subtasks&&o(p.subtasks))return true;return false}let m=d[c],s={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?n(m.subtasks):void 0};return d.splice(c+1,0,s),true},n=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?n(c.subtasks):void 0}));o(a);}return a}function Il(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},c=m=>{let s=m.findIndex(i=>i.id===t);if(s===-1){for(let i of m)if(i.subtasks&&c(i.subtasks))return true;return false}let p=a==="above"?s:s+1;return m.splice(p,0,d),true};return c(r),{tasks:r,newTask:d}}function Qn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Qn(r.subtasks,t,a)}:r)}function es(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:es(a.subtasks,t)}:a)}function ts(e,t){let a=p=>{for(let i of p){if(i.id===t)return i;if(i.subtasks){let l=a(i.subtasks);if(l)return l}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let d=r?.startDate||o,c=r?.endDate||n,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},s=p=>p.map(i=>{if(i.id===t){let l=i.subtasks||[];return {...i,subtasks:[...l,m],isExpanded:true}}return i.subtasks?{...i,subtasks:s(i.subtasks)}:i});return {tasks:s(e),newTask:m}}function Al(e,t,a,r){if(t===a)return e;let o=Ml(e,t);if(!o)return e;if(a){let c=(m,s)=>{if(!m.subtasks)return false;for(let p of m.subtasks)if(p.id===s||c(p,s))return true;return false};if(c(o,a))return e}let n=c=>c.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:n(m.subtasks)}:m),d=n(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=m=>m.map(s=>{if(s.id===a){let p=s.subtasks||[],i=r!==void 0?r:p.length,l=[...p];return l.splice(i,0,{...o,parentId:a}),{...s,subtasks:l,isExpanded:true}}return s.subtasks&&s.subtasks.length>0?{...s,subtasks:c(s.subtasks)}:s});d=c(d);}return d}function wo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:m,scrollTop:s,columns:p,onToggleColumn:i,onColumnResize:l,onTaskUpdate:u,onTaskIndent:y,onTaskOutdent:v,onTaskMove:h,onMultiTaskDelete:k,onTaskDuplicate:g,onTaskCreate:f,onTaskRename:T,onCreateSubtask:N,onOpenTaskModal:b,onDeleteRequest:x,onTaskReparent:w}){let A=react.useContext(fr),[C,B]=react.useState(null),[$,R]=react.useState(false),[E,H]=react.useState(null),[re,oe]=react.useState(""),Ae=react.useRef(null),Se=react.useRef(null),[ce,P]=react.useState(null),[M,I]=react.useState(0),[_,K]=react.useState(0),[j,le]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ne,Le]=react.useState(null),[be,Xe]=react.useState(null),[Ye,Mt]=react.useState(null),Jt=react.useRef(0),zt=5,It=react.useRef(false);react.useEffect(()=>{function F(U){Ae.current&&!Ae.current.contains(U.target)&&R(false);}if($)return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[$]),react.useEffect(()=>{E&&Se.current&&(Se.current.focus(),Se.current.select());},[E]),react.useEffect(()=>{if(!ce)return;let F=me=>{let ge=me.clientX-M,q=_+ge;l?.(ce,q);},U=()=>{P(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",F),document.addEventListener("mouseup",U),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",U),document.body.style.cursor="",document.body.style.userSelect="";}},[ce,M,_,l]);let{selectedTaskIds:At,handleTaskClick:St,isTaskSelected:fa}=Pl(),{setIsEditing:pt}=Sl({tasks:e,selectedTaskIds:At,onTaskSelect:(F,U)=>{let ge=hr(e).map(q=>q.id);St(F,ge,U||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:k||(()=>{}),onTaskDuplicate:g||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:v||(()=>{}),onTaskRename:F=>{let U=hr(e).find(me=>me.id===F);U&&xe(U);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:F=>{let U=hr(e).find(me=>me.id===F);U&&b&&b(U);},enableKeyboard:true}),ot=(F,U=0)=>{let me=[];for(let ge of F)me.push({task:ge,level:U}),ge.subtasks&&ge.subtasks.length>0&&ge.isExpanded&&me.push(...ot(ge.subtasks,U+1));return me},Lt=ot(e),Ca=48,de=F=>!F.startDate||!F.endDate?"-":`${Math.ceil((F.endDate.getTime()-F.startDate.getTime())/(1e3*60*60*24))}d`,xe=F=>{H(F.id),oe(F.name),pt(true);},_t=F=>{re.trim()&&re!==e.find(U=>U.id===F)?.name&&T?.(F,re.trim()),H(null),oe(""),pt(false);},ba=()=>{H(null),oe(""),pt(false);},xt=(F,U)=>{U.stopPropagation(),N?.(F.id);},ha=(F,U)=>{U.preventDefault(),Jt.current=U.clientY,Le(F),It.current=false;},va=F=>{if(!ne||(Math.abs(F.clientY-Jt.current)>zt&&(It.current=true),!It.current))return;let me=document.querySelectorAll("[data-task-row]"),ge=null,q=null;me.forEach(pe=>{let X=pe.getBoundingClientRect(),L=pe.getAttribute("data-task-row");if(L&&L!==ne&&F.clientY>=X.top&&F.clientY<=X.bottom){ge=L;let J=F.clientY-X.top,Ne=X.height;J<Ne*.25?q="above":J>Ne*.75?q="below":q="child";}}),Xe(ge),Mt(q);},Ce=()=>{if(It.current&&ne&&be&&Ye){if(Ye==="child")w?.(ne,be);else if(Ye==="above"||Ye==="below"){let F=(ge,q,pe=null)=>{for(let X of ge){if(X.id===q)return pe;if(X.subtasks){let L=F(X.subtasks,q,X.id);if(L!==void 0)return L}}},U=F(e,be,null),me=(ge,q)=>{let pe=ge.findIndex(X=>X.id===q);return Ye==="below"?pe+1:pe};if(U===null){let ge=me(e,be);w?.(ne,null,ge);}else {let ge=Lt.find(q=>q.task.id===U)?.task;if(ge?.subtasks){let q=me(ge.subtasks,be);w?.(ne,U,q);}}}}Le(null),Xe(null),Mt(null),It.current=false;};react.useEffect(()=>{if(ne)return document.addEventListener("mousemove",va),document.addEventListener("mouseup",Ce),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",va),document.removeEventListener("mouseup",Ce),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,be,Ye]);let Te=(F,U,me)=>{switch(F.id){case "name":let ge=E===U.id,q=C===U.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${me*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:q?1:.3},onMouseDown:ue=>ha(U.id,ue),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),U.subtasks&&U.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ue=>{ue.stopPropagation(),m?.(U.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:U.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"}),!(U.subtasks&&U.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:U.color||"#3B82F6",opacity:U.parentId?.6:1,borderColor:U.isMilestone?t.accent:"transparent",borderWidth:U.isMilestone?"2px":"0px"},title:U.isMilestone?"Milestone":U.parentId?"Subtask":"Task"}),ge?jsxRuntime.jsx("input",{ref:Se,type:"text",value:re,onChange:ue=>oe(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"?_t(U.id):ue.key==="Escape"&&ba();},onBlur:()=>_t(U.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:ue=>ue.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:U.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:U.parentId?"13px":"14px",fontWeight:U.isMilestone?600:U.parentId?400:600,letterSpacing:U.parentId?"0":"-0.01em"},title:U.name,children:U.name}),q&&!ge&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ue=>ue.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ue=>xt(U,ue),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:ue=>{ue.stopPropagation(),xe(U);},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":let pe=U.startDate?typeof U.startDate=="string"?U.startDate:U.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:pe||"",onChange:ue=>{u?.(U.id,{startDate:ue.target.value?new Date(ue.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let X=U.endDate?typeof U.endDate=="string"?U.endDate:U.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:X||"",onChange:ue=>{u?.(U.id,{endDate:ue.target.value?new Date(ue.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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:de(U)})});case "assignees":let L=r.filter(ue=>U.assignees?.some(Wa=>Wa.name===ue.name||Wa.initials===ue.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(Va,{assignedUsers:L,availableUsers:r,onChange:ue=>{let Wa=ue.map(rr=>({id:rr.id,name:rr.name,initials:rr.initials,color:rr.color}));u?.(U.id,{assignees:Wa.length>0?Wa:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(Ai,{status:U.status||"todo",onChange:ue=>{u?.(U.id,{status:ue,progress:ue==="completed"?100:U.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:`${U.progress}%`,backgroundColor:U.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:[U.progress,"%"]})]});case "priority":let J={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ne={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},qe=J[U.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(Ha,{priority:qe,onChange:ue=>{ue&&u?.(U.id,{priority:Ne[ue]||"medium"});}})});default:return null}},ut=F=>[{id:"hide",label:"Hide Column",icon:et.Hide,onClick:()=>i(F),disabled:F==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:et.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:et.SortDesc,onClick:()=>{}}],te=F=>F.subtasks&&F.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:et.Add,onClick:()=>{N?.(F.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:et.Delete,onClick:()=>{x?x(F.id,F.name):k?.([F.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:et.Pencil,onClick:()=>{d?.(F);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:et.Add,onClick:()=>{N?.(F.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:et.MarkIncomplete,onClick:()=>{u?.(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:et.SetInProgress,onClick:()=>{u?.(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:et.MarkComplete,onClick:()=>{u?.(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:et.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:et.Delete,onClick:()=>{x?x(F.id,F.name):k?.([F.id]);}}],ke=p.filter(F=>F.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:`${Ca}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[ke.map((F,U)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${F.id==="name"?"justify-between":"justify-center"}`,style:{...F.id==="name"?{flex:"1 1 auto",minWidth:`${F.minWidth??150}px`}:{width:`${F.width}px`,minWidth:`${F.minWidth??60}px`,maxWidth:`${F.maxWidth??2e3}px`,flexShrink:0},borderRight:U<ke.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:me=>{me.preventDefault(),le({isOpen:true,x:me.clientX,y:me.clientY,type:"header",columnId:F.id});},onMouseEnter:me=>{me.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:me=>{me.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",flex:F.id==="name"?"1 1 auto":"none",minWidth:0},title:F.label,children:F.label}),F.id==="name"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[jsxRuntime.jsx(yo,{columns:p,onToggleColumn:i,theme:t}),jsxRuntime.jsx("button",{onClick:()=>R(!$),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"})})]}),F.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ce===F.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:me=>{me.preventDefault(),me.stopPropagation(),P(F.id),I(me.clientX),K(F.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"}})})]},F.id)),$&&jsxRuntime.jsxs("div",{ref:Ae,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:F=>F.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:()=>R(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:Lt.map(({task:F,level:U},me)=>{let ge=fa(F.id),q=be===F.id,pe={};return q&&Ye&&(Ye==="above"?(pe.borderTopWidth="2px",pe.borderTopStyle="solid",pe.borderTopColor=t.accent):Ye==="below"?(pe.borderBottomWidth="2px",pe.borderBottomStyle="solid",pe.borderBottomColor=t.accent):Ye==="child"&&(pe.backgroundColor=t.accentLight,pe.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":F.id,className:`flex items-center cursor-pointer group ${ne===F.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:ge?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ge||q&&Ye==="child"?t.accentLight:me%2===0?t.bgPrimary:t.bgGrid,...pe},onMouseEnter:()=>B(F.id),onMouseLeave:()=>B(null),onClick:X=>{let J=hr(e).map(ue=>ue.id),qe=navigator.platform.toUpperCase().indexOf("MAC")>=0?X.metaKey:X.ctrlKey;St(F.id,J,qe,X.shiftKey),n?.(F);},onDoubleClick:X=>{X.stopPropagation(),d?.(F);},onContextMenu:X=>{X.preventDefault(),le({isOpen:true,x:X.clientX,y:X.clientY,type:"task",task:F}),c?.(F,X);},whileHover:{backgroundColor:ge?t.accentLight:t.hoverBg},children:ke.map((X,L)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${X.id==="name"?"justify-start":"justify-center"} ${L<ke.length-1?"border-r":""}`,style:{...X.id==="name"?{flex:"1 1 auto",minWidth:`${X.minWidth??150}px`}:{width:`${X.width}px`,minWidth:`${X.minWidth??60}px`,maxWidth:`${X.maxWidth??2e3}px`,flexShrink:0},borderColor:C===F.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Te(X,F,X.id==="name"?U:0)},`${F.id}-${X.id}`))},F.id)})}),jsxRuntime.jsx(br,{isOpen:j.isOpen,x:j.x,y:j.y,items:j.type==="header"&&j.columnId?ut(j.columnId):j.type==="task"&&j.task?te(j.task):[],onClose:()=>le({...j,isOpen:false}),theme:t})]})}function Ll(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[d,c]=react.useState(e),[m,s]=react.useState(t),[p,i]=react.useState(null),[l,u]=react.useState(null),[y,v]=react.useState(null),[h,k]=react.useState(null),[g,f]=react.useState(0),[T,N]=react.useState(0),[b,x]=react.useState(null),[w,A]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:d,setGhostX:c,ghostWidth:m,setGhostWidth:s,connectionLine:p,setConnectionLine:i,hoveredTaskId:l,setHoveredTaskId:u,activeZone:y,setActiveZone:v,draggedSegmentIndex:h,setDraggedSegmentIndex:k,draggedSegmentStartX:g,setDraggedSegmentStartX:f,segmentDragOffsetX:T,setSegmentDragOffsetX:N,hoveredSegmentIndex:b,setHoveredSegmentIndex:x,isHovered:w,setIsHovered:A,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(E,H)=>{r("none"),i(null),u(null),c(E),s(H),N(0),k(null),f(0);}}}function Co({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:d,templates:c,onClick:m,onDoubleClick:s,onContextMenu:p,onDateChange:i,onDependencyCreate:l,allTaskPositions:u=[],onDragMove:y,onHoverChange:v}){let h=Ll(t,r),k=react.useRef(null),{dragMode:g,setDragMode:f,dragOffset:T,setDragOffset:N,ghostX:b,setGhostX:x,ghostWidth:w,setGhostWidth:A,connectionLine:C,setConnectionLine:B,hoveredTaskId:$,setHoveredTaskId:R,activeZone:E,setActiveZone:H,draggedSegmentIndex:re,setDraggedSegmentIndex:oe,draggedSegmentStartX:Ae,setDraggedSegmentStartX:Se,segmentDragOffsetX:ce,setSegmentDragOffsetX:P,hoveredSegmentIndex:M,setHoveredSegmentIndex:I,isHovered:_,setIsHovered:K,isDragging:j,isResizing:le,isConnecting:ne,resetDragState:Le}=h,be=32,Xe=8,Ye=e.endDate&&e.endDate<new Date&&e.progress<100,Mt=e.isCriticalPath,Jt=o.name==="neutral"||o.today==="#1C1917",zt=e.status==="completed"||e.progress===100,It={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},St=e.isCriticalPath||Ye?"#DC2626":e.color?e.color:e.priority&&It[e.priority]?It[e.priority]:o.taskBarPrimary,pt=(te=>te>=80?20:te>=60?15:te>=50?12:10)(r),ot=r<50,Lt=r<40;react.useEffect(()=>{if(v)if(_&&!j&&!e.segments){let te=a<100;v({task:e,x:t,y:a,width:r,height:be,showBelow:te});}else v(null);},[_,j,e,t,a,r,be,v]);let Ca=te=>te.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),de=()=>{let te=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${te} day${te!==1?"s":""}`},xe=te=>Math.round(te/n)*n,_t=te=>{let ke=Math.round(te/n),F=new Date(d);return F.setDate(F.getDate()+ke),F},ba=(te,ke)=>{for(let F of u){if(F.id===e.id)continue;let U=5;if(te>=F.x-U&&te<=F.x+F.width+U&&ke>=F.y-U&&ke<=F.y+F.height+U)return F.id}return null},xt=react.useCallback((te,ke,F)=>{te.preventDefault(),te.stopPropagation();let U=k.current?.ownerSVGElement;if(!U)return;let me=U.createSVGPoint();me.x=te.clientX,me.y=te.clientY;let ge=me.matrixTransform(U.getScreenCTM()?.inverse()),q=F!==void 0?F:t,pe=ke;if(!pe){let X=ge.x-q;te.shiftKey?(pe="connect",B({x:t+r,y:a+be/2})):te.ctrlKey||te.metaKey?pe="move":te.altKey?pe=X<r/2?"resize-start":"resize-end":Lt?X<r/2?pe="move":pe="resize-end":ot?X<=pt/2?pe="resize-start":X>=r-pt/2?pe="resize-end":pe="move":X<=pt?pe="resize-start":X>=r-pt?pe="resize-end":pe="move";}f(pe),K(false),H(null),pe==="move"?N(ge.x-q):pe==="connect"?B({x:t+r,y:a+be/2}):N(0),x(q),A(r);},[t,r,a,be]),ha=react.useCallback(te=>{if(g==="none")return;let ke=k.current?.ownerSVGElement;if(!ke)return;let F=ke.createSVGPoint();F.x=te.clientX,F.y=te.clientY;let U=F.matrixTransform(ke.getScreenCTM()?.inverse());if(g==="connect"){B({x:U.x,y:U.y});let me=ba(U.x,U.y);R(me);}else if(g==="move"){let me=U.x-T,ge=xe(me);x(ge),A(r);let q=Math.round((ge-t)/n);if(y?.(e.id,q,true),e.segments&&e.segments.length>0&&re!==null){let pe=ge-Ae;P(pe);}}else if(g==="resize-start"){let me=U.x,ge=xe(me),q=t+r-ge;q>=n&&(x(ge),A(q));}else if(g==="resize-end"){let me=U.x,q=xe(me)-t;q>=n&&A(q);}},[g,t,r,n,T,e,xe,re,Ae,ba,R,B,x,A,P,y]),va=react.useCallback(()=>{if(g!=="none"){if(g==="connect")$&&l&&l(e,$),B(null),R(null);else {let te=e.endDate.getTime()-e.startDate.getTime(),ke,F,U=true;if(g==="move"){if(ke=_t(b),F=new Date(ke.getTime()+te),e.segments&&e.segments.length>0&&re!==null){let me=Math.round(ce/n),ge=e.segments.map((L,J)=>{if(J===re){let Ne=new Date(L.startDate),qe=new Date(L.endDate);return Ne.setDate(Ne.getDate()+me),qe.setDate(qe.getDate()+me),{startDate:Ne,endDate:qe}}return L}),q=ge.flatMap(L=>[L.startDate,L.endDate]),pe=new Date(Math.min(...q.map(L=>L.getTime()))),X=new Date(Math.max(...q.map(L=>L.getTime())));i?.({...e,segments:ge},pe,X),Le(t,r);return}}else g==="resize-start"?(ke=_t(b),F=e.endDate,ke>=F&&(console.warn("Invalid date range: start date must be before end date"),U=false)):g==="resize-end"?(ke=e.startDate,F=_t(b+w),F<=ke&&(console.warn("Invalid date range: end date must be after start date"),U=false)):U=false;U&&ke&&F&&(F.getTime()-ke.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):i?.(e,ke,F));}y?.(e.id,0,false),Le(t,r);}},[g,b,w,e,i,$,l,t,r,n,_t,ce,re,Le,y]);react.useEffect(()=>{if(g==="none")return;let te=F=>{ha(F);},ke=()=>{va();};return window.addEventListener("mousemove",te),window.addEventListener("mouseup",ke),()=>{window.removeEventListener("mousemove",te),window.removeEventListener("mouseup",ke);}},[g,ha,va]);let Ce=j&&!ne?b:t,Te=j&&!ne?w:r,ut=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,onMouseEnter:()=>!j&&K(true),onMouseLeave:()=>{j||(K(false),H(null));},onClick:()=>!j&&m?.(e),onDoubleClick:te=>{j||(te.stopPropagation(),s?.(e));},onContextMenu:te=>{te.preventDefault(),p?.(e,te);},children:[_&&!j&&!ot&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:pt,height:be,fill:E==="resize-start"?o.accent:"transparent",opacity:E==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>H("resize-start"),onMouseDown:te=>xt(te,"resize-start")}),jsxRuntime.jsx("rect",{x:t+pt,y:a,width:r-pt*2,height:be,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>H("move"),onMouseDown:te=>xt(te,"move")}),jsxRuntime.jsx("rect",{x:t+r-pt,y:a,width:pt,height:be,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>H("resize-end"),onMouseDown:te=>xt(te,"resize-end")})]}),_&&!j&&Lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:be,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>H("move"),onMouseDown:te=>xt(te,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:be,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>H("resize-end"),onMouseDown:te=>xt(te,"resize-end")}),_&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+be-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),j&&!ne&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:b,y:a,width:w,height:be,rx:Xe,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce,y:a,width:Te,height:be,rx:Xe,fill:St,"data-task-class":ut,initial:{opacity:0,scale:.95},animate:{opacity:j&&!ne?.15:e.parentId?.6:_?.9:.8,scale:_&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:te=>xt(te),style:{cursor:j?ne?"crosshair":le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Te*(e.progress/100),height:be,rx:Xe,fill:St,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((te,ke)=>{let F=(te.startDate.getTime()-d.getTime())/864e5*n,me=(te.endDate.getTime()-d.getTime())/(1e3*60*60*24)*n-F+n,ge=j&&g==="move"&&re===ke,q=M===ke,pe=ge?F+ce:F;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!j&&I(ke),onMouseLeave:()=>!j&&I(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:pe,y:a,width:me,height:be,rx:Xe,fill:St,initial:{opacity:0,scale:.95},animate:{opacity:ge||e.parentId?.6:q?.9:.8,scale:q&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:X=>{X.stopPropagation(),oe(ke),Se(F),xt(X,void 0,F);},style:{cursor:j?ne?"crosshair":le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:pe,y:a,width:me*(e.progress/100),height:be,rx:Xe,fill:St,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ke}`)}),Jt&&(Ye||Mt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Mt&&!Ye&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Te,height:be,rx:Xe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ye&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Te,height:be,rx:Xe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Te>60&&!e.segments&&(()=>{let te=c.taskLabel(e),ke=typeof te=="string"?te:e.name,F=ke.length>Math.floor(Te/8)?`${ke.substring(0,Math.floor(Te/8))}...`:ke;return jsxRuntime.jsx("text",{x:Ce+12,y:a+be/2,dominantBaseline:"middle",fill:zt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:zt?"line-through":"none"},children:F})})(),Te>100&&e.progress>0&&e.progress<100&&!j&&!e.segments&&jsxRuntime.jsxs("text",{x:Ce+Te-12,y:a+be/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&Te>80&&!j&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ce+Te-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ce+Te-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(_||le)&&!ne&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ot?Ce-15:Ce-10,y:a-5,width:ot?25:20,height:be+10,fill:"transparent",onMouseDown:te=>xt(te,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ot?Ce-8:Ce-3,y:a+6,width:ot?8:6,height:ot?be-12:be-16,rx:3,fill:g==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="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:Ce+Te-10,y:a-5,width:ot?25:20,height:be+10,fill:"transparent",onMouseDown:te=>xt(te,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ot?Ce+Te:Ce+Te-3,y:a+6,width:ot?8:6,height:ot?be-12:be-16,rx:3,fill:g==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&!j&&!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+be/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:te=>{te.stopPropagation(),xt(te,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+be/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ne&&C&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+be/2,x2:C.x,y2:C.y,stroke:$?o.statusCompleted:o.accent,strokeWidth:$?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:$?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:C.x,cy:C.y,r:$?8:6,fill:$?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),$&&jsxRuntime.jsx(framerMotion.motion.text,{x:C.x+15,y:C.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:C.x+10},animate:{opacity:1,x:C.x+15},transition:{duration:.2},children:"Connect"})]}),(_||j)&&!ne&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce-2,y:a-2,width:Te+4,height:be+4,rx:Xe+2,fill:"none",stroke:j?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:j?.6:.4,initial:{opacity:0},animate:{opacity:j?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:b,y1:0,x2:b,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:b+w,y1:0,x2:b+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&!j&&!e.segments&&!v&&(()=>{let F=a<100,U=F?a+be+13:a-82-13,me=F?`M ${Ce+Te/2-6} ${a+be+3} L ${Ce+Te/2} ${a+be+13} L ${Ce+Te/2+6} ${a+be+3}`:`M ${Ce+Te/2-6} ${a-13} L ${Ce+Te/2} ${a-3} L ${Ce+Te/2+6} ${a-13}`,ge=U+22,q=U+40,pe=U+55,X=U+70,L=F?U+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:F?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:F?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:me,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ce+Te/2-120,y:U,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:Ce+Te/2,y:ge,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:Ce+Te/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ce+Te/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ca(e.startDate)}),jsxRuntime.jsx("text",{x:Ce+Te/2-110,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ce+Te/2-70,y:pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ca(e.endDate)}),jsxRuntime.jsx("text",{x:Ce+Te/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ce+Te/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:de()}),jsxRuntime.jsx("text",{x:Ce+Te/2+10,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ce+Te/2+65,y:pe,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:Ce+Te/2-110,y:X,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ce+Te/2-50,y:X,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(J=>J.name).join(", ").substring(0,30),e.assignees.map(J=>J.name).join(", ").length>30?"...":""]})]}),!F&&jsxRuntime.jsx("text",{x:Ce+Te/2,y:L,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Lt?"Left: move \u2022 Right: resize":ot?"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 Rl({tooltipData:e,theme:t}){if(!e)return null;let{task:a,x:r,y:o,width:n,height:d,showBelow:c}=e,m=82,s=13,p=c?o+d+s:o-m-s,i=c?`M ${r+n/2-6} ${o+d+3} L ${r+n/2} ${o+d+13} L ${r+n/2+6} ${o+d+3}`:`M ${r+n/2-6} ${o-13} L ${r+n/2} ${o-3} L ${r+n/2+6} ${o-13}`,l=p+22,u=p+40,y=p+55,v=p+70,h=c?p+m-5:o-18,k=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),g=()=>{if(!a.startDate||!a.endDate)return "N/A";let N=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${N} day${N!==1?"s":""}`},f=n<50,T=n<40;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:i,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+n/2-120,y:p,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+n/2,y:l,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+n/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?k(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?k(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+n/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:g()}),jsxRuntime.jsx("text",{x:r+n/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+n/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+n/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+n/2-50,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(N=>N.name).join(", ").substring(0,30),a.assignees.map(N=>N.name).join(", ").length>30?"...":""]})]}),!c&&jsxRuntime.jsx("text",{x:r+n/2,y:h,textAnchor:"middle",fill:t.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:T?"Left: move \u2022 Right: resize":f?"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 Do({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n,onHoverChange:d}){let[c,m]=react.useState(false),s=a-e,p=r-t,i=e+s/2,l=`M ${e} ${t} C ${i} ${t}, ${i} ${r}, ${a} ${r}`,u=6,y=Math.atan2(p,s),v=a-u*Math.cos(y-Math.PI/6),h=r-u*Math.sin(y-Math.PI/6),k=a-u*Math.cos(y+Math.PI/6),g=r-u*Math.sin(y+Math.PI/6),f=o.dependency;return react.useEffect(()=>{d&&n&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:n}:null);},[c,e,t,a,r,n,d]),jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?1:.6,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.15},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${v} ${h} M ${a} ${r} L ${k} ${g}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?1:.6,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:c&&d?0:c?1.33:1},transition:{scale:{delay:.3,duration:.15}}}),c&&n&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:i,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:i-4,y1:(t+r)/2-4,x2:i+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:i+4,y1:(t+r)/2-4,x2:i-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Eo({task:e,x:t,y:a,theme:r,onClick:o}){let[n,d]=react.useState(false),c=16,m=s=>s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(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:n?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:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&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:n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Y={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=s=>{s.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let d=new Set,c=new Set,m=s=>{if(!d.has(s)){d.add(s),c.add(s);let p=r.get(s)||[];for(let i of p){if(!d.has(i)&&m(i))return true;if(c.has(i))return true}}return c.delete(s),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Y.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Y.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=Y.findTaskById(e,o);if(n)a.unshift(n),o=n.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=Y.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[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(n.join(","));}),r.join(`
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Fn({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{function s(p){n.current&&!n.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let c=s=>{t(s),o(false);},m=e.reduce((s,p)=>{let i=p.category||"Other";return s[i]||(s[i]=[]),s[i].push(p),s},{});return jsxRuntime.jsxs("div",{className:S("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,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:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",s.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",s.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:S("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:n,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([s,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:s})}),jsxRuntime.jsx("div",{children:p.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i),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:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:i.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:i.name}),i.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:i.description})]})]},i.id))})]},s)),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 Rn({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[d,c]=react.useState("export"),[m,s]=react.useState("json"),[p,i]=react.useState(null),l=react.useRef(null);if(!t)return null;let u=async()=>{let v=o?.current||void 0,h=await di(e,m,v);ci(h,m);},y=async v=>{let h=v.target.files?.[0];if(h){try{let k=await ui(h),g=h.name.endsWith(".json")?"json":"csv",f=pi(k,g);i(f),f.success&&r&&r(f,k);}catch(k){i({success:false,errors:[`Failed to read file: ${k instanceof Error?k.message:"Unknown error"}`]});}l.current&&(l.current.value="");}};return jsxRuntime.jsxs("div",{className:S("fixed inset-0 z-[9999] flex items-center justify-center",n),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:S("flex-1 px-6 py-4 font-semibold transition-colors",d==="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:S("flex-1 px-6 py-4 font-semibold transition-colors",d==="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:[d==="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(v=>jsxRuntime.jsxs("button",{onClick:()=>s(v),className:S("p-4 rounded-lg border-2 transition-all text-center",m===v?"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:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),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"})]}),d==="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:l,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>l.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:S("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:S("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((v,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},h))})]})]})]})]})]})}var _p=["URGENT","HIGH","MEDIUM","LOW"],Vp=[{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"}],jp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function On({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:m=[],availableLabels:s=[],availableColumns:p=[],showQuickFilters:i=true,compact:l=false,groupBy:u="none",onGroupByChange:y}){let[v,h]=react.useState(true),k=react.useCallback(b=>{a({search:b.target.value});},[a]),g=react.useCallback(b=>{a({dateFilter:b.target.value});},[a]),f=react.useCallback(b=>{r({by:b.target.value});},[r]),T=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${l?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:v?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!v&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[i&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),d&&jsxRuntime.jsx("button",{onClick:d,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:k,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:g,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:b=>{let x=b.target.value;a({priorities:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),_p.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:b=>{let x=b.target.value;a({assignees:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(b=>jsxRuntime.jsx("option",{value:b.id,children:b.name},b.id))]})}),s.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:b=>{let x=b.target.value;a({labels:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),s.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),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:Vp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:T,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:b=>y(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:jp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function $n({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:m}){let[s,p]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let u=y=>{i.current&&!i.current.contains(y.target)&&p(false);};return s&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[s]);let l=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:S("relative",r),ref:i,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!s),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":s,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"})]}),s&&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:()=>l(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:()=>l(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>l(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>l(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:()=>l(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>l(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:()=>l(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 zn={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"}},Un={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"}},Wn={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"}},qa={dark:zn,light:Un,neutral:Wn},fo="dark";var bo=react.createContext(void 0),au="asakaa-theme";function ml({children:e,defaultTheme:t=fo,storageKey:a=au}){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}),n=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,m=qa[r];Object.entries(m.colors).forEach(([p,i])=>{i&&c.style.setProperty(`--theme-${ru(p)}`,i);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,i])=>{let l=m.colors[p];l&&c.style.setProperty(i,l);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:n,themes:qa};return jsxRuntime.jsx(bo.Provider,{value:d,children:e})}function ur(){let e=react.useContext(bo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ru(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Gn({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ur();return e?jsxRuntime.jsxs("div",{className:S("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(qa).map(([n,d])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:S("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:d.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&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"})})]},n))})]})]}):null}var Ie={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"}};function pl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ie[e]||Ie.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,d)=>a.getPropertyValue(n).trim()||d;return {bgPrimary:r("--theme-bg-primary",Ie[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ie[e].bgSecondary),bgGrid:r("--theme-bg-card",Ie[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ie[e].bgWeekend),border:r("--theme-border-primary",Ie[e].border),borderLight:r("--theme-border-subtle",Ie[e].borderLight),textPrimary:r("--theme-text-primary",Ie[e].textPrimary),textSecondary:r("--theme-text-secondary",Ie[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ie[e].textTertiary),accent:r("--theme-accent-primary",Ie[e].accent),accentHover:r("--theme-accent-hover",Ie[e].accentHover),accentLight:r("--theme-accent-primary",Ie[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ie[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ie[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ie[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ie[e].dependency),dependencyHover:r("--theme-border-secondary",Ie[e].dependencyHover),criticalPath:r("--theme-error",Ie[e].criticalPath),criticalPathLight:r("--theme-error",Ie[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ie[e].today):e==="neutral"?r("--theme-text-primary",Ie[e].today):r("--theme-error",Ie[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ie[e].todayLight):e==="neutral"?r("--theme-text-primary",Ie[e].todayLight):r("--theme-error",Ie[e].todayLight),milestone:r("--theme-warning",Ie[e].milestone),milestoneLight:r("--theme-warning",Ie[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ie[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ie[e].statusInProgress),statusCompleted:r("--theme-success",Ie[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ie[e].hoverBg),focusRing:r("--theme-accent-primary",Ie[e].focusRing)}}var ho={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"}},ul={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"}},Hn={en:ho,es:ul};function gl(e){return Hn[e]||Hn.en}function _n(e,t){let a=gl(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 fr=react.createContext(ho);function $r(){return react.useContext(fr)}function xu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:d}){let[c,m]=react.useState(false),[s,p]=react.useState(null),i=react.useRef(null),l=$r();if(react.useEffect(()=>{let h=k=>{i.current&&!i.current.contains(k.target)&&m(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||a||r||o||n||d))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(h=>h.handler),v=async(h,k)=>{if(k){p(h);try{await k();}catch(g){console.error(`Export ${h} failed:`,g);}finally{p(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!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:l.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:y.map((h,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(h.id,h.handler),disabled:s!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:k<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:s===h.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):h.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function ku({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(n=>{let d=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(n.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:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&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}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function wu({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=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:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),n&&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 Cu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),d=$r();react.useEffect(()=>{let s=p=>{n.current&&!n.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],m=c.find(s=>s.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:n,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:`${d.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((s,p)=>{let i=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(s.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:i?e.accentLight:"transparent",borderBottom:p<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:i?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:i?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:i?600:500},children:s.label}),i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},s.value)})})})})]})}function vo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:d,rowDensity:c,onRowDensityChange:m,showThemeSelector:s=false,showCreateTaskButton:p=false,createTaskLabel:i,onCreateTask:l,onExportPNG:u,onExportPDF:y,onExportExcel:v,onExportCSV:h,onExportJSON:k,onExportMSProject:g}){let f=$r(),T=u||y||v||h||k||g,N=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],b=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(wu,{options:N,value:t,onChange:x=>a(x),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(Cu,{theme:e,value:c,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:l,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:i||f.toolbar.createTask})]}),(T||s)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xu,{theme:e,onExportPNG:u,onExportPDF:y,onExportExcel:v,onExportCSV:h,onExportJSON:k,onExportMSProject:g}),s&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),s&&jsxRuntime.jsx(ku,{options:b,value:n,onChange:x=>d(x),theme:e})]})]})}function yo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,d]=react.useState({x:0,y:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=i=>{c.current&&!c.current.contains(i.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let s=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let p=m.current.getBoundingClientRect();d({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Ue,{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:`${n.x}px`,top:`${n.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"}),s.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function br({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let d=react.useRef(null),[c,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,i=r.length*36+8,l=8,u=window.innerWidth,y=window.innerHeight,v=t,h=a;t+p+l>u&&(v=t-p,v<l&&(v=l)),a+i+l>y&&(h=y-i-l,h<l&&(h=l)),m({x:v,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=l=>{d.current&&!d.current.contains(l.target)&&o();},i=l=>{l.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",i);}},[e,o]),!e)return null;let s=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:s(n.bgSecondary),border:`1px solid ${n.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:i=>{p.disabled||(i.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},p.id))})})})}var et={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 Sl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:d,onTaskIndent:c,onTaskOutdent:m,onTaskRename:s,onTaskToggleExpand:p,onOpenTaskModal:i,enableKeyboard:l=true}){let u=react.useRef(false),y=react.useCallback(f=>{u.current=f;},[]),v=react.useCallback(f=>{let T=[],N=b=>{for(let x of b)T.push(x),x.subtasks&&x.subtasks.length>0&&x.isExpanded&&N(x.subtasks);};return N(f),T},[]),h=react.useCallback(()=>{let f=v(e);for(let T of f)if(t.has(T.id))return T;return null},[e,t,v]),k=react.useCallback((f,T)=>{let N=v(e);if(N.length===0)return;let b=h();if(!b){a(N[0].id,false);return}let x=N.findIndex(C=>C.id===b.id);if(x===-1)return;let w=f==="up"?x-1:x+1;if(w<0||w>=N.length)return;let A=N[w];a(A.id,T);},[e,h,v,a]),g=react.useCallback(f=>{if(!l)return;let T=f.target;if(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||u.current){f.key==="Escape"&&(T.blur(),u.current=false);return}let x=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,w=Array.from(t),A=h();if(f.key==="ArrowUp"){f.preventDefault(),k("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),k("down",f.shiftKey);return}if(A&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){A.subtasks&&A.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!A.isExpanded||f.key==="ArrowLeft"&&A.isExpanded)&&p(A.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){w.length>0&&(f.preventDefault(),d(w,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){w.length>0&&(f.preventDefault(),c(w));return}if(f.key==="Tab"&&f.shiftKey){w.length>0&&(f.preventDefault(),m(w));return}if(f.key==="Enter"&&!f.shiftKey&&!x){A&&(f.preventDefault(),r(A.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!x){A&&(f.preventDefault(),r(A.id,"above"));return}if(f.key==="Enter"&&x){A&&(f.preventDefault(),i(A.id));return}if(f.key==="F2"){A&&(f.preventDefault(),s(A.id));return}if(f.key==="Delete"||f.key==="Backspace"&&x){w.length>0&&(f.preventDefault(),o(w));return}if(f.key==="d"&&x&&!f.shiftKey){w.length>0&&(f.preventDefault(),n(w));return}},[l,t,h,k,r,o,n,d,c,m,s,p,i]);return react.useEffect(()=>{if(l)return window.addEventListener("keydown",g),()=>{window.removeEventListener("keydown",g);}},[l,g]),{setIsEditing:y}}function Pl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(i=>{t(new Set([i])),r(i);},[]),n=react.useCallback(i=>{t(l=>{let u=new Set(l);return u.has(i)?u.delete(i):u.add(i),u}),r(i);},[]),d=react.useCallback((i,l)=>{if(!a){o(i);return}let u=l.indexOf(a),y=l.indexOf(i);if(u===-1||y===-1){o(i);return}let v=Math.min(u,y),h=Math.max(u,y),k=l.slice(v,h+1);t(new Set(k)),r(i);},[a,o]),c=react.useCallback((i,l,u,y)=>{y?d(i,l):u?n(i):o(i);},[o,n,d]),m=react.useCallback((i,l)=>{l?t(u=>{let y=new Set(u);return y.add(i),y}):o(i);},[o]),s=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(i=>e.has(i),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:m,clearSelection:s,isTaskSelected:p}}function hr(e){let t=[],a=(r,o,n=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:n,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,n+1);}};return a(e),t}function Ml(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ml(a.subtasks,t);if(r)return r}}return null}function Kn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Kn(a.subtasks,t);if(r)return r}return null}function Yn(e,t){if(t.length===0)return e;let a=hr(e),r=t[0],o=a.findIndex(i=>i.id===r);if(o<=0)return e;let n=a[o-1],d=(i,l)=>{let u=[];return {tasks:i.filter(v=>{if(l.has(v.id))return u.push(v),false;if(v.subtasks){let h=d(v.subtasks,l);v.subtasks=h.tasks,u.push(...h.removed);}return true}),removed:u}},c=(i,l,u)=>i.map(y=>y.id===l?{...y,subtasks:[...y.subtasks||[],...u],isExpanded:true}:y.subtasks?{...y,subtasks:c(y.subtasks,l,u)}:y),m=new Set(t),{tasks:s,removed:p}=d(e,m);return c(s,n.id,p)}function qn(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Kn(a,r);if(!o)continue;let n=Kn(a,o.id),d=(s,p,i)=>{for(let l=0;l<s.length;l++){let u=s[l];if(u.id===p&&u.subtasks){let y=u.subtasks.findIndex(v=>v.id===i);if(y!==-1){let[v]=u.subtasks.splice(y,1);return v}}if(u.subtasks){let y=d(u.subtasks,p,i);if(y)return y}}return null},c=(s,p,i)=>{let l=s.findIndex(u=>u.id===p);if(l!==-1)return s.splice(l+1,0,i),s;for(let u of s)u.subtasks&&c(u.subtasks,p,i);return s},m=d(a,o.id,r);m&&(n&&n.subtasks?c(n.subtasks,o.id,m):c(a,o.id,m));}return a}function Xn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(d,c,m)=>{let s=d.findIndex(i=>i.id===c);if(s===-1){for(let i of d)if(i.subtasks&&n(i.subtasks,c,m))return true;return false}let p=m==="up"?s-1:s+1;return p<0||p>=d.length?false:([d[s],d[p]]=[d[p],d[s]],true)};return n(r,o,a),r}function Jn(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function Zn(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(p=>p.id===r);if(c===-1){for(let p of d)if(p.subtasks&&o(p.subtasks))return true;return false}let m=d[c],s={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?n(m.subtasks):void 0};return d.splice(c+1,0,s),true},n=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?n(c.subtasks):void 0}));o(a);}return a}function Il(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},c=m=>{let s=m.findIndex(i=>i.id===t);if(s===-1){for(let i of m)if(i.subtasks&&c(i.subtasks))return true;return false}let p=a==="above"?s:s+1;return m.splice(p,0,d),true};return c(r),{tasks:r,newTask:d}}function Qn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Qn(r.subtasks,t,a)}:r)}function es(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:es(a.subtasks,t)}:a)}function ts(e,t){let a=p=>{for(let i of p){if(i.id===t)return i;if(i.subtasks){let l=a(i.subtasks);if(l)return l}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let d=r?.startDate||o,c=r?.endDate||n,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},s=p=>p.map(i=>{if(i.id===t){let l=i.subtasks||[];return {...i,subtasks:[...l,m],isExpanded:true}}return i.subtasks?{...i,subtasks:s(i.subtasks)}:i});return {tasks:s(e),newTask:m}}function Al(e,t,a,r){if(t===a)return e;let o=Ml(e,t);if(!o)return e;if(a){let c=(m,s)=>{if(!m.subtasks)return false;for(let p of m.subtasks)if(p.id===s||c(p,s))return true;return false};if(c(o,a))return e}let n=c=>c.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:n(m.subtasks)}:m),d=n(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=m=>m.map(s=>{if(s.id===a){let p=s.subtasks||[],i=r!==void 0?r:p.length,l=[...p];return l.splice(i,0,{...o,parentId:a}),{...s,subtasks:l,isExpanded:true}}return s.subtasks&&s.subtasks.length>0?{...s,subtasks:c(s.subtasks)}:s});d=c(d);}return d}function wo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:m,scrollTop:s,columns:p,onToggleColumn:i,onColumnResize:l,onTaskUpdate:u,onTaskIndent:y,onTaskOutdent:v,onTaskMove:h,onMultiTaskDelete:k,onTaskDuplicate:g,onTaskCreate:f,onTaskRename:T,onCreateSubtask:N,onOpenTaskModal:b,onDeleteRequest:x,onTaskReparent:w}){let A=react.useContext(fr),[C,B]=react.useState(null),[$,R]=react.useState(false),[E,H]=react.useState(null),[re,ie]=react.useState(""),Ae=react.useRef(null),Se=react.useRef(null),[ce,P]=react.useState(null),[M,I]=react.useState(0),[_,K]=react.useState(0),[j,le]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[oe,Le]=react.useState(null),[fe,Xe]=react.useState(null),[Ye,Mt]=react.useState(null),Jt=react.useRef(0),zt=5,It=react.useRef(false);react.useEffect(()=>{function F(U){Ae.current&&!Ae.current.contains(U.target)&&R(false);}if($)return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[$]),react.useEffect(()=>{E&&Se.current&&(Se.current.focus(),Se.current.select());},[E]),react.useEffect(()=>{if(!ce)return;let F=me=>{let ge=me.clientX-M,q=_+ge;l?.(ce,q);},U=()=>{P(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",F),document.addEventListener("mouseup",U),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",U),document.body.style.cursor="",document.body.style.userSelect="";}},[ce,M,_,l]);let{selectedTaskIds:At,handleTaskClick:St,isTaskSelected:fa}=Pl(),{setIsEditing:pt}=Sl({tasks:e,selectedTaskIds:At,onTaskSelect:(F,U)=>{let ge=hr(e).map(q=>q.id);St(F,ge,U||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:k||(()=>{}),onTaskDuplicate:g||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:v||(()=>{}),onTaskRename:F=>{let U=hr(e).find(me=>me.id===F);U&&xe(U);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:F=>{let U=hr(e).find(me=>me.id===F);U&&b&&b(U);},enableKeyboard:true}),ot=(F,U=0)=>{let me=[];for(let ge of F)me.push({task:ge,level:U}),ge.subtasks&&ge.subtasks.length>0&&ge.isExpanded&&me.push(...ot(ge.subtasks,U+1));return me},Lt=ot(e),Ca=48,de=F=>!F.startDate||!F.endDate?"-":`${Math.ceil((F.endDate.getTime()-F.startDate.getTime())/(1e3*60*60*24))}d`,xe=F=>{H(F.id),ie(F.name),pt(true);},_t=F=>{re.trim()&&re!==e.find(U=>U.id===F)?.name&&T?.(F,re.trim()),H(null),ie(""),pt(false);},ba=()=>{H(null),ie(""),pt(false);},xt=(F,U)=>{U.stopPropagation(),N?.(F.id);},ha=(F,U)=>{U.preventDefault(),Jt.current=U.clientY,Le(F),It.current=false;},va=F=>{if(!oe||(Math.abs(F.clientY-Jt.current)>zt&&(It.current=true),!It.current))return;let me=document.querySelectorAll("[data-task-row]"),ge=null,q=null;me.forEach(pe=>{let X=pe.getBoundingClientRect(),L=pe.getAttribute("data-task-row");if(L&&L!==oe&&F.clientY>=X.top&&F.clientY<=X.bottom){ge=L;let J=F.clientY-X.top,Ne=X.height;J<Ne*.25?q="above":J>Ne*.75?q="below":q="child";}}),Xe(ge),Mt(q);},Ce=()=>{if(It.current&&oe&&fe&&Ye){if(Ye==="child")w?.(oe,fe);else if(Ye==="above"||Ye==="below"){let F=(ge,q,pe=null)=>{for(let X of ge){if(X.id===q)return pe;if(X.subtasks){let L=F(X.subtasks,q,X.id);if(L!==void 0)return L}}},U=F(e,fe,null),me=(ge,q)=>{let pe=ge.findIndex(X=>X.id===q);return Ye==="below"?pe+1:pe};if(U===null){let ge=me(e,fe);w?.(oe,null,ge);}else {let ge=Lt.find(q=>q.task.id===U)?.task;if(ge?.subtasks){let q=me(ge.subtasks,fe);w?.(oe,U,q);}}}}Le(null),Xe(null),Mt(null),It.current=false;};react.useEffect(()=>{if(oe)return document.addEventListener("mousemove",va),document.addEventListener("mouseup",Ce),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",va),document.removeEventListener("mouseup",Ce),document.body.style.cursor="",document.body.style.userSelect="";}},[oe,fe,Ye]);let Te=(F,U,me)=>{switch(F.id){case "name":let ge=E===U.id,q=C===U.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${me*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:q?1:.3},onMouseDown:ue=>ha(U.id,ue),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),U.subtasks&&U.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ue=>{ue.stopPropagation(),m?.(U.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:U.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"}),!(U.subtasks&&U.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:U.color||"#3B82F6",opacity:U.parentId?.6:1,borderColor:U.isMilestone?t.accent:"transparent",borderWidth:U.isMilestone?"2px":"0px"},title:U.isMilestone?"Milestone":U.parentId?"Subtask":"Task"}),ge?jsxRuntime.jsx("input",{ref:Se,type:"text",value:re,onChange:ue=>ie(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"?_t(U.id):ue.key==="Escape"&&ba();},onBlur:()=>_t(U.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:ue=>ue.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:U.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:U.parentId?"13px":"14px",fontWeight:U.isMilestone?600:U.parentId?400:600,letterSpacing:U.parentId?"0":"-0.01em"},title:U.name,children:U.name}),q&&!ge&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ue=>ue.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ue=>xt(U,ue),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:ue=>{ue.stopPropagation(),xe(U);},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":let pe=U.startDate?typeof U.startDate=="string"?U.startDate:U.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:pe||"",onChange:ue=>{u?.(U.id,{startDate:ue.target.value?new Date(ue.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let X=U.endDate?typeof U.endDate=="string"?U.endDate:U.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:X||"",onChange:ue=>{u?.(U.id,{endDate:ue.target.value?new Date(ue.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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:de(U)})});case "assignees":let L=r.filter(ue=>U.assignees?.some(Wa=>Wa.name===ue.name||Wa.initials===ue.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(Va,{assignedUsers:L,availableUsers:r,onChange:ue=>{let Wa=ue.map(rr=>({id:rr.id,name:rr.name,initials:rr.initials,color:rr.color}));u?.(U.id,{assignees:Wa.length>0?Wa:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(Ai,{status:U.status||"todo",onChange:ue=>{u?.(U.id,{status:ue,progress:ue==="completed"?100:U.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:`${U.progress}%`,backgroundColor:U.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:[U.progress,"%"]})]});case "priority":let J={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ne={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},qe=J[U.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(Ha,{priority:qe,onChange:ue=>{ue&&u?.(U.id,{priority:Ne[ue]||"medium"});}})});default:return null}},ut=F=>[{id:"hide",label:"Hide Column",icon:et.Hide,onClick:()=>i(F),disabled:F==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:et.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:et.SortDesc,onClick:()=>{}}],te=F=>F.subtasks&&F.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:et.Add,onClick:()=>{N?.(F.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:et.Delete,onClick:()=>{x?x(F.id,F.name):k?.([F.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:et.Pencil,onClick:()=>{d?.(F);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:et.Add,onClick:()=>{N?.(F.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:et.MarkIncomplete,onClick:()=>{u?.(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:et.SetInProgress,onClick:()=>{u?.(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:et.MarkComplete,onClick:()=>{u?.(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:et.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:et.Delete,onClick:()=>{x?x(F.id,F.name):k?.([F.id]);}}],ke=p.filter(F=>F.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:`${Ca}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[ke.map((F,U)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${F.id==="name"?"justify-between":"justify-center"}`,style:{...F.id==="name"?{flex:"1 1 auto",minWidth:`${F.minWidth??150}px`}:{width:`${F.width}px`,minWidth:`${F.minWidth??60}px`,maxWidth:`${F.maxWidth??2e3}px`,flexShrink:0},borderRight:U<ke.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:me=>{me.preventDefault(),le({isOpen:true,x:me.clientX,y:me.clientY,type:"header",columnId:F.id});},onMouseEnter:me=>{me.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:me=>{me.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",flex:F.id==="name"?"1 1 auto":"none",minWidth:0},title:F.label,children:F.label}),F.id==="name"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[jsxRuntime.jsx(yo,{columns:p,onToggleColumn:i,theme:t}),jsxRuntime.jsx("button",{onClick:()=>R(!$),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"})})]}),F.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ce===F.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:me=>{me.preventDefault(),me.stopPropagation(),P(F.id),I(me.clientX),K(F.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"}})})]},F.id)),$&&jsxRuntime.jsxs("div",{ref:Ae,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:F=>F.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:()=>R(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:Lt.map(({task:F,level:U},me)=>{let ge=fa(F.id),q=fe===F.id,pe={};return q&&Ye&&(Ye==="above"?(pe.borderTopWidth="2px",pe.borderTopStyle="solid",pe.borderTopColor=t.accent):Ye==="below"?(pe.borderBottomWidth="2px",pe.borderBottomStyle="solid",pe.borderBottomColor=t.accent):Ye==="child"&&(pe.backgroundColor=t.accentLight,pe.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":F.id,className:`flex items-center cursor-pointer group ${oe===F.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:ge?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ge||q&&Ye==="child"?t.accentLight:me%2===0?t.bgPrimary:t.bgGrid,...pe},onMouseEnter:()=>B(F.id),onMouseLeave:()=>B(null),onClick:X=>{let J=hr(e).map(ue=>ue.id),qe=navigator.platform.toUpperCase().indexOf("MAC")>=0?X.metaKey:X.ctrlKey;St(F.id,J,qe,X.shiftKey),n?.(F);},onDoubleClick:X=>{X.stopPropagation(),d?.(F);},onContextMenu:X=>{X.preventDefault(),le({isOpen:true,x:X.clientX,y:X.clientY,type:"task",task:F}),c?.(F,X);},whileHover:{backgroundColor:ge?t.accentLight:t.hoverBg},children:ke.map((X,L)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${X.id==="name"?"justify-start":"justify-center"} ${L<ke.length-1?"border-r":""}`,style:{...X.id==="name"?{flex:"1 1 auto",minWidth:`${X.minWidth??150}px`}:{width:`${X.width}px`,minWidth:`${X.minWidth??60}px`,maxWidth:`${X.maxWidth??2e3}px`,flexShrink:0},borderColor:C===F.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Te(X,F,X.id==="name"?U:0)},`${F.id}-${X.id}`))},F.id)})}),jsxRuntime.jsx(br,{isOpen:j.isOpen,x:j.x,y:j.y,items:j.type==="header"&&j.columnId?ut(j.columnId):j.type==="task"&&j.task?te(j.task):[],onClose:()=>le({...j,isOpen:false}),theme:t})]})}function Ll(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[d,c]=react.useState(e),[m,s]=react.useState(t),[p,i]=react.useState(null),[l,u]=react.useState(null),[y,v]=react.useState(null),[h,k]=react.useState(null),[g,f]=react.useState(0),[T,N]=react.useState(0),[b,x]=react.useState(null),[w,A]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:d,setGhostX:c,ghostWidth:m,setGhostWidth:s,connectionLine:p,setConnectionLine:i,hoveredTaskId:l,setHoveredTaskId:u,activeZone:y,setActiveZone:v,draggedSegmentIndex:h,setDraggedSegmentIndex:k,draggedSegmentStartX:g,setDraggedSegmentStartX:f,segmentDragOffsetX:T,setSegmentDragOffsetX:N,hoveredSegmentIndex:b,setHoveredSegmentIndex:x,isHovered:w,setIsHovered:A,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(E,H)=>{r("none"),i(null),u(null),c(E),s(H),N(0),k(null),f(0);}}}function Co({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:d,templates:c,onClick:m,onDoubleClick:s,onContextMenu:p,onDateChange:i,onDependencyCreate:l,allTaskPositions:u=[],onDragMove:y,onHoverChange:v}){let h=Ll(t,r),k=react.useRef(null),{dragMode:g,setDragMode:f,dragOffset:T,setDragOffset:N,ghostX:b,setGhostX:x,ghostWidth:w,setGhostWidth:A,connectionLine:C,setConnectionLine:B,hoveredTaskId:$,setHoveredTaskId:R,activeZone:E,setActiveZone:H,draggedSegmentIndex:re,setDraggedSegmentIndex:ie,draggedSegmentStartX:Ae,setDraggedSegmentStartX:Se,segmentDragOffsetX:ce,setSegmentDragOffsetX:P,hoveredSegmentIndex:M,setHoveredSegmentIndex:I,isHovered:_,setIsHovered:K,isDragging:j,isResizing:le,isConnecting:oe,resetDragState:Le}=h,fe=32,Xe=8,Ye=e.endDate&&e.endDate<new Date&&e.progress<100,Mt=e.isCriticalPath,Jt=o.name==="neutral"||o.today==="#1C1917",zt=e.status==="completed"||e.progress===100,It={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},St=e.isCriticalPath||Ye?"#DC2626":e.color?e.color:e.priority&&It[e.priority]?It[e.priority]:o.taskBarPrimary,pt=(te=>te>=80?20:te>=60?15:te>=50?12:10)(r),ot=r<50,Lt=r<40;react.useEffect(()=>{if(v)if(_&&!j&&!e.segments){let te=a<100;v({task:e,x:t,y:a,width:r,height:fe,showBelow:te});}else v(null);},[_,j,e,t,a,r,fe,v]);let Ca=te=>te.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),de=()=>{let te=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${te} day${te!==1?"s":""}`},xe=te=>Math.round(te/n)*n,_t=te=>{let ke=Math.round(te/n),F=new Date(d);return F.setDate(F.getDate()+ke),F},ba=(te,ke)=>{for(let F of u){if(F.id===e.id)continue;let U=5;if(te>=F.x-U&&te<=F.x+F.width+U&&ke>=F.y-U&&ke<=F.y+F.height+U)return F.id}return null},xt=react.useCallback((te,ke,F)=>{te.preventDefault(),te.stopPropagation();let U=k.current?.ownerSVGElement;if(!U)return;let me=U.createSVGPoint();me.x=te.clientX,me.y=te.clientY;let ge=me.matrixTransform(U.getScreenCTM()?.inverse()),q=F!==void 0?F:t,pe=ke;if(!pe){let X=ge.x-q;te.shiftKey?(pe="connect",B({x:t+r,y:a+fe/2})):te.ctrlKey||te.metaKey?pe="move":te.altKey?pe=X<r/2?"resize-start":"resize-end":Lt?X<r/2?pe="move":pe="resize-end":ot?X<=pt/2?pe="resize-start":X>=r-pt/2?pe="resize-end":pe="move":X<=pt?pe="resize-start":X>=r-pt?pe="resize-end":pe="move";}f(pe),K(false),H(null),pe==="move"?N(ge.x-q):pe==="connect"?B({x:t+r,y:a+fe/2}):N(0),x(q),A(r);},[t,r,a,fe]),ha=react.useCallback(te=>{if(g==="none")return;let ke=k.current?.ownerSVGElement;if(!ke)return;let F=ke.createSVGPoint();F.x=te.clientX,F.y=te.clientY;let U=F.matrixTransform(ke.getScreenCTM()?.inverse());if(g==="connect"){B({x:U.x,y:U.y});let me=ba(U.x,U.y);R(me);}else if(g==="move"){let me=U.x-T,ge=xe(me);x(ge),A(r);let q=Math.round((ge-t)/n);if(y?.(e.id,q,true),e.segments&&e.segments.length>0&&re!==null){let pe=ge-Ae;P(pe);}}else if(g==="resize-start"){let me=U.x,ge=xe(me),q=t+r-ge;q>=n&&(x(ge),A(q));}else if(g==="resize-end"){let me=U.x,q=xe(me)-t;q>=n&&A(q);}},[g,t,r,n,T,e,xe,re,Ae,ba,R,B,x,A,P,y]),va=react.useCallback(()=>{if(g!=="none"){if(g==="connect")$&&l&&l(e,$),B(null),R(null);else {let te=e.endDate.getTime()-e.startDate.getTime(),ke,F,U=true;if(g==="move"){if(ke=_t(b),F=new Date(ke.getTime()+te),e.segments&&e.segments.length>0&&re!==null){let me=Math.round(ce/n),ge=e.segments.map((L,J)=>{if(J===re){let Ne=new Date(L.startDate),qe=new Date(L.endDate);return Ne.setDate(Ne.getDate()+me),qe.setDate(qe.getDate()+me),{startDate:Ne,endDate:qe}}return L}),q=ge.flatMap(L=>[L.startDate,L.endDate]),pe=new Date(Math.min(...q.map(L=>L.getTime()))),X=new Date(Math.max(...q.map(L=>L.getTime())));i?.({...e,segments:ge},pe,X),Le(t,r);return}}else g==="resize-start"?(ke=_t(b),F=e.endDate,ke>=F&&(console.warn("Invalid date range: start date must be before end date"),U=false)):g==="resize-end"?(ke=e.startDate,F=_t(b+w),F<=ke&&(console.warn("Invalid date range: end date must be after start date"),U=false)):U=false;U&&ke&&F&&(F.getTime()-ke.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):i?.(e,ke,F));}y?.(e.id,0,false),Le(t,r);}},[g,b,w,e,i,$,l,t,r,n,_t,ce,re,Le,y]);react.useEffect(()=>{if(g==="none")return;let te=F=>{ha(F);},ke=()=>{va();};return window.addEventListener("mousemove",te),window.addEventListener("mouseup",ke),()=>{window.removeEventListener("mousemove",te),window.removeEventListener("mouseup",ke);}},[g,ha,va]);let Ce=j&&!oe?b:t,Te=j&&!oe?w:r,ut=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,onMouseEnter:()=>!j&&K(true),onMouseLeave:()=>{j||(K(false),H(null));},onClick:()=>!j&&m?.(e),onDoubleClick:te=>{j||(te.stopPropagation(),s?.(e));},onContextMenu:te=>{te.preventDefault(),p?.(e,te);},children:[_&&!j&&!ot&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:pt,height:fe,fill:E==="resize-start"?o.accent:"transparent",opacity:E==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>H("resize-start"),onMouseDown:te=>xt(te,"resize-start")}),jsxRuntime.jsx("rect",{x:t+pt,y:a,width:r-pt*2,height:fe,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>H("move"),onMouseDown:te=>xt(te,"move")}),jsxRuntime.jsx("rect",{x:t+r-pt,y:a,width:pt,height:fe,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>H("resize-end"),onMouseDown:te=>xt(te,"resize-end")})]}),_&&!j&&Lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:fe,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>H("move"),onMouseDown:te=>xt(te,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:fe,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>H("resize-end"),onMouseDown:te=>xt(te,"resize-end")}),_&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+fe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),j&&!oe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:b,y:a,width:w,height:fe,rx:Xe,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce,y:a,width:Te,height:fe,rx:Xe,fill:St,"data-task-class":ut,initial:{opacity:0,scale:.95},animate:{opacity:j&&!oe?.15:e.parentId?.6:_?.9:.8,scale:_&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:te=>xt(te),style:{cursor:j?oe?"crosshair":le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Te*(e.progress/100),height:fe,rx:Xe,fill:St,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((te,ke)=>{let F=(te.startDate.getTime()-d.getTime())/864e5*n,me=(te.endDate.getTime()-d.getTime())/(1e3*60*60*24)*n-F+n,ge=j&&g==="move"&&re===ke,q=M===ke,pe=ge?F+ce:F;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!j&&I(ke),onMouseLeave:()=>!j&&I(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:pe,y:a,width:me,height:fe,rx:Xe,fill:St,initial:{opacity:0,scale:.95},animate:{opacity:ge||e.parentId?.6:q?.9:.8,scale:q&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:X=>{X.stopPropagation(),ie(ke),Se(F),xt(X,void 0,F);},style:{cursor:j?oe?"crosshair":le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:pe,y:a,width:me*(e.progress/100),height:fe,rx:Xe,fill:St,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ke}`)}),Jt&&(Ye||Mt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Mt&&!Ye&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Te,height:fe,rx:Xe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ye&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Te,height:fe,rx:Xe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Te>60&&!e.segments&&(()=>{let te=c.taskLabel(e),ke=typeof te=="string"?te:e.name,F=ke.length>Math.floor(Te/8)?`${ke.substring(0,Math.floor(Te/8))}...`:ke;return jsxRuntime.jsx("text",{x:Ce+12,y:a+fe/2,dominantBaseline:"middle",fill:zt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:zt?"line-through":"none"},children:F})})(),Te>100&&e.progress>0&&e.progress<100&&!j&&!e.segments&&jsxRuntime.jsxs("text",{x:Ce+Te-12,y:a+fe/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&Te>80&&!j&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ce+Te-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ce+Te-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(_||le)&&!oe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ot?Ce-15:Ce-10,y:a-5,width:ot?25:20,height:fe+10,fill:"transparent",onMouseDown:te=>xt(te,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ot?Ce-8:Ce-3,y:a+6,width:ot?8:6,height:ot?fe-12:fe-16,rx:3,fill:g==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="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:Ce+Te-10,y:a-5,width:ot?25:20,height:fe+10,fill:"transparent",onMouseDown:te=>xt(te,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ot?Ce+Te:Ce+Te-3,y:a+6,width:ot?8:6,height:ot?fe-12:fe-16,rx:3,fill:g==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&!j&&!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+fe/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:te=>{te.stopPropagation(),xt(te,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+fe/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),oe&&C&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+fe/2,x2:C.x,y2:C.y,stroke:$?o.statusCompleted:o.accent,strokeWidth:$?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:$?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:C.x,cy:C.y,r:$?8:6,fill:$?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),$&&jsxRuntime.jsx(framerMotion.motion.text,{x:C.x+15,y:C.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:C.x+10},animate:{opacity:1,x:C.x+15},transition:{duration:.2},children:"Connect"})]}),(_||j)&&!oe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce-2,y:a-2,width:Te+4,height:fe+4,rx:Xe+2,fill:"none",stroke:j?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:j?.6:.4,initial:{opacity:0},animate:{opacity:j?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:b,y1:0,x2:b,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:b+w,y1:0,x2:b+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&!j&&!e.segments&&!v&&(()=>{let F=a<100,U=F?a+fe+13:a-82-13,me=F?`M ${Ce+Te/2-6} ${a+fe+3} L ${Ce+Te/2} ${a+fe+13} L ${Ce+Te/2+6} ${a+fe+3}`:`M ${Ce+Te/2-6} ${a-13} L ${Ce+Te/2} ${a-3} L ${Ce+Te/2+6} ${a-13}`,ge=U+22,q=U+40,pe=U+55,X=U+70,L=F?U+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:F?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:F?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:me,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ce+Te/2-120,y:U,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:Ce+Te/2,y:ge,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:Ce+Te/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ce+Te/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ca(e.startDate)}),jsxRuntime.jsx("text",{x:Ce+Te/2-110,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ce+Te/2-70,y:pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ca(e.endDate)}),jsxRuntime.jsx("text",{x:Ce+Te/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ce+Te/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:de()}),jsxRuntime.jsx("text",{x:Ce+Te/2+10,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ce+Te/2+65,y:pe,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:Ce+Te/2-110,y:X,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ce+Te/2-50,y:X,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(J=>J.name).join(", ").substring(0,30),e.assignees.map(J=>J.name).join(", ").length>30?"...":""]})]}),!F&&jsxRuntime.jsx("text",{x:Ce+Te/2,y:L,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Lt?"Left: move \u2022 Right: resize":ot?"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 Rl({tooltipData:e,theme:t}){if(!e)return null;let{task:a,x:r,y:o,width:n,height:d,showBelow:c}=e,m=82,s=13,p=c?o+d+s:o-m-s,i=c?`M ${r+n/2-6} ${o+d+3} L ${r+n/2} ${o+d+13} L ${r+n/2+6} ${o+d+3}`:`M ${r+n/2-6} ${o-13} L ${r+n/2} ${o-3} L ${r+n/2+6} ${o-13}`,l=p+22,u=p+40,y=p+55,v=p+70,h=c?p+m-5:o-18,k=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),g=()=>{if(!a.startDate||!a.endDate)return "N/A";let N=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${N} day${N!==1?"s":""}`},f=n<50,T=n<40;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:i,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+n/2-120,y:p,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+n/2,y:l,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+n/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?k(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?k(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+n/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:g()}),jsxRuntime.jsx("text",{x:r+n/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+n/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+n/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+n/2-50,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(N=>N.name).join(", ").substring(0,30),a.assignees.map(N=>N.name).join(", ").length>30?"...":""]})]}),!c&&jsxRuntime.jsx("text",{x:r+n/2,y:h,textAnchor:"middle",fill:t.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:T?"Left: move \u2022 Right: resize":f?"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 Do({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n,onHoverChange:d}){let[c,m]=react.useState(false),s=a-e,p=r-t,i=e+s/2,l=`M ${e} ${t} C ${i} ${t}, ${i} ${r}, ${a} ${r}`,u=6,y=Math.atan2(p,s),v=a-u*Math.cos(y-Math.PI/6),h=r-u*Math.sin(y-Math.PI/6),k=a-u*Math.cos(y+Math.PI/6),g=r-u*Math.sin(y+Math.PI/6),f=o.dependency;return react.useEffect(()=>{d&&n&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:n}:null);},[c,e,t,a,r,n,d]),jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?1:.6,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.15},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${v} ${h} M ${a} ${r} L ${k} ${g}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?1:.6,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:c&&d?0:c?1.33:1},transition:{scale:{delay:.3,duration:.15}}}),c&&n&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:i,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:i-4,y1:(t+r)/2-4,x2:i+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:i+4,y1:(t+r)/2-4,x2:i-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Eo({task:e,x:t,y:a,theme:r,onClick:o}){let[n,d]=react.useState(false),c=16,m=s=>s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(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:n?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:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&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:n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Y={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=s=>{s.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let d=new Set,c=new Set,m=s=>{if(!d.has(s)){d.add(s),c.add(s);let p=r.get(s)||[];for(let i of p){if(!d.has(i)&&m(i))return true;if(c.has(i))return true}}return c.delete(s),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Y.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Y.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=Y.findTaskById(e,o);if(n)a.unshift(n),o=n.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=Y.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[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(n.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=Y.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=Y.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)=>Y.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Y.findTaskById(e,t);return !a||!a.dependencies?[]:Y.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Y.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Y.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=Y.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 n=t[o];if(!a||n===void 0||n>=a.length||(r=a[n],!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=>Y.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,n=Y.flattenTasks(e);if(n.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let d=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=n.map(m=>{let s=m.startDate&&m.endDate?Y.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?Y.formatDate(m.startDate):"N/A",m.endDate?Y.formatDate(m.endDate):"N/A",s>0?`${s} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:d,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=Y.flattenTasks(e).map(m=>{let s=m.startDate&&m.endDate?Y.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?Y.formatDate(m.startDate):"","End Date":m.endDate?Y.formatDate(m.endDate):"","Duration (days)":s>0?s:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(p=>p.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),n=a.utils.json_to_sheet(o),d=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];n["!cols"]=d;let c=a.utils.book_new();a.utils.book_append_sheet(c,n,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Y.flattenTasks(e),o=new Map;r.forEach((l,u)=>{o.set(l.id,u+1);});let n=l=>l.toISOString().replace("Z",""),d=Y.getEarliestStartDate(e)||new Date,c=Y.getLatestEndDate(e)||new Date,m=r.map((l,u)=>{let y=o.get(l.id),v=l.startDate&&l.endDate?Y.calculateDuration(l.startDate,l.endDate):0,h=(l.dependencies||[]).filter(k=>o.has(k)).map(k=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
48
|
<PredecessorUID>${o.get(k)}</PredecessorUID>
|
|
@@ -273,9 +273,9 @@
|
|
|
273
273
|
</Calendars>
|
|
274
274
|
<Tasks>${m}
|
|
275
275
|
</Tasks>
|
|
276
|
-
</Project>`,p=new Blob([s],{type:"application/xml;charset=utf-8;"}),i=document.createElement("a");i.href=URL.createObjectURL(p),i.download=a,i.click(),URL.revokeObjectURL(i.href);},calculateCriticalPath:e=>{let t=Y.flattenTasks(e),a=t.filter(s=>s.startDate&&s.endDate);if(a.length===0)return [];let r=new Map,o=s=>{if(r.has(s.id))return;let p=s.startDate&&s.endDate?Y.calculateDuration(s.startDate,s.endDate):0,i=0;if(s.dependencies&&s.dependencies.length>0)for(let u of s.dependencies){let y=t.find(v=>v.id===u);if(y){o(y);let v=r.get(u)?.ef||0;i=Math.max(i,v);}}let l=i+p;r.set(s.id,{es:i,ef:l});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(s=>s.ef)),d=new Map,c=s=>{if(d.has(s.id))return;let p=s.startDate&&s.endDate?Y.calculateDuration(s.startDate,s.endDate):0,i=t.filter(y=>y.dependencies&&y.dependencies.includes(s.id)),l=n;if(i.length>0)for(let y of i){c(y);let v=d.get(y.id)?.ls||0;l=Math.min(l,v);}let u=l-p;d.set(s.id,{ls:u,lf:l});};a.forEach(c);let m=[];for(let s of a){let p=r.get(s.id),i=d.get(s.id);if(p&&i){let l=i.ls-p.es;Math.abs(l)<.01&&m.push(s.id);}}return m},calculateSlack:(e,t)=>{let a=Y.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Y.calculateCriticalPath(e).includes(t))return 0;let o=Y.getDependentTasks(e,t);if(o.length===0){let c=Y.getLatestEndDate(e);if(!c)return null;let m=Y.calculateDuration(a.endDate,c);return Math.max(0,m)}let n=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,m)=>c-m)[0];if(!n)return null;let d=Y.calculateDuration(a.endDate,new Date(n));return Math.max(0,d)},isOnCriticalPath:(e,t)=>Y.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Y.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Y.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let c=Y.calculateDuration(d.startDate,d.endDate),m;a!==void 0?(m=new Date(d.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let s=Y.calculateEndDate(m,c),p=i=>i.map(l=>l.id===d.id?{...l,startDate:m,endDate:s}:l.subtasks?{...l,subtasks:p(l.subtasks)}:l);n=p(n),n=Y.autoScheduleDependents(n,d.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,d,c)=>{if(a===0)return [];let m=[],s=o.getTime(),p=1e3*60*60*24,i=Y.findTaskById(e,t);if(!i||!i.endDate)return [];let l=(u,y,v=new Set)=>{if(v.has(u))return;v.add(u);let h=Y.getDependentTasks(e,u);for(let k of h){if(!k.startDate||!k.endDate)continue;let g=r.findIndex(B=>B.id===k.id);if(g===-1)continue;let f=k.startDate.getTime(),N=(k.endDate.getTime()-f)/p,x=(f-s)/p*n,w=x+y*n,A=Math.max(N*n,n),C=c+g*d+12;m.push({taskId:k.id,taskName:k.name,originalX:x,previewX:w,width:A,y:C,rowIndex:g,daysDelta:y,color:k.color}),l(k.id,y,v);}};return l(t,a),m},splitTask:(e,t,a,r=3)=>{let o=Y.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 n=new Date(a);n.setDate(n.getDate()-1);let d=new Date(a);d.setDate(d.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:n},{startDate:d,endDate:c}],s=p=>p.map(i=>i.id===o.id?{...i,endDate:c,segments:m}:i.subtasks?{...i,subtasks:s(i.subtasks)}:i);return s(e)}};function Mo({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:d,templates:c,onTaskClick:m,onTaskDblClick:s,onTaskContextMenu:p,onTaskDateChange:i,onDependencyCreate:l,onDependencyDelete:u}){let[v,h]=react.useState([]),[k,g]=react.useState(null),[f,T]=react.useState(null),N=react.useCallback(P=>{g(P);},[]),b=react.useCallback(P=>{T(P);},[]),x=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,A=x*w*d,C=P=>{let M=new Date(Date.UTC(P.getFullYear(),P.getMonth(),P.getDate())),I=M.getUTCDay()||7;M.setUTCDate(M.getUTCDate()+4-I);let _=new Date(Date.UTC(M.getUTCFullYear(),0,1));return Math.ceil(((M.getTime()-_.getTime())/864e5+1)/7)},B=P=>{let M=P.getDay();return M===0||M===6},$=react.useCallback(P=>{let M=Math.round(P/(w*d)),I=new Date(o);return I.setDate(I.getDate()+M),I},[o,w,d]),R=react.useCallback((P,M)=>{if(M.startDate&&M.endDate)return;let I=P.currentTarget.ownerSVGElement;if(!I)return;let _=I.createSVGPoint();_.x=P.clientX,_.y=P.clientY;let K=_.matrixTransform(I.getScreenCTM()?.inverse()),j=$(K.x),le=new Date(j);le.setDate(le.getDate()+1),i?.(M,j,le);},[$,i]),E=react.useMemo(()=>{let P=K=>K.map(j=>{if(j.subtasks&&j.subtasks.length>0){let le=P(j.subtasks),ne=le.filter(Le=>Le.startDate&&Le.endDate);if(ne.length>0){let Le=ne.map(Mt=>Mt.startDate.getTime()),be=ne.map(Mt=>Mt.endDate.getTime()),Xe=new Date(Math.min(...Le)),Ye=new Date(Math.max(...be));return {...j,subtasks:le,startDate:Xe,endDate:Ye}}return {...j,subtasks:le}}return j}),M=(K,j=[])=>{for(let le of K)j.push(le),le.subtasks&&le.subtasks.length>0&&(le.isExpanded===void 0||le.isExpanded)&&M(le.subtasks,j);return j},I=P(e);return M(I)},[e]),H=react.useCallback(P=>{if(!P.startDate||!P.endDate)return {x:0,width:0};let M=P.startDate.getTime(),I=P.endDate.getTime(),_=o.getTime(),K=(M-_)/(1e3*60*60*24),j=(I-M)/(1e3*60*60*24),le=K*w*d,ne=Math.max(w*d,40),Le=Math.max(j*w*d,ne);return {x:le,width:Le}},[o,w,d]),re=react.useMemo(()=>E.filter(P=>P.startDate&&P.endDate).map(P=>{let{x:M,width:I}=H(P),K=E.findIndex(j=>j.id===P.id)*a+12;return {id:P.id,x:M,y:K,width:I,height:32}}),[E,H]),oe=react.useCallback((P,M,I)=>{if(!I||M===0){h([]);return}let _=Y.calculateCascadePreview(e,P,M,E,o,w*d,a,48);h(_);},[e,E,o,w,d,a,48]),Ae=react.useMemo(()=>{let P=[],M=new Date(o);for(;M<=n;){let K=(M.getTime()-o.getTime())/864e5*w*d;if(r==="day")P.push({date:new Date(M),label:M.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:K}),M.setDate(M.getDate()+1);else if(r==="week"){let j=C(M);P.push({date:new Date(M),label:`Week ${j}`,x:K}),M.setDate(M.getDate()+7);}else P.push({date:new Date(M),label:M.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:K}),M.setMonth(M.getMonth()+1);}return P},[o,n,r,w,d]),Se=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*d,[o,w,d]),ce=Math.max(E.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(A,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(A,1e3),height:48,fill:t.bgGrid}),Ae.map((P,M)=>jsxRuntime.jsxs("g",{children:[M>0&&jsxRuntime.jsx("line",{x1:P.x,y1:0,x2:P.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:P.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:P.label})]},`header-${M}`)),Se>=0&&Se<=A&&jsxRuntime.jsx("circle",{cx:Se,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(A,1e3),height:ce,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(A,1e3),height:ce,fill:t.bgPrimary}),Ae.map((P,M)=>{let I=Ae[M+1]?.x||A,_=B(P.date);return jsxRuntime.jsxs("g",{children:[_&&jsxRuntime.jsx("rect",{x:P.x,y:0,width:I-P.x,height:E.length*a,fill:t.bgWeekend,opacity:1}),M>0&&jsxRuntime.jsx("line",{x1:P.x,y1:0,x2:P.x,y2:E.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},M)}),Se>=0&&Se<=A&&jsxRuntime.jsx("line",{x1:Se,y1:0,x2:Se,y2:E.length*a,stroke:t.today,strokeWidth:2,opacity:1}),E.map((P,M)=>{let I=P.startDate&&P.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:M*a,width:A,height:a,fill:M%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${P.id}`),!I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:M*a,width:A,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:_=>R(_,P),onMouseEnter:_=>{_.currentTarget.setAttribute("fill",t.accentLight),_.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:_=>{_.currentTarget.setAttribute("fill","transparent"),_.currentTarget.setAttribute("opacity","1");}},`clickable-${P.id}`),jsxRuntime.jsx("text",{x:Se>0?Se:100,y:M*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-${P.id}`)]})]},`row-group-${P.id}`)}),E.map((P,M)=>!P.dependencies||P.dependencies.length===0||!P.startDate||!P.endDate?null:P.dependencies.map(I=>{let _=E.find(ne=>ne.id===I);if(!_||!_.startDate||!_.endDate)return null;let K=E.findIndex(ne=>ne.id===I),j=H(_),le=H(P);return jsxRuntime.jsx(Do,{x1:j.x+j.width,y1:K*a+a/2,x2:le.x,y2:M*a+a/2,theme:t,onDelete:()=>u?.(P.id,I),onHoverChange:b},`dep-${I}-${P.id}`)})),E.map((P,M)=>{if(!P.startDate||!P.endDate)return null;let{x:I,width:_}=H(P),K=M*a+12,j=P.subtasks&&P.subtasks.length>0&&!P.isMilestone;return P.isMilestone?jsxRuntime.jsx(Eo,{task:P,x:I+_/2,y:K+16,theme:t,onClick:m},P.id):j?jsxRuntime.jsxs("g",{onClick:()=>m?.(P),onContextMenu:le=>{le.preventDefault(),le.stopPropagation(),p?.(P,le);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:I,y:K,width:_,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:I,y1:K,x2:I+_,y2:K,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:I,y1:K,x2:I,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:I+_,y1:K,x2:I+_,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:I,y1:K+32,x2:I+_,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),_>60&&jsxRuntime.jsx("text",{x:I+12,y:K+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:P.name})]},P.id):jsxRuntime.jsx(Co,{task:P,x:I,y:K,width:_,theme:t,dayWidth:w*d,startDate:o,templates:c,onClick:m,onDoubleClick:s,onContextMenu:p,onDateChange:i,onDependencyCreate:l,allTaskPositions:re,onDragMove:oe,onHoverChange:N},P.id)}),v.map(P=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:P.previewX,y:P.y-48,width:P.width,height:32,rx:8,fill:P.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(P.daysDelta)>0&&jsxRuntime.jsx("text",{x:P.previewX+P.width/2,y:P.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:P.daysDelta>0?`+${P.daysDelta}d`:`${P.daysDelta}d`})]},`cascade-preview-${P.taskId}`)),f&&(()=>{let{x1:P,y1:M,x2:I,y2:_,onDelete:K}=f,j=I-P,le=_-M,ne=P+j/2,Le=(M+_)/2,be=`M ${P} ${M} C ${ne} ${M}, ${ne} ${_}, ${I} ${_}`,Xe=6,Ye=Math.atan2(le,j),Mt=I-Xe*Math.cos(Ye-Math.PI/6),Jt=_-Xe*Math.sin(Ye-Math.PI/6),zt=I-Xe*Math.cos(Ye+Math.PI/6),It=_-Xe*Math.sin(Ye+Math.PI/6),At=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:be,fill:"none",stroke:At,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${I} ${_} L ${Mt} ${Jt} M ${I} ${_} L ${zt} ${It}`,fill:"none",stroke:At,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:I,cy:_,r:5,fill:At}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:St=>{St.stopPropagation(),K();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:ne,cy:Le,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:ne-4,y1:Le-4,x2:ne+4,y2:Le+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:ne+4,y1:Le-4,x2:ne-4,y2:Le+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),k&&jsxRuntime.jsx(Rl,{tooltipData:k,theme:t})]})]})}var zl=[{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:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function Ul({value:e="#6366F1",onChange:t,disabled:a=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:zl.map(r=>{let o=e===r.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!a&&t(r.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:r.value,boxShadow:o?`0 0 0 2px #FFFFFF, 0 0 0 4px ${r.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},whileHover:a?{}:{scale:1.1},whileTap:a?{}:{scale:.95},title:r.name,disabled:a,children:o&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},r.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:zl.find(r=>r.value===e)?.name||"Personalizado"})]})}var _l=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}];function Io({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:d=false,mode:c=a?"edit":"create",theme:m="dark",customStatuses:s=[]}){let p=[..._l,...s.filter(x=>!_l.some(w=>w.id===x.id))],i=Ie[m]||Ie.dark,[l,u]=react.useState(false),y={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},v={color:i.textSecondary},[h,k]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[g,f]=react.useState({});react.useEffect(()=>{a?(k({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||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&u(true)):(k({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),u(false));},[a,e]);let T=()=>{let x={};return h.name.trim()||(x.name="El nombre es requerido"),h.startDate&&h.endDate&&h.startDate>h.endDate&&(x.endDate="La fecha de fin debe ser posterior a la de inicio"),f(x),Object.keys(x).length===0},N=async x=>{if(x.preventDefault(),!!T())try{await n(h),t();}catch(w){console.error("Error submitting task:",w);}},b=(x,w)=>{k(A=>{let C={...A,[x]:w};if(x==="progress"){let B=typeof w=="number"?w:parseInt(w,10);B===100&&A.status!=="completed"?C.status="completed":B>0&&B<100&&A.status==="todo"?C.status="in-progress":B===0&&A.status!=="todo"&&(C.status="todo");}return C}),g[x]&&f(A=>{let C={...A};return delete C[x],C});};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/50 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:.2,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-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:c==="create"?"Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:x=>x.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor="transparent",disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:N,className:"p-6 space-y-5 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1.5",style:v,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:h.name,onChange:x=>b("name",x.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:y,onFocus:x=>x.currentTarget.style.borderColor=i.accent,onBlur:x=>x.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:d,autoFocus:true}),g.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),g.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium flex items-center gap-2",style:v,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fechas"]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:i.textTertiary},children:"Inicio"}),jsxRuntime.jsx("input",{type:"date",value:h.startDate?h.startDate.toISOString().split("T")[0]:"",onChange:x=>b("startDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d||h.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:i.textTertiary},children:"Fin"}),jsxRuntime.jsx("input",{type:"date",value:h.endDate?h.endDate.toISOString().split("T")[0]:"",onChange:x=>b("endDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d||h.isMilestone})]})]}),g.endDate&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),g.endDate]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1.5 flex items-center gap-2",style:v,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),o.length>0?jsxRuntime.jsx("div",{className:"space-y-1 max-h-[88px] overflow-y-auto p-2 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:o.map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.assignees?.some(w=>w.name===x.name),onChange:w=>{let A=w.target.checked?[...h.assignees||[],{id:x.id,name:x.name,avatar:x.avatar,initials:x.name.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(h.assignees||[]).filter(C=>C.name!==x.name);b("assignees",A);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold flex-shrink-0",style:{backgroundColor:i.accent},children:x.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate",style:{color:i.textPrimary},children:x.name})]},x.id))}):jsxRuntime.jsx("div",{className:"p-3 rounded-lg text-sm text-center",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textTertiary},children:"No hay usuarios disponibles"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),"Estado"]}),jsxRuntime.jsx("select",{value:h.status,onChange:x=>b("status",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d,children:p.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.title},x.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"}),"Prioridad"]}),jsxRuntime.jsxs("select",{value:h.priority||"medium",onChange:x=>b("priority",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d,children:[jsxRuntime.jsx("option",{value:"low",children:"\u{1F7E2} Baja"}),jsxRuntime.jsx("option",{value:"medium",children:"\u{1F7E1} Media"}),jsxRuntime.jsx("option",{value:"high",children:"\u{1F7E0} Alta"}),jsxRuntime.jsx("option",{value:"urgent",children:"\u{1F534} Urgente"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center justify-between",style:v,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3.5 h-3.5"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-1.5 py-0.5 rounded text-xs",style:{color:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981",backgroundColor:h.progress<30?"rgba(239, 68, 68, 0.1)":h.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[h.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:h.progress,onChange:x=>b("progress",parseInt(x.target.value)),className:"flex-1 h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981"},disabled:d})}),jsxRuntime.jsx("div",{className:"flex gap-1 mt-1.5",children:[0,50,100].map(x=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>b("progress",x),disabled:d,className:"flex-1 px-1 py-0.5 text-xs font-medium rounded transition-all",style:{backgroundColor:h.progress===x?x<30?"#EF4444":x<70?"#F59E0B":"#10B981":i.bgSecondary,color:h.progress===x?"#FFFFFF":i.textTertiary,border:`1px solid ${h.progress===x?"transparent":i.borderLight}`},children:[x,"%"]},x))})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-2 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"}),"Color"]}),jsxRuntime.jsx(Ul,{value:h.color,onChange:x=>b("color",x),disabled:d})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),"Descripci\xF3n",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:i.textTertiary},children:"(opcional)"})]}),jsxRuntime.jsx("textarea",{value:h.description||"",onChange:x=>b("description",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent resize-none text-sm",style:y,onFocus:x=>x.currentTarget.style.borderColor=i.accent,onBlur:x=>x.currentTarget.style.borderColor=i.borderLight,placeholder:"Describe los detalles de la tarea...",rows:2,disabled:d})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>u(!l),className:"flex items-center gap-2 text-sm font-medium w-full py-2 px-3 rounded-lg transition-colors",style:{color:i.textSecondary,backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},onMouseEnter:x=>x.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor=i.bgSecondary,children:[l?jsxRuntime.jsx(lucideReact.ChevronUp,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),"Opciones avanzadas",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:i.textTertiary},children:"(hito, dependencias)"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-4 space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:h.isMilestone,onChange:x=>b("isMilestone",x.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-28 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:r.filter(x=>x.id!==a?.id).map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.dependencies?.includes(x.id),onChange:w=>{let A=w.target.checked?[...h.dependencies||[],x.id]:(h.dependencies||[]).filter(C=>C!==x.id);b("dependencies",A);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsx("span",{className:"truncate",style:{color:i.textPrimary},children:x.name})]},x.id))})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:x=>{x.currentTarget.style.color=i.textPrimary,x.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:x=>{x.currentTarget.style.color=i.textSecondary,x.currentTarget.style.backgroundColor="transparent";},disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:N,disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:x=>!d&&(x.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:x=>!d&&(x.currentTarget.style.backgroundColor=i.accent),children:d?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.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Ig=['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"'],jl=()=>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"})]}),Ag=()=>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"})}),Lg=()=>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"})}),Fg=()=>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"})}),Bg=()=>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 Ao({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:m}){let[s,p]=react.useState(false),[i,l]=react.useState(false),[u,y]=react.useState([]),[v,h]=react.useState(""),[k,g]=react.useState(false),[f,T]=react.useState(true),N=react.useRef(null),b=react.useRef(null),x=react.useRef(null),{enabled:w=true,placeholder:A='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:C="bottom-right",onCommand:B,suggestions:$=Ig,maxHistory:R=50,persistHistory:E}=a,H=E?.storageKey||"gantt-ai-history",re=E?.maxMessages??5;react.useEffect(()=>{if(E?.enabled)try{let M=localStorage.getItem(H);if(M){let _=JSON.parse(M).map(K=>({...K,timestamp:new Date(K.timestamp)}));y(_.slice(-re));}}catch(M){console.warn("[GanttAIAssistant] Failed to load persisted history:",M);}},[E?.enabled,H,re]),react.useEffect(()=>{if(E?.enabled&&u.length>0)try{let M=u.filter(I=>!I.isLoading).slice(-re);localStorage.setItem(H,JSON.stringify(M));}catch(M){console.warn("[GanttAIAssistant] Failed to persist history:",M);}},[u,E?.enabled,H,re]),react.useEffect(()=>{b.current&&b.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{s&&!i&&N.current&&setTimeout(()=>N.current?.focus(),100);},[s,i]);let oe=react.useCallback(M=>{if(M.success)switch(M.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":M.taskId&&M.updates&&o?.(M.taskId,M.updates);break;case "create_task":M.newTask&&n?.(M.newTask);break;case "delete_task":M.taskId&&d?.(M.taskId);break;case "link_tasks":M.dependencyFrom&&M.dependencyTo&&c?.(M.dependencyFrom,M.dependencyTo);break;case "unlink_tasks":M.taskId&&M.dependencyFrom&&m?.(M.taskId,M.dependencyFrom);break}},[o,n,d,c,m]),Ae=react.useCallback(async M=>{if(!M.trim()||k)return;let I={id:`user-${Date.now()}`,role:"user",content:M,timestamp:new Date};y(K=>[...K.slice(-(R-1)),I]),h(""),T(false),g(true);let _={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(K=>[...K,_]);try{if(B){let K=await B(M,e);y(j=>{let le=j.filter(Le=>!Le.isLoading),ne={id:`assistant-${Date.now()}`,role:"assistant",content:K.message,timestamp:new Date,command:K};return [...le,ne]}),oe(K);}else y(K=>[...K.filter(le=>!le.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(K){y(j=>[...j.filter(ne=>!ne.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${K instanceof Error?K.message:"Unknown error"}`,timestamp:new Date}]);}finally{g(false);}},[k,R,B,e,oe]),Se=M=>{M.preventDefault(),Ae(v);},ce=M=>{h(M),N.current?.focus();};if(react.useEffect(()=>{let M=I=>{(I.metaKey||I.ctrlKey)&&I.key==="k"&&(I.preventDefault(),p(_=>!_),s||l(false)),I.key==="Escape"&&s&&p(false);};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[s]),react.useEffect(()=>{if(!s)return;let M=_=>{let K=_.target;x.current&&!x.current.contains(K)&&p(false);},I=setTimeout(()=>{document.addEventListener("mousedown",M);},100);return ()=>{clearTimeout(I),document.removeEventListener("mousedown",M);}},[s]),!w)return null;let P={"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(Ue,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!s&&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 ${P[C]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>p(true),children:[jsxRuntime.jsx(jl,{}),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:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:i?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${P[C]} 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(jl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>l(M=>!M),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Fg,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Lg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&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:$.slice(0,4).map((M,I)=>jsxRuntime.jsx("button",{onClick:()=>ce(M),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:M.length>30?M.slice(0,30)+"...":M},I))})]}),u.map(M=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${M.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${M.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:M.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:M.role==="user"?"white":t.textPrimary},children:[M.isLoading?jsxRuntime.jsx(Bg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:M.content}),M.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:M.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:M.command.success?"#10B981":"#EF4444"},children:[M.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:M.command.type.replace(/_/g," ")})]})]})},M.id)),jsxRuntime.jsx("div",{ref:b})]}),jsxRuntime.jsxs("form",{onSubmit:Se,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:N,type:"text",value:v,onChange:M=>h(M.target.value),placeholder:A,disabled:k,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!v.trim()||k,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:v.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:v.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Ag,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Kl(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((s,p=true)=>{r(i=>{let l=typeof s=="function"?s(i.present):s;if(o.current)return {...i,present:l};if(!p)return {...i,present:l};let u=[...i.past,i.present];return u.length>t&&u.shift(),{past:u,present:l,future:[]}});},[t]),d=react.useCallback(()=>{r(s=>{if(s.past.length===0)return s;let p=s.past[s.past.length-1],i=s.past.slice(0,s.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:i,present:p,future:[s.present,...s.future]}});},[]),c=react.useCallback(()=>{r(s=>{if(s.future.length===0)return s;let p=s.future[0],i=s.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...s.past,s.present],present:p,future:i}});},[]),m=react.useCallback(()=>{r(s=>({past:[],present:s.present,future:[]}));},[]);return {state:a.present,setState:n,undo:d,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function Yl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=d=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=c?d.metaKey:d.ctrlKey;if(m&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!c&&m&&d.key==="y"){d.preventDefault(),t();return}if(c&&m&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var zg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Y.formatDate(e.startDate)} - ${Y.formatDate(e.endDate)}`);let a=Y.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=>Y.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function ql(e){return {...zg,...e}}var jg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Zl=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:d="week",rowDensity:c="comfortable",showThemeSelector:m=true,showExportButton:s=true,availableUsers:p=[],templates:i,enableAutoCriticalPath:l=true,aiAssistant:u,locale:y="en",customTranslations:v,showCreateTaskButton:h=false,createTaskLabel:k,onCreateTask:g,onThemeChange:f,onTaskClick:T,onTaskDblClick:N,onTaskContextMenu:b,onTaskUpdate:x,onProgressChange:w,onTaskEdit:A,onTaskAddSubtask:C,onTaskMarkIncomplete:B,onTaskSetInProgress:$,onDependencyCreate:R,onDependencyDelete:E,onBeforeTaskAdd:H,onAfterTaskAdd:re,onBeforeTaskUpdate:oe,onAfterTaskUpdate:Ae,onBeforeTaskDelete:Se,onAfterTaskDelete:ce}=a,M=react.useContext(bo)?.theme,[I,_]=react.useState(M||n||"dark"),[K,j]=react.useState(d),[le,ne]=react.useState(c),[Le,be]=react.useState(1),[Xe,Ye]=react.useState(0),[Mt,Jt]=react.useState(false),[zt,It]=react.useState(null),[At,St]=react.useState({isOpen:false,x:0,y:0,task:null}),[fa,pt]=react.useState(null),[ot,Lt]=react.useState(null);react.useEffect(()=>{M&&M!==I&&_(M);},[M]),react.useEffect(()=>{n&&n!==I&&_(n);},[n]);let Ca=react.useCallback(D=>{_(D),f?.(D);},[f]),{state:de,setState:xe,undo:_t,redo:ba,canUndo:xt,canRedo:ha,clearHistory:va}=Kl(t,50);react.useEffect(()=>{xe(t);},[t,xe]);let Ce=react.useRef(t),Te=react.useRef(true);react.useEffect(()=>{if(Te.current){Te.current=false,Ce.current=de;return}if(!r)return;let D=JSON.stringify(Ce.current),O=JSON.stringify(de);D!==O&&(Ce.current=de,r(de));},[de,r]);let ut=react.useMemo(()=>_n(y,v),[y,v]),te=react.useCallback(D=>[{id:"name",label:D.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:D.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:D.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:D.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:D.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:D.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:D.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:D.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ke,F]=react.useState(()=>te(ut));react.useEffect(()=>{F(D=>D.map(O=>({...O,label:ut.columns[O.id==="name"?"taskName":O.id]||O.label})));},[ut]);let U=react.useMemo(()=>ke.filter(D=>D.visible).reduce((D,O)=>D+O.width,0)+60,[ke]),me=react.useMemo(()=>zt!==null?Math.max(280,zt,U):Math.max(280,U),[zt,U]),ge=react.useRef(null),q=react.useRef(null),pe=react.useRef(null),X=react.useMemo(()=>pl(I),[I]),L=react.useMemo(()=>({theme:X,themeName:I}),[X,I]),J=react.useMemo(()=>ql(i),[i]),Ne=react.useMemo(()=>{if(!l)return de;let D=Y.calculateCriticalPath(de),O=V=>V.map(Z=>({...Z,isCriticalPath:D.includes(Z.id),subtasks:Z.subtasks?O(Z.subtasks):void 0}));return O(de)},[de,l]),qe=jg(le);Yl({undo:_t,redo:ba,canUndo:xt,canRedo:ha,enabled:true}),react.useImperativeHandle(o,()=>({getTask:D=>Y.findTaskById(de,D),addTask:(D,O)=>{xe(V=>{if(!O)return [...V,{...D,level:0}];let Z=se=>se.map(he=>he.id===O?{...he,subtasks:[...he.subtasks||[],{...D,parentId:O,level:(he.level||0)+1}],isExpanded:true}:he.subtasks?{...he,subtasks:Z(he.subtasks)}:he);return Z(V)});},updateTask:(D,O)=>{xe(V=>{let Z=se=>se.map(he=>he.id===D?{...he,...O}:he.subtasks?{...he,subtasks:Z(he.subtasks)}:he);return Z(V)});},deleteTask:D=>{xe(O=>{let V=Z=>Z.filter(se=>se.id===D?false:(se.subtasks&&(se.subtasks=V(se.subtasks)),true));return V(O)});},deleteTasks:D=>{xe(O=>Jn(O,D));},duplicateTask:D=>{xe(O=>Zn(O,[D]));},splitTask:(D,O,V=3)=>{xe(Z=>Y.splitTask(Z,D,O,V));},calculateEndDate:Y.calculateEndDate,calculateDuration:Y.calculateDuration,validateDependency:(D,O)=>!Y.validateDependencies(de,D,O),getAllTasks:()=>Y.flattenTasks(de),getTasksByStatus:D=>Y.flattenTasks(de).filter(O=>O.status===D),getTasksByParent:D=>D?Y.findTaskById(de,D)?.subtasks||[]:de.filter(V=>!V.parentId),getCriticalPath:()=>Y.flattenTasks(de).filter(D=>D.isCriticalPath),indentTask:D=>{xe(O=>Yn(O,[D]));},outdentTask:D=>{xe(O=>qn(O,[D]));},moveTask:(D,O)=>{xe(V=>Xn(V,[D],O));},createSubtask:async D=>{let{tasks:O,newTask:V}=ts(de,D);if(H){let Z=H({...V,parentId:D});if((Z instanceof Promise?await Z:Z)===false)return}xe(O),re&&re({...V,parentId:D});},scrollToTask:D=>{let V=Y.flattenTasks(de).findIndex(Z=>Z.id===D);if(V!==-1&&ge.current){let Z=V*qe;ge.current.scrollTo({top:Z,behavior:"smooth"}),q.current&&q.current.scrollTo({top:Z,behavior:"smooth"});}},highlightTask:(D,O=2e3)=>{},expandTask:D=>{xe(O=>{let V=Z=>Z.map(se=>se.id===D?{...se,isExpanded:true}:se.subtasks?{...se,subtasks:V(se.subtasks)}:se);return V(O)});},collapseTask:D=>{xe(O=>{let V=Z=>Z.map(se=>se.id===D?{...se,isExpanded:false}:se.subtasks?{...se,subtasks:V(se.subtasks)}:se);return V(O)});},expandAll:()=>{xe(D=>{let O=V=>V.map(Z=>({...Z,isExpanded:true,subtasks:Z.subtasks?O(Z.subtasks):void 0}));return O(D)});},collapseAll:()=>{xe(D=>{let O=V=>V.map(Z=>({...Z,isExpanded:false,subtasks:Z.subtasks?O(Z.subtasks):void 0}));return O(D)});},undo:_t,redo:ba,canUndo:()=>xt,canRedo:()=>ha,clearHistory:va,exportToPNG:async()=>{if(!pe.current)throw new Error("Gantt container not found");let D=await Jl__default.default(pe.current,{backgroundColor:X.bgPrimary,scale:2});return new Promise((O,V)=>{D.toBlob(Z=>{Z?O(Z):V(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async D=>{await Y.exportToPDF(de,D);},exportToExcel:async D=>{await Y.exportToExcel(de,D);},exportToJSON:()=>Y.exportToJSON(de),exportToCSV:()=>Y.exportToCSV(de),importFromJSON:D=>{let O=Y.importFromJSON(D);xe(O);},getTasks:()=>de,refresh:()=>{xe(D=>[...D]);},clearAll:()=>{xe([]);}}),[de,_t,ba,xt,ha,va,X,qe]);let ue=react.useCallback(D=>{F(O=>O.map(V=>V.id===D?{...V,visible:!V.visible}:V));},[]),Wa=react.useCallback((D,O)=>{F(V=>V.map(Z=>{if(Z.id!==D)return Z;let se=Z.minWidth??100,he=Z.maxWidth??800,gt=Math.max(se,Math.min(he,O));return {...Z,width:gt}}));},[]),rr=react.useCallback(D=>{xe(O=>es(O,D)),a.onTaskToggleExpand?.(D);},[a]),or=react.useCallback((D,O)=>{if(oe&&oe(D,O)===false)return;let Z=Y.findTaskById(de,D)?.progress,se=gt=>gt.map(Et=>Et.id===D?{...Et,...O}:Et.subtasks?{...Et,subtasks:se(Et.subtasks)}:Et);xe(se(de));let he=Y.findTaskById(se(de),D);he&&(x?.(he),Ae?.(he),O.progress!==void 0&&Z!==void 0&&O.progress!==Z&&w?.(D,Z,O.progress));},[de,x,oe,Ae,w]),pc=react.useCallback(D=>{D.length!==0&&(xe(O=>Yn(O,D)),a.onTaskIndent?.(D[0]));},[a]),uc=react.useCallback(D=>{D.length!==0&&(xe(O=>qn(O,D)),a.onTaskOutdent?.(D[0]));},[a]),gc=react.useCallback((D,O,V)=>{xe(Z=>Al(Z,D,O,V)),a.onTaskReparent?.(D,O,V);},[a]),fc=react.useCallback((D,O)=>{D.length!==0&&(xe(V=>Xn(V,D,O)),a.onTaskMove?.(D[0],O));},[a]),Jo=react.useCallback(async D=>{let O=[];for(let V of D)Se&&await Promise.resolve(Se(V))===false||O.push(V);O.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(O):(xe(V=>Jn(V,O)),O.forEach(V=>a.onTaskDelete?.(V))),ce&&O.forEach(V=>ce(V)));},[a,Se,ce]),bc=react.useCallback(D=>{xe(O=>Zn(O,D)),D.forEach(O=>a.onTaskDuplicate?.(O));},[a]),hc=react.useCallback((D,O)=>{xe(V=>{let{tasks:Z,newTask:se}=Il(V,D,O);return H&&H(se)===false?V:(a.onTaskCreate?.(se.parentId,se.position||0),re?.(se),Z)});},[a,H,re]),vc=react.useCallback((D,O)=>{xe(V=>Qn(V,D,O)),a.onTaskRename?.(D,O);},[a]),Zo=react.useCallback(D=>{xe(O=>{let{tasks:V}=ts(O,D);return a.onTaskCreate?.(D,0),V});},[a]),yc=react.useCallback((D,O,V)=>{let Z=D.startDate?Math.round((O.getTime()-D.startDate.getTime())/864e5):0,se=Et=>Et.map(aa=>aa.id===D.id?{...aa,startDate:O,endDate:V,...D.segments&&{segments:D.segments}}:aa.subtasks?{...aa,subtasks:se(aa.subtasks)}:aa),he=se(de);he=Y.autoScheduleDependents(he,D.id,Z),xe(he);let gt={...D,startDate:O,endDate:V};x?.(gt);},[de,x]),xc=react.useCallback((D,O)=>{b?.(D,O),St({isOpen:true,x:O.clientX,y:O.clientY,task:D});},[b]),kc=react.useCallback((D,O)=>{let V=Y.splitTask(de,D.id,O);xe(V),St({isOpen:false,x:0,y:0,task:null});},[de]),ti=react.useCallback(D=>{N?.(D),A||pt(D);},[N,A]),ai=react.useCallback((D,O,V)=>{let Z=new Map,se=ra=>{ra.forEach(Ta=>{Ta.dependencies&&Z.set(Ta.id,Ta.dependencies),Ta.subtasks&&se(Ta.subtasks);});};se(V);let he=Z.get(O)||[];Z.set(O,[...he,D]);let gt=new Set,Et=new Set,aa=ra=>{if(!gt.has(ra)){gt.add(ra),Et.add(ra);let Ta=Z.get(ra)||[];for(let Nr of Ta){if(!gt.has(Nr)&&aa(Nr))return true;if(Et.has(Nr))return true}}return Et.delete(ra),false};return aa(O)},[]),ri=react.useCallback((D,O)=>{if(ai(D.id,O,de)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
276
|
+
</Project>`,p=new Blob([s],{type:"application/xml;charset=utf-8;"}),i=document.createElement("a");i.href=URL.createObjectURL(p),i.download=a,i.click(),URL.revokeObjectURL(i.href);},calculateCriticalPath:e=>{let t=Y.flattenTasks(e),a=t.filter(s=>s.startDate&&s.endDate);if(a.length===0)return [];let r=new Map,o=s=>{if(r.has(s.id))return;let p=s.startDate&&s.endDate?Y.calculateDuration(s.startDate,s.endDate):0,i=0;if(s.dependencies&&s.dependencies.length>0)for(let u of s.dependencies){let y=t.find(v=>v.id===u);if(y){o(y);let v=r.get(u)?.ef||0;i=Math.max(i,v);}}let l=i+p;r.set(s.id,{es:i,ef:l});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(s=>s.ef)),d=new Map,c=s=>{if(d.has(s.id))return;let p=s.startDate&&s.endDate?Y.calculateDuration(s.startDate,s.endDate):0,i=t.filter(y=>y.dependencies&&y.dependencies.includes(s.id)),l=n;if(i.length>0)for(let y of i){c(y);let v=d.get(y.id)?.ls||0;l=Math.min(l,v);}let u=l-p;d.set(s.id,{ls:u,lf:l});};a.forEach(c);let m=[];for(let s of a){let p=r.get(s.id),i=d.get(s.id);if(p&&i){let l=i.ls-p.es;Math.abs(l)<.01&&m.push(s.id);}}return m},calculateSlack:(e,t)=>{let a=Y.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Y.calculateCriticalPath(e).includes(t))return 0;let o=Y.getDependentTasks(e,t);if(o.length===0){let c=Y.getLatestEndDate(e);if(!c)return null;let m=Y.calculateDuration(a.endDate,c);return Math.max(0,m)}let n=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,m)=>c-m)[0];if(!n)return null;let d=Y.calculateDuration(a.endDate,new Date(n));return Math.max(0,d)},isOnCriticalPath:(e,t)=>Y.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Y.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Y.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let c=Y.calculateDuration(d.startDate,d.endDate),m;a!==void 0?(m=new Date(d.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let s=Y.calculateEndDate(m,c),p=i=>i.map(l=>l.id===d.id?{...l,startDate:m,endDate:s}:l.subtasks?{...l,subtasks:p(l.subtasks)}:l);n=p(n),n=Y.autoScheduleDependents(n,d.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,d,c)=>{if(a===0)return [];let m=[],s=o.getTime(),p=1e3*60*60*24,i=Y.findTaskById(e,t);if(!i||!i.endDate)return [];let l=(u,y,v=new Set)=>{if(v.has(u))return;v.add(u);let h=Y.getDependentTasks(e,u);for(let k of h){if(!k.startDate||!k.endDate)continue;let g=r.findIndex(B=>B.id===k.id);if(g===-1)continue;let f=k.startDate.getTime(),N=(k.endDate.getTime()-f)/p,x=(f-s)/p*n,w=x+y*n,A=Math.max(N*n,n),C=c+g*d+12;m.push({taskId:k.id,taskName:k.name,originalX:x,previewX:w,width:A,y:C,rowIndex:g,daysDelta:y,color:k.color}),l(k.id,y,v);}};return l(t,a),m},splitTask:(e,t,a,r=3)=>{let o=Y.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 n=new Date(a);n.setDate(n.getDate()-1);let d=new Date(a);d.setDate(d.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:n},{startDate:d,endDate:c}],s=p=>p.map(i=>i.id===o.id?{...i,endDate:c,segments:m}:i.subtasks?{...i,subtasks:s(i.subtasks)}:i);return s(e)}};function Mo({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:d,templates:c,onTaskClick:m,onTaskDblClick:s,onTaskContextMenu:p,onTaskDateChange:i,onDependencyCreate:l,onDependencyDelete:u}){let[v,h]=react.useState([]),[k,g]=react.useState(null),[f,T]=react.useState(null),N=react.useCallback(P=>{g(P);},[]),b=react.useCallback(P=>{T(P);},[]),x=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,A=x*w*d,C=P=>{let M=new Date(Date.UTC(P.getFullYear(),P.getMonth(),P.getDate())),I=M.getUTCDay()||7;M.setUTCDate(M.getUTCDate()+4-I);let _=new Date(Date.UTC(M.getUTCFullYear(),0,1));return Math.ceil(((M.getTime()-_.getTime())/864e5+1)/7)},B=P=>{let M=P.getDay();return M===0||M===6},$=react.useCallback(P=>{let M=Math.round(P/(w*d)),I=new Date(o);return I.setDate(I.getDate()+M),I},[o,w,d]),R=react.useCallback((P,M)=>{if(M.startDate&&M.endDate)return;let I=P.currentTarget.ownerSVGElement;if(!I)return;let _=I.createSVGPoint();_.x=P.clientX,_.y=P.clientY;let K=_.matrixTransform(I.getScreenCTM()?.inverse()),j=$(K.x),le=new Date(j);le.setDate(le.getDate()+1),i?.(M,j,le);},[$,i]),E=react.useMemo(()=>{let P=K=>K.map(j=>{if(j.subtasks&&j.subtasks.length>0){let le=P(j.subtasks),oe=le.filter(Le=>Le.startDate&&Le.endDate);if(oe.length>0){let Le=oe.map(Mt=>Mt.startDate.getTime()),fe=oe.map(Mt=>Mt.endDate.getTime()),Xe=new Date(Math.min(...Le)),Ye=new Date(Math.max(...fe));return {...j,subtasks:le,startDate:Xe,endDate:Ye}}return {...j,subtasks:le}}return j}),M=(K,j=[])=>{for(let le of K)j.push(le),le.subtasks&&le.subtasks.length>0&&(le.isExpanded===void 0||le.isExpanded)&&M(le.subtasks,j);return j},I=P(e);return M(I)},[e]),H=react.useCallback(P=>{if(!P.startDate||!P.endDate)return {x:0,width:0};let M=P.startDate.getTime(),I=P.endDate.getTime(),_=o.getTime(),K=(M-_)/(1e3*60*60*24),j=(I-M)/(1e3*60*60*24),le=K*w*d,oe=Math.max(w*d,40),Le=Math.max(j*w*d,oe);return {x:le,width:Le}},[o,w,d]),re=react.useMemo(()=>E.filter(P=>P.startDate&&P.endDate).map(P=>{let{x:M,width:I}=H(P),K=E.findIndex(j=>j.id===P.id)*a+12;return {id:P.id,x:M,y:K,width:I,height:32}}),[E,H]),ie=react.useCallback((P,M,I)=>{if(!I||M===0){h([]);return}let _=Y.calculateCascadePreview(e,P,M,E,o,w*d,a,48);h(_);},[e,E,o,w,d,a,48]),Ae=react.useMemo(()=>{let P=[],M=new Date(o);for(;M<=n;){let K=(M.getTime()-o.getTime())/864e5*w*d;if(r==="day")P.push({date:new Date(M),label:M.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:K}),M.setDate(M.getDate()+1);else if(r==="week"){let j=C(M);P.push({date:new Date(M),label:`Week ${j}`,x:K}),M.setDate(M.getDate()+7);}else P.push({date:new Date(M),label:M.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:K}),M.setMonth(M.getMonth()+1);}return P},[o,n,r,w,d]),Se=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*d,[o,w,d]),ce=Math.max(E.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(A,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(A,1e3),height:48,fill:t.bgGrid}),Ae.map((P,M)=>jsxRuntime.jsxs("g",{children:[M>0&&jsxRuntime.jsx("line",{x1:P.x,y1:0,x2:P.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:P.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:P.label})]},`header-${M}`)),Se>=0&&Se<=A&&jsxRuntime.jsx("circle",{cx:Se,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(A,1e3),height:ce,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(A,1e3),height:ce,fill:t.bgPrimary}),Ae.map((P,M)=>{let I=Ae[M+1]?.x||A,_=B(P.date);return jsxRuntime.jsxs("g",{children:[_&&jsxRuntime.jsx("rect",{x:P.x,y:0,width:I-P.x,height:E.length*a,fill:t.bgWeekend,opacity:1}),M>0&&jsxRuntime.jsx("line",{x1:P.x,y1:0,x2:P.x,y2:E.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},M)}),Se>=0&&Se<=A&&jsxRuntime.jsx("line",{x1:Se,y1:0,x2:Se,y2:E.length*a,stroke:t.today,strokeWidth:2,opacity:1}),E.map((P,M)=>{let I=P.startDate&&P.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:M*a,width:A,height:a,fill:M%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${P.id}`),!I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:M*a,width:A,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:_=>R(_,P),onMouseEnter:_=>{_.currentTarget.setAttribute("fill",t.accentLight),_.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:_=>{_.currentTarget.setAttribute("fill","transparent"),_.currentTarget.setAttribute("opacity","1");}},`clickable-${P.id}`),jsxRuntime.jsx("text",{x:Se>0?Se:100,y:M*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-${P.id}`)]})]},`row-group-${P.id}`)}),E.map((P,M)=>!P.dependencies||P.dependencies.length===0||!P.startDate||!P.endDate?null:P.dependencies.map(I=>{let _=E.find(oe=>oe.id===I);if(!_||!_.startDate||!_.endDate)return null;let K=E.findIndex(oe=>oe.id===I),j=H(_),le=H(P);return jsxRuntime.jsx(Do,{x1:j.x+j.width,y1:K*a+a/2,x2:le.x,y2:M*a+a/2,theme:t,onDelete:()=>u?.(P.id,I),onHoverChange:b},`dep-${I}-${P.id}`)})),E.map((P,M)=>{if(!P.startDate||!P.endDate)return null;let{x:I,width:_}=H(P),K=M*a+12,j=P.subtasks&&P.subtasks.length>0&&!P.isMilestone;return P.isMilestone?jsxRuntime.jsx(Eo,{task:P,x:I+_/2,y:K+16,theme:t,onClick:m},P.id):j?jsxRuntime.jsxs("g",{onClick:()=>m?.(P),onContextMenu:le=>{le.preventDefault(),le.stopPropagation(),p?.(P,le);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:I,y:K,width:_,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:I,y1:K,x2:I+_,y2:K,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:I,y1:K,x2:I,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:I+_,y1:K,x2:I+_,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:I,y1:K+32,x2:I+_,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),_>60&&jsxRuntime.jsx("text",{x:I+12,y:K+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:P.name})]},P.id):jsxRuntime.jsx(Co,{task:P,x:I,y:K,width:_,theme:t,dayWidth:w*d,startDate:o,templates:c,onClick:m,onDoubleClick:s,onContextMenu:p,onDateChange:i,onDependencyCreate:l,allTaskPositions:re,onDragMove:ie,onHoverChange:N},P.id)}),v.map(P=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:P.previewX,y:P.y-48,width:P.width,height:32,rx:8,fill:P.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(P.daysDelta)>0&&jsxRuntime.jsx("text",{x:P.previewX+P.width/2,y:P.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:P.daysDelta>0?`+${P.daysDelta}d`:`${P.daysDelta}d`})]},`cascade-preview-${P.taskId}`)),f&&(()=>{let{x1:P,y1:M,x2:I,y2:_,onDelete:K}=f,j=I-P,le=_-M,oe=P+j/2,Le=(M+_)/2,fe=`M ${P} ${M} C ${oe} ${M}, ${oe} ${_}, ${I} ${_}`,Xe=6,Ye=Math.atan2(le,j),Mt=I-Xe*Math.cos(Ye-Math.PI/6),Jt=_-Xe*Math.sin(Ye-Math.PI/6),zt=I-Xe*Math.cos(Ye+Math.PI/6),It=_-Xe*Math.sin(Ye+Math.PI/6),At=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:fe,fill:"none",stroke:At,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${I} ${_} L ${Mt} ${Jt} M ${I} ${_} L ${zt} ${It}`,fill:"none",stroke:At,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:I,cy:_,r:5,fill:At}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:St=>{St.stopPropagation(),K();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:oe,cy:Le,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:oe-4,y1:Le-4,x2:oe+4,y2:Le+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:oe+4,y1:Le-4,x2:oe-4,y2:Le+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),k&&jsxRuntime.jsx(Rl,{tooltipData:k,theme:t})]})]})}var zl=[{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:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function Ul({value:e="#6366F1",onChange:t,disabled:a=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:zl.map(r=>{let o=e===r.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!a&&t(r.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:r.value,boxShadow:o?`0 0 0 2px #FFFFFF, 0 0 0 4px ${r.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},whileHover:a?{}:{scale:1.1},whileTap:a?{}:{scale:.95},title:r.name,disabled:a,children:o&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},r.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:zl.find(r=>r.value===e)?.name||"Personalizado"})]})}var _l=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}];function Io({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:d=false,mode:c=a?"edit":"create",theme:m="dark",customStatuses:s=[]}){let p=[..._l,...s.filter(x=>!_l.some(w=>w.id===x.id))],i=Ie[m]||Ie.dark,[l,u]=react.useState(false),y={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},v={color:i.textSecondary},[h,k]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[g,f]=react.useState({});react.useEffect(()=>{a?(k({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||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&u(true)):(k({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),u(false));},[a,e]);let T=()=>{let x={};return h.name.trim()||(x.name="El nombre es requerido"),h.startDate&&h.endDate&&h.startDate>h.endDate&&(x.endDate="La fecha de fin debe ser posterior a la de inicio"),f(x),Object.keys(x).length===0},N=async x=>{if(x.preventDefault(),!!T())try{await n(h),t();}catch(w){console.error("Error submitting task:",w);}},b=(x,w)=>{k(A=>{let C={...A,[x]:w};if(x==="progress"){let B=typeof w=="number"?w:parseInt(w,10);B===100&&A.status!=="completed"?C.status="completed":B>0&&B<100&&A.status==="todo"?C.status="in-progress":B===0&&A.status!=="todo"&&(C.status="todo");}return C}),g[x]&&f(A=>{let C={...A};return delete C[x],C});};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/50 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:.2,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-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:c==="create"?"Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:x=>x.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor="transparent",disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:N,className:"p-6 space-y-5 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1.5",style:v,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:h.name,onChange:x=>b("name",x.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:y,onFocus:x=>x.currentTarget.style.borderColor=i.accent,onBlur:x=>x.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:d,autoFocus:true}),g.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),g.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium flex items-center gap-2",style:v,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fechas"]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:i.textTertiary},children:"Inicio"}),jsxRuntime.jsx("input",{type:"date",value:h.startDate?h.startDate.toISOString().split("T")[0]:"",onChange:x=>b("startDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d||h.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:i.textTertiary},children:"Fin"}),jsxRuntime.jsx("input",{type:"date",value:h.endDate?h.endDate.toISOString().split("T")[0]:"",onChange:x=>b("endDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d||h.isMilestone})]})]}),g.endDate&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),g.endDate]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1.5 flex items-center gap-2",style:v,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),o.length>0?jsxRuntime.jsx("div",{className:"space-y-1 max-h-[88px] overflow-y-auto p-2 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:o.map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.assignees?.some(w=>w.name===x.name),onChange:w=>{let A=w.target.checked?[...h.assignees||[],{id:x.id,name:x.name,avatar:x.avatar,initials:x.name.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(h.assignees||[]).filter(C=>C.name!==x.name);b("assignees",A);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold flex-shrink-0",style:{backgroundColor:i.accent},children:x.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate",style:{color:i.textPrimary},children:x.name})]},x.id))}):jsxRuntime.jsx("div",{className:"p-3 rounded-lg text-sm text-center",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textTertiary},children:"No hay usuarios disponibles"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),"Estado"]}),jsxRuntime.jsx("select",{value:h.status,onChange:x=>b("status",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d,children:p.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.title},x.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"}),"Prioridad"]}),jsxRuntime.jsxs("select",{value:h.priority||"medium",onChange:x=>b("priority",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:y,disabled:d,children:[jsxRuntime.jsx("option",{value:"low",children:"\u{1F7E2} Baja"}),jsxRuntime.jsx("option",{value:"medium",children:"\u{1F7E1} Media"}),jsxRuntime.jsx("option",{value:"high",children:"\u{1F7E0} Alta"}),jsxRuntime.jsx("option",{value:"urgent",children:"\u{1F534} Urgente"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center justify-between",style:v,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3.5 h-3.5"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-1.5 py-0.5 rounded text-xs",style:{color:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981",backgroundColor:h.progress<30?"rgba(239, 68, 68, 0.1)":h.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[h.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:h.progress,onChange:x=>b("progress",parseInt(x.target.value)),className:"flex-1 h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981"},disabled:d})}),jsxRuntime.jsx("div",{className:"flex gap-1 mt-1.5",children:[0,50,100].map(x=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>b("progress",x),disabled:d,className:"flex-1 px-1 py-0.5 text-xs font-medium rounded transition-all",style:{backgroundColor:h.progress===x?x<30?"#EF4444":x<70?"#F59E0B":"#10B981":i.bgSecondary,color:h.progress===x?"#FFFFFF":i.textTertiary,border:`1px solid ${h.progress===x?"transparent":i.borderLight}`},children:[x,"%"]},x))})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-2 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"}),"Color"]}),jsxRuntime.jsx(Ul,{value:h.color,onChange:x=>b("color",x),disabled:d})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),"Descripci\xF3n",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:i.textTertiary},children:"(opcional)"})]}),jsxRuntime.jsx("textarea",{value:h.description||"",onChange:x=>b("description",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent resize-none text-sm",style:y,onFocus:x=>x.currentTarget.style.borderColor=i.accent,onBlur:x=>x.currentTarget.style.borderColor=i.borderLight,placeholder:"Describe los detalles de la tarea...",rows:2,disabled:d})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>u(!l),className:"flex items-center gap-2 text-sm font-medium w-full py-2 px-3 rounded-lg transition-colors",style:{color:i.textSecondary,backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},onMouseEnter:x=>x.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor=i.bgSecondary,children:[l?jsxRuntime.jsx(lucideReact.ChevronUp,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),"Opciones avanzadas",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:i.textTertiary},children:"(hito, dependencias)"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-4 space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:h.isMilestone,onChange:x=>b("isMilestone",x.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:v,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-28 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:r.filter(x=>x.id!==a?.id).map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.dependencies?.includes(x.id),onChange:w=>{let A=w.target.checked?[...h.dependencies||[],x.id]:(h.dependencies||[]).filter(C=>C!==x.id);b("dependencies",A);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:i.accent},disabled:d}),jsxRuntime.jsx("span",{className:"truncate",style:{color:i.textPrimary},children:x.name})]},x.id))})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:x=>{x.currentTarget.style.color=i.textPrimary,x.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:x=>{x.currentTarget.style.color=i.textSecondary,x.currentTarget.style.backgroundColor="transparent";},disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:N,disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:x=>!d&&(x.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:x=>!d&&(x.currentTarget.style.backgroundColor=i.accent),children:d?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.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Ig=['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"'],jl=()=>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"})]}),Ag=()=>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"})}),Lg=()=>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"})}),Fg=()=>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"})}),Bg=()=>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 Ao({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:m}){let[s,p]=react.useState(false),[i,l]=react.useState(false),[u,y]=react.useState([]),[v,h]=react.useState(""),[k,g]=react.useState(false),[f,T]=react.useState(true),N=react.useRef(null),b=react.useRef(null),x=react.useRef(null),{enabled:w=true,placeholder:A='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:C="bottom-right",onCommand:B,suggestions:$=Ig,maxHistory:R=50,persistHistory:E}=a,H=E?.storageKey||"gantt-ai-history",re=E?.maxMessages??5;react.useEffect(()=>{if(E?.enabled)try{let M=localStorage.getItem(H);if(M){let _=JSON.parse(M).map(K=>({...K,timestamp:new Date(K.timestamp)}));y(_.slice(-re));}}catch(M){console.warn("[GanttAIAssistant] Failed to load persisted history:",M);}},[E?.enabled,H,re]),react.useEffect(()=>{if(E?.enabled&&u.length>0)try{let M=u.filter(I=>!I.isLoading).slice(-re);localStorage.setItem(H,JSON.stringify(M));}catch(M){console.warn("[GanttAIAssistant] Failed to persist history:",M);}},[u,E?.enabled,H,re]),react.useEffect(()=>{b.current&&b.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{s&&!i&&N.current&&setTimeout(()=>N.current?.focus(),100);},[s,i]);let ie=react.useCallback(M=>{if(M.success)switch(M.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":M.taskId&&M.updates&&o?.(M.taskId,M.updates);break;case "create_task":M.newTask&&n?.(M.newTask);break;case "delete_task":M.taskId&&d?.(M.taskId);break;case "link_tasks":M.dependencyFrom&&M.dependencyTo&&c?.(M.dependencyFrom,M.dependencyTo);break;case "unlink_tasks":M.taskId&&M.dependencyFrom&&m?.(M.taskId,M.dependencyFrom);break}},[o,n,d,c,m]),Ae=react.useCallback(async M=>{if(!M.trim()||k)return;let I={id:`user-${Date.now()}`,role:"user",content:M,timestamp:new Date};y(K=>[...K.slice(-(R-1)),I]),h(""),T(false),g(true);let _={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(K=>[...K,_]);try{if(B){let K=await B(M,e);y(j=>{let le=j.filter(Le=>!Le.isLoading),oe={id:`assistant-${Date.now()}`,role:"assistant",content:K.message,timestamp:new Date,command:K};return [...le,oe]}),ie(K);}else y(K=>[...K.filter(le=>!le.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(K){y(j=>[...j.filter(oe=>!oe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${K instanceof Error?K.message:"Unknown error"}`,timestamp:new Date}]);}finally{g(false);}},[k,R,B,e,ie]),Se=M=>{M.preventDefault(),Ae(v);},ce=M=>{h(M),N.current?.focus();};if(react.useEffect(()=>{let M=I=>{(I.metaKey||I.ctrlKey)&&I.key==="k"&&(I.preventDefault(),p(_=>!_),s||l(false)),I.key==="Escape"&&s&&p(false);};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[s]),react.useEffect(()=>{if(!s)return;let M=_=>{let K=_.target;x.current&&!x.current.contains(K)&&p(false);},I=setTimeout(()=>{document.addEventListener("mousedown",M);},100);return ()=>{clearTimeout(I),document.removeEventListener("mousedown",M);}},[s]),!w)return null;let P={"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(Ue,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!s&&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 ${P[C]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>p(true),children:[jsxRuntime.jsx(jl,{}),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:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:i?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${P[C]} 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(jl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>l(M=>!M),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Fg,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Lg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&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:$.slice(0,4).map((M,I)=>jsxRuntime.jsx("button",{onClick:()=>ce(M),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:M.length>30?M.slice(0,30)+"...":M},I))})]}),u.map(M=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${M.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${M.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:M.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:M.role==="user"?"white":t.textPrimary},children:[M.isLoading?jsxRuntime.jsx(Bg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:M.content}),M.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:M.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:M.command.success?"#10B981":"#EF4444"},children:[M.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:M.command.type.replace(/_/g," ")})]})]})},M.id)),jsxRuntime.jsx("div",{ref:b})]}),jsxRuntime.jsxs("form",{onSubmit:Se,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:N,type:"text",value:v,onChange:M=>h(M.target.value),placeholder:A,disabled:k,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!v.trim()||k,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:v.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:v.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Ag,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Kl(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((s,p=true)=>{r(i=>{let l=typeof s=="function"?s(i.present):s;if(o.current)return {...i,present:l};if(!p)return {...i,present:l};let u=[...i.past,i.present];return u.length>t&&u.shift(),{past:u,present:l,future:[]}});},[t]),d=react.useCallback(()=>{r(s=>{if(s.past.length===0)return s;let p=s.past[s.past.length-1],i=s.past.slice(0,s.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:i,present:p,future:[s.present,...s.future]}});},[]),c=react.useCallback(()=>{r(s=>{if(s.future.length===0)return s;let p=s.future[0],i=s.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...s.past,s.present],present:p,future:i}});},[]),m=react.useCallback(()=>{r(s=>({past:[],present:s.present,future:[]}));},[]);return {state:a.present,setState:n,undo:d,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function Yl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=d=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=c?d.metaKey:d.ctrlKey;if(m&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!c&&m&&d.key==="y"){d.preventDefault(),t();return}if(c&&m&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var zg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Y.formatDate(e.startDate)} - ${Y.formatDate(e.endDate)}`);let a=Y.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=>Y.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function ql(e){return {...zg,...e}}var jg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Zl=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:d="week",rowDensity:c="comfortable",showThemeSelector:m=true,showExportButton:s=true,availableUsers:p=[],templates:i,enableAutoCriticalPath:l=true,aiAssistant:u,locale:y="en",customTranslations:v,showCreateTaskButton:h=false,createTaskLabel:k,onCreateTask:g,onThemeChange:f,onTaskClick:T,onTaskDblClick:N,onTaskContextMenu:b,onTaskUpdate:x,onProgressChange:w,onTaskEdit:A,onTaskAddSubtask:C,onTaskMarkIncomplete:B,onTaskSetInProgress:$,onDependencyCreate:R,onDependencyDelete:E,onBeforeTaskAdd:H,onAfterTaskAdd:re,onBeforeTaskUpdate:ie,onAfterTaskUpdate:Ae,onBeforeTaskDelete:Se,onAfterTaskDelete:ce}=a,M=react.useContext(bo)?.theme,[I,_]=react.useState(M||n||"dark"),[K,j]=react.useState(d),[le,oe]=react.useState(c),[Le,fe]=react.useState(1),[Xe,Ye]=react.useState(0),[Mt,Jt]=react.useState(false),[zt,It]=react.useState(null),[At,St]=react.useState({isOpen:false,x:0,y:0,task:null}),[fa,pt]=react.useState(null),[ot,Lt]=react.useState(null);react.useEffect(()=>{M&&M!==I&&_(M);},[M]),react.useEffect(()=>{n&&n!==I&&_(n);},[n]);let Ca=react.useCallback(D=>{_(D),f?.(D);},[f]),{state:de,setState:xe,undo:_t,redo:ba,canUndo:xt,canRedo:ha,clearHistory:va}=Kl(t,50);react.useEffect(()=>{xe(t);},[t,xe]);let Ce=react.useRef(t),Te=react.useRef(true);react.useEffect(()=>{if(Te.current){Te.current=false,Ce.current=de;return}if(!r)return;let D=JSON.stringify(Ce.current),O=JSON.stringify(de);D!==O&&(Ce.current=de,r(de));},[de,r]);let ut=react.useMemo(()=>_n(y,v),[y,v]),te=react.useCallback(D=>[{id:"name",label:D.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:D.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:D.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:D.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:D.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:D.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:D.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:D.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ke,F]=react.useState(()=>te(ut));react.useEffect(()=>{F(D=>D.map(O=>({...O,label:ut.columns[O.id==="name"?"taskName":O.id]||O.label})));},[ut]);let U=react.useMemo(()=>ke.filter(D=>D.visible).reduce((D,O)=>D+O.width,0)+60,[ke]),me=react.useMemo(()=>zt!==null?Math.max(280,zt,U):Math.max(280,U),[zt,U]),ge=react.useRef(null),q=react.useRef(null),pe=react.useRef(null),X=react.useMemo(()=>pl(I),[I]),L=react.useMemo(()=>({theme:X,themeName:I}),[X,I]),J=react.useMemo(()=>ql(i),[i]),Ne=react.useMemo(()=>{if(!l)return de;let D=Y.calculateCriticalPath(de),O=V=>V.map(Z=>({...Z,isCriticalPath:D.includes(Z.id),subtasks:Z.subtasks?O(Z.subtasks):void 0}));return O(de)},[de,l]),qe=jg(le);Yl({undo:_t,redo:ba,canUndo:xt,canRedo:ha,enabled:true}),react.useImperativeHandle(o,()=>({getTask:D=>Y.findTaskById(de,D),addTask:(D,O)=>{xe(V=>{if(!O)return [...V,{...D,level:0}];let Z=ne=>ne.map(be=>be.id===O?{...be,subtasks:[...be.subtasks||[],{...D,parentId:O,level:(be.level||0)+1}],isExpanded:true}:be.subtasks?{...be,subtasks:Z(be.subtasks)}:be);return Z(V)});},updateTask:(D,O)=>{xe(V=>{let Z=ne=>ne.map(be=>be.id===D?{...be,...O}:be.subtasks?{...be,subtasks:Z(be.subtasks)}:be);return Z(V)});},deleteTask:D=>{xe(O=>{let V=Z=>Z.filter(ne=>ne.id===D?false:(ne.subtasks&&(ne.subtasks=V(ne.subtasks)),true));return V(O)});},deleteTasks:D=>{xe(O=>Jn(O,D));},duplicateTask:D=>{xe(O=>Zn(O,[D]));},splitTask:(D,O,V=3)=>{xe(Z=>Y.splitTask(Z,D,O,V));},calculateEndDate:Y.calculateEndDate,calculateDuration:Y.calculateDuration,validateDependency:(D,O)=>!Y.validateDependencies(de,D,O),getAllTasks:()=>Y.flattenTasks(de),getTasksByStatus:D=>Y.flattenTasks(de).filter(O=>O.status===D),getTasksByParent:D=>D?Y.findTaskById(de,D)?.subtasks||[]:de.filter(V=>!V.parentId),getCriticalPath:()=>Y.flattenTasks(de).filter(D=>D.isCriticalPath),indentTask:D=>{xe(O=>Yn(O,[D]));},outdentTask:D=>{xe(O=>qn(O,[D]));},moveTask:(D,O)=>{xe(V=>Xn(V,[D],O));},createSubtask:async D=>{let{tasks:O,newTask:V}=ts(de,D);if(H){let Z=H({...V,parentId:D});if((Z instanceof Promise?await Z:Z)===false)return}xe(O),re&&re({...V,parentId:D});},scrollToTask:D=>{let V=Y.flattenTasks(de).findIndex(Z=>Z.id===D);if(V!==-1&&ge.current){let Z=V*qe;ge.current.scrollTo({top:Z,behavior:"smooth"}),q.current&&q.current.scrollTo({top:Z,behavior:"smooth"});}},highlightTask:(D,O=2e3)=>{},expandTask:D=>{xe(O=>{let V=Z=>Z.map(ne=>ne.id===D?{...ne,isExpanded:true}:ne.subtasks?{...ne,subtasks:V(ne.subtasks)}:ne);return V(O)});},collapseTask:D=>{xe(O=>{let V=Z=>Z.map(ne=>ne.id===D?{...ne,isExpanded:false}:ne.subtasks?{...ne,subtasks:V(ne.subtasks)}:ne);return V(O)});},expandAll:()=>{xe(D=>{let O=V=>V.map(Z=>({...Z,isExpanded:true,subtasks:Z.subtasks?O(Z.subtasks):void 0}));return O(D)});},collapseAll:()=>{xe(D=>{let O=V=>V.map(Z=>({...Z,isExpanded:false,subtasks:Z.subtasks?O(Z.subtasks):void 0}));return O(D)});},undo:_t,redo:ba,canUndo:()=>xt,canRedo:()=>ha,clearHistory:va,exportToPNG:async()=>{if(!pe.current)throw new Error("Gantt container not found");let D=await Jl__default.default(pe.current,{backgroundColor:X.bgPrimary,scale:2});return new Promise((O,V)=>{D.toBlob(Z=>{Z?O(Z):V(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async D=>{await Y.exportToPDF(de,D);},exportToExcel:async D=>{await Y.exportToExcel(de,D);},exportToJSON:()=>Y.exportToJSON(de),exportToCSV:()=>Y.exportToCSV(de),importFromJSON:D=>{let O=Y.importFromJSON(D);xe(O);},getTasks:()=>de,refresh:()=>{xe(D=>[...D]);},clearAll:()=>{xe([]);}}),[de,_t,ba,xt,ha,va,X,qe]);let ue=react.useCallback(D=>{F(O=>O.map(V=>V.id===D?{...V,visible:!V.visible}:V));},[]),Wa=react.useCallback((D,O)=>{F(V=>V.map(Z=>{if(Z.id!==D)return Z;let ne=Z.minWidth??100,be=Z.maxWidth??800,gt=Math.max(ne,Math.min(be,O));return {...Z,width:gt}}));},[]),rr=react.useCallback(D=>{xe(O=>es(O,D)),a.onTaskToggleExpand?.(D);},[a]),or=react.useCallback((D,O)=>{if(ie&&ie(D,O)===false)return;let Z=Y.findTaskById(de,D)?.progress,ne=gt=>gt.map(Et=>Et.id===D?{...Et,...O}:Et.subtasks?{...Et,subtasks:ne(Et.subtasks)}:Et);xe(ne(de));let be=Y.findTaskById(ne(de),D);be&&(x?.(be),Ae?.(be),O.progress!==void 0&&Z!==void 0&&O.progress!==Z&&w?.(D,Z,O.progress));},[de,x,ie,Ae,w]),pc=react.useCallback(D=>{D.length!==0&&(xe(O=>Yn(O,D)),a.onTaskIndent?.(D[0]));},[a]),uc=react.useCallback(D=>{D.length!==0&&(xe(O=>qn(O,D)),a.onTaskOutdent?.(D[0]));},[a]),gc=react.useCallback((D,O,V)=>{xe(Z=>Al(Z,D,O,V)),a.onTaskReparent?.(D,O,V);},[a]),fc=react.useCallback((D,O)=>{D.length!==0&&(xe(V=>Xn(V,D,O)),a.onTaskMove?.(D[0],O));},[a]),Jo=react.useCallback(async D=>{let O=[];for(let V of D)Se&&await Promise.resolve(Se(V))===false||O.push(V);O.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(O):(xe(V=>Jn(V,O)),O.forEach(V=>a.onTaskDelete?.(V))),ce&&O.forEach(V=>ce(V)));},[a,Se,ce]),bc=react.useCallback(D=>{xe(O=>Zn(O,D)),D.forEach(O=>a.onTaskDuplicate?.(O));},[a]),hc=react.useCallback((D,O)=>{xe(V=>{let{tasks:Z,newTask:ne}=Il(V,D,O);return H&&H(ne)===false?V:(a.onTaskCreate?.(ne.parentId,ne.position||0),re?.(ne),Z)});},[a,H,re]),vc=react.useCallback((D,O)=>{xe(V=>Qn(V,D,O)),a.onTaskRename?.(D,O);},[a]),Zo=react.useCallback(D=>{xe(O=>{let{tasks:V}=ts(O,D);return a.onTaskCreate?.(D,0),V});},[a]),yc=react.useCallback((D,O,V)=>{let Z=D.startDate?Math.round((O.getTime()-D.startDate.getTime())/864e5):0,ne=Et=>Et.map(aa=>aa.id===D.id?{...aa,startDate:O,endDate:V,...D.segments&&{segments:D.segments}}:aa.subtasks?{...aa,subtasks:ne(aa.subtasks)}:aa),be=ne(de);be=Y.autoScheduleDependents(be,D.id,Z),xe(be);let gt={...D,startDate:O,endDate:V};x?.(gt);},[de,x]),xc=react.useCallback((D,O)=>{b?.(D,O),St({isOpen:true,x:O.clientX,y:O.clientY,task:D});},[b]),kc=react.useCallback((D,O)=>{let V=Y.splitTask(de,D.id,O);xe(V),St({isOpen:false,x:0,y:0,task:null});},[de]),ti=react.useCallback(D=>{N?.(D),A||pt(D);},[N,A]),ai=react.useCallback((D,O,V)=>{let Z=new Map,ne=ra=>{ra.forEach(Ta=>{Ta.dependencies&&Z.set(Ta.id,Ta.dependencies),Ta.subtasks&&ne(Ta.subtasks);});};ne(V);let be=Z.get(O)||[];Z.set(O,[...be,D]);let gt=new Set,Et=new Set,aa=ra=>{if(!gt.has(ra)){gt.add(ra),Et.add(ra);let Ta=Z.get(ra)||[];for(let Nr of Ta){if(!gt.has(Nr)&&aa(Nr))return true;if(Et.has(Nr))return true}}return Et.delete(ra),false};return aa(O)},[]),ri=react.useCallback((D,O)=>{if(ai(D.id,O,de)){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 V=Z=>Z.map(
|
|
278
|
+
Task dependencies must flow in one direction only.`);return}let V=Z=>Z.map(ne=>{if(ne.id===O){let be=ne.dependencies||[];if(!be.includes(D.id))return {...ne,dependencies:[...be,D.id]}}return ne.subtasks?{...ne,subtasks:V(ne.subtasks)}:ne});xe(V(de)),R?.(D.id,O);},[de,R,ai]),oi=react.useCallback((D,O)=>{let V=Z=>Z.map(ne=>{if(ne.id===D&&ne.dependencies){let be=ne.dependencies.filter(gt=>gt!==O);return {...ne,dependencies:be}}return ne.subtasks?{...ne,subtasks:V(ne.subtasks)}:ne});xe(V(de)),E?.(D,O);},[de,E]),{startDate:wc,endDate:Cc}=react.useMemo(()=>{let D=de.filter(be=>be.startDate&&be.endDate);if(D.length===0){let be=new Date,gt=new Date(be);gt.setDate(gt.getDate()-30);let Et=new Date(be);return Et.setDate(Et.getDate()+60),{startDate:gt,endDate:Et}}let O=D.flatMap(be=>[be.startDate,be.endDate]).filter(be=>be!==void 0),V=new Date(Math.min(...O.map(be=>be.getTime()))),Z=new Date(Math.max(...O.map(be=>be.getTime()))),ne=K==="day"?7:K==="week"?14:30;return V.setDate(V.getDate()-ne),Z.setDate(Z.getDate()+ne),{startDate:V,endDate:Z}},[de,K]),Tc=react.useCallback(async()=>{if(!pe.current)return;let D=await Jl__default.default(pe.current,{backgroundColor:X.bgPrimary,scale:2}),O=document.createElement("a");O.download="gantt-chart.png",O.href=D.toDataURL("image/png"),O.click();},[X]),Nc=react.useCallback(async()=>{await Y.exportToPDF(de);},[de]),Dc=react.useCallback(async()=>{await Y.exportToExcel(de);},[de]),Sc=react.useCallback(()=>{let D=Y.exportToCSV(de),O=new Blob([D],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(O),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[de]),Ec=react.useCallback(()=>{let D=Y.exportToJSON(de),O=new Blob([D],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(O),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[de]),Pc=react.useCallback(()=>{Y.exportToMSProject(de,"Gantt Project","project.xml");},[de]),Mc=D=>{D.preventDefault(),Jt(true);};return react.useEffect(()=>{let D=q.current,O=ge.current;if(!D||!O)return;let V=O.querySelector(".gantt-taskgrid-content"),Z=()=>{let gt=D.scrollTop;Ye(gt),V&&(V.style.transform=`translateY(-${gt}px)`);},ne=gt=>{if(Mt&&O){let aa=O.parentElement?.getBoundingClientRect()?.left||0,ra=gt.clientX-aa,Ta=280,Nr=Math.min(window.innerWidth-300,800);ra>=Ta&&ra<=Nr&&It(ra);}},be=()=>{Jt(false);};return D.addEventListener("scroll",Z),document.addEventListener("mousemove",ne),document.addEventListener("mouseup",be),()=>{D.removeEventListener("scroll",Z),document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",be);}},[Mt]),jsxRuntime.jsx(fr.Provider,{value:ut,children:jsxRuntime.jsx(rn.Provider,{value:L,children:jsxRuntime.jsxs("div",{ref:pe,className:"flex flex-col h-full w-full",style:{backgroundColor:X.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(vo,{theme:X,timeScale:K,onTimeScaleChange:j,zoom:Le,onZoomChange:fe,currentTheme:I,onThemeChange:Ca,rowDensity:le,onRowDensityChange:oe,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:k,onCreateTask:g,onExportPNG:s?Tc:void 0,onExportPDF:s?Nc:void 0,onExportExcel:s?Dc:void 0,onExportCSV:s?Sc:void 0,onExportJSON:s?Ec:void 0,onExportMSProject:s?Pc:void 0}),jsxRuntime.jsxs("div",{ref:ge,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:me,overflow:"hidden"},children:jsxRuntime.jsx(wo,{tasks:Ne,theme:X,rowHeight:qe,availableUsers:p,templates:J,onTaskClick:T,onTaskDblClick:ti,onTaskContextMenu:b,onTaskToggle:rr,scrollTop:Xe,columns:ke,onToggleColumn:ue,onColumnResize:Wa,onTaskUpdate:or,onTaskIndent:pc,onTaskOutdent:uc,onTaskMove:fc,onMultiTaskDelete:Jo,onTaskDuplicate:bc,onTaskCreate:hc,onTaskRename:vc,onCreateSubtask:Zo,onOpenTaskModal:T?D=>T(D):void 0,onDeleteRequest:(D,O)=>Lt({taskId:D,taskName:O}),onTaskReparent:gc})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Mc}),jsxRuntime.jsx("div",{ref:q,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Mo,{tasks:Ne,theme:X,rowHeight:qe,timeScale:K,startDate:wc,endDate:Cc,zoom:Le,templates:J,onTaskClick:T,onTaskDblClick:ti,onTaskContextMenu:xc,onTaskDateChange:yc,onDependencyCreate:ri,onDependencyDelete:oi})})]}),At.task&&jsxRuntime.jsx(br,{isOpen:At.isOpen,x:At.x,y:At.y,theme:X,onClose:()=>St({isOpen:false,x:0,y:0,task:null}),items:(()=>{let D=At.task;return D?D.subtasks&&D.subtasks.length>0?[{id:"addSubtask",label:ut.contextMenu?.addSubtask||"Add Subtask",icon:et.Add,onClick:()=>{C?C(D):Zo(D.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ut.contextMenu?.deleteTask||"Delete Task",icon:et.Delete,onClick:()=>{Lt({taskId:D.id,taskName:D.name});}}]:[{id:"edit",label:ut.contextMenu?.editTask||"Edit Task",icon:et.Pencil,onClick:()=>{A?A(D):pt(D);}},{id:"addSubtask",label:ut.contextMenu?.addSubtask||"Add Subtask",icon:et.Add,onClick:()=>{C?C(D):Zo(D.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ut.contextMenu?.markIncomplete||"Mark Incomplete",icon:et.MarkIncomplete,onClick:()=>{B?B(D):or(D.id,{status:"todo",progress:0});},disabled:D.status==="todo"},{id:"setInProgress",label:ut.contextMenu?.setInProgress||"Set In Progress",icon:et.SetInProgress,onClick:()=>{$?$(D):or(D.id,{status:"in-progress"});},disabled:D.status==="in-progress"},{id:"markComplete",label:ut.contextMenu?.markComplete||"Mark Complete",icon:et.MarkComplete,onClick:()=>{or(D.id,{status:"completed",progress:100});},disabled:D.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ut.contextMenu?.splitTask||"Split Task",icon:et.Split,onClick:()=>{if(!D.startDate||!D.endDate){console.warn("Cannot split task without dates");return}let V=D.startDate.getTime(),Z=D.endDate.getTime(),ne=V+(Z-V)/2,be=new Date(ne);kc(D,be);},disabled:!D.startDate||!D.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ut.contextMenu?.deleteTask||"Delete Task",icon:et.Delete,onClick:()=>{Lt({taskId:D.id,taskName:D.name});}}]:[]})()}),fa&&jsxRuntime.jsx(Io,{isOpen:true,onClose:()=>pt(null),task:fa,onSubmit:D=>{or(fa.id,D),pt(null);},mode:"edit",theme:I}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot&&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:()=>Lt(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:D=>D.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:X.bgSecondary,border:`1px solid ${X.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${X.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:X.textPrimary,fontFamily:"Inter, sans-serif"},children:[ut.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:X.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="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:X.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:X.textPrimary},children:['"',ot.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:X.bgPrimary,borderTop:`1px solid ${X.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Lt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:X.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=X.hoverBg;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Jo([ot.taskId]),Lt(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Ao,{tasks:de,theme:X,config:u,onTasksUpdate:xe,onTaskUpdate:or,onTaskCreate:D=>{xe(O=>[...O,D]);},onTaskDelete:D=>{Jo([D]);},onDependencyCreate:(D,O)=>{let V=Y.findTaskById(de,D);V&&ri(V,O);},onDependencyDelete:oi})]})})})});var Ql=`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
|
|
@@ -320,7 +320,7 @@ If ambiguous, ask for clarification in the message field.`;function ed(e){return
|
|
|
320
320
|
${td(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",n=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",d=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${n}, ${r.progress}%, ${r.status||"todo"}) ${d}`}).join(`
|
|
321
321
|
`)}
|
|
322
322
|
|
|
323
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function td(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Pa(e,t){let a=td(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let n=a.find(c=>c.name.toLowerCase().includes(r));if(n)return n;let d=r.split(/\s+/);return a.find(c=>{let m=c.name.toLowerCase();return d.every(s=>m.includes(s))})}function cs(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 l=new Date(r);return l.setDate(l.getDate()+1),l}if(a==="yesterday"||a==="ayer"){let l=new Date(r);return l.setDate(l.getDate()-1),l}if(a==="next week"||a==="la pr\xF3xima semana"){let l=new Date(r);return l.setDate(l.getDate()+7),l}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 y=new Date(r),v=y.getDay(),h=u-v;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let n=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(n&&n[1]&&n[2]){let l=parseInt(n[1],10),u=n[2].toLowerCase(),y=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?y.setDate(y.getDate()+l):u==="week"||u==="semana"||u==="semanas"?y.setDate(y.getDate()+l*7):(u==="month"||u==="mes"||u==="meses")&&y.setMonth(y.getMonth()+l),y}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 l=parseInt(c[1],10),u=parseInt(c[2],10)-1,y=parseInt(c[3],10);return new Date(y,u,l)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},s=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(s&&s[1]&&s[2]){let l=parseInt(s[1],10),u=m[s[2].toLowerCase()],y=s[3]?parseInt(s[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,l)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},i=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let l=p[i[1].toLowerCase()],u=parseInt(i[2],10),y=i[3]?parseInt(i[3],10):r.getFullYear();if(l!==void 0)return new Date(y,l,u)}return null}function ms(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 ps(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 ad(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 s=r[1].trim(),p=r[2].trim(),i=Pa(t,s),l=cs(p);if(!i)return {type:"move_task",taskName:s,message:`Could not find a task named "${s}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!l)return {type:"move_task",taskId:i.id,taskName:i.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=i.startDate&&i.endDate?Math.round((i.endDate.getTime()-i.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(l);return y.setDate(y.getDate()+u),{type:"move_task",taskId:i.id,taskName:i.name,updates:{startDate:l,endDate:y},message:`Moved "${i.name}" to ${l.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let s=o[1].trim(),p=o[2].trim(),i=Pa(t,s),l=ms(p);if(!i)return {type:"resize_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"};if(!l||!i.endDate)return {type:"resize_task",taskId:i.id,taskName:i.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let u=new Date(i.endDate);return u.setDate(u.getDate()+l),{type:"resize_task",taskId:i.id,taskName:i.name,updates:{endDate:u},message:`Extended "${i.name}" by ${l} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(n&&n[1]&&n[2]){let s=n[1].trim(),p=n[2].trim(),i=Pa(t,s),l=ps(p);return i?l===null?{type:"set_progress",taskId:i.id,taskName:i.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:i.id,taskName:i.name,updates:{progress:l},message:`Set "${i.name}" progress to ${l}%.`,success:true}:{type:"set_progress",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let d=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let s=d[1].trim(),p=d[2].trim(),i=Pa(t,s);return i?{type:"rename_task",taskId:i.id,taskName:i.name,updates:{name:p},message:`Renamed "${i.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:s,message:`Could not find a task named "${s}".`,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 s=c[1].trim(),p=c[2].trim(),i=Pa(t,s),l=Pa(t,p);return i?l?{type:"link_tasks",taskId:l.id,taskName:l.name,dependencyFrom:i.id,dependencyTo:l.id,message:`Linked "${i.name}" \u2192 "${l.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let s=m[1].trim(),p=Pa(t,s);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:s,message:`Could not find a task named "${s}".`,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 Kg(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 Yg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Fo(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let i=a.find(l=>l.id===p);return i?{name:i.name,initials:i.initials,color:i.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Fo(p,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let d=p=>{if(p)return typeof p=="string"?new Date(p):p},c=d(e.startDate),m=d(e.endDate),s=e.metadata?.isMilestone===true||c&&m&&Math.abs(m.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:m,progress:e.progress||0,status:Kg(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:n?.length?n:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:s,isCriticalPath:e.metadata?.isCriticalPath===true}}function nd(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(n=>n.name===r.name||n.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:Yg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function sd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Fo(r,e,t))}var us={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"}},gs={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"}},Bo={en:us,es:gs};function fs(e){return Bo[e]||Bo.en}function Ro(e,t){let a=fs(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 cd(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(...cd(r.subtasks,t+1));return a}function nf({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 md({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:d}){let{theme:c="dark",locale:m="en",customTranslations:s,showSearch:p=true,showHierarchy:i=true}=t,l=Ro(m,s),u=c==="dark",[y,v]=react.useState(new Set),[h,k]=react.useState("startDate"),[g,f]=react.useState("asc"),[T,N]=react.useState("");react.useMemo(()=>{let C=new Set;function B($){for(let R of $)R.subtasks?.length&&(C.add(R.id),B(R.subtasks));}B(e),v(C);},[e]);let b=react.useCallback(C=>{v(B=>{let $=new Set(B);return $.has(C)?$.delete(C):$.add(C),$}),a.onTaskToggleExpand?.(C);},[a]),x=react.useCallback(C=>{h===C?f(B=>B==="asc"?"desc":"asc"):(k(C),f("asc")),a.onSortChange?.({column:C,direction:g==="asc"?"desc":"asc"});},[h,g,a]),w=react.useMemo(()=>{let C=cd(e);if(T.trim()){let $=T.toLowerCase();C=C.filter(R=>R.name.toLowerCase().includes($));}let B=[];for(let $ of C){let R=$.level===0;$.level>0&&(R=true),(R||T.trim())&&B.push($);}return T.trim()&&B.sort(($,R)=>{let E,H;switch(h){case "name":E=$.name.toLowerCase(),H=R.name.toLowerCase();break;case "startDate":E=$.startDate?.getTime()||0,H=R.startDate?.getTime()||0;break;case "endDate":E=$.endDate?.getTime()||0,H=R.endDate?.getTime()||0;break;case "progress":E=$.progress||0,H=R.progress||0;break;case "status":E=$.status||"todo",H=R.status||"todo";break;default:return 0}return E<H?g==="asc"?-1:1:E>H?g==="asc"?1:-1:0}),B},[e,T,h,g]),A=C=>C?(C instanceof Date?C:new Date(C)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[l.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:S("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:S("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:l.empty.noTasks}),jsxRuntime.jsx("p",{className:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:S("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",n),style:d,children:[jsxRuntime.jsx("div",{className:S("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:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:S("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:T,onChange:C=>N(C.target.value),placeholder:l.toolbar.searchPlaceholder,className:S("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:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",l.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:S("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:()=>x("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w.map((C,B)=>{let $=y.has(C.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:B*.02},className:S("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:i?`${24+C.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(C),onDoubleClick:()=>a.onTaskDoubleClick?.(C),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[i&&C.hasChildren&&jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),b(C.id);},className:S("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:$?jsxRuntime.jsx(lucideReact.ChevronDown,{className:S("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:S("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),i&&!C.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),a.onTaskUpdate?.({...C,progress:C.progress===100?0:100,status:C.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(nf,{status:C.status,progress:C.progress})}),jsxRuntime.jsx("span",{className:S("truncate",u?"text-white":"text-gray-900",C.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:C.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:S("px-2 py-1 rounded-full text-xs font-medium",C.progress===100||C.status==="completed"?"bg-green-500/10 text-green-500":C.progress&&C.progress>0||C.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:C.progress===100||C.status==="completed"?l.status.completed:C.progress&&C.progress>0||C.status==="in-progress"?l.status.inProgress:l.status.todo})}),jsxRuntime.jsxs("div",{className:S("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"}),A(C.startDate)]}),jsxRuntime.jsxs("div",{className:S("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"}),A(C.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:S("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:S("h-full rounded-full transition-all",C.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${C.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:S("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[C.progress||0,"%"]})]})})]},C.id)})}),w.length===0&&T&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:S("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:S(u?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.noResults})]})})]})]})}var bs={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"},hs={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"},vs={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"},$o={dark:bs,light:hs,neutral:vs};function pd(e){return $o[e]||$o.dark}var ys={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"}},xs={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"}},zo={en:ys,es:xs};function _r(e){return zo[e]||zo.en}function Uo(e,t){let a=_r(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 ud(e){let t=_r(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 gd(e,t=0,a=true){let r=_r(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 yf(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 Ts(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 hd({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 yd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:d,style:c}){let{theme:m="dark",locale:s="en",customTranslations:p}=t,i=Uo(s,p),l=m==="dark",[u,y]=react.useState(r||new Date),[v,h]=react.useState(null),[k,g]=react.useState(null),[f,T]=react.useState(null),[N,b]=react.useState(new Date),x=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),w=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),A=react.useCallback(()=>{y(new Date);},[]),C=react.useMemo(()=>{let E=u.getFullYear(),H=u.getMonth(),re=new Date(E,H,1),oe=new Date(E,H+1,0),Ae=re.getDay(),Se=oe.getDate(),ce=yf(e),P=new Date;P.setHours(0,0,0,0);let M=[],I=Ae,_=new Date(E,H,0).getDate();for(let j=I-1;j>=0;j--){let le=new Date(E,H-1,_-j);M.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:ce.filter(ne=>Ts(le,ne)).map(ne=>({id:ne.id,title:ne.name,start:ne.startDate,end:ne.endDate,task:ne}))});}for(let j=1;j<=Se;j++){let le=new Date(E,H,j),ne=le.getTime()===P.getTime();M.push({date:le,isCurrentMonth:true,isToday:ne,isWeekend:le.getDay()===0||le.getDay()===6,events:ce.filter(Le=>Ts(le,Le)).map(Le=>({id:Le.id,title:Le.name,start:Le.startDate,end:Le.endDate,task:Le}))});}let K=42-M.length;for(let j=1;j<=K;j++){let le=new Date(E,H+1,j);M.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:ce.filter(ne=>Ts(le,ne)).map(ne=>({id:ne.id,title:ne.name,start:ne.startDate,end:ne.endDate,task:ne}))});}return M},[u,e]),B=s==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],$=u.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),R=react.useCallback(E=>{let H=E.progress===100?0:100,re=H===100?"completed":"todo";a.onTaskUpdate?.({...E,status:re,progress:H});},[a]);return o?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",d),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:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[i.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",d),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:S("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",d),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:S("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:i.labels.noEvents}),jsxRuntime.jsx("p",{className:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:i.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:S("flex-1 flex flex-col w-full h-full overflow-hidden",l?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsxRuntime.jsx("div",{className:S("flex-shrink-0 px-6 py-4 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:S("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:$}),jsxRuntime.jsx("button",{onClick:A,className:S("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:i.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:x,className:S("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:S("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:w,className:S("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:S("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 overflow-auto",children:jsxRuntime.jsxs("div",{className:"h-full flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:B.map(E=>jsxRuntime.jsx("div",{className:S("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:E},E))}),jsxRuntime.jsx("div",{className:S("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",l?"bg-white/5":"bg-gray-200"),children:C.map((E,H)=>{let re=E.date.getDay()===0||E.date.getDay()===6;return jsxRuntime.jsxs("div",{className:S("min-h-[100px] p-2 transition-colors flex flex-col relative",l?re?"bg-[#1A1D21]":E.isCurrentMonth?"bg-[#0F1117]":"bg-[#0A0C10]":re?"bg-gray-100":E.isCurrentMonth?"bg-white":"bg-gray-50",E.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsxs("div",{className:"space-y-1 overflow-hidden flex-1",children:[E.events.slice(0,3).map(oe=>jsxRuntime.jsxs("div",{className:"relative group",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{h(oe.task),a.onEventClick?.(oe);},whileHover:{scale:1.02},className:S("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",oe.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(hd,{task:oe.task}),jsxRuntime.jsx("span",{className:"truncate",children:oe.title})]}),jsxRuntime.jsx("div",{className:S("absolute left-0 bottom-full mb-1 px-2 py-1 rounded text-xs whitespace-nowrap z-50 opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity shadow-lg",l?"bg-[#1A1D25] text-white border border-white/10":"bg-gray-900 text-white"),children:oe.title})]},oe.id)),E.events.length>3&&jsxRuntime.jsxs("button",{onClick:oe=>{oe.stopPropagation(),g(E);},className:S("text-xs px-1.5 hover:underline cursor-pointer",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",E.events.length-3," ",s==="es"?"m\xE1s":"more"]})]}),jsxRuntime.jsx("div",{className:S("text-sm font-medium mt-1 text-right",E.isToday?"text-[#3B82F6]":E.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:E.date.getDate()})]},H)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(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:S("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:S("px-6 py-4 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:S("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:s==="es"?"Tarea":"Task"}),jsxRuntime.jsx("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:v.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:S("p-1.5 rounded hover:bg-white/10",l?"text-[#9CA3AF]":"text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:S("p-1.5 rounded hover:bg-white/10",l?"text-[#9CA3AF]":"text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsx("h2",{className:S("text-xl font-semibold",l?"text-white":"text-gray-900"),children:v.name})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Estado":"Status"}),jsxRuntime.jsx("span",{className:S("text-xs px-2 py-1 rounded font-medium",v.progress===100?"bg-green-500/20 text-green-400":v.progress&&v.progress>0?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.progress===100?s==="es"?"COMPLETADO":"DONE":v.progress&&v.progress>0?s==="es"?"EN PROGRESO":"IN PROGRESS":s==="es"?"POR HACER":"TO DO"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Asignados":"Assignees"}),v.assignees&&v.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[v.assignees.slice(0,3).map((E,H)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full bg-purple-500 flex items-center justify-center text-white text-xs font-medium",title:E.name,children:E.name.charAt(0).toUpperCase()},H)),v.assignees.length>3&&jsxRuntime.jsxs("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:S("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{T(f?null:"start"),b(v.startDate||new Date);},className:S("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[v.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:S("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),v.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Fin":"End"),(v.startDate||v.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:E=>{E.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:S("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:S("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[[{label:s==="es"?"Hoy":"Today",days:0,weekday:new Date().toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:s==="es"?"M\xE1s tarde":"Later today",time:"11:10 am"},{label:s==="es"?"Ma\xF1ana":"Tomorrow",days:1,weekday:new Date(Date.now()+864e5).toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:s==="es"?"Este fin de semana":"This weekend",weekday:s==="es"?"s\xE1b.":"sat."},{label:s==="es"?"Pr\xF3xima semana":"Next week",weekday:s==="es"?"lun.":"mon."},{label:s==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:(()=>{let E=new Date;return E.setDate(E.getDate()+(6-E.getDay()+7)%7+7),E.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})()},{label:s==="es"?"2 semanas":"2 weeks",date:(()=>{let E=new Date;return E.setDate(E.getDate()+14),E.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})()},{label:s==="es"?"4 semanas":"4 weeks",date:(()=>{let E=new Date;return E.setDate(E.getDate()+28),E.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})()}].map((E,H)=>jsxRuntime.jsxs("button",{className:S("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{T(null);},children:[jsxRuntime.jsx("span",{children:E.label}),jsxRuntime.jsx("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E.weekday||E.time||E.date})]},H)),jsxRuntime.jsx("div",{className:S("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{className:S("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),children:[jsxRuntime.jsx("span",{children:s==="es"?"Establecer como recurrente":"Set recurring"}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:S("font-medium",l?"text-white":"text-gray-900"),children:N.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{className:S("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:s==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(N.getFullYear(),N.getMonth()-1)),className:S("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(N.getFullYear(),N.getMonth()+1)),className:S("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(s==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:S("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let E=N.getFullYear(),H=N.getMonth(),re=new Date(E,H,1).getDay(),oe=new Date(E,H+1,0).getDate(),Ae=new Date(E,H,0).getDate(),Se=new Date,ce=[];for(let M=re-1;M>=0;M--)ce.push({day:Ae-M,isCurrentMonth:false,date:new Date(E,H-1,Ae-M)});for(let M=1;M<=oe;M++)ce.push({day:M,isCurrentMonth:true,date:new Date(E,H,M)});let P=42-ce.length;for(let M=1;M<=P;M++)ce.push({day:M,isCurrentMonth:false,date:new Date(E,H+1,M)});return ce.map((M,I)=>{let _=M.date.toDateString()===Se.toDateString(),K=v.startDate?.toDateString()===M.date.toDateString()||v.endDate?.toDateString()===M.date.toDateString(),j=v.startDate&&v.endDate&&M.date>=v.startDate&&M.date<=v.endDate;return jsxRuntime.jsx("button",{className:S("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!M.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),M.isCurrentMonth&&(l?"text-white":"text-gray-900"),_&&"ring-2 ring-[#3B82F6]",K&&"bg-[#7C3AED] text-white",j&&!K&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!K&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{T(null);},children:M.day},I)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Flag,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("span",{className:S("text-xs px-2 py-1 rounded font-medium",v.priority==="high"||v.priority==="urgent"?"bg-red-500/20 text-red-400":v.priority==="medium"?"bg-yellow-500/20 text-yellow-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:v.priority?v.priority==="high"||v.priority==="urgent"?s==="es"?"Urgente":"Urgent":v.priority==="medium"?s==="es"?"Media":"Medium":s==="es"?"Baja":"Low":s==="es"?"Sin prioridad":"No priority"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"text-white":"text-gray-900"),children:v.startDate&&v.endDate?`${Math.ceil((v.endDate.getTime()-v.startDate.getTime())/(1e3*60*60*24))} ${s==="es"?"d\xEDas":"days"}`:s==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:S("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[jsxRuntime.jsx("div",{className:S("flex-1 h-2 rounded-full overflow-hidden max-w-[120px]",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:S("h-full rounded-full transition-all",v.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${v.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:S("text-sm font-medium",l?"text-white":"text-gray-900"),children:[v.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:v.dependencies&&v.dependencies.length>0?`${v.dependencies.length} ${s==="es"?"dependencias":"dependencies"}`:s==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:S("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm font-medium",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("div",{className:S("min-h-[60px] p-3 rounded-lg text-sm",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-50 text-gray-600"),children:v.description||(s==="es"?"Sin descripci\xF3n":"No description")})]}),v.subtasks&&v.subtasks.length>0&&jsxRuntime.jsxs("div",{className:S("mt-4 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("span",{className:S("text-sm font-medium",l?"text-[#9CA3AF]":"text-gray-500"),children:[s==="es"?"Subtareas":"Subtasks"," (",v.subtasks.length,")"]})]}),jsxRuntime.jsx("div",{className:"space-y-2",children:v.subtasks.slice(0,5).map(E=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:S("w-4 h-4 rounded border flex items-center justify-center",E.progress===100?"bg-green-500 border-green-500":l?"border-white/20":"border-gray-300"),children:E.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:S("text-sm",E.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:E.name})]},E.id))})]})]}),jsxRuntime.jsx("div",{className:S("px-6 py-4 border-t flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("button",{onClick:()=>{R(v),h(null);},className:S("px-4 py-2 rounded-lg font-medium transition-colors",v.progress===100?"bg-gray-500/10 text-gray-500 hover:bg-gray-500/20":"bg-green-500/10 text-green-500 hover:bg-green-500/20"),children:v.progress===100?s==="es"?"Reabrir tarea":"Reopen task":s==="es"?"Completar tarea":"Complete task"})})]}),jsxRuntime.jsxs("div",{className:S("w-[280px] border-l flex flex-col",l?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:S("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:S("font-medium",l?"text-white":"text-gray-900"),children:s==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:S("text-sm text-center py-8",l?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),s==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:S("p-3 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:S("flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:s==="es"?"Escribe un comentario...":"Write a comment...",className:S("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>g(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:S("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:S("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:S("font-medium",l?"text-white":"text-gray-900"),children:k.date.toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>g(null),className:S("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:k.events.map(E=>jsxRuntime.jsxs("button",{onClick:()=>{g(null),h(E.task);},className:S("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(hd,{task:E.task}),jsxRuntime.jsx("span",{className:S("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:E.title}),E.task.priority==="high"||E.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},E.id))})]})]})})]})}var Ns={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"},Ds={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"},Ss={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"},Ho={dark:Ns,light:Ds,neutral:Ss};function xd(e){return Ho[e]||Ho.dark}function kf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:d,className:c}){let[m,s]=react.useState(false),p=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),i=react.useMemo(()=>{let u=p.length,y=new Set(p.flatMap(k=>k.assignedUserIds||[])).size,v=p.map(k=>k.priority).filter(Boolean),h=new Set(p.flatMap(k=>k.labels||[])).size;return {totalCards:u,uniqueAssignees:y,priorities:v,labels:h}},[p]),l=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:S("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:l,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:S("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:i.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),d?.(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:[i.uniqueAssignees," assignees"]})]}),i.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:[i.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(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:y=>{y.stopPropagation(),n?.(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 wd={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function jr(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 Kr(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 Cd(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 Td({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:d,className:c}){let m=react.useMemo(()=>({...wd,...d}),[d]),[s,p]=react.useState(new Set),i=react.useRef(null),l=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let g=new Map;return e.forEach(f=>{let T=f.timestamp.toISOString().split("T")[0],N=g.get(T);N?N.push(f):g.set(T,[f]);}),Array.from(g.entries()).sort((f,T)=>T[0].localeCompare(f[0])).map(([f,T])=>({date:new Date(f),events:T.sort((N,b)=>b.timestamp.getTime()-N.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:u,uniqueTypes:y}=react.useMemo(()=>{let g=new Set,f=new Set;return e.forEach(T=>{g.add(T.userId),f.add(T.type);}),{uniqueUsers:Array.from(g),uniqueTypes:Array.from(f)}},[e]),v=g=>{p(f=>{let T=new Set(f);return T.has(g)?T.delete(g):T.add(g),T});},h=g=>{let T=new Date().getTime()-g.getTime(),N=Math.floor(T/6e4),b=Math.floor(T/36e5),x=Math.floor(T/864e5);return N<1?"just now":N<60?`${N}m ago`:b<24?`${b}h ago`:x<7?`${x}d ago`:g.toLocaleDateString()},k=react.useMemo(()=>{let g=0;return t.types&&t.types.length>0&&g++,t.users&&t.users.length>0&&g++,t.dateRange&&g++,t.searchTerm&&g++,g},[t]);return react.useEffect(()=>{if(n&&i.current){let g=i.current.querySelector(`[data-event-id="${n}"]`);g&&g.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:S("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:S("history-timeline",m.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:g=>{let f=g.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(g=>jsxRuntime.jsxs("option",{value:g,children:[Kr(g)," ",g.replace("_"," ")]},g))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:g=>{let f=g.target.value;a({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(g=>jsxRuntime.jsx("option",{value:g,children:g},g))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:g=>a({...t,searchTerm:g.target.value})})]}),k>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",k,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:i,children:l.map(g=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&g.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:g.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[g.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:g.events.map((f,T)=>{let N=s.has(f.id),b=n===f.id,x=Cd(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:S("history-timeline-event",N&&"expanded",b&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:x},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Kr(f.type)})}),T<g.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:x}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&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:jr(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?h(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),v(f.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([w,A])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(A.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(A.to)})]})]},w)),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(([w,A])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(A)})]},w))]})]})]})]},f.id)})})]},g.date?.toISOString()||"all"))})]})}function Dd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:d,onGoToEvent:c,onSpeedChange:m,className:s}){let p=[.5,1,1.5,2,3],i=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),l=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:S("history-replay-empty",s),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:S("history-replay",s),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:i&&Kr(i.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:i&&jr(i)}),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:i&&i.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:`${l}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,y)=>jsxRuntime.jsx("div",{className:S("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>c(y),title:jr(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,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:d,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(u=>jsxRuntime.jsxs("button",{className:S("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>m(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:i&&i.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:S("history-replay-start",s),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 Es(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 Ps(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 Sd(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 Ed(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Sf(e,t,a,r,o,n=100){let d=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(d.map(m=>[m.id,m]));for(let m=0;m<n;m++){let s=1-m/n;d.forEach(p=>{let i=a/2,l=r/2;p.vx+=(i-p.x)*o.centerForce*s,p.vy+=(l-p.y)*o.centerForce*s,d.forEach(u=>{if(p.id===u.id)return;let y=p.x-u.x,v=p.y-u.y,h=Math.sqrt(y*y+v*v)||1,k=o.chargeStrength*s/(h*h);p.vx+=y/h*k,p.vy+=v/h*k;});}),t.forEach(p=>{let i=c.get(typeof p.source=="string"?p.source:p.source.id),l=c.get(typeof p.target=="string"?p.target:p.target.id);if(!i||!l)return;let u=l.x-i.x,y=l.y-i.y,v=Math.sqrt(u*u+y*y)||1,h=(v-o.linkDistance)/v*o.forceStrength*s;i.vx+=u*h,i.vy+=y*h,l.vx-=u*h,l.vy-=y*h;}),d.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return d}function Pd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:d,onInteraction:c,className:m}){let s=react.useRef(null),[p,i]=react.useState([]),[l,u]=react.useState(null),[y,v]=react.useState(null),[h,k]=react.useState(null),[g,f]=react.useState(1),[T,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let R=Sf(e,t,a.width,a.height,a,150);i(R);},[e,t,a]);let b=react.useCallback((R,E)=>{a.enableDragging&&(E.stopPropagation(),u(R));},[a.enableDragging]),x=react.useCallback(R=>{if(!l||!s.current)return;let H=s.current.getBoundingClientRect(),re=(R.clientX-H.left-T.x)/g,oe=(R.clientY-H.top-T.y)/g;i(Ae=>Ae.map(Se=>Se.id===l?{...Se,x:re,y:oe,fx:re,fy:oe}:Se));},[l,g,T]),w=react.useCallback(()=>{u(null);},[]),A=react.useCallback((R,E)=>{E.stopPropagation(),c?.({type:"node-click",node:R,position:{x:E.clientX,y:E.clientY}});},[c]),C=react.useCallback((R,E)=>{E.stopPropagation(),c?.({type:"edge-click",edge:R,position:{x:E.clientX,y:E.clientY}});},[c]),B=react.useCallback(R=>{let E=p.find(H=>H.id===R);return E?{x:E.x,y:E.y}:{x:0,y:0}},[p]),$=react.useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let E=R.card.priority;return E==="URGENT"?"#ef4444":E==="HIGH"?"#f59e0b":E==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:S("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:S("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:d.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:d.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),n&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.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(R=>Math.min(R+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(g*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Es(R)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Sd(R)," ",Ps(R)]})]},R))}),jsxRuntime.jsxs("svg",{ref:s,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:x,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${T.x}, ${T.y}) scale(${g})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let E=B(typeof R.source=="string"?R.source:R.source.id),H=B(typeof R.target=="string"?R.target:R.target.id),re=Ed(R.type),oe=h===R.id,Ae=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:S("relationships-graph-edge",oe&&"hovered",Ae&&"critical"),onMouseEnter:()=>k(R.id),onMouseLeave:()=>k(null),onClick:Se=>C(R,Se),children:[jsxRuntime.jsx("line",{x1:E.x,y1:E.y,x2:H.x,y2:H.y,stroke:Es(R.type),strokeWidth:Ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:oe?1:.6,markerEnd:re?"url(#arrowhead)":void 0}),a.showEdgeLabels&&oe&&jsxRuntime.jsx("text",{x:(E.x+H.x)/2,y:(E.y+H.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ps(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(R=>{let E=y===R.id,H=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:S("relationships-graph-node",E&&"hovered",H&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:re=>b(R.id,re),onMouseEnter:()=>v(R.id),onMouseLeave:()=>v(null),onClick:re=>A(R,re),children:[jsxRuntime.jsx("circle",{r:H?a.nodeSize*1.2:a.nodeSize,fill:$(R),stroke:H?"#fbbf24":"#ffffff",strokeWidth:H?3:2,opacity:E?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.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 Ad({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,d]=react.useState(""),[c,m]=react.useState(false),[s,p]=react.useState(null),[i,l]=react.useState(null),u=react.useRef(null),y=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let g=f=>{f.key==="Escape"&&!y&&v();};if(e)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,y]);let v=()=>{y||(d(""),p(null),l(null),t());},h=async()=>{if(!(!n.trim()||y)){m(true),p(null),l(null);try{let g=await r(n.trim());l(g);}catch(g){p(g instanceof Error?g.message:"Failed to generate plan");}finally{m(false);}}},k=()=>{i&&(a(i),v());};return e?jsxRuntime.jsxs(Ue,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:g=>g.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:v,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:i?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!"})]}),i.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:i.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",i.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:i.columns.map((g,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:g.title},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",i.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[i.cards.slice(0,10).map((g,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:g.title}),g.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:g.description})]}),g.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${g.priority==="URGENT"?"bg-red-500/20 text-red-400":g.priority==="HIGH"?"bg-orange-500/20 text-orange-400":g.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:g.priority})]})},f)),i.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",i.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:n,onChange:g=>d(g.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),s&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:s}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((g,f)=>jsxRuntime.jsx("button",{onClick:()=>d(g),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:g},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:v,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),i?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!n.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Ms={"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 Pf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Mf={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 If(e,t,a){let r=Ms[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function Yr(e){return `$${e.toFixed(4)}`}var Is=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=If(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(i=>i.timestamp>=t.start&&i.timestamp<=t.end));let r=a.length,o=a.reduce((i,l)=>i+l.cost,0),n=a.reduce((i,l)=>i+l.inputTokens,0),d=a.reduce((i,l)=>i+l.outputTokens,0),c=a.filter(i=>i.success),m=a.reduce((i,l)=>i+l.duration,0),s={},p={};return a.forEach(i=>{s[i.feature]=(s[i.feature]||0)+1,p[i.feature]=(p[i.feature]||0)+i.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:d,operationsByFeature:s,costsByFeature:p,averageDuration:r>0?m/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],n=new Date,d=new Date;a==="month"?d.setMonth(n.getMonth()-1):d.setDate(n.getDate()-1);let c=this.operations.filter(p=>p.timestamp>=d).length,m=Math.max(0,o-c),s=c/o*100;return {used:c,limit:o,remaining:m,percentUsed:s,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)}},Qa=new Is;function Bd({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Qa.getStats()),[n,d]=react.useState(Qa.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Qa.getStats()),d(Qa.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=s=>{s.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let c=Qa.getRecentOperations(5);return jsxRuntime.jsxs(Ue,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[n.used," / ",n.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,n.percentUsed)}%`,background:n.percentUsed>90?"#EF4444":n.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[n.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:Yr(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,s])=>{let p=r.costsByFeature[m]||0,i=r.totalOperations>0?s/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[s," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Yr(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${i}%`}})})]},m)})})]}),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(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Yr(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function $d({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[d,c]=react.useState(""),[m,s]=react.useState(""),[p,i]=react.useState(""),[l,u]=react.useState(false),[y,v]=react.useState(null),[h,k]=react.useState(null),[g,f]=react.useState(null),T=react.useRef(null),N=l||o;react.useEffect(()=>{e&&T.current&&T.current.focus();},[e]),react.useEffect(()=>{let C=B=>{B.key==="Escape"&&!N&&b();};if(e)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,N]);let b=()=>{N||(c(""),s(""),i(""),v(null),k(null),f(null),t());},x=async()=>{if(!(!d.trim()||N)){u(true),v(null),k(null),f(null);try{let C=await r({prompt:d.trim(),projectName:n||"Mi Proyecto",startDate:m||void 0,endDate:p||void 0});k(C.tasks.tasks),f({from_cache:C.from_cache,tokens_used:C.tokens_used,mock_mode:C.mock_mode,similarity:C.similarity,tokens_saved:C.tokens_saved});}catch(C){v(C instanceof Error?C.message:"Failed to generate tasks");}finally{u(false);}}},w=()=>{h&&(a(h),b());};if(!e)return null;let A=g?.similarity?((g.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ue,{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-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:C=>C.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:b,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[g?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),g?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",A,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[g?.tokens_used||0," tokens"]}),g?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[g.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((C,B)=>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:["#",B+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:C.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"})]}),C.start," \u2192 ",C.end]}),jsxRuntime.jsxs("span",{children:[C.duration," days"]}),C.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",C.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${C.priority==="high"?"bg-red-500/20 text-red-400":C.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:C.priority})]})},C.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:T,value:d,onChange:C=>c(C.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:C=>s(C.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:C=>i(C.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((C,B)=>jsxRuntime.jsx("button",{onClick:()=>c(C),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:C},B))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:x,disabled:!d.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function jo({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&ao(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(k,g,f)=>{console.warn(`Retry attempt ${g} after ${f}ms: ${k.message}`);}}).then(k=>{k.success||console.error(`Failed to persist board after ${k.attempts} attempts:`,k.error);});},[t]),n=react.useCallback(async(h,k,g)=>{r(f=>{let T=f.cards.find(C=>C.id===h);if(!T)return f;let N=T.columnId,b={...T,columnId:k,position:g},x=f.cards.map(C=>C.id===h?b:C),w=f.columns.map(C=>{if(C.id===N)return {...C,cardIds:C.cardIds.filter(B=>B!==h)};if(C.id===k){let B=x.filter($=>$.columnId===k).sort(($,R)=>$.position-R.position);return {...C,cardIds:B.map($=>$.id)}}return C}),A={...f,cards:x,columns:w};return o(A),A});},[o]),d=react.useCallback(async(h,k)=>{r(g=>{let f=g.cards.map(N=>N.id===h?{...N,...k}:N),T={...g,cards:f};return o(T),T});},[o]),c=react.useCallback(async h=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let f={...h,id:k},T=g.columns.map(b=>b.id===h.columnId?{...b,cardIds:[...b.cardIds,k]}:b),N={...g,cards:[...g.cards,f],columns:T};return o(N),N});},[o]),m=react.useCallback(async h=>{r(k=>{let g=k.cards.find(b=>b.id===h);if(!g)return k;let f=k.cards.filter(b=>b.id!==h),T=k.columns.map(b=>b.id===g.columnId?{...b,cardIds:b.cardIds.filter(x=>x!==h)}:b),N={...k,cards:f,columns:T};return o(N),N});},[o]),s=react.useCallback(async h=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let f={...h,id:k,cardIds:[]},T={...g,columns:[...g.columns,f]};return o(T),T});},[o]),p=react.useCallback(async(h,k)=>{r(g=>{let f=g.columns.map(N=>N.id===h?{...N,...k}:N),T={...g,columns:f};return o(T),T});},[o]),i=react.useCallback(async h=>{r(k=>{let g=k.cards.filter(N=>N.columnId!==h),f=k.columns.filter(N=>N.id!==h),T={...k,cards:g,columns:f};return o(T),T});},[o]),l=react.useCallback(h=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),k},[c]),u=react.useCallback(h=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return s(h),k},[s]),y=react.useCallback(()=>{r(h=>{let k={...h,cards:[],columns:[]};return o(k),k});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:d,onCardCreate:c,onCardDelete:m,onColumnCreate:s,onColumnUpdate:p,onColumnDelete:i},setBoard:r,helpers:{addCard:l,addColumn:u,deleteCard:m,deleteColumn:i,clearBoard:y}}}function Ud({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=jo({initialBoard:e,onPersist:a}),d=react.useMemo(()=>({addCard:(m,s,p={})=>{n.addCard({title:s,columnId:m,position:r.cards.filter(i=>i.columnId===m).length,...p});},addColumn:(m,s)=>{let p=r.columns.length>0?Math.max(...r.columns.map(i=>i.position)):0;n.addColumn({title:m,position:s??p+1e3});},reset:n.clearBoard}),[r.cards,r.columns,n]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:d}}var qr={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Gd={by:"none",order:"asc"};function Hd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...qr,...e}),[n,d]=react.useState({...Gd,...t}),c=react.useCallback(v=>{o(h=>({...h,...v}));},[]),m=react.useCallback(v=>{d(h=>({...h,...v}));},[]),s=react.useCallback(()=>{o(qr),d(Gd);},[]),p=react.useCallback(()=>{a&&o({...qr,assignees:[a]});},[a]),i=react.useCallback(()=>{o({...qr,dateFilter:"overdue"});},[]),l=react.useCallback(()=>{o({...qr,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!==""||n.by!=="none",[r,n]),y=react.useCallback(v=>{let h=[...v];if(r.search){let k=r.search.toLowerCase();h=h.filter(g=>g.title.toLowerCase().includes(k)||g.description?.toLowerCase().includes(k));}if(r.dateFilter!=="all"){let k=new Date,g=k.getFullYear(),f=String(k.getMonth()+1).padStart(2,"0"),T=String(k.getDate()).padStart(2,"0"),N=`${g}-${f}-${T}`;h=h.filter(b=>{if(!b.endDate&&!b.dueDate)return false;let x=b.endDate||b.dueDate;if(!x)return false;let w;if(typeof x=="string")w=x.split("T")[0]||x;else {let A=x.getUTCFullYear(),C=String(x.getUTCMonth()+1).padStart(2,"0"),B=String(x.getUTCDate()).padStart(2,"0");w=`${A}-${C}-${B}`;}switch(r.dateFilter){case "overdue":return w<N;case "today":return w===N;case "this-week":let A=new Date(N+"T00:00:00"),C=new Date(w+"T00:00:00"),B=new Date(A);return B.setDate(B.getDate()+7),C>=A&&C<=B;case "custom":if(r.dateRange){let $=typeof x=="string"?new Date(x):x;return $>=r.dateRange.start&&$<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(k=>k.priority&&r.priorities.includes(k.priority))),r.assignees.length>0&&(h=h.filter(k=>(k.assignedUserIds||(k.assigneeId?[k.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(h=h.filter(k=>k.labels&&k.labels.some(g=>r.labels.includes(g)))),r.columns.length>0&&(h=h.filter(k=>r.columns.includes(k.columnId))),n.by!=="none"&&h.sort((k,g)=>{let f=0;switch(n.by){case "created":let T=k.createdAt?new Date(k.createdAt).getTime():0,N=g.createdAt?new Date(g.createdAt).getTime():0;f=T-N;break;case "priority":let b={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},x=b[k.priority||"LOW"],w=b[g.priority||"LOW"];f=x-w;break;case "dueDate":let A=k.endDate||k.dueDate,C=g.endDate||g.dueDate;if(!A)return 1;if(!C)return -1;let B=typeof A=="string"?new Date(A).getTime():A.getTime(),$=typeof C=="string"?new Date(C).getTime():C.getTime();f=B-$;break;case "title":f=k.title.localeCompare(g.title);break;case "estimate":let R=k.estimatedTime||0,E=g.estimatedTime||0;f=R-E;break;default:f=0;}return n.order==="asc"?f:-f}),h},[r,n]);return {filters:r,sort:n,setFilters:c,setSort:m,resetFilters:s,filterMyTasks:p,filterOverdue:i,filterHighPriority:l,applyFilters:y,hasActiveFilters:u}}var Vd,jd;if(typeof window<"u")try{let e=Qr("ai");Vd=e.generateObject,jd=e.generateText;}catch{}function Kd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(Vd&&jd&&e.apiKey),d=react.useCallback(async i=>{if(!n)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:",i),{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: ${i}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(l){let u=l instanceof Error?l:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[n]),c=react.useCallback(async i=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",i.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(l){let u=l instanceof Error?l:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[n]),m=react.useCallback(async i=>{if(!n)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(l){let u=l instanceof Error?l:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[n]),s=react.useCallback(async i=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",i.title),[{title:`Subtask 1 for: ${i.title}`,position:i.position+.1,columnId:i.columnId},{title:`Subtask 2 for: ${i.title}`,position:i.position+.2,columnId:i.columnId}]}catch(l){let u=l instanceof Error?l:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[n]),p=react.useCallback(async i=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",i.title),{hours:8,confidence:.75}}catch(l){let u=l instanceof Error?l:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[n]);return {onGeneratePlan:d,onSuggestAssignee:c,onPredictRisks:m,onGenerateSubtasks:s,onEstimateEffort:p,isAvailable:n,isLoading:t,error:r}}function Ls(){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 Yd(e){let{cards:t}=e,[a,r]=Ls(),o=react.useCallback(i=>a.selectedCardIds.includes(i),[a.selectedCardIds]),n=react.useCallback((i,l)=>{if(!l){r({selectedCardIds:[i],lastSelectedCardId:i});return}let u=l.ctrlKey||l.metaKey,y=l.shiftKey;if(u)a.selectedCardIds.includes(i)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==i),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});else if(y&&a.lastSelectedCardId){let v=t.find(k=>k.id===i),h=t.find(k=>k.id===a.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let k=t.filter(w=>w.columnId===v.columnId).sort((w,A)=>w.position-A.position),g=k.findIndex(w=>w.id===a.lastSelectedCardId),f=k.findIndex(w=>w.id===i),[T,N]=g<f?[g,f]:[f,g],b=k.slice(T,N+1).map(w=>w.id),x=Array.from(new Set([...a.selectedCardIds,...b]));r({selectedCardIds:x,lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});},[t,a,r]),d=react.useCallback(i=>{r({selectedCardIds:a.selectedCardIds.filter(l=>l!==i),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(i=>i.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),s=react.useCallback(i=>{a.selectedCardIds.includes(i)?d(i):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});},[a,d,r]),p=react.useCallback(()=>t.filter(i=>a.selectedCardIds.includes(i.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:n,deselectCard:d,clearSelection:c,selectAll:m,toggleCard:s,getSelectedCards:p}}var qd={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Xd(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...qd,...a}),[a]),[n,d]=react.useState([]),c=react.useCallback((v,h,k,g,f)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let T={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:v,cardIds:h,columnId:k,strategy:g,color:f,isExpanded:true,position:n.filter(N=>N.columnId===k).length,createdAt:new Date};d(N=>[...N,T]);},[o.minCardsPerStack,n]),m=react.useCallback(v=>{d(h=>h.filter(k=>k.id!==v));},[]),s=react.useCallback(v=>{d(h=>h.map(k=>k.id===v?{...k,isExpanded:!k.isExpanded}:k));},[]),p=react.useCallback((v,h)=>{d(k=>k.map(g=>g.id===v&&!g.cardIds.includes(h)?{...g,cardIds:[...g.cardIds,h]}:g));},[]),i=react.useCallback((v,h)=>{d(k=>k.map(g=>{if(g.id===v){let f=g.cardIds.filter(T=>T!==h);return f.length<o.minCardsPerStack?null:{...g,cardIds:f}}return g}).filter(g=>g!==null));},[o.minCardsPerStack]),l=react.useCallback(v=>n.filter(h=>h.columnId===v).sort((h,k)=>h.position-k.position),[n]),u=react.useCallback(async v=>{let h=t.filter(N=>N.columnId===v);if(h.length<o.minCardsPerStack*2)return [];let k=[],g=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(b=>{g.has(b)||g.set(b,[]),g.get(b).push(N);});}),g.forEach((N,b)=>{N.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F4CC} ${b}`,cardIds:N.map(x=>x.id),columnId:v,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${b}"`,confidence:.85});});let f=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(b=>{f.has(b)||f.set(b,[]),f.get(b).push(N);});}),f.forEach((N,b)=>{N.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F464} Assigned to user-${b.slice(-4)}`,cardIds:N.map(x=>x.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let T=new Map;if(h.forEach(N=>{N.priority&&(T.has(N.priority)||T.set(N.priority,[]),T.get(N.priority).push(N));}),T.forEach((N,b)=>{if(N.length>=o.minCardsPerStack){let x={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[b.toLowerCase()]||"\u26AA";k.push({stack:{title:`${x} ${b} Priority`,cardIds:N.map(w=>w.id),columnId:v,strategy:"priority",color:b==="high"||b==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${b} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let x=(await r.findSimilar(N,h)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(x.length>=o.minCardsPerStack-1){let w=[N.id,...x.map(C=>C.card.id)],A=x.reduce((C,B)=>C+B.similarity,0)/x.length;k.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:w,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${x.length+1} similar tasks`,confidence:A});}}return k.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,b)=>b.confidence-N.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(v=>{c(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let k=await u(h),g=k[0];k.length>0&&g&&g.confidence>=.9&&y(g);});},[]),{stacks:n,createStack:c,deleteStack:m,toggleStack:s,addToStack:p,removeFromStack:i,getStacksForColumn:l,getSuggestions:u,applySuggestion:y,config:o}}var Jd=react.createContext(null);function Zd({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,d=new Map;t?.columns?.forEach(m=>{let{Column:s}=Qr("@libxai/core");n.set(m.id,new s(m));}),t?.cards?.forEach(m=>{let{Card:s}=Qr("@libxai/core");d.set(m.id,new s(m));});let c=null;if(t?.board){let{Board:m}=Qr("@libxai/core");c=new m(t.board);}r.current=new core.BoardStore({board:c,columns:n,cards:d});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Jd.Provider,{value:{store:o},children:e})}function Ko(){let e=react.useContext(Jd);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Jr(){let e=Ko(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[n,d]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),d(e.getAllCards());}),[e]);let c=react.useCallback(g=>{e.updateBoard(g);},[e]),m=react.useCallback(g=>{e.addColumn(g);},[e]),s=react.useCallback((g,f)=>{e.updateColumn(g,f);},[e]),p=react.useCallback(g=>{e.deleteColumn(g);},[e]),i=react.useCallback(g=>e.getColumn(g),[e]),l=react.useCallback(g=>{e.addCard(g);},[e]),u=react.useCallback((g,f)=>{e.updateCard(g,f);},[e]),y=react.useCallback(g=>{e.deleteCard(g);},[e]),v=react.useCallback((g,f,T)=>{e.moveCard(g,f,T);},[e]),h=react.useCallback(g=>e.getCard(g),[e]),k=react.useCallback(g=>e.getCardsByColumn(g),[e]);return {board:t,columns:r,cards:n,updateBoard:c,addColumn:m,updateColumn:s,deleteColumn:p,getColumn:i,addCard:l,updateCard:u,deleteCard:y,moveCard:v,getCard:h,getCardsByColumn:k}}function ec(e){let{cards:t}=Jr();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),n=a.description?.toLowerCase().includes(r);if(!o&&!n)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 tc(e="position",t="asc"){let{cards:a}=Jr();return react.useMemo(()=>[...a].sort((o,n)=>{let d=0;switch(e){case "title":d=o.title.localeCompare(n.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?c[o.priority]:0,s=n.priority?c[n.priority]:0;d=m-s;break}case "createdAt":d=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":d=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":d=o.position-n.position;break}return t==="asc"?d:-d}),[a,e,t])}var Yo=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=ii.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 n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let d=n[t];if(typeof d=="function")try{let c=await Promise.resolve(d.apply(n,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,c,{plugin:n.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 n=o[t];typeof n=="function"&&r.push(Promise.resolve(n.apply(o,a)).catch(d=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,d,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Yf=new Yo;function rc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:d=false,gap:c=0,getItemKey:m}){let s=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>s.current,estimateSize:()=>a,overscan:n,horizontal:d,gap:c}),i=p.getVirtualItems(),l={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=d?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:s,style:l,className:o,children:jsxRuntime.jsx("div",{style:u,children:i.map(y=>{let v=e[y.index];if(!v)return null;let h=m?m(v,y.index):y.index,k={position:"absolute",top:d?0:y.start,left:d?y.start:0,width:d?y.size:"100%",height:d?"100%":y.size};return jsxRuntime.jsx("div",{style:k,"data-index":y.index,children:r(v,y.index)},h)})})})}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 sc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:d=3,gap:c=16,getItemKey:m,horizontal:s=true}){let p=react.useRef(null),i=reactVirtual.useVirtualizer({horizontal:s,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:d,gap:c}),l=i.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${i.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:u,className:n,children:jsxRuntime.jsx("div",{style:y,children:l.map(v=>{let h=e[v.index];if(!h)return null;let k=m?m(h,v.index):v.index,g={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsxRuntime.jsx("div",{style:g,"data-index":v.index,children:o(h,v.index)},k)})})})}function ic(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 lc(e,t=10){return e>t}var Os={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},$s={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},zs={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Us={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ws={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Gs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Hs={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},_s={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)"},Vs={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)"},js={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Ks={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}},Ys={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}},qo={spacing:Os,borderRadius:$s,fontSize:zs,fontWeight:Us,lineHeight:Ws,zIndex:Gs,duration:Hs,easing:_s,shadows:Vs,opacity:js,kanban:Ks,gantt:Ys};function dc(e,t,a){return e[t]??a}function qs(e,t="",a={}){for(let[r,o]of Object.entries(e)){let n=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?qs(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function Jf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Xs(e="asakaa"){let t=qs(qo),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,d=Jf(o);a.push(` ${n}: ${d};`);}return `:root {
|
|
323
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function td(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Pa(e,t){let a=td(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let n=a.find(c=>c.name.toLowerCase().includes(r));if(n)return n;let d=r.split(/\s+/);return a.find(c=>{let m=c.name.toLowerCase();return d.every(s=>m.includes(s))})}function cs(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 l=new Date(r);return l.setDate(l.getDate()+1),l}if(a==="yesterday"||a==="ayer"){let l=new Date(r);return l.setDate(l.getDate()-1),l}if(a==="next week"||a==="la pr\xF3xima semana"){let l=new Date(r);return l.setDate(l.getDate()+7),l}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 y=new Date(r),v=y.getDay(),h=u-v;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let n=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(n&&n[1]&&n[2]){let l=parseInt(n[1],10),u=n[2].toLowerCase(),y=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?y.setDate(y.getDate()+l):u==="week"||u==="semana"||u==="semanas"?y.setDate(y.getDate()+l*7):(u==="month"||u==="mes"||u==="meses")&&y.setMonth(y.getMonth()+l),y}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 l=parseInt(c[1],10),u=parseInt(c[2],10)-1,y=parseInt(c[3],10);return new Date(y,u,l)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},s=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(s&&s[1]&&s[2]){let l=parseInt(s[1],10),u=m[s[2].toLowerCase()],y=s[3]?parseInt(s[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,l)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},i=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let l=p[i[1].toLowerCase()],u=parseInt(i[2],10),y=i[3]?parseInt(i[3],10):r.getFullYear();if(l!==void 0)return new Date(y,l,u)}return null}function ms(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 ps(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 ad(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 s=r[1].trim(),p=r[2].trim(),i=Pa(t,s),l=cs(p);if(!i)return {type:"move_task",taskName:s,message:`Could not find a task named "${s}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!l)return {type:"move_task",taskId:i.id,taskName:i.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=i.startDate&&i.endDate?Math.round((i.endDate.getTime()-i.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(l);return y.setDate(y.getDate()+u),{type:"move_task",taskId:i.id,taskName:i.name,updates:{startDate:l,endDate:y},message:`Moved "${i.name}" to ${l.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let s=o[1].trim(),p=o[2].trim(),i=Pa(t,s),l=ms(p);if(!i)return {type:"resize_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"};if(!l||!i.endDate)return {type:"resize_task",taskId:i.id,taskName:i.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let u=new Date(i.endDate);return u.setDate(u.getDate()+l),{type:"resize_task",taskId:i.id,taskName:i.name,updates:{endDate:u},message:`Extended "${i.name}" by ${l} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(n&&n[1]&&n[2]){let s=n[1].trim(),p=n[2].trim(),i=Pa(t,s),l=ps(p);return i?l===null?{type:"set_progress",taskId:i.id,taskName:i.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:i.id,taskName:i.name,updates:{progress:l},message:`Set "${i.name}" progress to ${l}%.`,success:true}:{type:"set_progress",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let d=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let s=d[1].trim(),p=d[2].trim(),i=Pa(t,s);return i?{type:"rename_task",taskId:i.id,taskName:i.name,updates:{name:p},message:`Renamed "${i.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:s,message:`Could not find a task named "${s}".`,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 s=c[1].trim(),p=c[2].trim(),i=Pa(t,s),l=Pa(t,p);return i?l?{type:"link_tasks",taskId:l.id,taskName:l.name,dependencyFrom:i.id,dependencyTo:l.id,message:`Linked "${i.name}" \u2192 "${l.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let s=m[1].trim(),p=Pa(t,s);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:s,message:`Could not find a task named "${s}".`,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 Kg(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 Yg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Fo(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let i=a.find(l=>l.id===p);return i?{name:i.name,initials:i.initials,color:i.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Fo(p,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let d=p=>{if(p)return typeof p=="string"?new Date(p):p},c=d(e.startDate),m=d(e.endDate),s=e.metadata?.isMilestone===true||c&&m&&Math.abs(m.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:m,progress:e.progress||0,status:Kg(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:n?.length?n:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:s,isCriticalPath:e.metadata?.isCriticalPath===true}}function nd(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(n=>n.name===r.name||n.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:Yg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function sd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Fo(r,e,t))}var us={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"}},gs={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"}},Bo={en:us,es:gs};function fs(e){return Bo[e]||Bo.en}function Ro(e,t){let a=fs(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 cd(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(...cd(r.subtasks,t+1));return a}function nf({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 md({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:d}){let{theme:c="dark",locale:m="en",customTranslations:s,showSearch:p=true,showHierarchy:i=true}=t,l=Ro(m,s),u=c==="dark",[y,v]=react.useState(new Set),[h,k]=react.useState("startDate"),[g,f]=react.useState("asc"),[T,N]=react.useState("");react.useMemo(()=>{let C=new Set;function B($){for(let R of $)R.subtasks?.length&&(C.add(R.id),B(R.subtasks));}B(e),v(C);},[e]);let b=react.useCallback(C=>{v(B=>{let $=new Set(B);return $.has(C)?$.delete(C):$.add(C),$}),a.onTaskToggleExpand?.(C);},[a]),x=react.useCallback(C=>{h===C?f(B=>B==="asc"?"desc":"asc"):(k(C),f("asc")),a.onSortChange?.({column:C,direction:g==="asc"?"desc":"asc"});},[h,g,a]),w=react.useMemo(()=>{let C=cd(e);if(T.trim()){let $=T.toLowerCase();C=C.filter(R=>R.name.toLowerCase().includes($));}let B=[];for(let $ of C){let R=$.level===0;$.level>0&&(R=true),(R||T.trim())&&B.push($);}return T.trim()&&B.sort(($,R)=>{let E,H;switch(h){case "name":E=$.name.toLowerCase(),H=R.name.toLowerCase();break;case "startDate":E=$.startDate?.getTime()||0,H=R.startDate?.getTime()||0;break;case "endDate":E=$.endDate?.getTime()||0,H=R.endDate?.getTime()||0;break;case "progress":E=$.progress||0,H=R.progress||0;break;case "status":E=$.status||"todo",H=R.status||"todo";break;default:return 0}return E<H?g==="asc"?-1:1:E>H?g==="asc"?1:-1:0}),B},[e,T,h,g]),A=C=>C?(C instanceof Date?C:new Date(C)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[l.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:S("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:S("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:l.empty.noTasks}),jsxRuntime.jsx("p",{className:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:S("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",n),style:d,children:[jsxRuntime.jsx("div",{className:S("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:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:S("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:T,onChange:C=>N(C.target.value),placeholder:l.toolbar.searchPlaceholder,className:S("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:S("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",l.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:S("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:()=>x("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.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:()=>x("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w.map((C,B)=>{let $=y.has(C.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:B*.02},className:S("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:i?`${24+C.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(C),onDoubleClick:()=>a.onTaskDoubleClick?.(C),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[i&&C.hasChildren&&jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),b(C.id);},className:S("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:$?jsxRuntime.jsx(lucideReact.ChevronDown,{className:S("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:S("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),i&&!C.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),a.onTaskUpdate?.({...C,progress:C.progress===100?0:100,status:C.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(nf,{status:C.status,progress:C.progress})}),jsxRuntime.jsx("span",{className:S("truncate",u?"text-white":"text-gray-900",C.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:C.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:S("px-2 py-1 rounded-full text-xs font-medium",C.progress===100||C.status==="completed"?"bg-green-500/10 text-green-500":C.progress&&C.progress>0||C.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:C.progress===100||C.status==="completed"?l.status.completed:C.progress&&C.progress>0||C.status==="in-progress"?l.status.inProgress:l.status.todo})}),jsxRuntime.jsxs("div",{className:S("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"}),A(C.startDate)]}),jsxRuntime.jsxs("div",{className:S("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"}),A(C.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:S("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:S("h-full rounded-full transition-all",C.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${C.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:S("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[C.progress||0,"%"]})]})})]},C.id)})}),w.length===0&&T&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:S("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:S(u?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.noResults})]})})]})]})}var bs={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"},hs={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"},vs={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"},$o={dark:bs,light:hs,neutral:vs};function pd(e){return $o[e]||$o.dark}var ys={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"}},xs={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"}},zo={en:ys,es:xs};function _r(e){return zo[e]||zo.en}function Uo(e,t){let a=_r(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 ud(e){let t=_r(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 gd(e,t=0,a=true){let r=_r(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 yf(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 Ts(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 hd({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 yd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:d,style:c}){let{theme:m="dark",locale:s="en",customTranslations:p}=t,i=Uo(s,p),l=m==="dark",[u,y]=react.useState(r||new Date),[v,h]=react.useState(null),[k,g]=react.useState(null),[f,T]=react.useState(null),[N,b]=react.useState(new Date),x=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),w=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),A=react.useCallback(()=>{y(new Date);},[]),C=react.useMemo(()=>{let E=u.getFullYear(),H=u.getMonth(),re=new Date(E,H,1),ie=new Date(E,H+1,0),Ae=re.getDay(),Se=ie.getDate(),ce=yf(e),P=new Date;P.setHours(0,0,0,0);let M=[],I=Ae,_=new Date(E,H,0).getDate();for(let j=I-1;j>=0;j--){let le=new Date(E,H-1,_-j);M.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:ce.filter(oe=>Ts(le,oe)).map(oe=>({id:oe.id,title:oe.name,start:oe.startDate,end:oe.endDate,task:oe}))});}for(let j=1;j<=Se;j++){let le=new Date(E,H,j),oe=le.getTime()===P.getTime();M.push({date:le,isCurrentMonth:true,isToday:oe,isWeekend:le.getDay()===0||le.getDay()===6,events:ce.filter(Le=>Ts(le,Le)).map(Le=>({id:Le.id,title:Le.name,start:Le.startDate,end:Le.endDate,task:Le}))});}let K=42-M.length;for(let j=1;j<=K;j++){let le=new Date(E,H+1,j);M.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:ce.filter(oe=>Ts(le,oe)).map(oe=>({id:oe.id,title:oe.name,start:oe.startDate,end:oe.endDate,task:oe}))});}return M},[u,e]),B=s==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],$=u.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),R=react.useCallback(E=>{let H=E.progress===100?0:100,re=H===100?"completed":"todo";a.onTaskUpdate?.({...E,status:re,progress:H});},[a]);return o?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",d),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:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[i.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",d),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:S("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:S("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",d),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:S("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:i.labels.noEvents}),jsxRuntime.jsx("p",{className:S("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:i.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:S("flex-1 flex flex-col w-full h-full overflow-hidden",l?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsxRuntime.jsx("div",{className:S("flex-shrink-0 px-6 py-4 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:S("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:$}),jsxRuntime.jsx("button",{onClick:A,className:S("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:i.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:x,className:S("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:S("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:w,className:S("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:S("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 overflow-auto",children:jsxRuntime.jsxs("div",{className:"h-full flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:B.map(E=>jsxRuntime.jsx("div",{className:S("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:E},E))}),jsxRuntime.jsx("div",{className:S("grid grid-cols-7 auto-rows-min gap-px rounded-lg overflow-hidden",l?"bg-white/5":"bg-gray-200"),children:C.map((E,H)=>{let re=E.date.getDay()===0||E.date.getDay()===6;return jsxRuntime.jsxs("div",{className:S("min-h-[120px] p-2 transition-colors flex flex-col relative",l?re?"bg-[#1A1D21]":E.isCurrentMonth?"bg-[#0F1117]":"bg-[#0A0C10]":re?"bg-gray-100":E.isCurrentMonth?"bg-white":"bg-gray-50",E.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsx("div",{className:"space-y-1 flex-1",children:E.events.map(ie=>jsxRuntime.jsxs("div",{className:"relative group",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{h(ie.task),a.onEventClick?.(ie);},whileHover:{scale:1.02},className:S("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",ie.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(hd,{task:ie.task}),jsxRuntime.jsx("span",{className:"truncate",children:ie.title})]}),jsxRuntime.jsx("div",{className:S("absolute left-0 bottom-full mb-1 px-2 py-1 rounded text-xs whitespace-nowrap z-50 opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity shadow-lg",l?"bg-[#1A1D25] text-white border border-white/10":"bg-gray-900 text-white"),children:ie.title})]},ie.id))}),jsxRuntime.jsx("div",{className:S("text-sm font-medium mt-1 text-right",E.isToday?"text-[#3B82F6]":E.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:E.date.getDate()})]},H)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(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:S("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:S("px-6 py-4 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:S("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:s==="es"?"Tarea":"Task"}),jsxRuntime.jsx("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:v.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:S("p-1.5 rounded hover:bg-white/10",l?"text-[#9CA3AF]":"text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:S("p-1.5 rounded hover:bg-white/10",l?"text-[#9CA3AF]":"text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsx("h2",{className:S("text-xl font-semibold",l?"text-white":"text-gray-900"),children:v.name})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Estado":"Status"}),jsxRuntime.jsx("span",{className:S("text-xs px-2 py-1 rounded font-medium",v.progress===100?"bg-green-500/20 text-green-400":v.progress&&v.progress>0?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.progress===100?s==="es"?"COMPLETADO":"DONE":v.progress&&v.progress>0?s==="es"?"EN PROGRESO":"IN PROGRESS":s==="es"?"POR HACER":"TO DO"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Asignados":"Assignees"}),v.assignees&&v.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[v.assignees.slice(0,3).map((E,H)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full bg-purple-500 flex items-center justify-center text-white text-xs font-medium",title:E.name,children:E.name.charAt(0).toUpperCase()},H)),v.assignees.length>3&&jsxRuntime.jsxs("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:S("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{T(f?null:"start"),b(v.startDate||new Date);},className:S("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[v.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:S("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),v.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Fin":"End"),(v.startDate||v.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:E=>{E.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:S("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:S("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[[{label:s==="es"?"Hoy":"Today",days:0,weekday:new Date().toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:s==="es"?"M\xE1s tarde":"Later today",time:"11:10 am"},{label:s==="es"?"Ma\xF1ana":"Tomorrow",days:1,weekday:new Date(Date.now()+864e5).toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:s==="es"?"Este fin de semana":"This weekend",weekday:s==="es"?"s\xE1b.":"sat."},{label:s==="es"?"Pr\xF3xima semana":"Next week",weekday:s==="es"?"lun.":"mon."},{label:s==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:(()=>{let E=new Date;return E.setDate(E.getDate()+(6-E.getDay()+7)%7+7),E.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})()},{label:s==="es"?"2 semanas":"2 weeks",date:(()=>{let E=new Date;return E.setDate(E.getDate()+14),E.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})()},{label:s==="es"?"4 semanas":"4 weeks",date:(()=>{let E=new Date;return E.setDate(E.getDate()+28),E.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})()}].map((E,H)=>jsxRuntime.jsxs("button",{className:S("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{T(null);},children:[jsxRuntime.jsx("span",{children:E.label}),jsxRuntime.jsx("span",{className:S("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E.weekday||E.time||E.date})]},H)),jsxRuntime.jsx("div",{className:S("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{className:S("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),children:[jsxRuntime.jsx("span",{children:s==="es"?"Establecer como recurrente":"Set recurring"}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:S("font-medium",l?"text-white":"text-gray-900"),children:N.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{className:S("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:s==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(N.getFullYear(),N.getMonth()-1)),className:S("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(N.getFullYear(),N.getMonth()+1)),className:S("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(s==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:S("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let E=N.getFullYear(),H=N.getMonth(),re=new Date(E,H,1).getDay(),ie=new Date(E,H+1,0).getDate(),Ae=new Date(E,H,0).getDate(),Se=new Date,ce=[];for(let M=re-1;M>=0;M--)ce.push({day:Ae-M,isCurrentMonth:false,date:new Date(E,H-1,Ae-M)});for(let M=1;M<=ie;M++)ce.push({day:M,isCurrentMonth:true,date:new Date(E,H,M)});let P=42-ce.length;for(let M=1;M<=P;M++)ce.push({day:M,isCurrentMonth:false,date:new Date(E,H+1,M)});return ce.map((M,I)=>{let _=M.date.toDateString()===Se.toDateString(),K=v.startDate?.toDateString()===M.date.toDateString()||v.endDate?.toDateString()===M.date.toDateString(),j=v.startDate&&v.endDate&&M.date>=v.startDate&&M.date<=v.endDate;return jsxRuntime.jsx("button",{className:S("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!M.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),M.isCurrentMonth&&(l?"text-white":"text-gray-900"),_&&"ring-2 ring-[#3B82F6]",K&&"bg-[#7C3AED] text-white",j&&!K&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!K&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{T(null);},children:M.day},I)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Flag,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("span",{className:S("text-xs px-2 py-1 rounded font-medium",v.priority==="high"||v.priority==="urgent"?"bg-red-500/20 text-red-400":v.priority==="medium"?"bg-yellow-500/20 text-yellow-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:v.priority?v.priority==="high"||v.priority==="urgent"?s==="es"?"Urgente":"Urgent":v.priority==="medium"?s==="es"?"Media":"Medium":s==="es"?"Baja":"Low":s==="es"?"Sin prioridad":"No priority"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"text-white":"text-gray-900"),children:v.startDate&&v.endDate?`${Math.ceil((v.endDate.getTime()-v.startDate.getTime())/(1e3*60*60*24))} ${s==="es"?"d\xEDas":"days"}`:s==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:S("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[jsxRuntime.jsx("div",{className:S("flex-1 h-2 rounded-full overflow-hidden max-w-[120px]",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:S("h-full rounded-full transition-all",v.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${v.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:S("text-sm font-medium",l?"text-white":"text-gray-900"),children:[v.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:S("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:v.dependencies&&v.dependencies.length>0?`${v.dependencies.length} ${s==="es"?"dependencias":"dependencies"}`:s==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:S("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:S("text-sm font-medium",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("div",{className:S("min-h-[60px] p-3 rounded-lg text-sm",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-50 text-gray-600"),children:v.description||(s==="es"?"Sin descripci\xF3n":"No description")})]}),v.subtasks&&v.subtasks.length>0&&jsxRuntime.jsxs("div",{className:S("mt-4 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:S("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("span",{className:S("text-sm font-medium",l?"text-[#9CA3AF]":"text-gray-500"),children:[s==="es"?"Subtareas":"Subtasks"," (",v.subtasks.length,")"]})]}),jsxRuntime.jsx("div",{className:"space-y-2",children:v.subtasks.slice(0,5).map(E=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:S("w-4 h-4 rounded border flex items-center justify-center",E.progress===100?"bg-green-500 border-green-500":l?"border-white/20":"border-gray-300"),children:E.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:S("text-sm",E.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:E.name})]},E.id))})]})]}),jsxRuntime.jsx("div",{className:S("px-6 py-4 border-t flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("button",{onClick:()=>{R(v),h(null);},className:S("px-4 py-2 rounded-lg font-medium transition-colors",v.progress===100?"bg-gray-500/10 text-gray-500 hover:bg-gray-500/20":"bg-green-500/10 text-green-500 hover:bg-green-500/20"),children:v.progress===100?s==="es"?"Reabrir tarea":"Reopen task":s==="es"?"Completar tarea":"Complete task"})})]}),jsxRuntime.jsxs("div",{className:S("w-[280px] border-l flex flex-col",l?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:S("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:S("font-medium",l?"text-white":"text-gray-900"),children:s==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:S("text-sm text-center py-8",l?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),s==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:S("p-3 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:S("flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:s==="es"?"Escribe un comentario...":"Write a comment...",className:S("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>g(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:S("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:S("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:S("font-medium",l?"text-white":"text-gray-900"),children:k.date.toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>g(null),className:S("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:k.events.map(E=>jsxRuntime.jsxs("button",{onClick:()=>{g(null),h(E.task);},className:S("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(hd,{task:E.task}),jsxRuntime.jsx("span",{className:S("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:E.title}),E.task.priority==="high"||E.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},E.id))})]})]})})]})}var Ns={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"},Ds={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"},Ss={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"},Ho={dark:Ns,light:Ds,neutral:Ss};function xd(e){return Ho[e]||Ho.dark}function kf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:d,className:c}){let[m,s]=react.useState(false),p=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),i=react.useMemo(()=>{let u=p.length,y=new Set(p.flatMap(k=>k.assignedUserIds||[])).size,v=p.map(k=>k.priority).filter(Boolean),h=new Set(p.flatMap(k=>k.labels||[])).size;return {totalCards:u,uniqueAssignees:y,priorities:v,labels:h}},[p]),l=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:S("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:l,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:S("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:i.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),d?.(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:[i.uniqueAssignees," assignees"]})]}),i.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:[i.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(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:y=>{y.stopPropagation(),n?.(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 wd={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function jr(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 Kr(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 Cd(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 Td({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:d,className:c}){let m=react.useMemo(()=>({...wd,...d}),[d]),[s,p]=react.useState(new Set),i=react.useRef(null),l=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let g=new Map;return e.forEach(f=>{let T=f.timestamp.toISOString().split("T")[0],N=g.get(T);N?N.push(f):g.set(T,[f]);}),Array.from(g.entries()).sort((f,T)=>T[0].localeCompare(f[0])).map(([f,T])=>({date:new Date(f),events:T.sort((N,b)=>b.timestamp.getTime()-N.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:u,uniqueTypes:y}=react.useMemo(()=>{let g=new Set,f=new Set;return e.forEach(T=>{g.add(T.userId),f.add(T.type);}),{uniqueUsers:Array.from(g),uniqueTypes:Array.from(f)}},[e]),v=g=>{p(f=>{let T=new Set(f);return T.has(g)?T.delete(g):T.add(g),T});},h=g=>{let T=new Date().getTime()-g.getTime(),N=Math.floor(T/6e4),b=Math.floor(T/36e5),x=Math.floor(T/864e5);return N<1?"just now":N<60?`${N}m ago`:b<24?`${b}h ago`:x<7?`${x}d ago`:g.toLocaleDateString()},k=react.useMemo(()=>{let g=0;return t.types&&t.types.length>0&&g++,t.users&&t.users.length>0&&g++,t.dateRange&&g++,t.searchTerm&&g++,g},[t]);return react.useEffect(()=>{if(n&&i.current){let g=i.current.querySelector(`[data-event-id="${n}"]`);g&&g.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:S("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:S("history-timeline",m.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:g=>{let f=g.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(g=>jsxRuntime.jsxs("option",{value:g,children:[Kr(g)," ",g.replace("_"," ")]},g))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:g=>{let f=g.target.value;a({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(g=>jsxRuntime.jsx("option",{value:g,children:g},g))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:g=>a({...t,searchTerm:g.target.value})})]}),k>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",k,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:i,children:l.map(g=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&g.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:g.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[g.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:g.events.map((f,T)=>{let N=s.has(f.id),b=n===f.id,x=Cd(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:S("history-timeline-event",N&&"expanded",b&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:x},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Kr(f.type)})}),T<g.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:x}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&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:jr(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?h(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),v(f.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([w,A])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(A.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(A.to)})]})]},w)),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(([w,A])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(A)})]},w))]})]})]})]},f.id)})})]},g.date?.toISOString()||"all"))})]})}function Dd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:d,onGoToEvent:c,onSpeedChange:m,className:s}){let p=[.5,1,1.5,2,3],i=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),l=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:S("history-replay-empty",s),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:S("history-replay",s),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:i&&Kr(i.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:i&&jr(i)}),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:i&&i.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:`${l}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,y)=>jsxRuntime.jsx("div",{className:S("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>c(y),title:jr(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,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:d,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(u=>jsxRuntime.jsxs("button",{className:S("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>m(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:i&&i.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:S("history-replay-start",s),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 Es(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 Ps(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 Sd(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 Ed(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Sf(e,t,a,r,o,n=100){let d=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(d.map(m=>[m.id,m]));for(let m=0;m<n;m++){let s=1-m/n;d.forEach(p=>{let i=a/2,l=r/2;p.vx+=(i-p.x)*o.centerForce*s,p.vy+=(l-p.y)*o.centerForce*s,d.forEach(u=>{if(p.id===u.id)return;let y=p.x-u.x,v=p.y-u.y,h=Math.sqrt(y*y+v*v)||1,k=o.chargeStrength*s/(h*h);p.vx+=y/h*k,p.vy+=v/h*k;});}),t.forEach(p=>{let i=c.get(typeof p.source=="string"?p.source:p.source.id),l=c.get(typeof p.target=="string"?p.target:p.target.id);if(!i||!l)return;let u=l.x-i.x,y=l.y-i.y,v=Math.sqrt(u*u+y*y)||1,h=(v-o.linkDistance)/v*o.forceStrength*s;i.vx+=u*h,i.vy+=y*h,l.vx-=u*h,l.vy-=y*h;}),d.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return d}function Pd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:d,onInteraction:c,className:m}){let s=react.useRef(null),[p,i]=react.useState([]),[l,u]=react.useState(null),[y,v]=react.useState(null),[h,k]=react.useState(null),[g,f]=react.useState(1),[T,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let R=Sf(e,t,a.width,a.height,a,150);i(R);},[e,t,a]);let b=react.useCallback((R,E)=>{a.enableDragging&&(E.stopPropagation(),u(R));},[a.enableDragging]),x=react.useCallback(R=>{if(!l||!s.current)return;let H=s.current.getBoundingClientRect(),re=(R.clientX-H.left-T.x)/g,ie=(R.clientY-H.top-T.y)/g;i(Ae=>Ae.map(Se=>Se.id===l?{...Se,x:re,y:ie,fx:re,fy:ie}:Se));},[l,g,T]),w=react.useCallback(()=>{u(null);},[]),A=react.useCallback((R,E)=>{E.stopPropagation(),c?.({type:"node-click",node:R,position:{x:E.clientX,y:E.clientY}});},[c]),C=react.useCallback((R,E)=>{E.stopPropagation(),c?.({type:"edge-click",edge:R,position:{x:E.clientX,y:E.clientY}});},[c]),B=react.useCallback(R=>{let E=p.find(H=>H.id===R);return E?{x:E.x,y:E.y}:{x:0,y:0}},[p]),$=react.useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let E=R.card.priority;return E==="URGENT"?"#ef4444":E==="HIGH"?"#f59e0b":E==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:S("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:S("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:d.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:d.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),n&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.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(R=>Math.min(R+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(g*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Es(R)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Sd(R)," ",Ps(R)]})]},R))}),jsxRuntime.jsxs("svg",{ref:s,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:x,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${T.x}, ${T.y}) scale(${g})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let E=B(typeof R.source=="string"?R.source:R.source.id),H=B(typeof R.target=="string"?R.target:R.target.id),re=Ed(R.type),ie=h===R.id,Ae=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:S("relationships-graph-edge",ie&&"hovered",Ae&&"critical"),onMouseEnter:()=>k(R.id),onMouseLeave:()=>k(null),onClick:Se=>C(R,Se),children:[jsxRuntime.jsx("line",{x1:E.x,y1:E.y,x2:H.x,y2:H.y,stroke:Es(R.type),strokeWidth:Ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ie?1:.6,markerEnd:re?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ie&&jsxRuntime.jsx("text",{x:(E.x+H.x)/2,y:(E.y+H.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ps(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(R=>{let E=y===R.id,H=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:S("relationships-graph-node",E&&"hovered",H&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:re=>b(R.id,re),onMouseEnter:()=>v(R.id),onMouseLeave:()=>v(null),onClick:re=>A(R,re),children:[jsxRuntime.jsx("circle",{r:H?a.nodeSize*1.2:a.nodeSize,fill:$(R),stroke:H?"#fbbf24":"#ffffff",strokeWidth:H?3:2,opacity:E?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.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 Ad({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,d]=react.useState(""),[c,m]=react.useState(false),[s,p]=react.useState(null),[i,l]=react.useState(null),u=react.useRef(null),y=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let g=f=>{f.key==="Escape"&&!y&&v();};if(e)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,y]);let v=()=>{y||(d(""),p(null),l(null),t());},h=async()=>{if(!(!n.trim()||y)){m(true),p(null),l(null);try{let g=await r(n.trim());l(g);}catch(g){p(g instanceof Error?g.message:"Failed to generate plan");}finally{m(false);}}},k=()=>{i&&(a(i),v());};return e?jsxRuntime.jsxs(Ue,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:g=>g.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:v,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:i?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!"})]}),i.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:i.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",i.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:i.columns.map((g,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:g.title},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",i.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[i.cards.slice(0,10).map((g,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:g.title}),g.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:g.description})]}),g.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${g.priority==="URGENT"?"bg-red-500/20 text-red-400":g.priority==="HIGH"?"bg-orange-500/20 text-orange-400":g.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:g.priority})]})},f)),i.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",i.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:n,onChange:g=>d(g.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),s&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:s}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((g,f)=>jsxRuntime.jsx("button",{onClick:()=>d(g),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:g},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:v,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),i?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!n.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Ms={"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 Pf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Mf={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 If(e,t,a){let r=Ms[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function Yr(e){return `$${e.toFixed(4)}`}var Is=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=If(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(i=>i.timestamp>=t.start&&i.timestamp<=t.end));let r=a.length,o=a.reduce((i,l)=>i+l.cost,0),n=a.reduce((i,l)=>i+l.inputTokens,0),d=a.reduce((i,l)=>i+l.outputTokens,0),c=a.filter(i=>i.success),m=a.reduce((i,l)=>i+l.duration,0),s={},p={};return a.forEach(i=>{s[i.feature]=(s[i.feature]||0)+1,p[i.feature]=(p[i.feature]||0)+i.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:d,operationsByFeature:s,costsByFeature:p,averageDuration:r>0?m/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],n=new Date,d=new Date;a==="month"?d.setMonth(n.getMonth()-1):d.setDate(n.getDate()-1);let c=this.operations.filter(p=>p.timestamp>=d).length,m=Math.max(0,o-c),s=c/o*100;return {used:c,limit:o,remaining:m,percentUsed:s,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)}},Qa=new Is;function Bd({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Qa.getStats()),[n,d]=react.useState(Qa.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Qa.getStats()),d(Qa.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=s=>{s.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let c=Qa.getRecentOperations(5);return jsxRuntime.jsxs(Ue,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[n.used," / ",n.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,n.percentUsed)}%`,background:n.percentUsed>90?"#EF4444":n.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[n.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:Yr(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,s])=>{let p=r.costsByFeature[m]||0,i=r.totalOperations>0?s/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[s," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Yr(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${i}%`}})})]},m)})})]}),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(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Yr(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function $d({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[d,c]=react.useState(""),[m,s]=react.useState(""),[p,i]=react.useState(""),[l,u]=react.useState(false),[y,v]=react.useState(null),[h,k]=react.useState(null),[g,f]=react.useState(null),T=react.useRef(null),N=l||o;react.useEffect(()=>{e&&T.current&&T.current.focus();},[e]),react.useEffect(()=>{let C=B=>{B.key==="Escape"&&!N&&b();};if(e)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,N]);let b=()=>{N||(c(""),s(""),i(""),v(null),k(null),f(null),t());},x=async()=>{if(!(!d.trim()||N)){u(true),v(null),k(null),f(null);try{let C=await r({prompt:d.trim(),projectName:n||"Mi Proyecto",startDate:m||void 0,endDate:p||void 0});k(C.tasks.tasks),f({from_cache:C.from_cache,tokens_used:C.tokens_used,mock_mode:C.mock_mode,similarity:C.similarity,tokens_saved:C.tokens_saved});}catch(C){v(C instanceof Error?C.message:"Failed to generate tasks");}finally{u(false);}}},w=()=>{h&&(a(h),b());};if(!e)return null;let A=g?.similarity?((g.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ue,{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-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:C=>C.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:b,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[g?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),g?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",A,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[g?.tokens_used||0," tokens"]}),g?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[g.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((C,B)=>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:["#",B+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:C.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"})]}),C.start," \u2192 ",C.end]}),jsxRuntime.jsxs("span",{children:[C.duration," days"]}),C.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",C.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${C.priority==="high"?"bg-red-500/20 text-red-400":C.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:C.priority})]})},C.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:T,value:d,onChange:C=>c(C.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:C=>s(C.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:C=>i(C.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((C,B)=>jsxRuntime.jsx("button",{onClick:()=>c(C),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:C},B))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:x,disabled:!d.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function jo({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&ao(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(k,g,f)=>{console.warn(`Retry attempt ${g} after ${f}ms: ${k.message}`);}}).then(k=>{k.success||console.error(`Failed to persist board after ${k.attempts} attempts:`,k.error);});},[t]),n=react.useCallback(async(h,k,g)=>{r(f=>{let T=f.cards.find(C=>C.id===h);if(!T)return f;let N=T.columnId,b={...T,columnId:k,position:g},x=f.cards.map(C=>C.id===h?b:C),w=f.columns.map(C=>{if(C.id===N)return {...C,cardIds:C.cardIds.filter(B=>B!==h)};if(C.id===k){let B=x.filter($=>$.columnId===k).sort(($,R)=>$.position-R.position);return {...C,cardIds:B.map($=>$.id)}}return C}),A={...f,cards:x,columns:w};return o(A),A});},[o]),d=react.useCallback(async(h,k)=>{r(g=>{let f=g.cards.map(N=>N.id===h?{...N,...k}:N),T={...g,cards:f};return o(T),T});},[o]),c=react.useCallback(async h=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let f={...h,id:k},T=g.columns.map(b=>b.id===h.columnId?{...b,cardIds:[...b.cardIds,k]}:b),N={...g,cards:[...g.cards,f],columns:T};return o(N),N});},[o]),m=react.useCallback(async h=>{r(k=>{let g=k.cards.find(b=>b.id===h);if(!g)return k;let f=k.cards.filter(b=>b.id!==h),T=k.columns.map(b=>b.id===g.columnId?{...b,cardIds:b.cardIds.filter(x=>x!==h)}:b),N={...k,cards:f,columns:T};return o(N),N});},[o]),s=react.useCallback(async h=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let f={...h,id:k,cardIds:[]},T={...g,columns:[...g.columns,f]};return o(T),T});},[o]),p=react.useCallback(async(h,k)=>{r(g=>{let f=g.columns.map(N=>N.id===h?{...N,...k}:N),T={...g,columns:f};return o(T),T});},[o]),i=react.useCallback(async h=>{r(k=>{let g=k.cards.filter(N=>N.columnId!==h),f=k.columns.filter(N=>N.id!==h),T={...k,cards:g,columns:f};return o(T),T});},[o]),l=react.useCallback(h=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),k},[c]),u=react.useCallback(h=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return s(h),k},[s]),y=react.useCallback(()=>{r(h=>{let k={...h,cards:[],columns:[]};return o(k),k});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:d,onCardCreate:c,onCardDelete:m,onColumnCreate:s,onColumnUpdate:p,onColumnDelete:i},setBoard:r,helpers:{addCard:l,addColumn:u,deleteCard:m,deleteColumn:i,clearBoard:y}}}function Ud({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=jo({initialBoard:e,onPersist:a}),d=react.useMemo(()=>({addCard:(m,s,p={})=>{n.addCard({title:s,columnId:m,position:r.cards.filter(i=>i.columnId===m).length,...p});},addColumn:(m,s)=>{let p=r.columns.length>0?Math.max(...r.columns.map(i=>i.position)):0;n.addColumn({title:m,position:s??p+1e3});},reset:n.clearBoard}),[r.cards,r.columns,n]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:d}}var qr={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Gd={by:"none",order:"asc"};function Hd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...qr,...e}),[n,d]=react.useState({...Gd,...t}),c=react.useCallback(v=>{o(h=>({...h,...v}));},[]),m=react.useCallback(v=>{d(h=>({...h,...v}));},[]),s=react.useCallback(()=>{o(qr),d(Gd);},[]),p=react.useCallback(()=>{a&&o({...qr,assignees:[a]});},[a]),i=react.useCallback(()=>{o({...qr,dateFilter:"overdue"});},[]),l=react.useCallback(()=>{o({...qr,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!==""||n.by!=="none",[r,n]),y=react.useCallback(v=>{let h=[...v];if(r.search){let k=r.search.toLowerCase();h=h.filter(g=>g.title.toLowerCase().includes(k)||g.description?.toLowerCase().includes(k));}if(r.dateFilter!=="all"){let k=new Date,g=k.getFullYear(),f=String(k.getMonth()+1).padStart(2,"0"),T=String(k.getDate()).padStart(2,"0"),N=`${g}-${f}-${T}`;h=h.filter(b=>{if(!b.endDate&&!b.dueDate)return false;let x=b.endDate||b.dueDate;if(!x)return false;let w;if(typeof x=="string")w=x.split("T")[0]||x;else {let A=x.getUTCFullYear(),C=String(x.getUTCMonth()+1).padStart(2,"0"),B=String(x.getUTCDate()).padStart(2,"0");w=`${A}-${C}-${B}`;}switch(r.dateFilter){case "overdue":return w<N;case "today":return w===N;case "this-week":let A=new Date(N+"T00:00:00"),C=new Date(w+"T00:00:00"),B=new Date(A);return B.setDate(B.getDate()+7),C>=A&&C<=B;case "custom":if(r.dateRange){let $=typeof x=="string"?new Date(x):x;return $>=r.dateRange.start&&$<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(k=>k.priority&&r.priorities.includes(k.priority))),r.assignees.length>0&&(h=h.filter(k=>(k.assignedUserIds||(k.assigneeId?[k.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(h=h.filter(k=>k.labels&&k.labels.some(g=>r.labels.includes(g)))),r.columns.length>0&&(h=h.filter(k=>r.columns.includes(k.columnId))),n.by!=="none"&&h.sort((k,g)=>{let f=0;switch(n.by){case "created":let T=k.createdAt?new Date(k.createdAt).getTime():0,N=g.createdAt?new Date(g.createdAt).getTime():0;f=T-N;break;case "priority":let b={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},x=b[k.priority||"LOW"],w=b[g.priority||"LOW"];f=x-w;break;case "dueDate":let A=k.endDate||k.dueDate,C=g.endDate||g.dueDate;if(!A)return 1;if(!C)return -1;let B=typeof A=="string"?new Date(A).getTime():A.getTime(),$=typeof C=="string"?new Date(C).getTime():C.getTime();f=B-$;break;case "title":f=k.title.localeCompare(g.title);break;case "estimate":let R=k.estimatedTime||0,E=g.estimatedTime||0;f=R-E;break;default:f=0;}return n.order==="asc"?f:-f}),h},[r,n]);return {filters:r,sort:n,setFilters:c,setSort:m,resetFilters:s,filterMyTasks:p,filterOverdue:i,filterHighPriority:l,applyFilters:y,hasActiveFilters:u}}var Vd,jd;if(typeof window<"u")try{let e=Qr("ai");Vd=e.generateObject,jd=e.generateText;}catch{}function Kd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(Vd&&jd&&e.apiKey),d=react.useCallback(async i=>{if(!n)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:",i),{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: ${i}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(l){let u=l instanceof Error?l:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[n]),c=react.useCallback(async i=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",i.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(l){let u=l instanceof Error?l:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[n]),m=react.useCallback(async i=>{if(!n)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(l){let u=l instanceof Error?l:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[n]),s=react.useCallback(async i=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",i.title),[{title:`Subtask 1 for: ${i.title}`,position:i.position+.1,columnId:i.columnId},{title:`Subtask 2 for: ${i.title}`,position:i.position+.2,columnId:i.columnId}]}catch(l){let u=l instanceof Error?l:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[n]),p=react.useCallback(async i=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",i.title),{hours:8,confidence:.75}}catch(l){let u=l instanceof Error?l:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[n]);return {onGeneratePlan:d,onSuggestAssignee:c,onPredictRisks:m,onGenerateSubtasks:s,onEstimateEffort:p,isAvailable:n,isLoading:t,error:r}}function Ls(){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 Yd(e){let{cards:t}=e,[a,r]=Ls(),o=react.useCallback(i=>a.selectedCardIds.includes(i),[a.selectedCardIds]),n=react.useCallback((i,l)=>{if(!l){r({selectedCardIds:[i],lastSelectedCardId:i});return}let u=l.ctrlKey||l.metaKey,y=l.shiftKey;if(u)a.selectedCardIds.includes(i)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==i),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});else if(y&&a.lastSelectedCardId){let v=t.find(k=>k.id===i),h=t.find(k=>k.id===a.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let k=t.filter(w=>w.columnId===v.columnId).sort((w,A)=>w.position-A.position),g=k.findIndex(w=>w.id===a.lastSelectedCardId),f=k.findIndex(w=>w.id===i),[T,N]=g<f?[g,f]:[f,g],b=k.slice(T,N+1).map(w=>w.id),x=Array.from(new Set([...a.selectedCardIds,...b]));r({selectedCardIds:x,lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});},[t,a,r]),d=react.useCallback(i=>{r({selectedCardIds:a.selectedCardIds.filter(l=>l!==i),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(i=>i.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),s=react.useCallback(i=>{a.selectedCardIds.includes(i)?d(i):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});},[a,d,r]),p=react.useCallback(()=>t.filter(i=>a.selectedCardIds.includes(i.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:n,deselectCard:d,clearSelection:c,selectAll:m,toggleCard:s,getSelectedCards:p}}var qd={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Xd(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...qd,...a}),[a]),[n,d]=react.useState([]),c=react.useCallback((v,h,k,g,f)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let T={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:v,cardIds:h,columnId:k,strategy:g,color:f,isExpanded:true,position:n.filter(N=>N.columnId===k).length,createdAt:new Date};d(N=>[...N,T]);},[o.minCardsPerStack,n]),m=react.useCallback(v=>{d(h=>h.filter(k=>k.id!==v));},[]),s=react.useCallback(v=>{d(h=>h.map(k=>k.id===v?{...k,isExpanded:!k.isExpanded}:k));},[]),p=react.useCallback((v,h)=>{d(k=>k.map(g=>g.id===v&&!g.cardIds.includes(h)?{...g,cardIds:[...g.cardIds,h]}:g));},[]),i=react.useCallback((v,h)=>{d(k=>k.map(g=>{if(g.id===v){let f=g.cardIds.filter(T=>T!==h);return f.length<o.minCardsPerStack?null:{...g,cardIds:f}}return g}).filter(g=>g!==null));},[o.minCardsPerStack]),l=react.useCallback(v=>n.filter(h=>h.columnId===v).sort((h,k)=>h.position-k.position),[n]),u=react.useCallback(async v=>{let h=t.filter(N=>N.columnId===v);if(h.length<o.minCardsPerStack*2)return [];let k=[],g=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(b=>{g.has(b)||g.set(b,[]),g.get(b).push(N);});}),g.forEach((N,b)=>{N.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F4CC} ${b}`,cardIds:N.map(x=>x.id),columnId:v,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${b}"`,confidence:.85});});let f=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(b=>{f.has(b)||f.set(b,[]),f.get(b).push(N);});}),f.forEach((N,b)=>{N.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F464} Assigned to user-${b.slice(-4)}`,cardIds:N.map(x=>x.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let T=new Map;if(h.forEach(N=>{N.priority&&(T.has(N.priority)||T.set(N.priority,[]),T.get(N.priority).push(N));}),T.forEach((N,b)=>{if(N.length>=o.minCardsPerStack){let x={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[b.toLowerCase()]||"\u26AA";k.push({stack:{title:`${x} ${b} Priority`,cardIds:N.map(w=>w.id),columnId:v,strategy:"priority",color:b==="high"||b==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${b} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let x=(await r.findSimilar(N,h)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(x.length>=o.minCardsPerStack-1){let w=[N.id,...x.map(C=>C.card.id)],A=x.reduce((C,B)=>C+B.similarity,0)/x.length;k.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:w,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${x.length+1} similar tasks`,confidence:A});}}return k.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,b)=>b.confidence-N.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(v=>{c(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let k=await u(h),g=k[0];k.length>0&&g&&g.confidence>=.9&&y(g);});},[]),{stacks:n,createStack:c,deleteStack:m,toggleStack:s,addToStack:p,removeFromStack:i,getStacksForColumn:l,getSuggestions:u,applySuggestion:y,config:o}}var Jd=react.createContext(null);function Zd({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,d=new Map;t?.columns?.forEach(m=>{let{Column:s}=Qr("@libxai/core");n.set(m.id,new s(m));}),t?.cards?.forEach(m=>{let{Card:s}=Qr("@libxai/core");d.set(m.id,new s(m));});let c=null;if(t?.board){let{Board:m}=Qr("@libxai/core");c=new m(t.board);}r.current=new core.BoardStore({board:c,columns:n,cards:d});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Jd.Provider,{value:{store:o},children:e})}function Ko(){let e=react.useContext(Jd);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Jr(){let e=Ko(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[n,d]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),d(e.getAllCards());}),[e]);let c=react.useCallback(g=>{e.updateBoard(g);},[e]),m=react.useCallback(g=>{e.addColumn(g);},[e]),s=react.useCallback((g,f)=>{e.updateColumn(g,f);},[e]),p=react.useCallback(g=>{e.deleteColumn(g);},[e]),i=react.useCallback(g=>e.getColumn(g),[e]),l=react.useCallback(g=>{e.addCard(g);},[e]),u=react.useCallback((g,f)=>{e.updateCard(g,f);},[e]),y=react.useCallback(g=>{e.deleteCard(g);},[e]),v=react.useCallback((g,f,T)=>{e.moveCard(g,f,T);},[e]),h=react.useCallback(g=>e.getCard(g),[e]),k=react.useCallback(g=>e.getCardsByColumn(g),[e]);return {board:t,columns:r,cards:n,updateBoard:c,addColumn:m,updateColumn:s,deleteColumn:p,getColumn:i,addCard:l,updateCard:u,deleteCard:y,moveCard:v,getCard:h,getCardsByColumn:k}}function ec(e){let{cards:t}=Jr();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),n=a.description?.toLowerCase().includes(r);if(!o&&!n)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 tc(e="position",t="asc"){let{cards:a}=Jr();return react.useMemo(()=>[...a].sort((o,n)=>{let d=0;switch(e){case "title":d=o.title.localeCompare(n.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?c[o.priority]:0,s=n.priority?c[n.priority]:0;d=m-s;break}case "createdAt":d=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":d=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":d=o.position-n.position;break}return t==="asc"?d:-d}),[a,e,t])}var Yo=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=ii.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 n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let d=n[t];if(typeof d=="function")try{let c=await Promise.resolve(d.apply(n,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,c,{plugin:n.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 n=o[t];typeof n=="function"&&r.push(Promise.resolve(n.apply(o,a)).catch(d=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,d,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Yf=new Yo;function rc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:d=false,gap:c=0,getItemKey:m}){let s=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>s.current,estimateSize:()=>a,overscan:n,horizontal:d,gap:c}),i=p.getVirtualItems(),l={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=d?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:s,style:l,className:o,children:jsxRuntime.jsx("div",{style:u,children:i.map(y=>{let v=e[y.index];if(!v)return null;let h=m?m(v,y.index):y.index,k={position:"absolute",top:d?0:y.start,left:d?y.start:0,width:d?y.size:"100%",height:d?"100%":y.size};return jsxRuntime.jsx("div",{style:k,"data-index":y.index,children:r(v,y.index)},h)})})})}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 sc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:d=3,gap:c=16,getItemKey:m,horizontal:s=true}){let p=react.useRef(null),i=reactVirtual.useVirtualizer({horizontal:s,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:d,gap:c}),l=i.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${i.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:u,className:n,children:jsxRuntime.jsx("div",{style:y,children:l.map(v=>{let h=e[v.index];if(!h)return null;let k=m?m(h,v.index):v.index,g={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsxRuntime.jsx("div",{style:g,"data-index":v.index,children:o(h,v.index)},k)})})})}function ic(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 lc(e,t=10){return e>t}var Os={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},$s={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},zs={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Us={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ws={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Gs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Hs={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},_s={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)"},Vs={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)"},js={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Ks={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}},Ys={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}},qo={spacing:Os,borderRadius:$s,fontSize:zs,fontWeight:Us,lineHeight:Ws,zIndex:Gs,duration:Hs,easing:_s,shadows:Vs,opacity:js,kanban:Ks,gantt:Ys};function dc(e,t,a){return e[t]??a}function qs(e,t="",a={}){for(let[r,o]of Object.entries(e)){let n=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?qs(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function Jf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Xs(e="asakaa"){let t=qs(qo),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,d=Jf(o);a.push(` ${n}: ${d};`);}return `:root {
|
|
324
324
|
${a.join(`
|
|
325
325
|
`)}
|
|
326
326
|
}`}function Zr(e,t="asakaa"){let a=[],r=qs(e);for(let[o,n]of Object.entries(r)){let d=`--${t}-color-${o}`;a.push(` ${d}: ${n};`);}return `:root {
|