@libxai/board 0.17.137 → 0.17.139

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
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'),bd=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),np=require('react-markdown'),sp=require('remark-gfm'),ip=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var bd__default=/*#__PURE__*/_interopDefault(bd);var np__default=/*#__PURE__*/_interopDefault(np);var sp__default=/*#__PURE__*/_interopDefault(sp);var ip__default=/*#__PURE__*/_interopDefault(ip);var ho=(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 yo=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 [yo.Translate.toString(e),yo.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function k(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function vo(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 _c(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function wn(e,t){return e.length===0?1e3:t===0?vo(null,e[0].position):t>=e.length?vo(e[e.length-1].position,null):vo(e[t-1].position,e[t].position)}function Ni(e,t=100){return e>t}var Vc=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 jc(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function xo(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:d=Vc,onRetry:m}=t,c,n=0;for(let p=1;p<=a;p++){n=p;try{return {data:await e(),attempts:n,success:!0}}catch(l){if(c=l,p===a||!d(c,p))return {error:c,attempts:n,success:false};let u=jc(p,r,o,s);if(m)try{m(c,p,u);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,u));}}return {error:c||new Error("Unknown error"),attempts:n,success:false}}function Kc(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 Yc(e,t={}){return async(...a)=>xo(()=>e(...a),t)}var Cn=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=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.NONE=4]="NONE",s))(Si||{}),tr=class tr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...d}=t,m=`[${a}] [${r}] [${s}]`,c=Object.keys(d).length>0;switch(r){case "DEBUG":console.debug(m,o,c?d:"");break;case "INFO":console.info(m,o,c?d:"");break;case "WARN":console.warn(m,o,c?d:"");break;case "ERROR":console.error(m,o,c?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",...tr.globalOptions};}static configure(t){tr.globalOptions={...tr.globalOptions,...t};}child(t){return new tr({...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 ko((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new ko(()=>{},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);}};tr.globalOptions={};var Tn=tr,ko=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}},Ei=new Tn;function Xc(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 Jc(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let d=e.columns.find(m=>m.id===s.columnId);return [s.id,Dn(s.title),Dn(s.description||""),Dn(d?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
2
  `)}async function Zc(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 bd__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=d.toDataURL("image/png"),c=297,n=210,p=d.width/d.height,l=c-20,i=l/p;i>n-20&&(i=n-20,l=i*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,c,15,"F"),u.text(e.title||"Kanban Board",10,10);let v=(c-l)/2;return u.addImage(m,"PNG",v,20,l,i),u}catch(d){console.error("Error capturing board:",d);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(d=>{let m=e.cards.filter(c=>c.columnId===d.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(d.title,20,s),s+=8,m.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):m.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(c.description,160);o.text(p,25,s),s+=p.length*5;}let n=[];if(c.priority&&n.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&n.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&n.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),n.push(p.join(" \u2192 "));}n.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(n.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Dn(e){return e.includes(",")||e.includes('"')||e.includes(`
3
3
  `)?`"${e.replace(/"/g,'""')}"`:e}async function Mi(e,t,a,r){switch(t){case "json":return Xc(e,r);case "csv":return Jc(e);case "pdf":return await Zc(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Ai(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,d={json:"application/json",csv:"text/csv",pdf:"application/pdf"},m=new Blob([e],{type:d[t]}),c=URL.createObjectURL(m),n=document.createElement("a");n.href=c,n.download=s,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(c);}function Qc(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 em(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=Ii(t[0]),r=[],o=new Map,s=[];for(let d=1;d<t.length;d++)try{let m=Ii(t[d]||"");if(m.length>a.length){s.push(`Line ${d+1}: Too many columns`);continue}if(a.length-m.length>3){s.push(`Line ${d+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let n={};a.forEach((u,v)=>{n[u]=m[v]||"";});let p=n.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let l=o.get(p),i={id:n["Card ID"]||`card-${d}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),l.cardIds.push(i.id);}catch(m){s.push(`Line ${d+1}: ${m instanceof Error?m.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Ii(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],d=e[o+1];s==='"'&&r&&d==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Li(e,t){switch(t){case "json":return Qc(e);case "csv":return em(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Fi(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 Nn=react.createContext(null);function Bi(){return react.useContext(Nn)}var Ri=react.createContext(null);function Oi({children:e,themeName:t}){return jsxRuntime.jsx(Ri.Provider,{value:{themeName:t},children:e})}function kr(){return react.useContext(Ri)}function Ye({children:e,container:t}){let[a,r]=react.useState(false),o=Bi(),s=kr();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:m,themeName:c}=o,n={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:n,children:e}),d)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),d):reactDom.createPortal(e,d)}var Gi={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},lm="#BDC3C7",dm=({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 ar({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState({top:0,left:0}),m=react.useRef(null),c=react.useRef(null),n=()=>{if(!c.current)return;let u=c.current.getBoundingClientRect(),v=window.innerHeight,f=window.innerWidth,y=160,x=220,b=4,g=u.right-y;g<10&&(g=u.left),g+y>f-10&&(g=f-y-10);let w=v-u.bottom,D=u.top,h;w>=x+b?h=u.bottom+b:D>=x+b?h=u.top-x-b:h=w>=D?u.bottom+b:Math.max(10,u.top-x-b),d({top:h,left:g}),o(true);};react.useEffect(()=>{let u=v=>{m.current&&!m.current.contains(v.target)&&!c.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let p=u=>{t(u),o(false);},l=e?Gi[e]:null,i=l?.color||lm;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):n(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:m,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Gi).map(([u,v])=>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:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(dm,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===u&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},u)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>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 cm=[{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 Hr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[d,m]=react.useState({top:0,left:0}),c=react.useRef(null),n=react.useRef(null),i=(kr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),w=window.innerHeight,D=window.innerWidth,h=320,A=380,C=4,L=g.left;L+h>D-10&&(L=D-h-10),L<10&&(L=10);let T=w-g.bottom,U=g.top,G;T>=A+C?G=g.bottom+C:U>=A+C?G=g.top-A-C:G=T>=U?g.bottom+C:Math.max(10,g.top-A-C),m({top:G,left:L}),s(true);};react.useEffect(()=>{let g=w=>{c.current&&!c.current.contains(w.target)&&!n.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let v=g=>{let w=new Date,D=L=>{let T=L.getFullYear(),U=String(L.getMonth()+1).padStart(2,"0"),G=String(L.getDate()).padStart(2,"0");return `${T}-${U}-${G}`},h=D(w),A=new Date(w);A.setDate(A.getDate()+g);let C=D(A);a(h,C),s(false);},f=()=>{if(!e||!t)return "Set date";let g=A=>{if(A instanceof Date)return A;if(typeof A!="string"||!A.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=A.split("-").map(Number);if(C.length!==3||C.some(G=>isNaN(G)))return null;let L=C[0],T=C[1],U=C[2];return L===void 0||T===void 0||U===void 0?null:new Date(L,T-1,U)},w=g(e),D=g(t);if(!w||!D||isNaN(w.getTime())||isNaN(D.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[w.getMonth()]} ${w.getDate()} \u2013 ${h[D.getMonth()]} ${D.getDate()}`},y=e&&t,b=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),g<w})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${f()}`:"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:f()})]}),o&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:cm.map(g=>jsxRuntime.jsx("button",{onClick:()=>v(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function or({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,d]=react.useState(false),[m,c]=react.useState(""),[n,p]=react.useState({top:0,left:0}),l=react.useRef(null),i=react.useRef(null),u=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),g=window.innerHeight,w=window.innerWidth,D=300,h=380,A=4,C=b.right-D;C<10&&(C=b.left),C+D>w-10&&(C=w-D-10);let L=g-b.bottom,T=b.top,U;L>=h+A?U=b.bottom+A:T>=h+A?U=b.top-h-A:U=L>=T?b.bottom+A:Math.max(10,b.top-h-A),p({top:U,left:C}),d(true);};react.useEffect(()=>{let b=g=>{l.current&&!l.current.contains(g.target)&&!i.current?.contains(g.target)&&(d(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&(d(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let v=b=>{let g=e.some(w=>w.id===b.id);a(g?e.filter(w=>w.id!==b.id):[...e,b]);},f=t.filter(b=>b.name.toLowerCase().includes(m.toLowerCase())),y=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?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:[y.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),x>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:b=>c(b.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:f.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"}):f.map(b=>{let g=e.some(w=>w.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>v(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.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:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.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:b.name}),g&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},b.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 wo(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let n=c.dependencies.map(p=>{if(typeof p=="string")return p;let l=p;return l.taskId||l.targetId||""}).filter(Boolean);r.set(c.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,d=new Set,m=c=>{if(!s.has(c)){s.add(c),d.add(c);let n=r.get(c)||[];for(let p of n){if(!s.has(p)&&m(p))return true;if(d.has(p))return true}}return d.delete(c),false};return m(a)}function Vr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:d}){let[m,c]=react.useState(false),[n,p]=react.useState(""),[l,i]=react.useState(t.length>0),[u,v]=react.useState({top:0,left:0}),[f,y]=react.useState(null),x=react.useRef(null),b=react.useRef(null),g=()=>{if(!b.current)return;let C=b.current.getBoundingClientRect(),L=window.innerHeight,T=window.innerWidth,U=300,G=l?380:120,$=4,E=C.right-U;E<10&&(E=C.left),E+U>T-10&&(E=T-U-10);let X=L-C.bottom,fe=C.top,Ce;X>=G+$?Ce=C.bottom+$:fe>=G+$?Ce=C.top-G-$:Ce=X>=fe?C.bottom+$:Math.max(10,C.top-G-$),v({top:Ce,left:E}),c(true);};react.useEffect(()=>{if(!m||!b.current)return;let C=b.current.getBoundingClientRect(),L=window.innerHeight,T=window.innerWidth,U=300,G=l?380:120,$=4,E=C.right-U;E<10&&(E=C.left),E+U>T-10&&(E=T-U-10);let X=L-C.bottom,fe=C.top,Ce;X>=G+$?Ce=C.bottom+$:fe>=G+$?Ce=C.top-G-$:Ce=X>=fe?C.bottom+$:Math.max(10,C.top-G-$),v({top:Ce,left:E});},[l,m]),react.useEffect(()=>{let C=L=>{x.current&&!x.current.contains(L.target)&&!b.current?.contains(L.target)&&(c(false),p(""));};if(m)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[m]),react.useEffect(()=>{let C=L=>{L.key==="Escape"&&(c(false),p(""));};if(m)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[m]);let w=C=>{let L=t.includes(C),T=a.find(U=>U.id===C);if(y(null),L){let U=t.filter(G=>G!==C);r(U),U.length===0&&i(false);}else {if(s&&wo(a,C,e)){let G=`Cannot add "${T?.title||C}" as dependency - would create circular reference`;y(G),d?.(C,T?.title||C),setTimeout(()=>y(null),3e3);return}r([...t,C]),i(true);}},D=()=>{let C=!l;i(C),C||r([]);},h=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(n.toLowerCase())||C.id.toLowerCase().includes(n.toLowerCase())),A=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>m?c(false):g(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:A,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:A},children:t.length})]}),m&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:x,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[f&&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:f})]}),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:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:n,onChange:C=>p(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:h.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"}):h.map(C=>{let L=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>w(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:T=>{T.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:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:C.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),i(false),c(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 La=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:d,availableUsers:m=[],allCards:c=[]})=>{let{attributes:n,listeners:p,setNodeRef:l,transform:i,transition:u,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),f={transform:yo.Transform.toString(i),transition:u};if(t)return jsxRuntime.jsx("div",{ref:l,style:f,...n,...p,onClick:()=>a?.(e),children:t(e)});let y=m.filter(g=>e.assignedUserIds?.includes(g.id)),x=e.progress===100,b={...f,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:b,className:k("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...p,onClick:g=>{g.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:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:x?"line-through":"none",opacity:x?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(ar,{priority:e.priority,onChange:g=>d?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Hr,{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:(g,w)=>d?.(e.id,{startDate:g,endDate:w})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(or,{assignedUsers:y,availableUsers:m,onChange:g=>d?.(e.id,{assignedUserIds:g.map(w=>w.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Vr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:c,onChange:g=>d?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))}),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));La.displayName="Card";var Co={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"}},Zi=({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 Qi({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[d,m]=react.useState({top:0,left:0}),c=react.useRef(null),n=react.useRef(null),p=[...Object.entries(Co).map(([y,x])=>({id:y,label:x.label,color:x.color,icon:x.icon})),...r.filter(y=>!Object.keys(Co).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let y=Co[e];if(y)return {...y,id:e};let x=r.find(b=>b.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...Co.todo,id:"todo"}},i=()=>{if(!n.current)return;let y=n.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,g=180,w=280,D=4,h=y.right-g;h<10&&(h=y.left),h+g>b-10&&(h=b-g-10);let A=x-y.bottom,C=y.top,L;A>=w+D?L=y.bottom+D:C>=w+D?L=y.top-w-D:L=A>=C?y.bottom+D:Math.max(10,y.top-w-D),m({top:L,left:h}),s(true);};react.useEffect(()=>{let y=x=>{c.current&&!c.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let u=y=>{t(y),s(false);},v=l(),f=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${f}10`,boxShadow:`0 0 0 2px ${f}30 inset`},title:v.label,children:jsxRuntime.jsx(Zi,{icon:v.icon,color:f})}),o&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:c,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(y=>jsxRuntime.jsxs("button",{onClick:()=>u(y.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:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Zi,{icon:y.icon,color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:y.label}),e===y.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"})})]},y.id))})]})})]})}function el({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,d]=react.useState(false),[m,c]=react.useState(false),[n,p]=react.useState(e),[l,i]=react.useState({top:0,left:0}),u=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let g=v.current.getBoundingClientRect();i({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[s]),react.useEffect(()=>{let g=w=>{u.current&&!u.current.contains(w.target)&&!v.current?.contains(w.target)&&(d(false),c(false));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),react.useEffect(()=>{let g=w=>{w.key==="Escape"&&(d(false),c(false),p(e));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s,e]),react.useEffect(()=>{m&&f.current&&(f.current.focus(),f.current.select());},[m]);let y=()=>{c(true),p(e);},x=()=>{let g=n.trim();g&&g!==e&&t(g),c(false),d(false),p(e);},b=g=>{g.key==="Enter"?x():g.key==="Escape"&&(c(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>d(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:m?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:f,type:"text",value:n,onChange:g=>p(g.target.value),onKeyDown:b,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:y,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 Tr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:d,onCardUpdate:m,availableUsers:c,allCards:n,enableVirtualization:p,cardHeight:l=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:v,onColumnDelete:f,isDeletable:y=false,className:x})=>{let{setNodeRef:b,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),w=react.useRef(null),D=p??Ni(t.length),h=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>w.current,estimateSize:()=>l,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:b,className:x,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let U=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:U}:U>=80?{state:"warning",percentage:U}:U>=60?{state:"approaching",percentage:U}:{state:"ok",percentage:U}})(),L=C.state==="exceeded",T=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:k("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",x),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:k(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),C.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),C.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),C.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(v||f)&&jsxRuntime.jsx(el,{columnTitle:e.title,onRename:U=>v?.(e.id,U),onDelete:f?()=>f(e.id):void 0,isDeletable:y}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:w,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(U=>U.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${h.getTotalSize()}px`,position:"relative"},children:h.getVirtualItems().map(U=>{let G=t[U.index];return G?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${U.start}px)`},children:jsxRuntime.jsx(La,{card:G,render:r,onClick:d,onUpdate:m,availableUsers:c,allCards:n})},G.id):null})}):t.map(U=>jsxRuntime.jsx(La,{card:U,render:r,onClick:d,onUpdate:m,availableUsers:c,allCards:n},U.id))})})]})});Tr.displayName="Column";function An({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):d(e),o(false);},n=p=>{p.key==="Enter"?c():p.key==="Escape"&&(d(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:s,onChange:p=>d(p.target.value),onBlur:c,onKeyDown:n,className:k("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:k("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Ln(){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 ja({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:d,style:m,isLoading:c,error:n,children:p}){let[l,i]=Ln(),u=o?.theme||"dark",f=u==="dark"||u==="neutral"?"dark":"",y=react.useCallback((T,U)=>{t.onCardUpdate?.(T,U);},[t]),x=react.useCallback((T,U)=>{t.onColumnUpdate?.(T,{title:U});},[t]),b=react.useCallback(T=>{t.onColumnDelete?.(T);},[t]),g=["todo","in-progress","completed"],w=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),D=react.useMemo(()=>{let T=new Map;return e.columns.forEach(U=>{let G=U.cardIds.map($=>e.cards.find(E=>E.id===$)).filter($=>$!==void 0).sort(($,E)=>$.position-E.position);T.set(U.id,G);}),T},[e.cards,e.columns]),h=react.useCallback(T=>{let{active:U}=T,G=e.cards.find($=>$.id===U.id);G&&i({isDragging:true,draggedCardId:G.id,sourceColumnId:G.columnId,targetColumnId:G.columnId});},[e.cards,i]),A=react.useCallback(T=>{let{active:U,over:G}=T;if(!G||!e.cards.find(X=>X.id===U.id))return;let E=null;G.data.current?.type==="column"?E=G.id:G.data.current?.type==="card"&&(E=e.cards.find(fe=>fe.id===G.id)?.columnId||null),E&&E!==l.targetColumnId&&i({...l,targetColumnId:E});},[e.cards,l,i]),C=react.useCallback(async T=>{let{active:U,over:G}=T;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!G)return;let $=e.cards.find(Ce=>Ce.id===U.id);if(!$)return;let E,X;if(G.data.current?.type==="column"){E=G.id;let Ce=D.get(E)||[];X=wn(Ce,0);}else {let Ce=e.cards.find(ce=>ce.id===G.id);if(!Ce)return;E=Ce.columnId;let Le=D.get(E)||[],Pe=Le.findIndex(ce=>ce.id===G.id);X=wn(Le,Pe);}let fe=e.columns.find(Ce=>Ce.id===E);if(fe&&fe.wipLimit&&fe.wipLimitType==="hard"){let Ce=D.get(E)||[];if($.columnId!==E&&Ce.length>=fe.wipLimit){t.onWipLimitExceeded?.(fe,$);return}}($.columnId!==E||$.position!==X)&&await t.onCardMove?.($.id,E,X);},[e.cards,e.columns,D,t,i]),L=react.useCallback(T=>{a?.(T);},[a]);return c?jsxRuntime.jsx("div",{className:k("asakaa-board",f,d),style:m,children:jsxRuntime.jsx(Fm,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:k("asakaa-board",f,d),style:m,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsxRuntime.jsx(Oi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:w,collisionDetection:core$1.closestCorners,onDragStart:h,onDragOver:A,onDragEnd:C,children:[jsxRuntime.jsxs("div",{className:k("asakaa-board",f,d),style:m,"data-theme":u,children:[e.columns.sort((T,U)=>T.position-U.position).map(T=>{let U=D.get(T.id)||[],G=!g.includes(T.id);return jsxRuntime.jsx(Tr,{column:T,cards:U,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:L,onCardUpdate:y,onColumnRename:x,onColumnDelete:b,isDeletable:G,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},T.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(La,{card:e.cards.find(T=>T.id===l.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Fm({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 Um={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)"},zm={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)"},Wm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Gm={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Hm({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,d]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let n=p=>{m.current&&!m.current.contains(p.target)&&d(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let c=n=>{t(n),d(false);};return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((n,p)=>n.position-p.position).map((n,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(n.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:n.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function _m({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,d]=react.useState(false),[m,c]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let u=v=>{n.current&&!n.current.contains(v.target)&&d(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(u=>u.handler),i=async(u,v)=>{if(v){c(u);try{await v();}catch(f){console.error(`Export ${u} failed:`,f);}finally{c(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((u,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(u.id,u.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:m===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 Vm({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 Bn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:d,onExportJSON:m,onExportExcel:c,translations:n}){let p=r==="dark"?Um:zm,l={...o==="es"?Wm:Gm,...n},i=d||m||c;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:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(_m,{theme:p,t:l,onExportCSV:d,onExportJSON:m,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(s?jsxRuntime.jsx(Hm,{columns:e,onSelect:t,theme:p,t:l,createTaskLabel:a}):jsxRuntime.jsx(Vm,{onClick:()=>t(),label:a||l.newTask}))]})})}function On({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,d]=react.useState(false),[m,c]=react.useState(""),n=react.useCallback(()=>{let i=m.trim();i&&(e(i),c(""),d(false));},[m,e]),p=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(c(""),d(false));},[n]),l=react.useCallback(()=>{setTimeout(()=>{m.trim()||d(false);},150);},[m]);return s?jsxRuntime.jsx("div",{className:k("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:m,onChange:i=>c(i.target.value),onKeyDown:p,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:n,disabled:!m.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),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:k("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 $n({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:d=false,theme:m="dark",locale:c="es"}){let[n,p]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState([]),[x,b]=react.useState(""),[g,w]=react.useState(""),[D,h]=react.useState(""),[A,C]=react.useState(false),[L,T]=react.useState(false),[U,G]=react.useState(false),$=react.useRef(null),E=react.useRef(null),X={placeholder:o||(c==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(c==="es"?"Agregar Tarea":"Add Task"),save:c==="es"?"Guardar":"Save",addAssignee:c==="es"?"Agregar asignado":"Add assignee",addDates:c==="es"?"Agregar fechas":"Add dates",addPriority:c==="es"?"Agregar prioridad":"Add priority",startDate:c==="es"?"Inicio":"Start",endDate:c==="es"?"Fin":"End",low:c==="es"?"Baja":"Low",medium:c==="es"?"Media":"Medium",high:c==="es"?"Alta":"High",urgent:c==="es"?"Urgente":"Urgent"},fe=react.useCallback(()=>{v(""),y([]),b(""),w(""),h(""),C(false),T(false),G(false),p(false);},[]);react.useEffect(()=>{n&&$.current&&$.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let S=F=>{E.current&&!E.current.contains(F.target)&&(u.trim()||fe());};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n,u,fe]);let Ce=react.useCallback(async()=>{let S=u.trim();if(!(!S||l)){i(true);try{await t({name:S,columnId:e,assigneeIds:f.length>0?f:void 0,startDate:x?new Date(x):void 0,endDate:g?new Date(g):void 0,priority:D||void 0}),v(""),y([]),b(""),w(""),h(""),C(!1),T(!1),G(!1),$.current?.focus();}catch(F){console.error("Error creating card:",F);}finally{i(false);}}},[u,e,f,x,g,D,t,l]),Le=react.useCallback(S=>{S.key==="Enter"&&!S.shiftKey?(S.preventDefault(),Ce()):S.key==="Escape"&&fe();},[Ce,fe]),Pe=react.useCallback(S=>{y(F=>F.includes(S)?F.filter(M=>M!==S):[...F,S]);},[]),ce=m==="dark";return n?jsxRuntime.jsxs("div",{ref:E,className:k("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:$,type:"text",value:u,onChange:S=>v(S.target.value),onKeyDown:Le,placeholder:X.placeholder,disabled:l,className:k("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:()=>C(!A),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||f.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:X.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"})]}),f.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:f.length})]}),jsxRuntime.jsx("button",{onClick:()=>T(!L),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||x||g?"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:X.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:()=>G(!U),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",U||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="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:X.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:Ce,disabled:!u.trim()||l,className:k("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):X.save})]})]}),A&&a.length>0&&jsxRuntime.jsx("div",{className:k("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(S=>jsxRuntime.jsxs("button",{onClick:()=>Pe(S.id),className:k("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",f.includes(S.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:[S.avatar?jsxRuntime.jsx("img",{src:S.avatar,alt:S.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:k("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",f.includes(S.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:S.name.split(" ")[0]})]},S.id))})}),L&&jsxRuntime.jsx("div",{className:k("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:k("block text-[10px] uppercase tracking-wide mb-1",ce?"text-gray-500":"text-gray-400"),children:X.startDate}),jsxRuntime.jsx("input",{type:"date",value:x,onChange:S=>b(S.target.value),className:k("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:k("block text-[10px] uppercase tracking-wide mb-1",ce?"text-gray-500":"text-gray-400"),children:X.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:S=>w(S.target.value),className:k("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")})]})]})}),U&&jsxRuntime.jsx("div",{className:k("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(S=>jsxRuntime.jsx("button",{onClick:()=>h(D===S?"":S),className:k("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===S?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[S]} text-white`:ce?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:X[S]},S))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:d,className:k("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:X.buttonLabel})]})}var Xr=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(ja,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
4
+ `);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Ii(t[0]),r=[],o=new Map,s=[];for(let d=1;d<t.length;d++)try{let m=Ii(t[d]||"");if(m.length>a.length){s.push(`Line ${d+1}: Too many columns`);continue}if(a.length-m.length>3){s.push(`Line ${d+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let n={};a.forEach((u,v)=>{n[u]=m[v]||"";});let p=n.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let l=o.get(p),i={id:n["Card ID"]||`card-${d}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),l.cardIds.push(i.id);}catch(m){s.push(`Line ${d+1}: ${m instanceof Error?m.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Ii(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],d=e[o+1];s==='"'&&r&&d==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Li(e,t){switch(t){case "json":return Qc(e);case "csv":return em(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Fi(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 Nn=react.createContext(null);function Bi(){return react.useContext(Nn)}var Ri=react.createContext(null);function Oi({children:e,themeName:t}){return jsxRuntime.jsx(Ri.Provider,{value:{themeName:t},children:e})}function kr(){return react.useContext(Ri)}function Ye({children:e,container:t}){let[a,r]=react.useState(false),o=Bi(),s=kr();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:m,themeName:c}=o,n={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:n,children:e}),d)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),d):reactDom.createPortal(e,d)}var Gi={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},lm="#BDC3C7",dm=({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 ar({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState({top:0,left:0}),m=react.useRef(null),c=react.useRef(null),n=()=>{if(!c.current)return;let u=c.current.getBoundingClientRect(),v=window.innerHeight,f=window.innerWidth,y=160,x=220,b=4,g=u.right-y;g<10&&(g=u.left),g+y>f-10&&(g=f-y-10);let w=v-u.bottom,D=u.top,h;w>=x+b?h=u.bottom+b:D>=x+b?h=u.top-x-b:h=w>=D?u.bottom+b:Math.max(10,u.top-x-b),d({top:h,left:g}),o(true);};react.useEffect(()=>{let u=v=>{m.current&&!m.current.contains(v.target)&&!c.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let p=u=>{t(u),o(false);},l=e?Gi[e]:null,i=l?.color||lm;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):n(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:m,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Gi).map(([u,v])=>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:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(dm,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===u&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},u)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>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 cm=[{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 Hr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[d,m]=react.useState({top:0,left:0}),c=react.useRef(null),n=react.useRef(null),i=(kr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),w=window.innerHeight,D=window.innerWidth,h=320,A=380,C=4,L=g.left;L+h>D-10&&(L=D-h-10),L<10&&(L=10);let T=w-g.bottom,U=g.top,G;T>=A+C?G=g.bottom+C:U>=A+C?G=g.top-A-C:G=T>=U?g.bottom+C:Math.max(10,g.top-A-C),m({top:G,left:L}),s(true);};react.useEffect(()=>{let g=w=>{c.current&&!c.current.contains(w.target)&&!n.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let v=g=>{let w=new Date,D=L=>{let T=L.getFullYear(),U=String(L.getMonth()+1).padStart(2,"0"),G=String(L.getDate()).padStart(2,"0");return `${T}-${U}-${G}`},h=D(w),A=new Date(w);A.setDate(A.getDate()+g);let C=D(A);a(h,C),s(false);},f=()=>{if(!e||!t)return "Set date";let g=A=>{if(A instanceof Date)return A;if(typeof A!="string"||!A.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=A.split("-").map(Number);if(C.length!==3||C.some(G=>isNaN(G)))return null;let L=C[0],T=C[1],U=C[2];return L===void 0||T===void 0||U===void 0?null:new Date(L,T-1,U)},w=g(e),D=g(t);if(!w||!D||isNaN(w.getTime())||isNaN(D.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[w.getMonth()]} ${w.getDate()} \u2013 ${h[D.getMonth()]} ${D.getDate()}`},y=e&&t,b=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),g<w})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${f()}`:"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:f()})]}),o&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:cm.map(g=>jsxRuntime.jsx("button",{onClick:()=>v(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function or({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,d]=react.useState(false),[m,c]=react.useState(""),[n,p]=react.useState({top:0,left:0}),l=react.useRef(null),i=react.useRef(null),u=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),g=window.innerHeight,w=window.innerWidth,D=300,h=380,A=4,C=b.right-D;C<10&&(C=b.left),C+D>w-10&&(C=w-D-10);let L=g-b.bottom,T=b.top,U;L>=h+A?U=b.bottom+A:T>=h+A?U=b.top-h-A:U=L>=T?b.bottom+A:Math.max(10,b.top-h-A),p({top:U,left:C}),d(true);};react.useEffect(()=>{let b=g=>{l.current&&!l.current.contains(g.target)&&!i.current?.contains(g.target)&&(d(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&(d(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let v=b=>{let g=e.some(w=>w.id===b.id);a(g?e.filter(w=>w.id!==b.id):[...e,b]);},f=t.filter(b=>b.name.toLowerCase().includes(m.toLowerCase())),y=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?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:[y.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),x>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:b=>c(b.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:f.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"}):f.map(b=>{let g=e.some(w=>w.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>v(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.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:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:g?"#3b82f6":"transparent"},children:g?"\u2713":""})]},b.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 wo(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let n=c.dependencies.map(p=>{if(typeof p=="string")return p;let l=p;return l.taskId||l.targetId||""}).filter(Boolean);r.set(c.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,d=new Set,m=c=>{if(!s.has(c)){s.add(c),d.add(c);let n=r.get(c)||[];for(let p of n){if(!s.has(p)&&m(p))return true;if(d.has(p))return true}}return d.delete(c),false};return m(a)}function Vr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:d}){let[m,c]=react.useState(false),[n,p]=react.useState(""),[l,i]=react.useState(t.length>0),[u,v]=react.useState({top:0,left:0}),[f,y]=react.useState(null),x=react.useRef(null),b=react.useRef(null),g=()=>{if(!b.current)return;let C=b.current.getBoundingClientRect(),L=window.innerHeight,T=window.innerWidth,U=300,G=l?380:120,$=4,E=C.right-U;E<10&&(E=C.left),E+U>T-10&&(E=T-U-10);let X=L-C.bottom,fe=C.top,Ce;X>=G+$?Ce=C.bottom+$:fe>=G+$?Ce=C.top-G-$:Ce=X>=fe?C.bottom+$:Math.max(10,C.top-G-$),v({top:Ce,left:E}),c(true);};react.useEffect(()=>{if(!m||!b.current)return;let C=b.current.getBoundingClientRect(),L=window.innerHeight,T=window.innerWidth,U=300,G=l?380:120,$=4,E=C.right-U;E<10&&(E=C.left),E+U>T-10&&(E=T-U-10);let X=L-C.bottom,fe=C.top,Ce;X>=G+$?Ce=C.bottom+$:fe>=G+$?Ce=C.top-G-$:Ce=X>=fe?C.bottom+$:Math.max(10,C.top-G-$),v({top:Ce,left:E});},[l,m]),react.useEffect(()=>{let C=L=>{x.current&&!x.current.contains(L.target)&&!b.current?.contains(L.target)&&(c(false),p(""));};if(m)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[m]),react.useEffect(()=>{let C=L=>{L.key==="Escape"&&(c(false),p(""));};if(m)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[m]);let w=C=>{let L=t.includes(C),T=a.find(U=>U.id===C);if(y(null),L){let U=t.filter(G=>G!==C);r(U),U.length===0&&i(false);}else {if(s&&wo(a,C,e)){let G=`Cannot add "${T?.title||C}" as dependency - would create circular reference`;y(G),d?.(C,T?.title||C),setTimeout(()=>y(null),3e3);return}r([...t,C]),i(true);}},D=()=>{let C=!l;i(C),C||r([]);},h=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(n.toLowerCase())||C.id.toLowerCase().includes(n.toLowerCase())),A=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>m?c(false):g(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:A,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:A},children:t.length})]}),m&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:x,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[f&&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:f})]}),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:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:n,onChange:C=>p(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:h.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"}):h.map(C=>{let L=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>w(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:T=>{T.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:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:C.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),i(false),c(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 La=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:d,availableUsers:m=[],allCards:c=[]})=>{let{attributes:n,listeners:p,setNodeRef:l,transform:i,transition:u,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),f={transform:yo.Transform.toString(i),transition:u};if(t)return jsxRuntime.jsx("div",{ref:l,style:f,...n,...p,onClick:()=>a?.(e),children:t(e)});let y=m.filter(g=>e.assignedUserIds?.includes(g.id)),x=e.progress===100,b={...f,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:b,className:k("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...p,onClick:g=>{g.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:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:x?"line-through":"none",opacity:x?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(ar,{priority:e.priority,onChange:g=>d?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Hr,{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:(g,w)=>d?.(e.id,{startDate:g,endDate:w})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(or,{assignedUsers:y,availableUsers:m,onChange:g=>d?.(e.id,{assignedUserIds:g.map(w=>w.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Vr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:c,onChange:g=>d?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))}),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));La.displayName="Card";var Co={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"}},Zi=({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 Qi({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[d,m]=react.useState({top:0,left:0}),c=react.useRef(null),n=react.useRef(null),p=[...Object.entries(Co).map(([y,x])=>({id:y,label:x.label,color:x.color,icon:x.icon})),...r.filter(y=>!Object.keys(Co).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let y=Co[e];if(y)return {...y,id:e};let x=r.find(b=>b.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...Co.todo,id:"todo"}},i=()=>{if(!n.current)return;let y=n.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,g=180,w=280,D=4,h=y.right-g;h<10&&(h=y.left),h+g>b-10&&(h=b-g-10);let A=x-y.bottom,C=y.top,L;A>=w+D?L=y.bottom+D:C>=w+D?L=y.top-w-D:L=A>=C?y.bottom+D:Math.max(10,y.top-w-D),m({top:L,left:h}),s(true);};react.useEffect(()=>{let y=x=>{c.current&&!c.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let u=y=>{t(y),s(false);},v=l(),f=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${f}10`,boxShadow:`0 0 0 2px ${f}30 inset`},title:v.label,children:jsxRuntime.jsx(Zi,{icon:v.icon,color:f})}),o&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:c,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(y=>jsxRuntime.jsxs("button",{onClick:()=>u(y.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:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Zi,{icon:y.icon,color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:y.label}),e===y.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"})})]},y.id))})]})})]})}function el({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,d]=react.useState(false),[m,c]=react.useState(false),[n,p]=react.useState(e),[l,i]=react.useState({top:0,left:0}),u=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let g=v.current.getBoundingClientRect();i({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[s]),react.useEffect(()=>{let g=w=>{u.current&&!u.current.contains(w.target)&&!v.current?.contains(w.target)&&(d(false),c(false));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),react.useEffect(()=>{let g=w=>{w.key==="Escape"&&(d(false),c(false),p(e));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s,e]),react.useEffect(()=>{m&&f.current&&(f.current.focus(),f.current.select());},[m]);let y=()=>{c(true),p(e);},x=()=>{let g=n.trim();g&&g!==e&&t(g),c(false),d(false),p(e);},b=g=>{g.key==="Enter"?x():g.key==="Escape"&&(c(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>d(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:m?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:f,type:"text",value:n,onChange:g=>p(g.target.value),onKeyDown:b,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:y,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 Tr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:d,onCardUpdate:m,availableUsers:c,allCards:n,enableVirtualization:p,cardHeight:l=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:v,onColumnDelete:f,isDeletable:y=false,className:x})=>{let{setNodeRef:b,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),w=react.useRef(null),D=p??Ni(t.length),h=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>w.current,estimateSize:()=>l,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:b,className:x,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let U=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:U}:U>=80?{state:"warning",percentage:U}:U>=60?{state:"approaching",percentage:U}:{state:"ok",percentage:U}})(),L=C.state==="exceeded",T=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:k("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",x),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:k(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),C.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),C.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),C.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(v||f)&&jsxRuntime.jsx(el,{columnTitle:e.title,onRename:U=>v?.(e.id,U),onDelete:f?()=>f(e.id):void 0,isDeletable:y}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:w,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(U=>U.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${h.getTotalSize()}px`,position:"relative"},children:h.getVirtualItems().map(U=>{let G=t[U.index];return G?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${U.start}px)`},children:jsxRuntime.jsx(La,{card:G,render:r,onClick:d,onUpdate:m,availableUsers:c,allCards:n})},G.id):null})}):t.map(U=>jsxRuntime.jsx(La,{card:U,render:r,onClick:d,onUpdate:m,availableUsers:c,allCards:n},U.id))})})]})});Tr.displayName="Column";function An({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,d]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):d(e),o(false);},n=p=>{p.key==="Enter"?c():p.key==="Escape"&&(d(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:s,onChange:p=>d(p.target.value),onBlur:c,onKeyDown:n,className:k("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:k("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Ln(){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 ja({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:d,style:m,isLoading:c,error:n,children:p}){let[l,i]=Ln(),u=o?.theme||"dark",f=u==="dark"||u==="neutral"?"dark":"",y=react.useCallback((T,U)=>{t.onCardUpdate?.(T,U);},[t]),x=react.useCallback((T,U)=>{t.onColumnUpdate?.(T,{title:U});},[t]),b=react.useCallback(T=>{t.onColumnDelete?.(T);},[t]),g=["todo","in-progress","completed"],w=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),D=react.useMemo(()=>{let T=new Map;return e.columns.forEach(U=>{let G=U.cardIds.map($=>e.cards.find(E=>E.id===$)).filter($=>$!==void 0).sort(($,E)=>$.position-E.position);T.set(U.id,G);}),T},[e.cards,e.columns]),h=react.useCallback(T=>{let{active:U}=T,G=e.cards.find($=>$.id===U.id);G&&i({isDragging:true,draggedCardId:G.id,sourceColumnId:G.columnId,targetColumnId:G.columnId});},[e.cards,i]),A=react.useCallback(T=>{let{active:U,over:G}=T;if(!G||!e.cards.find(X=>X.id===U.id))return;let E=null;G.data.current?.type==="column"?E=G.id:G.data.current?.type==="card"&&(E=e.cards.find(fe=>fe.id===G.id)?.columnId||null),E&&E!==l.targetColumnId&&i({...l,targetColumnId:E});},[e.cards,l,i]),C=react.useCallback(async T=>{let{active:U,over:G}=T;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!G)return;let $=e.cards.find(Ce=>Ce.id===U.id);if(!$)return;let E,X;if(G.data.current?.type==="column"){E=G.id;let Ce=D.get(E)||[];X=wn(Ce,0);}else {let Ce=e.cards.find(ce=>ce.id===G.id);if(!Ce)return;E=Ce.columnId;let Le=D.get(E)||[],Pe=Le.findIndex(ce=>ce.id===G.id);X=wn(Le,Pe);}let fe=e.columns.find(Ce=>Ce.id===E);if(fe&&fe.wipLimit&&fe.wipLimitType==="hard"){let Ce=D.get(E)||[];if($.columnId!==E&&Ce.length>=fe.wipLimit){t.onWipLimitExceeded?.(fe,$);return}}($.columnId!==E||$.position!==X)&&await t.onCardMove?.($.id,E,X);},[e.cards,e.columns,D,t,i]),L=react.useCallback(T=>{a?.(T);},[a]);return c?jsxRuntime.jsx("div",{className:k("asakaa-board",f,d),style:m,children:jsxRuntime.jsx(Fm,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:k("asakaa-board",f,d),style:m,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsxRuntime.jsx(Oi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:w,collisionDetection:core$1.closestCorners,onDragStart:h,onDragOver:A,onDragEnd:C,children:[jsxRuntime.jsxs("div",{className:k("asakaa-board",f,d),style:m,"data-theme":u,children:[e.columns.sort((T,U)=>T.position-U.position).map(T=>{let U=D.get(T.id)||[],G=!g.includes(T.id);return jsxRuntime.jsx(Tr,{column:T,cards:U,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:L,onCardUpdate:y,onColumnRename:x,onColumnDelete:b,isDeletable:G,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},T.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(La,{card:e.cards.find(T=>T.id===l.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Fm({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 Um={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)"},zm={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)"},Wm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Gm={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Hm({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,d]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let n=p=>{m.current&&!m.current.contains(p.target)&&d(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let c=n=>{t(n),d(false);};return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((n,p)=>n.position-p.position).map((n,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(n.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:n.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function _m({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,d]=react.useState(false),[m,c]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let u=v=>{n.current&&!n.current.contains(v.target)&&d(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(u=>u.handler),i=async(u,v)=>{if(v){c(u);try{await v();}catch(f){console.error(`Export ${u} failed:`,f);}finally{c(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((u,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(u.id,u.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:m===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 Vm({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 Bn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:d,onExportJSON:m,onExportExcel:c,translations:n}){let p=r==="dark"?Um:zm,l={...o==="es"?Wm:Gm,...n},i=d||m||c;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:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(_m,{theme:p,t:l,onExportCSV:d,onExportJSON:m,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(s?jsxRuntime.jsx(Hm,{columns:e,onSelect:t,theme:p,t:l,createTaskLabel:a}):jsxRuntime.jsx(Vm,{onClick:()=>t(),label:a||l.newTask}))]})})}function On({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,d]=react.useState(false),[m,c]=react.useState(""),n=react.useCallback(()=>{let i=m.trim();i&&(e(i),c(""),d(false));},[m,e]),p=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(c(""),d(false));},[n]),l=react.useCallback(()=>{setTimeout(()=>{m.trim()||d(false);},150);},[m]);return s?jsxRuntime.jsx("div",{className:k("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:m,onChange:i=>c(i.target.value),onKeyDown:p,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:n,disabled:!m.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),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:k("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 $n({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:d=false,theme:m="dark",locale:c="es"}){let[n,p]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState([]),[x,b]=react.useState(""),[g,w]=react.useState(""),[D,h]=react.useState(""),[A,C]=react.useState(false),[L,T]=react.useState(false),[U,G]=react.useState(false),$=react.useRef(null),E=react.useRef(null),X={placeholder:o||(c==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(c==="es"?"Agregar Tarea":"Add Task"),save:c==="es"?"Guardar":"Save",addAssignee:c==="es"?"Agregar asignado":"Add assignee",addDates:c==="es"?"Agregar fechas":"Add dates",addPriority:c==="es"?"Agregar prioridad":"Add priority",startDate:c==="es"?"Inicio":"Start",endDate:c==="es"?"Fin":"End",low:c==="es"?"Baja":"Low",medium:c==="es"?"Media":"Medium",high:c==="es"?"Alta":"High",urgent:c==="es"?"Urgente":"Urgent"},fe=react.useCallback(()=>{v(""),y([]),b(""),w(""),h(""),C(false),T(false),G(false),p(false);},[]);react.useEffect(()=>{n&&$.current&&$.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let S=F=>{E.current&&!E.current.contains(F.target)&&(u.trim()||fe());};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n,u,fe]);let Ce=react.useCallback(async()=>{let S=u.trim();if(!(!S||l)){i(true);try{await t({name:S,columnId:e,assigneeIds:f.length>0?f:void 0,startDate:x?new Date(x):void 0,endDate:g?new Date(g):void 0,priority:D||void 0}),v(""),y([]),b(""),w(""),h(""),C(!1),T(!1),G(!1),$.current?.focus();}catch(F){console.error("Error creating card:",F);}finally{i(false);}}},[u,e,f,x,g,D,t,l]),Le=react.useCallback(S=>{S.key==="Enter"&&!S.shiftKey?(S.preventDefault(),Ce()):S.key==="Escape"&&fe();},[Ce,fe]),Pe=react.useCallback(S=>{y(F=>F.includes(S)?F.filter(M=>M!==S):[...F,S]);},[]),ce=m==="dark";return n?jsxRuntime.jsxs("div",{ref:E,className:k("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:$,type:"text",value:u,onChange:S=>v(S.target.value),onKeyDown:Le,placeholder:X.placeholder,disabled:l,className:k("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:()=>C(!A),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||f.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:X.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"})]}),f.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:f.length})]}),jsxRuntime.jsx("button",{onClick:()=>T(!L),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||x||g?"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:X.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:()=>G(!U),className:k("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",U||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="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:X.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:Ce,disabled:!u.trim()||l,className:k("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):X.save})]})]}),A&&a.length>0&&jsxRuntime.jsx("div",{className:k("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(S=>jsxRuntime.jsxs("button",{onClick:()=>Pe(S.id),className:k("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",f.includes(S.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:[S.avatar?jsxRuntime.jsx("img",{src:S.avatar,alt:S.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:k("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",f.includes(S.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:S.name.split(" ")[0]})]},S.id))})}),L&&jsxRuntime.jsx("div",{className:k("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:k("block text-[10px] uppercase tracking-wide mb-1",ce?"text-gray-500":"text-gray-400"),children:X.startDate}),jsxRuntime.jsx("input",{type:"date",value:x,onChange:S=>b(S.target.value),className:k("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:k("block text-[10px] uppercase tracking-wide mb-1",ce?"text-gray-500":"text-gray-400"),children:X.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:S=>w(S.target.value),className:k("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")})]})]})}),U&&jsxRuntime.jsx("div",{className:k("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(S=>jsxRuntime.jsx("button",{onClick:()=>h(D===S?"":S),className:k("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===S?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[S]} text-white`:ce?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:X[S]},S))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:d,className:k("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:X.buttonLabel})]})}var Xr=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(ja,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
5
  `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(d=>{d?o(d):s(new Error("Failed to create PNG blob"));},"image/png");})}};function ul(e={}){return new Xr(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:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(d){console.error("Error in error handler:",d);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:d}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children: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 Un(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 Wn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:d,onPredictRisks:m,onOpenAIUsage:c,shortcut:n="k",className:p=""}){let[l,i]=react.useState(false),[u,v]=react.useState(""),[f,y]=react.useState("home"),[x,b]=react.useState(""),[g,w]=react.useState("");react.useEffect(()=>{let C=L=>{(L.metaKey||L.ctrlKey)&&L.key===n&&(L.preventDefault(),i(T=>!T)),L.key==="Escape"&&(i(false),y("home"),v(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[n]),react.useEffect(()=>{l||(y("home"),v(""),b(""),w(""));},[l]);let D=react.useCallback(()=>{i(false);},[]),h=react.useCallback(C=>{let[L,T]=C.split(":");switch(L){case "create-card":y("create-card");break;case "create-card-in":b(T||"");break;case "navigate":T?(a?.(T),D()):y("navigate");break;case "search":r?.(u),D();break;case "priority":y("priority");break;case "set-priority":g&&T&&(o?.(g,T),D());break;case "assign":y("assign");break;case "assign-user":g&&T&&(s?.(g,T),D());break;case "ai":y("ai");break;case "ai-generate-plan":d?.(),D();break;case "ai-predict-risks":m?.(),D();break;case "ai-usage":c?.(),D();break;case "back":y("home");break;}},[u,g,t,a,r,o,s,d,m,c,D]),A=react.useCallback(()=>{x&&u.trim()&&(t?.(x,u.trim()),D());},[x,u,t,D]);return l?jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:v,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:f==="create-card"&&x?"Type card title and press Enter...":f==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&f==="create-card"&&x&&A();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),f==="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:h,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:h,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:h,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:h,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:h,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},C.id))})]}),f==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.id}`,onSelect:h,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),f==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(C=>{let L=e.columns.find(T=>T.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:h,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:L?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:T},T))})]},C.id)})})]}),f==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:h,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:h,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:h,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:h,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 Zm(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 Qm(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 ep(e){return e.startsWith("image/")}function Zr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[d,m]=react.useState(false),[c,n]=react.useState(false),[p,l]=react.useState(null),i=react.useRef(null),u=react.useCallback(h=>{let A=[],C=[];return e.length+h.length>s?(C.push(`Maximum ${s} files allowed`),{valid:A,errors:C}):(h.forEach(L=>{if(L.size/1048576>r){C.push(`${L.name} is too large (max ${r}MB)`);return}if(o&&!o.some(U=>L.type.match(U))){C.push(`${L.name} has invalid file type`);return}A.push(L);}),{valid:A,errors:C})},[e.length,s,r,o]),v=react.useCallback(async h=>{let{valid:A,errors:C}=u(h);if(C.length>0){l(C.join(", ")),setTimeout(()=>l(null),5e3);return}if(A.length!==0){n(true),l(null);try{await t?.(A);}catch(L){l(L instanceof Error?L.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{n(false);}}},[u,t]),f=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),m(true);},[]),y=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),m(false);},[]),x=react.useCallback(h=>{h.preventDefault(),h.stopPropagation();},[]),b=react.useCallback(h=>{h.preventDefault(),h.stopPropagation(),m(false);let A=Array.from(h.dataTransfer.files);v(A);},[v]),g=react.useCallback(h=>{let A=h.target.files?Array.from(h.target.files):[];v(A),i.current&&(i.current.value="");},[v]),w=react.useCallback(()=>{i.current?.click();},[]),D=react.useCallback(h=>{confirm("Are you sure you want to delete this attachment?")&&a?.(h);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${d?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:x,onDrop:b,onClick:w,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?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,"/",s," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(h=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:ep(h.type)&&h.url?jsxRuntime.jsx("img",{src:h.thumbnailUrl||h.url,alt:h.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Qm(h.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:h.name,children:h.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Zm(h.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(h.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(h.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"})})})]},h.id))})]})}function Hn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:m=[],aiInsights:c=[],attachments:n=[],onAddComment:p,onDeleteComment:l,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:v,onGenerateSubtasks:f,onEstimateEffort:y,currentUserId:x="user-1"}){let[b,g]=react.useState("details"),[w,D]=react.useState(false),[h,A]=react.useState({}),[C,L]=react.useState(""),[T,U]=react.useState(false),[G,$]=react.useState({});if(!t||!e)return null;let E=react.useCallback(()=>{D(false),A({}),g("details"),L(""),$({}),a();},[a]),X=react.useCallback(()=>{r&&Object.keys(h).length>0&&(r(e.id,h),A({}),D(false));},[e.id,h,r]),fe=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),E());},[e.id,o,E]),Ce=react.useCallback(()=>{p&&C.trim()&&(p(e.id,C.trim()),L(""));},[e.id,C,p]),Le=react.useCallback(async()=>{if(v){U(true);try{let M=await v(e);$(V=>({...V,assignees:M}));}catch(M){console.error("Failed to suggest assignee:",M);}finally{U(false);}}},[e,v]),Pe=react.useCallback(async()=>{if(f){U(true);try{let M=await f(e);$(V=>({...V,subtasks:M}));}catch(M){console.error("Failed to generate subtasks:",M);}finally{U(false);}}},[e,f]),ce=react.useCallback(async()=>{if(y){U(true);try{let M=await y(e);$(V=>({...V,effort:M}));}catch(M){console.error("Failed to estimate effort:",M);}finally{U(false);}}},[e,y]),S={...e,...h},F=s.filter(M=>S.assignedUserIds?.includes(M.id));return jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:E,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:M=>M.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:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsxRuntime.jsx("input",{type:"text",value:h.title??S.title,onChange:M=>A({...h,title:M.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:S.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[w?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:X,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),A({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(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:fe,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:()=>g("details"),className:`card-detail-tab ${b==="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:()=>g("comments"),className:`card-detail-tab ${b==="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:()=>g("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${b==="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:[b==="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"}),w?jsxRuntime.jsx("textarea",{value:h.description??S.description??"",onChange:M=>A({...h,description:M.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:S.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsxRuntime.jsx("select",{multiple:true,value:h.assignedUserIds??S.assignedUserIds??[],onChange:M=>{let V=Array.from(M.target.selectedOptions,P=>P.value);A({...h,assignedUserIds:V});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:F.length>0?F.map(M=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:M.color},children:M.initials}),jsxRuntime.jsx("span",{children:M.name})]},M.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"}),w?jsxRuntime.jsxs("select",{value:h.priority??S.priority??"",onChange:M=>A({...h,priority:M.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:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:S.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:S.labels&&S.labels.length>0?S.labels.map(M=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:M},M)):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"}),w?jsxRuntime.jsx("input",{type:"date",value:h.startDate?new Date(h.startDate).toISOString().split("T")[0]:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:"",onChange:M=>A({...h,startDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.startDate?new Date(S.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsxRuntime.jsx("input",{type:"date",value:h.endDate?new Date(h.endDate).toISOString().split("T")[0]:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:"",onChange:M=>A({...h,endDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.endDate?new Date(S.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:h.estimatedTime??S.estimatedTime??"",onChange:M=>A({...h,estimatedTime:M.target.value?parseFloat(M.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:S.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:S.dependencies&&S.dependencies.length>0?S.dependencies.map(M=>{let V=typeof M=="string"?M:M.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",V.slice(-4)]},V)}):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:S.createdAt?new Date(S.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:M=>L(M.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Ce,disabled:!C.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(M=>{let V=s.find(P=>P.id===M.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:[V&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:V.color},children:V.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:V?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(M.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(M.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:M.content})]},M.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"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(M=>{let V=s.find(P=>P.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[M.type.includes("CREATED")&&"\u2795",M.type.includes("UPDATED")&&"\u270F\uFE0F",M.type.includes("MOVED")&&"\u27A1\uFE0F",M.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",M.type.includes("COMMENT")&&"\u{1F4AC}",M.type.includes("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",M.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:V?.name||"Unknown"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:M.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.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"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Zr,{cardId:e.id,attachments:n,onUpload:i?M=>i(e.id,M):void 0,onDelete:u,currentUserId:x,maxSizeMB:10,maxFiles:20})}),b==="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:Le,disabled:T||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:Pe,disabled:T||!f,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:T||!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("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),G.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),G.assignees.map((M,V)=>{let P=s.find(W=>W.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[P&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:P?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:M.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(M.confidence*100).toFixed(0),"%"]})]})]},V)})]}),G.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),G.subtasks.map((M,V)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:M.title}),M.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:M.description}),M.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",M.estimatedTime,"h"]})]},V))]}),G.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:[G.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(G.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(M=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${M.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:M.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:M.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:M.description}),M.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",M.suggestedAction]})]},M.id))]}),!G.assignees&&!G.subtasks&&!G.effort&&c.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 Qr({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:d=""}){let[m,c]=react.useState({top:0,left:0}),n=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,v=4,f=l.left;f+o>u-10&&(f=u-o-10),f<10&&(f=10);let y=i-l.bottom,x=l.top,b;return y>=s+v?b=l.bottom+v:x>=s+v?b=l.top-s-v:y>=x?b=l.bottom+v:b=Math.max(10,l.top-s-v),{top:b,left:f}},[e,o,s]);return react.useEffect(()=>{t&&c(p());},[t,p]),react.useEffect(()=>{if(!t)return;let l=u=>{let v=u.target;n.current&&!n.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${d}`,style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var lp=["LOW","MEDIUM","HIGH","URGENT"],dp=["todo","in-progress","review","done"];function jn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:m=[],onAddComment:c,onDeleteComment:n,currentUser:p,onAIGenerateDescription:l,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:v=[],availableLabels:f=[],onUploadCoverImage:y,unsplashAccessKey:x,theme:b,onSubtasksChange:g}){let w=kr(),D=b||w?.themeName||"dark",[h,A]=react.useState(e),[C,L]=react.useState(false),[T,U]=react.useState(e?.subtasks||[]),[G,$]=react.useState(false),[E,X]=react.useState(""),[fe,Ce]=react.useState(""),[Le,Pe]=react.useState("all"),[ce,S]=react.useState(false),[F,M]=react.useState(false),[V,P]=react.useState(false),[W,de]=react.useState(false),[ae,Ee]=react.useState(false),[le,Ve]=react.useState(false),he=react.useRef(null),at=react.useRef(null),Et=react.useRef(null),gt=react.useRef(null),ft=react.useRef(null),rt=react.useRef(null),ot=react.useRef(null),ia=react.useRef(null),wt=react.useRef(null),ct=react.useRef(null),Lt=react.useRef(null),jt=react.useRef(null);react.useEffect(()=>{e&&!h?(A({...e}),U(e.subtasks||[])):e&&h&&e.id!==h.id&&(A({...e}),U(e.subtasks||[]));},[e,h]),react.useEffect(()=>{let B=K=>{let Ne=K.target;gt.current&&!gt.current.contains(Ne)&&S(false),ft.current&&!ft.current.contains(Ne)&&M(false),rt.current&&!rt.current.contains(Ne)&&P(false),ot.current&&!ot.current.contains(Ne)&&de(false);};if(ce||F||V||W)return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[ce,F,V,W]),react.useEffect(()=>{if(!t)return;let B=K=>{let Ne=K.target,je=Ne.tagName==="INPUT"||Ne.tagName==="TEXTAREA"||Ne.isContentEditable;if(K.key==="Escape"){K.preventDefault(),ce||F||V||W||ae||le?(S(false),M(false),P(false),de(false),Ee(false),Ve(false)):je||a();return}if(je&&K.key!=="Escape")return;let Pt=K.metaKey||K.ctrlKey;switch(K.key.toLowerCase()){case "s":K.preventDefault(),S(true);break;case "a":K.preventDefault(),P(true);break;case "p":K.preventDefault(),M(true);break;case "l":K.preventDefault(),de(true);break;case "d":Pt||(K.preventDefault(),Ee(true),setTimeout(()=>ia.current?.focus(),0));break;case "e":Pt||(K.preventDefault(),Ve(true));break;case "i":K.preventDefault(),L(true),setTimeout(()=>at.current?.focus(),0);break;case "t":K.preventDefault(),$(true);break;case "c":K.preventDefault(),Et.current?.focus();break}};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[t,a,ce,F,V,W,ae,le]);let we=react.useCallback(B=>{let K=B.currentTarget.textContent?.trim()||"";if(h&&K!==h.title){let Ne={...h,title:K};A(Ne),r?.(h.id,{title:K});}},[h,r]),O=react.useCallback(B=>{B.key==="Enter"&&(B.preventDefault(),B.currentTarget.blur()),B.key==="Escape"&&(B.preventDefault(),B.currentTarget.textContent=h?.title||"",B.currentTarget.blur());},[h]),De=react.useCallback(()=>{h&&e&&h.description!==e.description&&r?.(h.id,{description:h.description}),L(false);},[h,e,r]),ze=react.useCallback(B=>{if(h){let K={...h,columnId:B};A(K),r?.(h.id,{columnId:B}),S(false);}},[h,r]),Ue=react.useCallback(B=>{if(h){let K={...h,priority:B};A(K),r?.(h.id,{priority:B}),M(false);}},[h,r]),bt=react.useCallback(B=>{if(h){let K=h.assignedUserIds||[],Ne=K.includes(B)?K.filter(Pt=>Pt!==B):[...K,B],je={...h,assignedUserIds:Ne};A(je),r?.(h.id,{assignedUserIds:Ne});}},[h,r]),J=react.useCallback(B=>{if(h){let K=h.labels||[],Ne=K.includes(B)?K.filter(Pt=>Pt!==B):[...K,B],je={...h,labels:Ne};A(je),r?.(h.id,{labels:Ne});}},[h,r]),Q=react.useCallback(B=>{if(h){let K=B.target.value,Ne={...h,endDate:K};A(Ne),r?.(h.id,{endDate:K}),Ee(false);}},[h,r]),xe=react.useCallback(B=>{if(h){let K={...h,estimatedTime:parseFloat(B)||0};A(K),r?.(h.id,{estimatedTime:parseFloat(B)||0});}},[h,r]),ge=react.useCallback(()=>{if(E.trim()&&h){let B={id:`subtask-${Date.now()}`,title:E.trim(),completed:false,createdAt:new Date},K=[...T,B];U(K),X(""),$(false),g?.(h.id,K);}},[E,T,h,g]),ee=react.useCallback(B=>{let K=T.map(Ne=>Ne.id===B?{...Ne,completed:!Ne.completed,updatedAt:new Date}:Ne);U(K),h&&g?.(h.id,K);},[T,h,g]),Te=react.useCallback(B=>{let K=T.filter(Ne=>Ne.id!==B);U(K),h&&g?.(h.id,K);},[T,h,g]),be=react.useCallback(()=>{fe.trim()&&h&&c&&(c(h.id,fe.trim()),Ce(""));},[fe,h,c]),ke=react.useCallback(B=>{(B.metaKey||B.ctrlKey)&&B.key==="Enter"&&(B.preventDefault(),be());},[be]),R=B=>jsxRuntime.jsx(np__default.default,{remarkPlugins:[sp__default.default],rehypePlugins:[ip__default.default],components:{a:({node:K,...Ne})=>jsxRuntime.jsx("a",{...Ne,target:"_blank",rel:"noopener noreferrer"})},children:B}),H=m.filter(B=>Le==="comments"?B.type.includes("COMMENT"):Le==="history"?!B.type.includes("COMMENT"):true);if(!t||!e)return null;let q=h||e,se=s.filter(B=>q.assignedUserIds?.includes(B.id)),ie=T.filter(B=>B.completed).length;return jsxRuntime.jsx(Ye,{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:B=>B.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:he,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:we,onKeyDown:O,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:gt,children:[jsxRuntime.jsxs("button",{ref:wt,className:"modal-v2-field",onClick:()=>S(!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(Qr,{triggerRef:wt,isOpen:ce,onClose:()=>S(false),width:250,estimatedHeight:200,children:(v.length>0?v:dp.map(B=>({id:B,title:B}))).map(B=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${q.columnId===B.id?"active":""}`,onClick:()=>ze(B.id),children:B.title},B.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:rt,children:[jsxRuntime.jsxs("button",{ref:ct,className:"modal-v2-field",onClick:()=>P(!V),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:se.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:se.map(B=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:B.color},title:B.name,children:B.initials},B.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Qr,{triggerRef:ct,isOpen:V,onClose:()=>P(false),width:280,estimatedHeight:300,children:s.map(B=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.assignedUserIds?.includes(B.id)?"active":""}`,onClick:()=>bt(B.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:B.color},children:B.initials}),B.name,q.assignedUserIds?.includes(B.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"})})]},B.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ft,children:[jsxRuntime.jsxs("button",{ref:Lt,className:"modal-v2-field",onClick:()=>M(!F),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(Qr,{triggerRef:Lt,isOpen:F,onClose:()=>M(false),width:180,estimatedHeight:220,children:[lp.map(B=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${B.toLowerCase()} ${q.priority===B?"active":""}`,onClick:()=>Ue(B),children:B},B)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ue(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ot,children:[jsxRuntime.jsxs("button",{ref:jt,className:"modal-v2-field",onClick:()=>de(!W),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(Qr,{triggerRef:jt,isOpen:W,onClose:()=>de(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(B=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.labels?.includes(B)?"active":""}`,onClick:()=>J(B),children:[B,q.labels?.includes(B)&&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"})})]},B))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Ee(!ae),setTimeout(()=>ia.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:ia,type:"date",value:typeof q.endDate=="string"?q.endDate.split("T")[0]:q.endDate?(()=>{let B=new Date(q.endDate),K=B.getUTCFullYear(),Ne=String(B.getUTCMonth()+1).padStart(2,"0"),je=String(B.getUTCDate()).padStart(2,"0");return `${K}-${Ne}-${je}`})():"",onChange:Q,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ve(!le),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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"})]}),le&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:q.estimatedTime||"",onChange:B=>xe(B.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ve(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"})]}),C?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:q.description||"",onChange:B=>{if(h){let K={...h,description:B.target.value};A(K);}},onBlur:De,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>L(true),children:q.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:R(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"}),T.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ie,"/",T.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>$(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:[T.map(B=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${B.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ee(B.id),children:B.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:B.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Te(B.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"})]})})]},B.id)),G&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:E,onChange:B=>X(B.target.value),onKeyDown:B=>{B.key==="Enter"&&ge(),B.key==="Escape"&&($(false),X(""));},onBlur:ge,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 ${Le==="all"?"active":""}`,onClick:()=>Pe("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Le==="comments"?"active":""}`,onClick:()=>Pe("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${Le==="history"?"active":""}`,onClick:()=>Pe("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:Et,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:fe,onChange:B=>Ce(B.target.value),onKeyDown:ke,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:be,disabled:!fe.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[H.map(B=>{let K=s.find(je=>je.id===B.userId);if(B.type.includes("COMMENT")){let je=d.find(Pt=>Pt.id===B.metadata?.commentId);return je?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[K&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:K.color},children:K.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:K?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(B.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:je.content})]})]},B.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[B.type.includes("CREATED")&&"\u2795",B.type.includes("UPDATED")&&"\u270F\uFE0F",B.type.includes("MOVED")&&"\u27A1\uFE0F",B.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",B.type.includes("ASSIGNED")&&"\u{1F464}",B.type.includes("PRIORITY")&&"\u{1F3AF}",B.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:K?.name||"Unknown"})," ",B.type.replace(/_/g," ").toLowerCase(),B.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:B.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(B.timestamp).toLocaleString()})]})]},B.id)}),H.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 yp({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 Yn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(d=>({...d,average:d.average??e.reduce((m,c)=>m+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(yp,{})}),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,m)=>d+m.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((d,m)=>d+m.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,m)=>d+(m.planned||0),0)})]})]})]})}function Sp({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 qn({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),d=e[e.length-1]?.remaining||0,m=e[e.length-1]?.ideal||0,c=s>0?(s-d)/s*100:0,n=d<=m;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Sp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",fill:n?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:n?"#10B981":"#EF4444"},children: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:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Rp={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Cl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Op({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let d=r+(o-r)*.5,m=e+d*Math.cos(-a*(Math.PI/180)),c=t+d*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:m,y:c,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Tl({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 Xn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,n)=>c+n.value,0),d=e.map(c=>({...c,totalValue:s,color:c.color||Rp[c.name]||Cl[e.indexOf(c)%Cl.length]})),m=d.map(c=>c.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?Op:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:d.map((c,n)=>jsxRuntime.jsx(recharts.Cell,{fill:m[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Tl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,n)=>{let p=n.payload,l=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.value} - ${l}%)`}})]}):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(Tl,{})}),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((c,n)=>jsxRuntime.jsx(recharts.Cell,{fill:m[n]},`cell-${n}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,n)=>n.value>c.value?n:c).name})]})]})]})}var Mo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[d,m]=react.useState(false),[c,n]=react.useState(false),[p,l]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let v=e.map(w=>w.id),f=w=>{r.onBulkUpdate?.(v,{priority:w}),m(false);},y=w=>{r.onBulkMove?.(v,w),n(false),a();},x=w=>{r.onBulkUpdate?.(v,{assignedUserIds:w}),l(false);},b=w=>{let D=new Set;e.forEach(A=>{A.labels?.forEach(C=>D.add(C));});let h=Array.from(new Set([...D,...w]));r.onBulkUpdate?.(v,{labels:h}),u(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!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(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(w),children:[jsxRuntime.jsx("span",{className:k("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w.id),children:w.title},w.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([w.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:g,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"})})]})]})})});Mo.displayName="BulkOperationsToolbar";function Gp(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,d,m,c,n;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(u=>{let v=a?.find(f=>f.id===u);d=`assignee-${u}`,m=v?.name||`User ${u}`,c=v?.color,n=v?.avatar,r.has(d)||r.set(d,{id:d,title:m,groupValue:u,cardIds:[],color:c,icon:n}),r.get(d).cardIds.push(o.id);}):(d="assignee-unassigned",m="Unassigned",c="#6b7280",n="\u{1F464}",r.has(d)||r.set(d,{id:d,title:m,groupValue:null,cardIds:[],color:c,icon:n}),r.get(d).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",d=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];m=i.title,c=i.color,r.has(d)||r.set(d,{id:d,title:m,groupValue:s,cardIds:[],color:c}),r.get(d).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{d=`label-${u}`,m=u,c="#6b7280",r.has(d)||r.set(d,{id:d,title:m,groupValue:u,cardIds:[],color:c}),r.get(d).cardIds.push(o.id);}):(d="label-none",m="No Labels",c="#6b7280",r.has(d)||r.set(d,{id:d,title:m,groupValue:null,cardIds:[],color:c}),r.get(d).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Jn({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,d]=react.useState(new Set),m=react.useMemo(()=>Gp(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(n=>{d(p=>{let l=new Set(p);return l.has(n)?l.delete(n):l.add(n),l});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(ja,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:k("asakaa-swimlane-view",o),children:[m.map(n=>{let p=s.has(n.id),l=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(ja,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),m.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Zn=[{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 Qn({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null),m=Zn.find(n=>n.value===e)||Zn[0];react.useEffect(()=>{function n(p){s.current&&!s.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:k("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:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:k("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Zn.map(n=>jsxRuntime.jsxs("button",{onClick:()=>c(n.value),className:k("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:n.label}),e===n.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:n.description})]})]},n.value))})]})]})}var eo=[{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 Vp(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,d=o.shift?e.shiftKey:!e.shiftKey,m=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&d&&m&&c}function Pl(e={}){let{shortcuts:t=eo,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let d=react.useCallback(c=>{o.current=[...o.current,c];},[]),m=react.useCallback(c=>{o.current=o.current.filter(n=>n.action!==c);},[]);return react.useEffect(()=>{function c(n){if(!s.current)return;let p=n.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let l of o.current)if(Vp(n,l)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:d,unregisterShortcut:m,isEnabled:a}}function Kp(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Yp(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 qp(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Yp(e),r=t?Kp(t):"";return a?`${a} + ${r}`:r}function Xp(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 es({shortcuts:e=eo,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function m(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let d=Xp(e);return jsxRuntime.jsxs("div",{className:k("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(([m,c])=>c.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"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:qp(n)})]},n.action))})]},m))})}),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 ts=[{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
 
@@ -273,7 +273,7 @@
273
273
  </Calendars>
274
274
  <Tasks>${c}
275
275
  </Tasks>
276
- </Project>`,p=new Blob([n],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(p),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=oe.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let p=n.startDate&&n.endDate?oe.calculateDuration(n.startDate,n.endDate):0,l=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(f=>f.id===u);if(v){o(v);let f=r.get(u)?.ef||0;l=Math.max(l,f);}}let i=l+p;r.set(n.id,{es:l,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),d=new Map,m=n=>{if(d.has(n.id))return;let p=n.startDate&&n.endDate?oe.calculateDuration(n.startDate,n.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(l.length>0)for(let v of l){m(v);let f=d.get(v.id)?.ls||0;i=Math.min(i,f);}let u=i-p;d.set(n.id,{ls:u,lf:i});};a.forEach(m);let c=[];for(let n of a){let p=r.get(n.id),l=d.get(n.id);if(p&&l){let i=l.ls-p.es;Math.abs(i)<.01&&c.push(n.id);}}return c},calculateSlack:(e,t)=>{let a=oe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(oe.calculateCriticalPath(e).includes(t))return 0;let o=oe.getDependentTasks(e,t);if(o.length===0){let m=oe.getLatestEndDate(e);if(!m)return null;let c=oe.calculateDuration(a.endDate,m);return Math.max(0,c)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,c)=>m-c)[0];if(!s)return null;let d=oe.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>oe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=oe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=oe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let m=oe.calculateDuration(d.startDate,d.endDate),c;a!==void 0?(c=new Date(d.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let n=oe.calculateEndDate(c,m),p=l=>l.map(i=>i.id===d.id?{...i,startDate:c,endDate:n}:i.subtasks?{...i,subtasks:p(i.subtasks)}:i);s=p(s),s=oe.autoScheduleDependents(s,d.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,d,m)=>{if(a===0)return [];let c=[],n=o.getTime(),p=1e3*60*60*24,l=oe.findTaskById(e,t);if(!l||!l.endDate)return [];let i=(u,v,f=new Set)=>{if(f.has(u))return;f.add(u);let y=oe.getDependentTasks(e,u);for(let x of y){if(!x.startDate||!x.endDate)continue;let b=r.findIndex(U=>U.id===x.id);if(b===-1)continue;let g=x.startDate.getTime(),D=(x.endDate.getTime()-g)/p,A=(g-n)/p*s,C=A+v*s,L=Math.max(D*s,s),T=m+b*d+12;c.push({taskId:x.id,taskName:x.name,originalX:A,previewX:C,width:L,y:T,rowIndex:b,daysDelta:v,color:x.color}),i(x.id,v,f);}};return i(t,a),c},splitTask:(e,t,a,r=3)=>{let o=oe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let d=new Date(a);d.setDate(d.getDate()+r);let m=new Date(o.endDate);m.setDate(m.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:d,endDate:m}],n=p=>p.map(l=>l.id===o.id?{...l,endDate:m,segments:c}:l.subtasks?{...l,subtasks:n(l.subtasks)}:l);return n(e)}};function Ko({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:m,onTaskClick:c,onTaskDblClick:n,onTaskContextMenu:p,onTaskDateChange:l,onDependencyCreate:i,onDependencyDelete:u}){let[f,y]=react.useState([]),[x,b]=react.useState(null),[g,w]=react.useState(null),D=react.useCallback(S=>{b(S);},[]),h=react.useCallback(S=>{w(S);},[]),A=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),C=r==="day"?60:r==="week"?20:8,L=A*C*d,T=S=>{let F=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),M=F.getUTCDay()||7;F.setUTCDate(F.getUTCDate()+4-M);let V=new Date(Date.UTC(F.getUTCFullYear(),0,1));return Math.ceil(((F.getTime()-V.getTime())/864e5+1)/7)},U=S=>{let F=S.getDay();return F===0||F===6},G=react.useCallback(S=>{let F=Math.round(S/(C*d)),M=new Date(o);return M.setDate(M.getDate()+F),M},[o,C,d]),$=react.useCallback((S,F)=>{if(F.startDate&&F.endDate)return;let M=S.currentTarget.ownerSVGElement;if(!M)return;let V=M.createSVGPoint();V.x=S.clientX,V.y=S.clientY;let P=V.matrixTransform(M.getScreenCTM()?.inverse()),W=G(P.x),de=new Date(W);de.setDate(de.getDate()+1),l?.(F,W,de);},[G,l]),E=react.useMemo(()=>{let S=P=>P.map(W=>{if(W.subtasks&&W.subtasks.length>0){let de=S(W.subtasks),ae=de.filter(Ee=>Ee.startDate&&Ee.endDate);if(ae.length>0){let Ee=ae.map(at=>at.startDate.getTime()),le=ae.map(at=>at.endDate.getTime()),Ve=new Date(Math.min(...Ee)),he=new Date(Math.max(...le));return {...W,subtasks:de,startDate:Ve,endDate:he}}return {...W,subtasks:de}}return W}),F=(P,W=[])=>{for(let de of P)W.push(de),de.subtasks&&de.subtasks.length>0&&(de.isExpanded===void 0||de.isExpanded)&&F(de.subtasks,W);return W},M=S(e);return F(M)},[e]),X=react.useCallback(S=>{if(!S.startDate||!S.endDate)return {x:0,width:0};let F=S.startDate.getTime(),M=S.endDate.getTime(),V=o.getTime(),P=(F-V)/(1e3*60*60*24),W=(M-F)/(1e3*60*60*24),de=P*C*d,ae=Math.max(C*d,40),Ee=Math.max(W*C*d,ae);return {x:de,width:Ee}},[o,C,d]),fe=react.useMemo(()=>E.filter(S=>S.startDate&&S.endDate).map(S=>{let{x:F,width:M}=X(S),P=E.findIndex(W=>W.id===S.id)*a+12;return {id:S.id,x:F,y:P,width:M,height:32}}),[E,X]),Ce=react.useCallback((S,F,M)=>{if(!M||F===0){y([]);return}let V=oe.calculateCascadePreview(e,S,F,E,o,C*d,a,48);y(V);},[e,E,o,C,d,a,48]),Le=react.useMemo(()=>{let S=[],F=new Date(o);for(;F<=s;){let P=(F.getTime()-o.getTime())/864e5*C*d;if(r==="day")S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:P}),F.setDate(F.getDate()+1);else if(r==="week"){let W=T(F);S.push({date:new Date(F),label:`Week ${W}`,x:P}),F.setDate(F.getDate()+7);}else S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:P}),F.setMonth(F.getMonth()+1);}return S},[o,s,r,C,d]),Pe=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*C*d,[o,C,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(L,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:48,fill:t.bgGrid}),Le.map((S,F)=>jsxRuntime.jsxs("g",{children:[F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:S.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:S.label})]},`header-${F}`)),Pe>=0&&Pe<=L&&jsxRuntime.jsx("circle",{cx:Pe,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(L,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(L,1e3),height:ce,fill:t.bgPrimary}),Le.map((S,F)=>{let M=Le[F+1]?.x||L,V=U(S.date);return jsxRuntime.jsxs("g",{children:[V&&jsxRuntime.jsx("rect",{x:S.x,y:0,width:M-S.x,height:E.length*a,fill:t.bgWeekend,opacity:1}),F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:E.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},F)}),Pe>=0&&Pe<=L&&jsxRuntime.jsx("line",{x1:Pe,y1:0,x2:Pe,y2:E.length*a,stroke:t.today,strokeWidth:2,opacity:1}),E.map((S,F)=>{let M=S.startDate&&S.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:F%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${S.id}`),!M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:V=>$(V,S),onMouseEnter:V=>{V.currentTarget.setAttribute("fill",t.accentLight),V.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:V=>{V.currentTarget.setAttribute("fill","transparent"),V.currentTarget.setAttribute("opacity","1");}},`clickable-${S.id}`),jsxRuntime.jsx("text",{x:Pe>0?Pe:100,y:F*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${S.id}`)]})]},`row-group-${S.id}`)}),E.map((S,F)=>!S.dependencies||S.dependencies.length===0||!S.startDate||!S.endDate?null:S.dependencies.map(M=>{let V=E.find(ae=>ae.id===M);if(!V||!V.startDate||!V.endDate)return null;let P=E.findIndex(ae=>ae.id===M),W=X(V),de=X(S);return jsxRuntime.jsx(Ho,{x1:W.x+W.width,y1:P*a+a/2,x2:de.x,y2:F*a+a/2,theme:t,onDelete:()=>u?.(S.id,M),onHoverChange:h},`dep-${M}-${S.id}`)})),E.map((S,F)=>{if(!S.startDate||!S.endDate)return null;let{x:M,width:V}=X(S),P=F*a+12,W=S.subtasks&&S.subtasks.length>0&&!S.isMilestone;return S.isMilestone?jsxRuntime.jsx(Vo,{task:S,x:M+V/2,y:P+16,theme:t,onClick:c},S.id):W?jsxRuntime.jsxs("g",{onClick:()=>c?.(S),onContextMenu:de=>{de.preventDefault(),de.stopPropagation(),p?.(S,de);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:M,y:P,width:V,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M+V,y2:P,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M+V,y1:P,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P+32,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),V>60&&jsxRuntime.jsx("text",{x:M+12,y:P+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S.name})]},S.id):jsxRuntime.jsx(zo,{task:S,x:M,y:P,width:V,theme:t,dayWidth:C*d,startDate:o,templates:m,onClick:c,onDoubleClick:n,onContextMenu:p,onDateChange:l,onDependencyCreate:i,allTaskPositions:fe,onDragMove:Ce,onHoverChange:D},S.id)}),f.map(S=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:S.previewX,y:S.y-48,width:S.width,height:32,rx:8,fill:S.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(S.daysDelta)>0&&jsxRuntime.jsx("text",{x:S.previewX+S.width/2,y:S.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:S.daysDelta>0?`+${S.daysDelta}d`:`${S.daysDelta}d`})]},`cascade-preview-${S.taskId}`)),g&&(()=>{let{x1:S,y1:F,x2:M,y2:V,onDelete:P}=g,W=M-S,de=V-F,ae=S+W/2,Ee=(F+V)/2,le=`M ${S} ${F} C ${ae} ${F}, ${ae} ${V}, ${M} ${V}`,Ve=6,he=Math.atan2(de,W),at=M-Ve*Math.cos(he-Math.PI/6),Et=V-Ve*Math.sin(he-Math.PI/6),gt=M-Ve*Math.cos(he+Math.PI/6),ft=V-Ve*Math.sin(he+Math.PI/6),rt=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:le,fill:"none",stroke:rt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${M} ${V} L ${at} ${Et} M ${M} ${V} L ${gt} ${ft}`,fill:"none",stroke:rt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:M,cy:V,r:5,fill:rt}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:ot=>{ot.stopPropagation(),P();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:ae,cy:Ee,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:ae-4,y1:Ee-4,x2:ae+4,y2:Ee+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:ae+4,y1:Ee-4,x2:ae-4,y2:Ee+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(sd,{tooltipData:x,theme:t})]})]})}var Yo=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];var Es=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ps=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Xo({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:d=false,mode:m=a?"edit":"create",theme:c="dark",customStatuses:n=[]}){let p=[...Es,...n.filter(P=>!Es.some(W=>W.id===P.id))],l=Oe[c]||Oe.dark,[i,u]=react.useState(false),[v,f]=react.useState(false),[y,x]=react.useState(false),[b,g]=react.useState(false),[w,D]=react.useState(null),[h,A]=react.useState(new Date),[C,L]=react.useState(false),T=react.useRef(null),U=react.useRef(null),G=react.useRef(null),$=react.useRef(null),[E,X]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[fe,Ce]=react.useState({});react.useEffect(()=>{a?(X({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)&&L(true)):(X({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),L(false));},[a,e]),react.useEffect(()=>{let P=W=>{T.current&&!T.current.contains(W.target)&&u(false),U.current&&!U.current.contains(W.target)&&f(false),G.current&&!G.current.contains(W.target)&&x(false),$.current&&!$.current.contains(W.target)&&g(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);let Le=()=>{let P={};return E.name.trim()||(P.name="El nombre es requerido"),E.startDate&&E.endDate&&E.startDate>E.endDate&&(P.endDate="La fecha de fin debe ser posterior a la de inicio"),Ce(P),Object.keys(P).length===0},Pe=async P=>{if(P.preventDefault(),!!Le())try{await s(E),t();}catch(W){console.error("Error submitting task:",W);}},ce=(P,W)=>{X(de=>{let ae={...de,[P]:W};if(P==="status"){let Ee=W;Ee==="todo"?ae.progress=0:Ee==="in-progress"?(de.progress===0||de.progress===100)&&(ae.progress=50):Ee==="completed"||Ee==="closed"?ae.progress=100:(Ee==="in-review"||Ee==="review")&&(ae.progress=75);}if(P==="progress"){let Ee=typeof W=="number"?W:parseInt(W,10);Ee===100&&de.status!=="completed"?ae.status="completed":Ee>0&&Ee<100&&de.status==="todo"?ae.status="in-progress":Ee===0&&de.status!=="todo"&&(ae.status="todo");}return ae}),fe[P]&&Ce(de=>{let ae={...de};return delete ae[P],ae});},S=p.find(P=>P.id===E.status)??Es[0],F=Ps.find(P=>P.id===E.priority)??Ps[1],M=Yo.find(P=>P.value===E.color)??Yo[0],V={backgroundColor:l.bgSecondary,border:`1px solid ${l.borderLight}`,color:l.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${l.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color||l.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textSecondary},children:m==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:l.textTertiary},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=l.hoverBg,P.currentTarget.style.color=l.textPrimary;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent",P.currentTarget.style.color=l.textTertiary;},disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Pe,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:E.name,onChange:P=>ce("name",P.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:l.textPrimary},placeholder:"Nombre de la tarea",disabled:d,autoFocus:true}),fe.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),fe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:E.description||"",onChange:P=>ce("description",P.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:l.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:d})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:T,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&u(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...V,borderColor:S.color,backgroundColor:`${S.color}15`},disabled:d,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),jsxRuntime.jsx("span",{style:{color:S.color},children:S.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:S.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:p.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("status",P.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:P.color}}),P.title,E.status===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),jsxRuntime.jsxs("div",{ref:U,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&f(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:F.color}}),jsxRuntime.jsx("span",{children:F.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:Ps.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("priority",P.id),f(false);},children:[jsxRuntime.jsx("span",{children:P.icon}),P.label,E.priority===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[E.assignees&&E.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:E.assignees.slice(0,3).map((P,W)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:P.color||l.accent,borderColor:l.bgSecondary},children:P.initials},W))}),E.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:l.textTertiary},children:["+",E.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:l.textTertiary}}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:o.map(P=>{let W=E.assignees?.some(de=>de.name===P.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:de=>de.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:de=>de.currentTarget.style.backgroundColor="transparent",onClick:()=>{let de=W?(E.assignees||[]).filter(ae=>ae.name!==P.name):[...E.assignees||[],{name:P.name,avatar:P.avatar,initials:P.name.split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),color:l.accent}];ce("assignees",de);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium",style:{backgroundColor:l.accent},children:P.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:P.name}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:l.accent}})]},P.id)})})})]}),jsxRuntime.jsxs("div",{ref:$,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:E.color}}),jsxRuntime.jsx("span",{children:M.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"absolute left-0 top-full mt-1.5 z-50 rounded-lg",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:Yo.slice(0,16).map(P=>{let W=E.color===P.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{ce("color",P.value),g(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:P.value,outline:W?`2px solid ${P.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:P.name},P.value)})})})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(w==="start"?null:"start"),A(E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.startDate?E.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(w==="end"?null:"end"),A(E.endDate||E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.endDate?E.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${l.border}`},children:[(()=>{let P=new Date,W=new Date(P);W.setDate(P.getDate()+1);let de=new Date(P);de.setDate(P.getDate()+7);let ae=new Date(P);return ae.setDate(P.getDate()+14),[{label:"Hoy",date:P},{label:"Ma\xF1ana",date:W},{label:"Pr\xF3xima semana",date:de},{label:"2 semanas",date:ae}].map((le,Ve)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:l.textPrimary},onMouseEnter:he=>he.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:he=>he.currentTarget.style.backgroundColor="transparent",onClick:()=>{w==="start"?(ce("startDate",le.date),(!E.endDate||le.date>E.endDate)&&ce("endDate",le.date),D("end")):(ce("endDate",le.date),(!E.startDate||le.date<E.startDate)&&ce("startDate",le.date),D(null));},children:le.label},Ve))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("startDate",void 0),ce("endDate",void 0),D(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:l.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textPrimary},children:h.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:l.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((P,W)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:l.textTertiary},children:P},W))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=h.getFullYear(),W=h.getMonth(),de=new Date(P,W,1).getDay(),ae=new Date(P,W+1,0).getDate(),Ee=new Date,le=[];for(let he=de-1;he>=0;he--)le.push({day:new Date(P,W,-he).getDate(),date:new Date(P,W-1,new Date(P,W,-he).getDate()),isCurrentMonth:false});for(let he=1;he<=ae;he++)le.push({day:he,date:new Date(P,W,he),isCurrentMonth:true});let Ve=42-le.length;for(let he=1;he<=Ve;he++)le.push({day:he,date:new Date(P,W+1,he),isCurrentMonth:false});return le.map((he,at)=>{let Et=he.date.toDateString()===Ee.toDateString(),gt=E.startDate?.toDateString()===he.date.toDateString(),ft=E.endDate?.toDateString()===he.date.toDateString(),rt=E.startDate&&E.endDate&&he.date>=E.startDate&&he.date<=E.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:he.isCurrentMonth?gt||ft?"#FFF":l.textPrimary:l.textTertiary,backgroundColor:gt?"#3B82F6":ft?"#7C3AED":rt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Et&&!gt&&!ft?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{w==="start"?(ce("startDate",he.date),E.endDate&&he.date>E.endDate&&ce("endDate",he.date),D("end")):(ce("endDate",he.date),E.startDate&&he.date<E.startDate&&ce("startDate",he.date),D(null));},children:he.day},at)})})()})]})]})]})})]}),fe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:fe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:E.progress,onChange:P=>ce("progress",parseInt(P.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:l.bgSecondary,accentColor:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},disabled:d}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"}20`,color:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},children:[E.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>L(!C),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${C?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:E.isMilestone,onChange:P=>ce("isMilestone",P.target.checked),className:"w-4 h-4 rounded",style:{accentColor:l.accent},disabled:d}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:l.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:l.bgSecondary},children:r.filter(P=>P.id!==a?.id).map(P=>{let W=E.dependencies?.includes(P.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let de=W?(E.dependencies||[]).filter(ae=>ae!==P.id):[...E.dependencies||[],P.id];ce("dependencies",de);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:W?`${l.accent}30`:l.bgPrimary,color:W?l.accent:l.textSecondary,border:`1px solid ${W?l.accent:l.borderLight}`},disabled:d,children:P.name},P.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${l.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:l.textSecondary},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:l.accent,color:"#FFF"},onMouseEnter:P=>!d&&(P.currentTarget.style.opacity="0.9"),onMouseLeave:P=>!d&&(P.currentTarget.style.opacity="1"),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.jsx(jsxRuntime.Fragment,{children:m==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var $g=['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"'],md=()=>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"})]}),Ug=()=>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"})}),zg=()=>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"})}),Wg=()=>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"})}),Gg=()=>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 Jo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:m,onDependencyDelete:c}){let[n,p]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState([]),[f,y]=react.useState(""),[x,b]=react.useState(false),[g,w]=react.useState(true),D=react.useRef(null),h=react.useRef(null),A=react.useRef(null),{enabled:C=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:U,suggestions:G=$g,maxHistory:$=50,persistHistory:E}=a,X=E?.storageKey||"gantt-ai-history",fe=E?.maxMessages??5;react.useEffect(()=>{if(E?.enabled)try{let F=localStorage.getItem(X);if(F){let V=JSON.parse(F).map(P=>({...P,timestamp:new Date(P.timestamp)}));v(V.slice(-fe));}}catch(F){console.warn("[GanttAIAssistant] Failed to load persisted history:",F);}},[E?.enabled,X,fe]),react.useEffect(()=>{if(E?.enabled&&u.length>0)try{let F=u.filter(M=>!M.isLoading).slice(-fe);localStorage.setItem(X,JSON.stringify(F));}catch(F){console.warn("[GanttAIAssistant] Failed to persist history:",F);}},[u,E?.enabled,X,fe]),react.useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!l&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,l]);let Ce=react.useCallback(F=>{if(F.success)switch(F.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":F.taskId&&F.updates&&o?.(F.taskId,F.updates);break;case "create_task":F.newTask&&s?.(F.newTask);break;case "delete_task":F.taskId&&d?.(F.taskId);break;case "link_tasks":F.dependencyFrom&&F.dependencyTo&&m?.(F.dependencyFrom,F.dependencyTo);break;case "unlink_tasks":F.taskId&&F.dependencyFrom&&c?.(F.taskId,F.dependencyFrom);break}},[o,s,d,m,c]),Le=react.useCallback(async F=>{if(!F.trim()||x)return;let M={id:`user-${Date.now()}`,role:"user",content:F,timestamp:new Date};v(P=>[...P.slice(-($-1)),M]),y(""),w(false),b(true);let V={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(P=>[...P,V]);try{if(U){let P=await U(F,e);v(W=>{let de=W.filter(Ee=>!Ee.isLoading),ae={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...de,ae]}),Ce(P);}else v(P=>[...P.filter(de=>!de.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(P){v(W=>[...W.filter(ae=>!ae.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,$,U,e,Ce]),Pe=F=>{F.preventDefault(),Le(f);},ce=F=>{y(F),D.current?.focus();};if(react.useEffect(()=>{let F=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),p(V=>!V),n||i(false)),M.key==="Escape"&&n&&p(false);};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[n]),react.useEffect(()=>{if(!n)return;let F=V=>{let P=V.target;A.current&&!A.current.contains(P)&&p(false);},M=setTimeout(()=>{document.addEventListener("mousedown",F);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",F);}},[n]),!C)return null;let S={"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(Ye,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${S[T]} 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(md,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${S[T]} 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(md,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(F=>!F),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Wg,{})}),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(zg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&g&&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:G.slice(0,4).map((F,M)=>jsxRuntime.jsx("button",{onClick:()=>ce(F),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:F.length>30?F.slice(0,30)+"...":F},M))})]}),u.map(F=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${F.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:F.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:F.role==="user"?"white":t.textPrimary},children:[F.isLoading?jsxRuntime.jsx(Gg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:F.content}),F.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:F.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:F.command.success?"#10B981":"#EF4444"},children:[F.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:F.command.type.replace(/_/g," ")})]})]})},F.id)),jsxRuntime.jsx("div",{ref:h})]}),jsxRuntime.jsxs("form",{onSubmit:Pe,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:D,type:"text",value:f,onChange:F=>y(F.target.value),placeholder:L,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Ug,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function pd(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,p=true)=>{r(l=>{let i=typeof n=="function"?n(l.present):n;if(o.current)return {...l,present:i};if(!p)return {...l,present:i};let u=[...l.past,l.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),d=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let p=n.past[n.past.length-1],l=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:p,future:[n.present,...n.future]}});},[]),m=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let p=n.future[0],l=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:p,future:l}});},[]),c=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:d,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function ud({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=d=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=m?d.metaKey:d.ctrlKey;if(c&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!m&&c&&d.key==="y"){d.preventDefault(),t();return}if(m&&c&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var jg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${oe.formatDate(e.startDate)} - ${oe.formatDate(e.endDate)}`);let a=oe.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=>oe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function gd(e){return {...jg,...e}}var Qg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},hd=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:d="week",rowDensity:m="comfortable",showThemeSelector:c=true,showExportButton:n=true,availableUsers:p=[],templates:l,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:f,showCreateTaskButton:y=false,createTaskLabel:x,onCreateTask:b,onThemeChange:g,onTaskClick:w,onTaskDblClick:D,onTaskContextMenu:h,onTaskUpdate:A,onProgressChange:C,onTaskEdit:L,onTaskAddSubtask:T,onTaskMarkIncomplete:U,onTaskSetInProgress:G,onDependencyCreate:$,onDependencyDelete:E,onBeforeTaskAdd:X,onAfterTaskAdd:fe,onBeforeTaskUpdate:Ce,onAfterTaskUpdate:Le,onBeforeTaskDelete:Pe,onAfterTaskDelete:ce}=a,F=react.useContext(Lo)?.theme,[M,V]=react.useState(F||s||"dark"),[P,W]=react.useState(d),[de,ae]=react.useState(m),[Ee,le]=react.useState(1),[Ve,he]=react.useState(0),[at,Et]=react.useState(false),[gt,ft]=react.useState(null),[rt,ot]=react.useState({isOpen:false,x:0,y:0,task:null}),[ia,wt]=react.useState(null),[ct,Lt]=react.useState(null);react.useEffect(()=>{F&&F!==M&&V(F);},[F]),react.useEffect(()=>{s&&s!==M&&V(s);},[s]);let jt=react.useCallback(N=>{V(N),g?.(N);},[g]),{state:we,setState:O,undo:De,redo:ze,canUndo:Ue,canRedo:bt,clearHistory:J}=pd(t,50);react.useEffect(()=>{O(t);},[t,O]);let Q=react.useRef(t),xe=react.useRef(true);react.useEffect(()=>{if(xe.current){xe.current=false,Q.current=we;return}if(!r)return;let N=JSON.stringify(Q.current),z=JSON.stringify(we);N!==z&&(Q.current=we,r(we));},[we,r]);let ge=react.useMemo(()=>ps(v,f),[v,f]),ee=react.useCallback(N=>[{id:"name",label:N.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:N.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:N.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:N.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:N.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:N.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:N.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:N.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Te,be]=react.useState(()=>ee(ge));react.useEffect(()=>{be(N=>N.map(z=>({...z,label:ge.columns[z.id==="name"?"taskName":z.id]||z.label})));},[ge]);let ke=react.useMemo(()=>{let N=Te.filter(re=>re.visible),z=N.some(re=>re.id!=="name");return N.reduce((re,ye)=>re+ye.width,0)+(z?20:0)},[Te]);react.useEffect(()=>{gt!==null&&gt>ke&&(Te.filter(Y=>Y.visible).some(Y=>Y.id!=="name")||ft(null));},[Te,ke,gt]);let R=react.useMemo(()=>gt!==null?Math.max(280,gt,ke):Math.max(280,ke),[gt,ke]),H=react.useRef(null),q=react.useRef(null),se=react.useRef(null),ie=react.useMemo(()=>Ll(M),[M]),B=react.useMemo(()=>({theme:ie,themeName:M}),[ie,M]),K=react.useMemo(()=>gd(l),[l]),Ne=react.useMemo(()=>{if(!i)return we;let N=oe.calculateCriticalPath(we),z=Y=>Y.map(re=>({...re,isCriticalPath:N.includes(re.id),subtasks:re.subtasks?z(re.subtasks):void 0}));return z(we)},[we,i]),je=Qg(de);ud({undo:De,redo:ze,canUndo:Ue,canRedo:bt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>oe.findTaskById(we,N),addTask:(N,z)=>{O(Y=>{if(!z)return [...Y,{...N,level:0}];let re=ye=>ye.map(Se=>Se.id===z?{...Se,subtasks:[...Se.subtasks||[],{...N,parentId:z,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:re(Se.subtasks)}:Se);return re(Y)});},updateTask:(N,z)=>{O(Y=>{let re=ye=>ye.map(Se=>Se.id===N?{...Se,...z}:Se.subtasks?{...Se,subtasks:re(Se.subtasks)}:Se);return re(Y)});},deleteTask:N=>{O(z=>{let Y=re=>re.filter(ye=>ye.id===N?false:(ye.subtasks&&(ye.subtasks=Y(ye.subtasks)),true));return Y(z)});},deleteTasks:N=>{O(z=>vs(z,N));},duplicateTask:N=>{O(z=>xs(z,[N]));},splitTask:(N,z,Y=3)=>{O(re=>oe.splitTask(re,N,z,Y));},calculateEndDate:oe.calculateEndDate,calculateDuration:oe.calculateDuration,validateDependency:(N,z)=>!oe.validateDependencies(we,N,z),getAllTasks:()=>oe.flattenTasks(we),getTasksByStatus:N=>oe.flattenTasks(we).filter(z=>z.status===N),getTasksByParent:N=>N?oe.findTaskById(we,N)?.subtasks||[]:we.filter(Y=>!Y.parentId),getCriticalPath:()=>oe.flattenTasks(we).filter(N=>N.isCriticalPath),indentTask:N=>{O(z=>bs(z,[N]));},outdentTask:N=>{O(z=>hs(z,[N]));},moveTask:(N,z)=>{O(Y=>ys(Y,[N],z));},createSubtask:async N=>{let{tasks:z,newTask:Y}=Cs(we,N);if(X){let re=X({...Y,parentId:N});if((re instanceof Promise?await re:re)===false)return}O(z),fe&&fe({...Y,parentId:N});},scrollToTask:N=>{let Y=oe.flattenTasks(we).findIndex(re=>re.id===N);if(Y!==-1&&H.current){let re=Y*je;H.current.scrollTo({top:re,behavior:"smooth"}),q.current&&q.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(N,z=2e3)=>{},expandTask:N=>{O(z=>{let Y=re=>re.map(ye=>ye.id===N?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye);return Y(z)});},collapseTask:N=>{O(z=>{let Y=re=>re.map(ye=>ye.id===N?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye);return Y(z)});},expandAll:()=>{O(N=>{let z=Y=>Y.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?z(re.subtasks):void 0}));return z(N)});},collapseAll:()=>{O(N=>{let z=Y=>Y.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?z(re.subtasks):void 0}));return z(N)});},undo:De,redo:ze,canUndo:()=>Ue,canRedo:()=>bt,clearHistory:J,exportToPNG:async()=>{if(!se.current)throw new Error("Gantt container not found");let N=await bd__default.default(se.current,{backgroundColor:ie.bgPrimary,scale:2});return new Promise((z,Y)=>{N.toBlob(re=>{re?z(re):Y(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await oe.exportToPDF(we,N);},exportToExcel:async N=>{await oe.exportToExcel(we,N);},exportToJSON:()=>oe.exportToJSON(we),exportToCSV:()=>oe.exportToCSV(we),importFromJSON:N=>{let z=oe.importFromJSON(N);O(z);},getTasks:()=>we,refresh:()=>{O(N=>[...N]);},clearAll:()=>{O([]);}}),[we,De,ze,Ue,bt,J,ie,je]);let Pt=react.useCallback(N=>{be(z=>z.map(Y=>Y.id===N?{...Y,visible:!Y.visible}:Y));},[]),Wr=react.useCallback((N,z)=>{be(Y=>Y.map(re=>{if(re.id!==N)return re;let ye=re.minWidth??100,Se=re.maxWidth??800,Ft=Math.max(ye,Math.min(Se,z));return {...re,width:Ft}}));},[]),Gr=react.useCallback(N=>{O(z=>ws(z,N)),a.onTaskToggleExpand?.(N);},[a]),Wa=react.useCallback((N,z)=>{if(Ce&&Ce(N,z)===false)return;let re=oe.findTaskById(we,N)?.progress,ye=Ft=>Ft.map(Bt=>Bt.id===N?{...Bt,...z}:Bt.subtasks?{...Bt,subtasks:ye(Bt.subtasks)}:Bt);O(ye(we));let Se=oe.findTaskById(ye(we),N);Se&&(A?.(Se),Le?.(Se),z.progress!==void 0&&re!==void 0&&z.progress!==re&&C?.(N,re,z.progress));},[we,A,Ce,Le,C]),yn=react.useCallback(N=>{N.length!==0&&(O(z=>bs(z,N)),a.onTaskIndent?.(N[0]));},[a]),me=react.useCallback(N=>{N.length!==0&&(O(z=>hs(z,N)),a.onTaskOutdent?.(N[0]));},[a]),mt=react.useCallback((N,z,Y)=>{O(re=>Ql(re,N,z,Y)),a.onTaskReparent?.(N,z,Y);},[a]),Ht=react.useCallback((N,z)=>{N.length!==0&&(O(Y=>ys(Y,N,z)),a.onTaskMove?.(N[0],z));},[a]),Ga=react.useCallback(async N=>{let z=[];for(let Y of N)Pe&&await Promise.resolve(Pe(Y))===false||z.push(Y);z.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(z):(O(Y=>vs(Y,z)),z.forEach(Y=>a.onTaskDelete?.(Y))),ce&&z.forEach(Y=>ce(Y)));},[a,Pe,ce]),bo=react.useCallback(N=>{O(z=>xs(z,N)),N.forEach(z=>a.onTaskDuplicate?.(z));},[a]),vr=react.useCallback((N,z)=>{O(Y=>{let{tasks:re,newTask:ye}=Zl(Y,N,z);return X&&X(ye)===false?Y:(a.onTaskCreate?.(ye.parentId,ye.position||0),fe?.(ye),re)});},[a,X,fe]),Ma=react.useCallback((N,z)=>{O(Y=>ks(Y,N,z)),a.onTaskRename?.(N,z);},[a]),Aa=react.useCallback(N=>{O(z=>{let{tasks:Y}=Cs(z,N);return a.onTaskCreate?.(N,0),Y});},[a]),Ct=react.useCallback((N,z,Y)=>{let re=N.startDate?Math.round((z.getTime()-N.startDate.getTime())/864e5):0,ye=Bt=>Bt.map(_t=>_t.id===N.id?{..._t,startDate:z,endDate:Y,...N.segments&&{segments:N.segments}}:_t.subtasks?{..._t,subtasks:ye(_t.subtasks)}:_t),Se=ye(we);Se=oe.autoScheduleDependents(Se,N.id,re),O(Se);let Ft={...N,startDate:z,endDate:Y};A?.(Ft);},[we,A]),vn=react.useCallback((N,z)=>{h?.(N,z),ot({isOpen:true,x:z.clientX,y:z.clientY,task:N});},[h]),xn=react.useCallback((N,z)=>{let Y=oe.splitTask(we,N.id,z);O(Y),ot({isOpen:false,x:0,y:0,task:null});},[we]),kn=react.useCallback(N=>{D?.(N),L||wt(N);},[D,L]),xr=react.useCallback((N,z,Y)=>{let re=new Map,ye=fa=>{fa.forEach(Ia=>{Ia.dependencies&&re.set(Ia.id,Ia.dependencies),Ia.subtasks&&ye(Ia.subtasks);});};ye(Y);let Se=re.get(z)||[];re.set(z,[...Se,N]);let Ft=new Set,Bt=new Set,_t=fa=>{if(!Ft.has(fa)){Ft.add(fa),Bt.add(fa);let Ia=re.get(fa)||[];for(let er of Ia){if(!Ft.has(er)&&_t(er))return true;if(Bt.has(er))return true}}return Bt.delete(fa),false};return _t(z)},[]),Ti=react.useCallback((N,z)=>{if(xr(N.id,z,we)){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([n],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(p),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=oe.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let p=n.startDate&&n.endDate?oe.calculateDuration(n.startDate,n.endDate):0,l=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(f=>f.id===u);if(v){o(v);let f=r.get(u)?.ef||0;l=Math.max(l,f);}}let i=l+p;r.set(n.id,{es:l,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),d=new Map,m=n=>{if(d.has(n.id))return;let p=n.startDate&&n.endDate?oe.calculateDuration(n.startDate,n.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(l.length>0)for(let v of l){m(v);let f=d.get(v.id)?.ls||0;i=Math.min(i,f);}let u=i-p;d.set(n.id,{ls:u,lf:i});};a.forEach(m);let c=[];for(let n of a){let p=r.get(n.id),l=d.get(n.id);if(p&&l){let i=l.ls-p.es;Math.abs(i)<.01&&c.push(n.id);}}return c},calculateSlack:(e,t)=>{let a=oe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(oe.calculateCriticalPath(e).includes(t))return 0;let o=oe.getDependentTasks(e,t);if(o.length===0){let m=oe.getLatestEndDate(e);if(!m)return null;let c=oe.calculateDuration(a.endDate,m);return Math.max(0,c)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,c)=>m-c)[0];if(!s)return null;let d=oe.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>oe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=oe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=oe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let m=oe.calculateDuration(d.startDate,d.endDate),c;a!==void 0?(c=new Date(d.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let n=oe.calculateEndDate(c,m),p=l=>l.map(i=>i.id===d.id?{...i,startDate:c,endDate:n}:i.subtasks?{...i,subtasks:p(i.subtasks)}:i);s=p(s),s=oe.autoScheduleDependents(s,d.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,d,m)=>{if(a===0)return [];let c=[],n=o.getTime(),p=1e3*60*60*24,l=oe.findTaskById(e,t);if(!l||!l.endDate)return [];let i=(u,v,f=new Set)=>{if(f.has(u))return;f.add(u);let y=oe.getDependentTasks(e,u);for(let x of y){if(!x.startDate||!x.endDate)continue;let b=r.findIndex(U=>U.id===x.id);if(b===-1)continue;let g=x.startDate.getTime(),D=(x.endDate.getTime()-g)/p,A=(g-n)/p*s,C=A+v*s,L=Math.max(D*s,s),T=m+b*d+12;c.push({taskId:x.id,taskName:x.name,originalX:A,previewX:C,width:L,y:T,rowIndex:b,daysDelta:v,color:x.color}),i(x.id,v,f);}};return i(t,a),c},splitTask:(e,t,a,r=3)=>{let o=oe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let d=new Date(a);d.setDate(d.getDate()+r);let m=new Date(o.endDate);m.setDate(m.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:d,endDate:m}],n=p=>p.map(l=>l.id===o.id?{...l,endDate:m,segments:c}:l.subtasks?{...l,subtasks:n(l.subtasks)}:l);return n(e)}};function Ko({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:m,onTaskClick:c,onTaskDblClick:n,onTaskContextMenu:p,onTaskDateChange:l,onDependencyCreate:i,onDependencyDelete:u}){let[f,y]=react.useState([]),[x,b]=react.useState(null),[g,w]=react.useState(null),D=react.useCallback(S=>{b(S);},[]),h=react.useCallback(S=>{w(S);},[]),A=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),C=r==="day"?60:r==="week"?20:8,L=A*C*d,T=S=>{let F=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),M=F.getUTCDay()||7;F.setUTCDate(F.getUTCDate()+4-M);let V=new Date(Date.UTC(F.getUTCFullYear(),0,1));return Math.ceil(((F.getTime()-V.getTime())/864e5+1)/7)},U=S=>{let F=S.getDay();return F===0||F===6},G=react.useCallback(S=>{let F=Math.round(S/(C*d)),M=new Date(o);return M.setDate(M.getDate()+F),M},[o,C,d]),$=react.useCallback((S,F)=>{if(F.startDate&&F.endDate)return;let M=S.currentTarget.ownerSVGElement;if(!M)return;let V=M.createSVGPoint();V.x=S.clientX,V.y=S.clientY;let P=V.matrixTransform(M.getScreenCTM()?.inverse()),W=G(P.x),de=new Date(W);de.setDate(de.getDate()+1),l?.(F,W,de);},[G,l]),E=react.useMemo(()=>{let S=P=>P.map(W=>{if(W.subtasks&&W.subtasks.length>0){let de=S(W.subtasks),ae=de.filter(Ee=>Ee.startDate&&Ee.endDate);if(ae.length>0){let Ee=ae.map(at=>at.startDate.getTime()),le=ae.map(at=>at.endDate.getTime()),Ve=new Date(Math.min(...Ee)),he=new Date(Math.max(...le));return {...W,subtasks:de,startDate:Ve,endDate:he}}return {...W,subtasks:de}}return W}),F=(P,W=[])=>{for(let de of P)W.push(de),de.subtasks&&de.subtasks.length>0&&(de.isExpanded===void 0||de.isExpanded)&&F(de.subtasks,W);return W},M=S(e);return F(M)},[e]),X=react.useCallback(S=>{if(!S.startDate||!S.endDate)return {x:0,width:0};let F=S.startDate.getTime(),M=S.endDate.getTime(),V=o.getTime(),P=(F-V)/(1e3*60*60*24),W=(M-F)/(1e3*60*60*24),de=P*C*d,ae=Math.max(C*d,40),Ee=Math.max(W*C*d,ae);return {x:de,width:Ee}},[o,C,d]),fe=react.useMemo(()=>E.filter(S=>S.startDate&&S.endDate).map(S=>{let{x:F,width:M}=X(S),P=E.findIndex(W=>W.id===S.id)*a+12;return {id:S.id,x:F,y:P,width:M,height:32}}),[E,X]),Ce=react.useCallback((S,F,M)=>{if(!M||F===0){y([]);return}let V=oe.calculateCascadePreview(e,S,F,E,o,C*d,a,48);y(V);},[e,E,o,C,d,a,48]),Le=react.useMemo(()=>{let S=[],F=new Date(o);for(;F<=s;){let P=(F.getTime()-o.getTime())/864e5*C*d;if(r==="day")S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:P}),F.setDate(F.getDate()+1);else if(r==="week"){let W=T(F);S.push({date:new Date(F),label:`Week ${W}`,x:P}),F.setDate(F.getDate()+7);}else S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:P}),F.setMonth(F.getMonth()+1);}return S},[o,s,r,C,d]),Pe=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*C*d,[o,C,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(L,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:48,fill:t.bgGrid}),Le.map((S,F)=>jsxRuntime.jsxs("g",{children:[F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:S.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:S.label})]},`header-${F}`)),Pe>=0&&Pe<=L&&jsxRuntime.jsx("circle",{cx:Pe,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(L,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(L,1e3),height:ce,fill:t.bgPrimary}),Le.map((S,F)=>{let M=Le[F+1]?.x||L,V=U(S.date);return jsxRuntime.jsxs("g",{children:[V&&jsxRuntime.jsx("rect",{x:S.x,y:0,width:M-S.x,height:E.length*a,fill:t.bgWeekend,opacity:1}),F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:E.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},F)}),Pe>=0&&Pe<=L&&jsxRuntime.jsx("line",{x1:Pe,y1:0,x2:Pe,y2:E.length*a,stroke:t.today,strokeWidth:2,opacity:1}),E.map((S,F)=>{let M=S.startDate&&S.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:F%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${S.id}`),!M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:V=>$(V,S),onMouseEnter:V=>{V.currentTarget.setAttribute("fill",t.accentLight),V.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:V=>{V.currentTarget.setAttribute("fill","transparent"),V.currentTarget.setAttribute("opacity","1");}},`clickable-${S.id}`),jsxRuntime.jsx("text",{x:Pe>0?Pe:100,y:F*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${S.id}`)]})]},`row-group-${S.id}`)}),E.map((S,F)=>!S.dependencies||S.dependencies.length===0||!S.startDate||!S.endDate?null:S.dependencies.map(M=>{let V=E.find(ae=>ae.id===M);if(!V||!V.startDate||!V.endDate)return null;let P=E.findIndex(ae=>ae.id===M),W=X(V),de=X(S);return jsxRuntime.jsx(Ho,{x1:W.x+W.width,y1:P*a+a/2,x2:de.x,y2:F*a+a/2,theme:t,onDelete:()=>u?.(S.id,M),onHoverChange:h},`dep-${M}-${S.id}`)})),E.map((S,F)=>{if(!S.startDate||!S.endDate)return null;let{x:M,width:V}=X(S),P=F*a+12,W=S.subtasks&&S.subtasks.length>0&&!S.isMilestone;return S.isMilestone?jsxRuntime.jsx(Vo,{task:S,x:M+V/2,y:P+16,theme:t,onClick:c},S.id):W?jsxRuntime.jsxs("g",{onClick:()=>c?.(S),onContextMenu:de=>{de.preventDefault(),de.stopPropagation(),p?.(S,de);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:M,y:P,width:V,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M+V,y2:P,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M+V,y1:P,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P+32,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),V>60&&jsxRuntime.jsx("text",{x:M+12,y:P+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S.name})]},S.id):jsxRuntime.jsx(zo,{task:S,x:M,y:P,width:V,theme:t,dayWidth:C*d,startDate:o,templates:m,onClick:c,onDoubleClick:n,onContextMenu:p,onDateChange:l,onDependencyCreate:i,allTaskPositions:fe,onDragMove:Ce,onHoverChange:D},S.id)}),f.map(S=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:S.previewX,y:S.y-48,width:S.width,height:32,rx:8,fill:S.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(S.daysDelta)>0&&jsxRuntime.jsx("text",{x:S.previewX+S.width/2,y:S.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:S.daysDelta>0?`+${S.daysDelta}d`:`${S.daysDelta}d`})]},`cascade-preview-${S.taskId}`)),g&&(()=>{let{x1:S,y1:F,x2:M,y2:V,onDelete:P}=g,W=M-S,de=V-F,ae=S+W/2,Ee=(F+V)/2,le=`M ${S} ${F} C ${ae} ${F}, ${ae} ${V}, ${M} ${V}`,Ve=6,he=Math.atan2(de,W),at=M-Ve*Math.cos(he-Math.PI/6),Et=V-Ve*Math.sin(he-Math.PI/6),gt=M-Ve*Math.cos(he+Math.PI/6),ft=V-Ve*Math.sin(he+Math.PI/6),rt=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:le,fill:"none",stroke:rt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${M} ${V} L ${at} ${Et} M ${M} ${V} L ${gt} ${ft}`,fill:"none",stroke:rt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:M,cy:V,r:5,fill:rt}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:ot=>{ot.stopPropagation(),P();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:ae,cy:Ee,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:ae-4,y1:Ee-4,x2:ae+4,y2:Ee+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:ae+4,y1:Ee-4,x2:ae-4,y2:Ee+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(sd,{tooltipData:x,theme:t})]})]})}var Yo=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];var Es=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ps=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Xo({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:d=false,mode:m=a?"edit":"create",theme:c="dark",customStatuses:n=[]}){let p=[...Es,...n.filter(P=>!Es.some(W=>W.id===P.id))],l=Oe[c]||Oe.dark,[i,u]=react.useState(false),[v,f]=react.useState(false),[y,x]=react.useState(false),[b,g]=react.useState(false),[w,D]=react.useState(null),[h,A]=react.useState(new Date),[C,L]=react.useState(false),T=react.useRef(null),U=react.useRef(null),G=react.useRef(null),$=react.useRef(null),[E,X]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[fe,Ce]=react.useState({});react.useEffect(()=>{a?(X({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)&&L(true)):(X({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),L(false));},[a,e]),react.useEffect(()=>{let P=W=>{T.current&&!T.current.contains(W.target)&&u(false),U.current&&!U.current.contains(W.target)&&f(false),G.current&&!G.current.contains(W.target)&&x(false),$.current&&!$.current.contains(W.target)&&g(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);let Le=()=>{let P={};return E.name.trim()||(P.name="El nombre es requerido"),E.startDate&&E.endDate&&E.startDate>E.endDate&&(P.endDate="La fecha de fin debe ser posterior a la de inicio"),Ce(P),Object.keys(P).length===0},Pe=async P=>{if(P.preventDefault(),!!Le())try{await s(E),t();}catch(W){console.error("Error submitting task:",W);}},ce=(P,W)=>{X(de=>{let ae={...de,[P]:W};if(P==="status"){let Ee=W;Ee==="todo"?ae.progress=0:Ee==="in-progress"?(de.progress===0||de.progress===100)&&(ae.progress=50):Ee==="completed"||Ee==="closed"?ae.progress=100:(Ee==="in-review"||Ee==="review")&&(ae.progress=75);}if(P==="progress"){let Ee=typeof W=="number"?W:parseInt(W,10);Ee===100&&de.status!=="completed"?ae.status="completed":Ee>0&&Ee<100&&de.status==="todo"?ae.status="in-progress":Ee===0&&de.status!=="todo"&&(ae.status="todo");}return ae}),fe[P]&&Ce(de=>{let ae={...de};return delete ae[P],ae});},S=p.find(P=>P.id===E.status)??Es[0],F=Ps.find(P=>P.id===E.priority)??Ps[1],M=Yo.find(P=>P.value===E.color)??Yo[0],V={backgroundColor:l.bgSecondary,border:`1px solid ${l.borderLight}`,color:l.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${l.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color||l.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textSecondary},children:m==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:l.textTertiary},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=l.hoverBg,P.currentTarget.style.color=l.textPrimary;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent",P.currentTarget.style.color=l.textTertiary;},disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Pe,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:E.name,onChange:P=>ce("name",P.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:l.textPrimary},placeholder:"Nombre de la tarea",disabled:d,autoFocus:true}),fe.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),fe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:E.description||"",onChange:P=>ce("description",P.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:l.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:d})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:T,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&u(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...V,borderColor:S.color,backgroundColor:`${S.color}15`},disabled:d,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),jsxRuntime.jsx("span",{style:{color:S.color},children:S.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:S.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:p.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("status",P.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:P.color}}),P.title,E.status===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),jsxRuntime.jsxs("div",{ref:U,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&f(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:F.color}}),jsxRuntime.jsx("span",{children:F.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:Ps.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("priority",P.id),f(false);},children:[jsxRuntime.jsx("span",{children:P.icon}),P.label,E.priority===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[E.assignees&&E.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:E.assignees.slice(0,3).map((P,W)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:P.color||l.accent,borderColor:l.bgSecondary},children:P.initials},W))}),E.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:l.textTertiary},children:["+",E.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:l.textTertiary}}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:o.map(P=>{let W=E.assignees?.some(de=>de.name===P.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:de=>de.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:de=>de.currentTarget.style.backgroundColor="transparent",onClick:()=>{let de=W?(E.assignees||[]).filter(ae=>ae.name!==P.name):[...E.assignees||[],{name:P.name,avatar:P.avatar,initials:P.name.split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),color:l.accent}];ce("assignees",de);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:l.accent},children:P.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:P.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:l.accent}})})]},P.id)})})})]}),jsxRuntime.jsxs("div",{ref:$,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:E.color}}),jsxRuntime.jsx("span",{children:M.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"absolute left-0 top-full mt-1.5 z-50 rounded-lg",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:Yo.slice(0,16).map(P=>{let W=E.color===P.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{ce("color",P.value),g(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:P.value,outline:W?`2px solid ${P.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:P.name},P.value)})})})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(w==="start"?null:"start"),A(E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.startDate?E.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(w==="end"?null:"end"),A(E.endDate||E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.endDate?E.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${l.border}`},children:[(()=>{let P=new Date,W=new Date(P);W.setDate(P.getDate()+1);let de=new Date(P);de.setDate(P.getDate()+7);let ae=new Date(P);return ae.setDate(P.getDate()+14),[{label:"Hoy",date:P},{label:"Ma\xF1ana",date:W},{label:"Pr\xF3xima semana",date:de},{label:"2 semanas",date:ae}].map((le,Ve)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:l.textPrimary},onMouseEnter:he=>he.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:he=>he.currentTarget.style.backgroundColor="transparent",onClick:()=>{w==="start"?(ce("startDate",le.date),(!E.endDate||le.date>E.endDate)&&ce("endDate",le.date),D("end")):(ce("endDate",le.date),(!E.startDate||le.date<E.startDate)&&ce("startDate",le.date),D(null));},children:le.label},Ve))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("startDate",void 0),ce("endDate",void 0),D(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:l.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textPrimary},children:h.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:l.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((P,W)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:l.textTertiary},children:P},W))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=h.getFullYear(),W=h.getMonth(),de=new Date(P,W,1).getDay(),ae=new Date(P,W+1,0).getDate(),Ee=new Date,le=[];for(let he=de-1;he>=0;he--)le.push({day:new Date(P,W,-he).getDate(),date:new Date(P,W-1,new Date(P,W,-he).getDate()),isCurrentMonth:false});for(let he=1;he<=ae;he++)le.push({day:he,date:new Date(P,W,he),isCurrentMonth:true});let Ve=42-le.length;for(let he=1;he<=Ve;he++)le.push({day:he,date:new Date(P,W+1,he),isCurrentMonth:false});return le.map((he,at)=>{let Et=he.date.toDateString()===Ee.toDateString(),gt=E.startDate?.toDateString()===he.date.toDateString(),ft=E.endDate?.toDateString()===he.date.toDateString(),rt=E.startDate&&E.endDate&&he.date>=E.startDate&&he.date<=E.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:he.isCurrentMonth?gt||ft?"#FFF":l.textPrimary:l.textTertiary,backgroundColor:gt?"#3B82F6":ft?"#7C3AED":rt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Et&&!gt&&!ft?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{w==="start"?(ce("startDate",he.date),E.endDate&&he.date>E.endDate&&ce("endDate",he.date),D("end")):(ce("endDate",he.date),E.startDate&&he.date<E.startDate&&ce("startDate",he.date),D(null));},children:he.day},at)})})()})]})]})]})})]}),fe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:fe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:E.progress,onChange:P=>ce("progress",parseInt(P.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:l.bgSecondary,accentColor:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},disabled:d}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"}20`,color:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},children:[E.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>L(!C),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${C?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:E.isMilestone,onChange:P=>ce("isMilestone",P.target.checked),className:"w-4 h-4 rounded",style:{accentColor:l.accent},disabled:d}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:l.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:l.bgSecondary},children:r.filter(P=>P.id!==a?.id).map(P=>{let W=E.dependencies?.includes(P.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let de=W?(E.dependencies||[]).filter(ae=>ae!==P.id):[...E.dependencies||[],P.id];ce("dependencies",de);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:W?`${l.accent}30`:l.bgPrimary,color:W?l.accent:l.textSecondary,border:`1px solid ${W?l.accent:l.borderLight}`},disabled:d,children:P.name},P.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${l.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:l.textSecondary},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:l.accent,color:"#FFF"},onMouseEnter:P=>!d&&(P.currentTarget.style.opacity="0.9"),onMouseLeave:P=>!d&&(P.currentTarget.style.opacity="1"),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.jsx(jsxRuntime.Fragment,{children:m==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var $g=['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"'],md=()=>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"})]}),Ug=()=>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"})}),zg=()=>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"})}),Wg=()=>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"})}),Gg=()=>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 Jo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:m,onDependencyDelete:c}){let[n,p]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState([]),[f,y]=react.useState(""),[x,b]=react.useState(false),[g,w]=react.useState(true),D=react.useRef(null),h=react.useRef(null),A=react.useRef(null),{enabled:C=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:U,suggestions:G=$g,maxHistory:$=50,persistHistory:E}=a,X=E?.storageKey||"gantt-ai-history",fe=E?.maxMessages??5;react.useEffect(()=>{if(E?.enabled)try{let F=localStorage.getItem(X);if(F){let V=JSON.parse(F).map(P=>({...P,timestamp:new Date(P.timestamp)}));v(V.slice(-fe));}}catch(F){console.warn("[GanttAIAssistant] Failed to load persisted history:",F);}},[E?.enabled,X,fe]),react.useEffect(()=>{if(E?.enabled&&u.length>0)try{let F=u.filter(M=>!M.isLoading).slice(-fe);localStorage.setItem(X,JSON.stringify(F));}catch(F){console.warn("[GanttAIAssistant] Failed to persist history:",F);}},[u,E?.enabled,X,fe]),react.useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!l&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,l]);let Ce=react.useCallback(F=>{if(F.success)switch(F.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":F.taskId&&F.updates&&o?.(F.taskId,F.updates);break;case "create_task":F.newTask&&s?.(F.newTask);break;case "delete_task":F.taskId&&d?.(F.taskId);break;case "link_tasks":F.dependencyFrom&&F.dependencyTo&&m?.(F.dependencyFrom,F.dependencyTo);break;case "unlink_tasks":F.taskId&&F.dependencyFrom&&c?.(F.taskId,F.dependencyFrom);break}},[o,s,d,m,c]),Le=react.useCallback(async F=>{if(!F.trim()||x)return;let M={id:`user-${Date.now()}`,role:"user",content:F,timestamp:new Date};v(P=>[...P.slice(-($-1)),M]),y(""),w(false),b(true);let V={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(P=>[...P,V]);try{if(U){let P=await U(F,e);v(W=>{let de=W.filter(Ee=>!Ee.isLoading),ae={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...de,ae]}),Ce(P);}else v(P=>[...P.filter(de=>!de.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(P){v(W=>[...W.filter(ae=>!ae.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,$,U,e,Ce]),Pe=F=>{F.preventDefault(),Le(f);},ce=F=>{y(F),D.current?.focus();};if(react.useEffect(()=>{let F=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),p(V=>!V),n||i(false)),M.key==="Escape"&&n&&p(false);};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[n]),react.useEffect(()=>{if(!n)return;let F=V=>{let P=V.target;A.current&&!A.current.contains(P)&&p(false);},M=setTimeout(()=>{document.addEventListener("mousedown",F);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",F);}},[n]),!C)return null;let S={"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(Ye,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${S[T]} 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(md,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${S[T]} 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(md,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(F=>!F),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Wg,{})}),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(zg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&g&&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:G.slice(0,4).map((F,M)=>jsxRuntime.jsx("button",{onClick:()=>ce(F),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:F.length>30?F.slice(0,30)+"...":F},M))})]}),u.map(F=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${F.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:F.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:F.role==="user"?"white":t.textPrimary},children:[F.isLoading?jsxRuntime.jsx(Gg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:F.content}),F.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:F.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:F.command.success?"#10B981":"#EF4444"},children:[F.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:F.command.type.replace(/_/g," ")})]})]})},F.id)),jsxRuntime.jsx("div",{ref:h})]}),jsxRuntime.jsxs("form",{onSubmit:Pe,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:D,type:"text",value:f,onChange:F=>y(F.target.value),placeholder:L,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Ug,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function pd(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,p=true)=>{r(l=>{let i=typeof n=="function"?n(l.present):n;if(o.current)return {...l,present:i};if(!p)return {...l,present:i};let u=[...l.past,l.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),d=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let p=n.past[n.past.length-1],l=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:p,future:[n.present,...n.future]}});},[]),m=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let p=n.future[0],l=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:p,future:l}});},[]),c=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:d,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function ud({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=d=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=m?d.metaKey:d.ctrlKey;if(c&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!m&&c&&d.key==="y"){d.preventDefault(),t();return}if(m&&c&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var jg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${oe.formatDate(e.startDate)} - ${oe.formatDate(e.endDate)}`);let a=oe.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=>oe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function gd(e){return {...jg,...e}}var Qg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},hd=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:d="week",rowDensity:m="comfortable",showThemeSelector:c=true,showExportButton:n=true,availableUsers:p=[],templates:l,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:f,showCreateTaskButton:y=false,createTaskLabel:x,onCreateTask:b,onThemeChange:g,onTaskClick:w,onTaskDblClick:D,onTaskContextMenu:h,onTaskUpdate:A,onProgressChange:C,onTaskEdit:L,onTaskAddSubtask:T,onTaskMarkIncomplete:U,onTaskSetInProgress:G,onDependencyCreate:$,onDependencyDelete:E,onBeforeTaskAdd:X,onAfterTaskAdd:fe,onBeforeTaskUpdate:Ce,onAfterTaskUpdate:Le,onBeforeTaskDelete:Pe,onAfterTaskDelete:ce}=a,F=react.useContext(Lo)?.theme,[M,V]=react.useState(F||s||"dark"),[P,W]=react.useState(d),[de,ae]=react.useState(m),[Ee,le]=react.useState(1),[Ve,he]=react.useState(0),[at,Et]=react.useState(false),[gt,ft]=react.useState(null),[rt,ot]=react.useState({isOpen:false,x:0,y:0,task:null}),[ia,wt]=react.useState(null),[ct,Lt]=react.useState(null);react.useEffect(()=>{F&&F!==M&&V(F);},[F]),react.useEffect(()=>{s&&s!==M&&V(s);},[s]);let jt=react.useCallback(N=>{V(N),g?.(N);},[g]),{state:we,setState:O,undo:De,redo:ze,canUndo:Ue,canRedo:bt,clearHistory:J}=pd(t,50);react.useEffect(()=>{O(t);},[t,O]);let Q=react.useRef(t),xe=react.useRef(true);react.useEffect(()=>{if(xe.current){xe.current=false,Q.current=we;return}if(!r)return;let N=JSON.stringify(Q.current),z=JSON.stringify(we);N!==z&&(Q.current=we,r(we));},[we,r]);let ge=react.useMemo(()=>ps(v,f),[v,f]),ee=react.useCallback(N=>[{id:"name",label:N.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:N.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:N.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:N.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:N.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:N.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:N.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:N.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Te,be]=react.useState(()=>ee(ge));react.useEffect(()=>{be(N=>N.map(z=>({...z,label:ge.columns[z.id==="name"?"taskName":z.id]||z.label})));},[ge]);let ke=react.useMemo(()=>{let N=Te.filter(re=>re.visible),z=N.some(re=>re.id!=="name");return N.reduce((re,ye)=>re+ye.width,0)+(z?20:0)},[Te]);react.useEffect(()=>{gt!==null&&gt>ke&&(Te.filter(Y=>Y.visible).some(Y=>Y.id!=="name")||ft(null));},[Te,ke,gt]);let R=react.useMemo(()=>gt!==null?Math.max(280,gt,ke):Math.max(280,ke),[gt,ke]),H=react.useRef(null),q=react.useRef(null),se=react.useRef(null),ie=react.useMemo(()=>Ll(M),[M]),B=react.useMemo(()=>({theme:ie,themeName:M}),[ie,M]),K=react.useMemo(()=>gd(l),[l]),Ne=react.useMemo(()=>{if(!i)return we;let N=oe.calculateCriticalPath(we),z=Y=>Y.map(re=>({...re,isCriticalPath:N.includes(re.id),subtasks:re.subtasks?z(re.subtasks):void 0}));return z(we)},[we,i]),je=Qg(de);ud({undo:De,redo:ze,canUndo:Ue,canRedo:bt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>oe.findTaskById(we,N),addTask:(N,z)=>{O(Y=>{if(!z)return [...Y,{...N,level:0}];let re=ye=>ye.map(Se=>Se.id===z?{...Se,subtasks:[...Se.subtasks||[],{...N,parentId:z,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:re(Se.subtasks)}:Se);return re(Y)});},updateTask:(N,z)=>{O(Y=>{let re=ye=>ye.map(Se=>Se.id===N?{...Se,...z}:Se.subtasks?{...Se,subtasks:re(Se.subtasks)}:Se);return re(Y)});},deleteTask:N=>{O(z=>{let Y=re=>re.filter(ye=>ye.id===N?false:(ye.subtasks&&(ye.subtasks=Y(ye.subtasks)),true));return Y(z)});},deleteTasks:N=>{O(z=>vs(z,N));},duplicateTask:N=>{O(z=>xs(z,[N]));},splitTask:(N,z,Y=3)=>{O(re=>oe.splitTask(re,N,z,Y));},calculateEndDate:oe.calculateEndDate,calculateDuration:oe.calculateDuration,validateDependency:(N,z)=>!oe.validateDependencies(we,N,z),getAllTasks:()=>oe.flattenTasks(we),getTasksByStatus:N=>oe.flattenTasks(we).filter(z=>z.status===N),getTasksByParent:N=>N?oe.findTaskById(we,N)?.subtasks||[]:we.filter(Y=>!Y.parentId),getCriticalPath:()=>oe.flattenTasks(we).filter(N=>N.isCriticalPath),indentTask:N=>{O(z=>bs(z,[N]));},outdentTask:N=>{O(z=>hs(z,[N]));},moveTask:(N,z)=>{O(Y=>ys(Y,[N],z));},createSubtask:async N=>{let{tasks:z,newTask:Y}=Cs(we,N);if(X){let re=X({...Y,parentId:N});if((re instanceof Promise?await re:re)===false)return}O(z),fe&&fe({...Y,parentId:N});},scrollToTask:N=>{let Y=oe.flattenTasks(we).findIndex(re=>re.id===N);if(Y!==-1&&H.current){let re=Y*je;H.current.scrollTo({top:re,behavior:"smooth"}),q.current&&q.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(N,z=2e3)=>{},expandTask:N=>{O(z=>{let Y=re=>re.map(ye=>ye.id===N?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye);return Y(z)});},collapseTask:N=>{O(z=>{let Y=re=>re.map(ye=>ye.id===N?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye);return Y(z)});},expandAll:()=>{O(N=>{let z=Y=>Y.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?z(re.subtasks):void 0}));return z(N)});},collapseAll:()=>{O(N=>{let z=Y=>Y.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?z(re.subtasks):void 0}));return z(N)});},undo:De,redo:ze,canUndo:()=>Ue,canRedo:()=>bt,clearHistory:J,exportToPNG:async()=>{if(!se.current)throw new Error("Gantt container not found");let N=await bd__default.default(se.current,{backgroundColor:ie.bgPrimary,scale:2});return new Promise((z,Y)=>{N.toBlob(re=>{re?z(re):Y(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await oe.exportToPDF(we,N);},exportToExcel:async N=>{await oe.exportToExcel(we,N);},exportToJSON:()=>oe.exportToJSON(we),exportToCSV:()=>oe.exportToCSV(we),importFromJSON:N=>{let z=oe.importFromJSON(N);O(z);},getTasks:()=>we,refresh:()=>{O(N=>[...N]);},clearAll:()=>{O([]);}}),[we,De,ze,Ue,bt,J,ie,je]);let Pt=react.useCallback(N=>{be(z=>z.map(Y=>Y.id===N?{...Y,visible:!Y.visible}:Y));},[]),Wr=react.useCallback((N,z)=>{be(Y=>Y.map(re=>{if(re.id!==N)return re;let ye=re.minWidth??100,Se=re.maxWidth??800,Ft=Math.max(ye,Math.min(Se,z));return {...re,width:Ft}}));},[]),Gr=react.useCallback(N=>{O(z=>ws(z,N)),a.onTaskToggleExpand?.(N);},[a]),Wa=react.useCallback((N,z)=>{if(Ce&&Ce(N,z)===false)return;let re=oe.findTaskById(we,N)?.progress,ye=Ft=>Ft.map(Bt=>Bt.id===N?{...Bt,...z}:Bt.subtasks?{...Bt,subtasks:ye(Bt.subtasks)}:Bt);O(ye(we));let Se=oe.findTaskById(ye(we),N);Se&&(A?.(Se),Le?.(Se),z.progress!==void 0&&re!==void 0&&z.progress!==re&&C?.(N,re,z.progress));},[we,A,Ce,Le,C]),yn=react.useCallback(N=>{N.length!==0&&(O(z=>bs(z,N)),a.onTaskIndent?.(N[0]));},[a]),me=react.useCallback(N=>{N.length!==0&&(O(z=>hs(z,N)),a.onTaskOutdent?.(N[0]));},[a]),mt=react.useCallback((N,z,Y)=>{O(re=>Ql(re,N,z,Y)),a.onTaskReparent?.(N,z,Y);},[a]),Ht=react.useCallback((N,z)=>{N.length!==0&&(O(Y=>ys(Y,N,z)),a.onTaskMove?.(N[0],z));},[a]),Ga=react.useCallback(async N=>{let z=[];for(let Y of N)Pe&&await Promise.resolve(Pe(Y))===false||z.push(Y);z.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(z):(O(Y=>vs(Y,z)),z.forEach(Y=>a.onTaskDelete?.(Y))),ce&&z.forEach(Y=>ce(Y)));},[a,Pe,ce]),bo=react.useCallback(N=>{O(z=>xs(z,N)),N.forEach(z=>a.onTaskDuplicate?.(z));},[a]),vr=react.useCallback((N,z)=>{O(Y=>{let{tasks:re,newTask:ye}=Zl(Y,N,z);return X&&X(ye)===false?Y:(a.onTaskCreate?.(ye.parentId,ye.position||0),fe?.(ye),re)});},[a,X,fe]),Ma=react.useCallback((N,z)=>{O(Y=>ks(Y,N,z)),a.onTaskRename?.(N,z);},[a]),Aa=react.useCallback(N=>{O(z=>{let{tasks:Y}=Cs(z,N);return a.onTaskCreate?.(N,0),Y});},[a]),Ct=react.useCallback((N,z,Y)=>{let re=N.startDate?Math.round((z.getTime()-N.startDate.getTime())/864e5):0,ye=Bt=>Bt.map(_t=>_t.id===N.id?{..._t,startDate:z,endDate:Y,...N.segments&&{segments:N.segments}}:_t.subtasks?{..._t,subtasks:ye(_t.subtasks)}:_t),Se=ye(we);Se=oe.autoScheduleDependents(Se,N.id,re),O(Se);let Ft={...N,startDate:z,endDate:Y};A?.(Ft);},[we,A]),vn=react.useCallback((N,z)=>{h?.(N,z),ot({isOpen:true,x:z.clientX,y:z.clientY,task:N});},[h]),xn=react.useCallback((N,z)=>{let Y=oe.splitTask(we,N.id,z);O(Y),ot({isOpen:false,x:0,y:0,task:null});},[we]),kn=react.useCallback(N=>{D?.(N),L||wt(N);},[D,L]),xr=react.useCallback((N,z,Y)=>{let re=new Map,ye=fa=>{fa.forEach(Ia=>{Ia.dependencies&&re.set(Ia.id,Ia.dependencies),Ia.subtasks&&ye(Ia.subtasks);});};ye(Y);let Se=re.get(z)||[];re.set(z,[...Se,N]);let Ft=new Set,Bt=new Set,_t=fa=>{if(!Ft.has(fa)){Ft.add(fa),Bt.add(fa);let Ia=re.get(fa)||[];for(let er of Ia){if(!Ft.has(er)&&_t(er))return true;if(Bt.has(er))return true}}return Bt.delete(fa),false};return _t(z)},[]),Ti=react.useCallback((N,z)=>{if(xr(N.id,z,we)){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
278
  Task dependencies must flow in one direction only.`);return}let Y=re=>re.map(ye=>{if(ye.id===z){let Se=ye.dependencies||[];if(!Se.includes(N.id))return {...ye,dependencies:[...Se,N.id]}}return ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye});O(Y(we)),$?.(N.id,z);},[we,$,xr]),Di=react.useCallback((N,z)=>{let Y=re=>re.map(ye=>{if(ye.id===N&&ye.dependencies){let Se=ye.dependencies.filter(Ft=>Ft!==z);return {...ye,dependencies:Se}}return ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye});O(Y(we)),E?.(N,z);},[we,E]),{startDate:Ac,endDate:Ic}=react.useMemo(()=>{let N=we.filter(Se=>Se.startDate&&Se.endDate);if(N.length===0){let Se=new Date,Ft=new Date(Se);Ft.setDate(Ft.getDate()-30);let Bt=new Date(Se);return Bt.setDate(Bt.getDate()+60),{startDate:Ft,endDate:Bt}}let z=N.flatMap(Se=>[Se.startDate,Se.endDate]).filter(Se=>Se!==void 0),Y=new Date(Math.min(...z.map(Se=>Se.getTime()))),re=new Date(Math.max(...z.map(Se=>Se.getTime()))),ye=P==="day"?7:P==="week"?14:30;return Y.setDate(Y.getDate()-ye),re.setDate(re.getDate()+ye),{startDate:Y,endDate:re}},[we,P]),Lc=react.useCallback(async()=>{if(!se.current)return;let N=await bd__default.default(se.current,{backgroundColor:ie.bgPrimary,scale:2}),z=document.createElement("a");z.download="gantt-chart.png",z.href=N.toDataURL("image/png"),z.click();},[ie]),Fc=react.useCallback(async()=>{await oe.exportToPDF(we);},[we]),Bc=react.useCallback(async()=>{await oe.exportToExcel(we);},[we]),Rc=react.useCallback(()=>{let N=oe.exportToCSV(we),z=new Blob([N],{type:"text/csv;charset=utf-8;"}),Y=document.createElement("a");Y.href=URL.createObjectURL(z),Y.download="gantt-chart.csv",Y.click(),URL.revokeObjectURL(Y.href);},[we]),Oc=react.useCallback(()=>{let N=oe.exportToJSON(we),z=new Blob([N],{type:"application/json;charset=utf-8;"}),Y=document.createElement("a");Y.href=URL.createObjectURL(z),Y.download="gantt-chart.json",Y.click(),URL.revokeObjectURL(Y.href);},[we]),$c=react.useCallback(()=>{oe.exportToMSProject(we,"Gantt Project","project.xml");},[we]),Uc=N=>{N.preventDefault(),Et(true);};return react.useEffect(()=>{let N=q.current,z=H.current;if(!N||!z)return;let Y=z.querySelector(".gantt-taskgrid-content"),re=()=>{let _t=N.scrollTop;he(_t),Y&&(Y.style.transform=`translateY(-${_t}px)`);},ye=_t=>{if(at&&z){let Ia=z.parentElement?.getBoundingClientRect()?.left||0,er=_t.clientX-Ia,zc=280,Wc=Math.min(window.innerWidth-300,800);er>=zc&&er<=Wc&&ft(er);}},Se=()=>{Et(false);},Ft=z.querySelector(".gantt-grid-scroll")||z,Bt=_t=>{let fa=_t;fa.deltaY!==0&&(N.scrollTop+=fa.deltaY,_t.preventDefault());};return N.addEventListener("scroll",re),Ft.addEventListener("wheel",Bt,{passive:false}),document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Se),()=>{N.removeEventListener("scroll",re),Ft.removeEventListener("wheel",Bt),document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Se);}},[at]),jsxRuntime.jsx(Ar.Provider,{value:ge,children:jsxRuntime.jsx(Nn.Provider,{value:B,children:jsxRuntime.jsxs("div",{ref:se,className:"flex flex-col h-full w-full",style:{backgroundColor:ie.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Bo,{theme:ie,timeScale:P,onTimeScaleChange:W,zoom:Ee,onZoomChange:le,currentTheme:M,onThemeChange:jt,rowDensity:de,onRowDensityChange:ae,showThemeSelector:c,showCreateTaskButton:y,createTaskLabel:x,onCreateTask:b,onExportPNG:n?Lc:void 0,onExportPDF:n?Fc:void 0,onExportExcel:n?Bc:void 0,onExportCSV:n?Rc:void 0,onExportJSON:n?Oc:void 0,onExportMSProject:n?$c:void 0}),jsxRuntime.jsxs("div",{ref:H,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:R,overflow:"hidden"},children:jsxRuntime.jsx(Uo,{tasks:Ne,theme:ie,rowHeight:je,availableUsers:p,templates:K,onTaskClick:w,onTaskDblClick:kn,onTaskContextMenu:h,onTaskToggle:Gr,scrollTop:Ve,columns:Te,onToggleColumn:Pt,onColumnResize:Wr,onTaskUpdate:Wa,onTaskIndent:yn,onTaskOutdent:me,onTaskMove:Ht,onMultiTaskDelete:Ga,onTaskDuplicate:bo,onTaskCreate:vr,onTaskRename:Ma,onCreateSubtask:Aa,onOpenTaskModal:w?N=>w(N):void 0,onDeleteRequest:(N,z)=>Lt({taskId:N,taskName:z}),onTaskReparent:mt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Uc}),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(Ko,{tasks:Ne,theme:ie,rowHeight:je,timeScale:P,startDate:Ac,endDate:Ic,zoom:Ee,templates:K,onTaskClick:w,onTaskDblClick:kn,onTaskContextMenu:vn,onTaskDateChange:Ct,onDependencyCreate:Ti,onDependencyDelete:Di})})]}),rt.task&&jsxRuntime.jsx(Ir,{isOpen:rt.isOpen,x:rt.x,y:rt.y,theme:ie,onClose:()=>ot({isOpen:false,x:0,y:0,task:null}),items:(()=>{let N=rt.task;return N?N.subtasks&&N.subtasks.length>0?[{id:"addSubtask",label:ge.contextMenu?.addSubtask||"Add Subtask",icon:lt.Add,onClick:()=>{T?T(N):Aa(N.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ge.contextMenu?.deleteTask||"Delete Task",icon:lt.Delete,onClick:()=>{Lt({taskId:N.id,taskName:N.name});}}]:[{id:"edit",label:ge.contextMenu?.editTask||"Edit Task",icon:lt.Pencil,onClick:()=>{L?L(N):wt(N);}},{id:"addSubtask",label:ge.contextMenu?.addSubtask||"Add Subtask",icon:lt.Add,onClick:()=>{T?T(N):Aa(N.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ge.contextMenu?.markIncomplete||"Mark Incomplete",icon:lt.MarkIncomplete,onClick:()=>{U?U(N):Wa(N.id,{status:"todo",progress:0});},disabled:N.status==="todo"},{id:"setInProgress",label:ge.contextMenu?.setInProgress||"Set In Progress",icon:lt.SetInProgress,onClick:()=>{G?G(N):Wa(N.id,{status:"in-progress"});},disabled:N.status==="in-progress"},{id:"markComplete",label:ge.contextMenu?.markComplete||"Mark Complete",icon:lt.MarkComplete,onClick:()=>{Wa(N.id,{status:"completed",progress:100});},disabled:N.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ge.contextMenu?.splitTask||"Split Task",icon:lt.Split,onClick:()=>{if(!N.startDate||!N.endDate){console.warn("Cannot split task without dates");return}let Y=N.startDate.getTime(),re=N.endDate.getTime(),ye=Y+(re-Y)/2,Se=new Date(ye);xn(N,Se);},disabled:!N.startDate||!N.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ge.contextMenu?.deleteTask||"Delete Task",icon:lt.Delete,onClick:()=>{Lt({taskId:N.id,taskName:N.name});}}]:[]})()}),ia&&jsxRuntime.jsx(Xo,{isOpen:true,onClose:()=>wt(null),task:ia,onSubmit:N=>{Wa(ia.id,N),wt(null);},mode:"edit",theme:M}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>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:N=>N.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ie.bgSecondary,border:`1px solid ${ie.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ie.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:ie.textPrimary,fontFamily:"Inter, sans-serif"},children:[ge.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ie.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:ie.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ie.textPrimary},children:['"',ct.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ie.bgPrimary,borderTop:`1px solid ${ie.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Lt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ie.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=ie.hoverBg;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Ga([ct.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:N=>{N.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Jo,{tasks:we,theme:ie,config:u,onTasksUpdate:O,onTaskUpdate:Wa,onTaskCreate:N=>{O(z=>[...z,N]);},onTaskDelete:N=>{Ga([N]);},onDependencyCreate:(N,z)=>{let Y=oe.findTaskById(we,N);Y&&Ti(Y,z);},onDependencyDelete:Di})]})})})});var yd=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
279
279