@libxai/board 0.17.189 → 0.17.190

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
@@ -68,7 +68,7 @@
68
68
  border: none !important;
69
69
  cursor: pointer !important;
70
70
  opacity: 0.5 !important;
71
- `,u.onmouseenter=()=>{u.style.opacity="1";},u.onmouseleave=()=>{u.style.opacity="0.5";},u.onclick=x=>{x.stopPropagation();let f=r<a.length-1?r+1:0;n(),o(f);},l.appendChild(d),l.appendChild(i),l.appendChild(u);}l.appendChild(c),l.appendChild(p),document.body.appendChild(l),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function hm(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 bm(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 Zn(e){return e.startsWith("image/")}function $a({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(null),i=react.useRef(null),u=react.useRef(e);u.current=e;let x=react.useCallback((v,R)=>{R.preventDefault(),R.stopPropagation();let T=u.current.filter(P=>Zn(P.type)),w=T.findIndex(P=>P.id===v.id),B=P=>{let H=u.current.filter(ye=>Zn(ye.type)),X=H[P];X&&Ml(X.url,X.name,H,P,B);};Ml(v.url,v.name,T,w,B);},[]),f=react.useCallback(v=>{let R=[],T=[];return e.length+v.length>s?(T.push(`Maximum ${s} files allowed`),{valid:R,errors:T}):(v.forEach(w=>{if(w.size/1048576>r){T.push(`${w.name} is too large (max ${r}MB)`);return}if(o&&!o.some(P=>w.type.match(P))){T.push(`${w.name} has invalid file type`);return}R.push(w);}),{valid:R,errors:T})},[e.length,s,r,o]),g=react.useCallback(async v=>{let{valid:R,errors:T}=f(v);if(T.length>0){d(T.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){n(true),d(null);try{await t?.(R);}catch(w){d(w instanceof Error?w.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{n(false);}}},[f,t]),k=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(true);},[]),h=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);},[]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),y=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);let R=Array.from(v.dataTransfer.files);g(R);},[g]),D=react.useCallback(v=>{let R=v.target.files?Array.from(v.target.files):[];g(R),i.current&&(i.current.value="");},[g]),N=react.useCallback(()=>{i.current?.click();},[]),A=react.useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${p?"uploading":""}`,onDragEnter:k,onDragLeave:h,onDragOver:b,onDrop:y,onClick:N,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:l?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Zn(v.type)&&v.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>x(v,R),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:v.thumbnailUrl||v.url,alt:v.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:bm(v.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:hm(v.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>A(v.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"})})})]},v.id))})]})}function Qn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:x,onGenerateSubtasks:f,onEstimateEffort:g,currentUserId:k="user-1"}){let[h,b]=react.useState("details"),[y,D]=react.useState(false),[N,A]=react.useState({}),[v,R]=react.useState(""),[T,w]=react.useState(false),[B,P]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{D(false),A({}),b("details"),R(""),P({}),a();},[a]),X=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),A({}),D(false));},[e.id,N,r]),ye=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),ke=react.useCallback(()=>{m&&v.trim()&&(m(e.id,v.trim()),R(""));},[e.id,v,m]),Ae=react.useCallback(async()=>{if(x){w(true);try{let E=await x(e);P(K=>({...K,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{w(false);}}},[e,x]),Fe=react.useCallback(async()=>{if(f){w(true);try{let E=await f(e);P(K=>({...K,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{w(false);}}},[e,f]),z=react.useCallback(async()=>{if(g){w(true);try{let E=await g(e);P(K=>({...K,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{w(false);}}},[e,g]),F={...e,...N},W=s.filter(E=>F.assignedUserIds?.includes(E.id));return jsxRuntime.jsx(rt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),y?jsxRuntime.jsx("input",{type:"text",value:N.title??F.title,onChange:E=>A({...N,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[y?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:ye,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:H,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>b("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>b("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),y?jsxRuntime.jsx("textarea",{value:N.description??F.description??"",onChange:E=>A({...N,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),y?jsxRuntime.jsx("select",{multiple:true,value:N.assignedUserIds??F.assignedUserIds??[],onChange:E=>{let K=Array.from(E.target.selectedOptions,ae=>ae.value);A({...N,assignedUserIds:K});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:W.length>0?W.map(E=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsxRuntime.jsx("span",{children:E.name})]},E.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),y?jsxRuntime.jsxs("select",{value:N.priority??F.priority??"",onChange:E=>A({...N,priority:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:F.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:F.labels&&F.labels.length>0?F.labels.map(E=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:E},E)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),y?jsxRuntime.jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:E=>A({...N,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),y?jsxRuntime.jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:E=>A({...N,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),y?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??F.estimatedTime??"",onChange:E=>A({...N,estimatedTime:E.target.value?parseFloat(E.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:F.dependencies&&F.dependencies.length>0?F.dependencies.map(E=>{let K=typeof E=="string"?E:E.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",K.slice(-4)]},K)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:F.createdAt?new Date(F.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:v,onChange:E=>R(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ke,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(E=>{let K=s.find(ae=>ae.id===E.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[K&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:K?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(E.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:E.content})]},E.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(E=>{let K=s.find(ae=>ae.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:K?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:E.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx($a,{cardId:e.id,attachments:n,onUpload:i?E=>i(e.id,E):void 0,onDelete:u,currentUserId:k,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ae,disabled:T||!x,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:Fe,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:z,disabled:T||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),B.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),B.assignees.map((E,K)=>{let ae=s.find(O=>O.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ae&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ae.color},children:ae.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ae?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:E.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},K)})]}),B.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),B.subtasks.map((E,K)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},K))]}),B.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[B.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(B.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(E=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!B.assignees&&!B.subtasks&&!B.effort&&p.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function io({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:l=""}){let[c,p]=react.useState({top:0,left:0}),n=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,x=4,f=d.left;f+o>u-10&&(f=u-o-10),f<10&&(f=10);let g=i-d.bottom,k=d.top,h;return g>=s+x?h=d.bottom+x:k>=s+x?h=d.top-s-x:g>=k?h=d.bottom+x:h=Math.max(10,d.top-s-x),{top:h,left:f}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let d=u=>{let x=u.target;n.current&&!n.current.contains(x)&&e.current&&!e.current.contains(x)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(rt,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${l}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Uo=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Ur({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:l=true}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[d,i]=react.useState(false),[u,x]=react.useState(Uo[10]||"#3B82F6"),[f,g]=react.useState({top:0,left:0}),k=react.useRef(null),h=react.useRef(null),b=react.useRef(null),y=react.useRef(null),D=t.filter(w=>w.name.toLowerCase().includes(n.toLowerCase())),N=t.some(w=>w.name.toLowerCase()===n.toLowerCase());react.useEffect(()=>{if(c&&h.current){let w=h.current.getBoundingClientRect();g({top:w.bottom+6,left:w.left});}},[c]),react.useEffect(()=>{let w=B=>{let P=B.target,H=k.current?.contains(P),X=b.current?.contains(P);!H&&!X&&(p(false),m(""),i(false));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{c&&y.current&&y.current.focus();},[c]);let A=w=>{let B=e.some(P=>P.id===w.id);a(B?e.filter(P=>P.id!==w.id):[...e,w]);},v=async()=>{if(!(!r||!n.trim())){i(true);try{let w=await r(n.trim(),u);w&&(a([...e,w]),m(""),x(Uo[Math.floor(Math.random()*Uo.length)]||"#3B82F6"));}finally{i(false);}}},R=(w,B)=>{B.stopPropagation(),a(e.filter(P=>P.id!==w));},T={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:k,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&p(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:T,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(w=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${w.color}20`,color:w.color},children:w.name},w.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Etiquetas"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:b,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:f.top,left:f.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:y,type:"text",value:n,onChange:w=>m(w.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:w=>{w.key==="Enter"&&n.trim()&&!N&&r&&v();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(w=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${w.color}20`,color:w.color},onClick:B=>R(w.id,B),children:[w.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},w.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(w=>{let B=e.some(P=>P.id===w.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(w),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:B?`${w.color}15`:"transparent",color:o.textPrimary},onMouseEnter:P=>{B||(P.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:P=>{B||(P.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:w.name}),B&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:w.color}})]},w.id)}):n.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),n.trim()&&!N&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Uo.map(w=>jsxRuntime.jsx("button",{type:"button",onClick:()=>x(w),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:w,outline:u===w?`2px solid ${w}`:"none",outlineOffset:"2px"}},w))}),jsxRuntime.jsxs("button",{type:"button",onClick:v,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:u,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',n.trim(),'"']})]})]})}),document.body)]})}function as({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Fl({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(as,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Ge={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Im=["LOW","MEDIUM","HIGH","URGENT"],Lm=["todo","in-progress","review","done"];function os({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:x=[],availableLabels:f=[],availableTags:g=[],onCreateTag:k,onUploadCoverImage:h,unsplashAccessKey:b,theme:y,onSubtasksChange:D,attachments:N=[],onUploadAttachments:A,onDeleteAttachment:v}){let R=Fr(),T=y||R?.themeName||"dark",[w,B]=react.useState(e),[P,H]=react.useState(false),[X,ye]=react.useState(e?.subtasks||[]),[ke,Ae]=react.useState(false),[Fe,z]=react.useState(""),[F,W]=react.useState(""),[E,K]=react.useState("all"),[ae,O]=react.useState(false),[Me,he]=react.useState(false),[qe,me]=react.useState(false),[tt,we]=react.useState(false),[st,ht]=react.useState(false),[Bt,Xe]=react.useState(false),$=react.useRef(null),ne=react.useRef(null),be=react.useRef(null),Te=react.useRef(null),De=react.useRef(null),Ye=react.useRef(null),mt=react.useRef(null),Ie=react.useRef(null),I=react.useRef(null),Y=react.useRef(null),He=react.useRef(null),We=react.useRef(null);react.useEffect(()=>{e&&!w?(B({...e}),ye(e.subtasks||[])):e&&w&&e.id!==w.id&&(B({...e}),ye(e.subtasks||[]));},[e,w]),react.useEffect(()=>{let U=ce=>{let Se=ce.target;Te.current&&!Te.current.contains(Se)&&O(false),De.current&&!De.current.contains(Se)&&he(false),Ye.current&&!Ye.current.contains(Se)&&me(false),mt.current&&!mt.current.contains(Se)&&we(false);};if(ae||Me||qe||tt)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[ae,Me,qe,tt]),react.useEffect(()=>{if(!t)return;let U=ce=>{let Se=ce.target,Ut=Se.tagName==="INPUT"||Se.tagName==="TEXTAREA"||Se.isContentEditable;if(ce.key==="Escape"){ce.preventDefault(),ae||Me||qe||tt||st||Bt?(O(false),he(false),me(false),we(false),ht(false),Xe(false)):Ut||a();return}if(Ut&&ce.key!=="Escape")return;let ea=ce.metaKey||ce.ctrlKey;switch(ce.key.toLowerCase()){case "s":ce.preventDefault(),O(true);break;case "a":ce.preventDefault(),me(true);break;case "p":ce.preventDefault(),he(true);break;case "l":ce.preventDefault(),we(true);break;case "d":ea||(ce.preventDefault(),ht(true),setTimeout(()=>Ie.current?.focus(),0));break;case "e":ea||(ce.preventDefault(),Xe(true));break;case "i":ce.preventDefault(),H(true),setTimeout(()=>ne.current?.focus(),0);break;case "t":ce.preventDefault(),Ae(true);break;case "c":ce.preventDefault(),be.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,ae,Me,qe,tt,st,Bt]);let bt=react.useCallback(U=>{let ce=U.currentTarget.textContent?.trim()||"";if(w&&ce!==w.title){let Se={...w,title:ce};B(Se),r?.(w.id,{title:ce});}},[w,r]),J=react.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=w?.title||"",U.currentTarget.blur());},[w]),Q=react.useCallback(()=>{w&&e&&w.description!==e.description&&r?.(w.id,{description:w.description}),H(false);},[w,e,r]),xe=react.useCallback(U=>{if(w){let ce={...w,columnId:U};B(ce),r?.(w.id,{columnId:U}),O(false);}},[w,r]),Ce=react.useCallback(U=>{if(w){let ce={...w,priority:U};B(ce),r?.(w.id,{priority:U}),he(false);}},[w,r]),re=react.useCallback(U=>{if(w){let ce=w.assignedUserIds||[],Se=ce.includes(U)?ce.filter(ea=>ea!==U):[...ce,U],Ut={...w,assignedUserIds:Se};B(Ut),r?.(w.id,{assignedUserIds:Se});}},[w,r]),Pe=react.useCallback(U=>{if(w){let ce=w.labels||[],Se=ce.includes(U)?ce.filter(ea=>ea!==U):[...ce,U],Ut={...w,labels:Se};B(Ut),r?.(w.id,{labels:Se});}},[w,r]),ve=react.useCallback(U=>{if(w){let ce={...w,tags:U};B(ce),r?.(w.id,{tags:U});}},[w,r]),Ne=react.useCallback(U=>{if(w){let ce=U.target.value,Se={...w,endDate:ce};B(Se),r?.(w.id,{endDate:ce}),ht(false);}},[w,r]),se=react.useCallback(U=>{if(w){let ce={...w,estimatedTime:parseFloat(U)||0};B(ce),r?.(w.id,{estimatedTime:parseFloat(U)||0});}},[w,r]),Re=react.useCallback(()=>{if(Fe.trim()&&w){let U={id:`subtask-${Date.now()}`,title:Fe.trim(),completed:false,createdAt:new Date},ce=[...X,U];ye(ce),z(""),Ae(false),D?.(w.id,ce);}},[Fe,X,w,D]),Le=react.useCallback(U=>{let ce=X.map(Se=>Se.id===U?{...Se,completed:!Se.completed,updatedAt:new Date}:Se);ye(ce),w&&D?.(w.id,ce);},[X,w,D]),$e=react.useCallback(U=>{let ce=X.filter(Se=>Se.id!==U);ye(ce),w&&D?.(w.id,ce);},[X,w,D]),_=react.useCallback(()=>{F.trim()&&w&&p&&(p(w.id,F.trim()),W(""));},[F,w,p]),q=react.useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),_());},[_]),at=U=>jsxRuntime.jsx(Pm__default.default,{remarkPlugins:[Mm__default.default],rehypePlugins:[Am__default.default],components:{a:({node:ce,...Se})=>jsxRuntime.jsx("a",{...Se,target:"_blank",rel:"noopener noreferrer"})},children:U}),Ue=c.filter(U=>E==="comments"?U.type.includes("COMMENT"):E==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let le=w||e,Je=s.filter(U=>le.assignedUserIds?.includes(U.id)),Tt=X.filter(U=>U.completed).length;return jsxRuntime.jsx(rt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":T,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:$,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:bt,onKeyDown:J,children:le.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:Te,children:[jsxRuntime.jsxs("button",{ref:I,className:"modal-v2-field",onClick:()=>O(!ae),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:le.columnId||"No status"})]}),jsxRuntime.jsx(io,{triggerRef:I,isOpen:ae,onClose:()=>O(false),width:250,estimatedHeight:200,children:(x.length>0?x:Lm.map(U=>({id:U,title:U}))).map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${le.columnId===U.id?"active":""}`,onClick:()=>xe(U.id),children:U.title},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ye,children:[jsxRuntime.jsxs("button",{ref:Y,className:"modal-v2-field",onClick:()=>me(!qe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Je.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Je.map(U=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:Y,isOpen:qe,onClose:()=>me(false),width:280,estimatedHeight:300,children:s.map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${le.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>re(U.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,le.assignedUserIds?.includes(U.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:De,children:[jsxRuntime.jsxs("button",{ref:He,className:"modal-v2-field",onClick:()=>he(!Me),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:le.priority||"None"})]}),jsxRuntime.jsxs(io,{triggerRef:He,isOpen:Me,onClose:()=>he(false),width:180,estimatedHeight:220,children:[Im.map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${le.priority===U?"active":""}`,onClick:()=>Ce(U),children:U},U)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ce(""),children:"None"})]})]}),g.length>0||k?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Ur,{selectedTags:le.tags||[],availableTags:g,onChange:ve,onCreateTag:k,theme:Ge[T]||Ge.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:mt,children:[jsxRuntime.jsxs("button",{ref:We,className:"modal-v2-field",onClick:()=>we(!tt),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:le.labels&&le.labels.length>0?jsxRuntime.jsx("span",{children:le.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:We,isOpen:tt,onClose:()=>we(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${le.labels?.includes(U)?"active":""}`,onClick:()=>Pe(U),children:[U,le.labels?.includes(U)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},U))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ht(!st),setTimeout(()=>Ie.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:le.endDate?new Date(le.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Ie,type:"date",value:typeof le.endDate=="string"?le.endDate.split("T")[0]:le.endDate?(()=>{let U=new Date(le.endDate),ce=U.getUTCFullYear(),Se=String(U.getUTCMonth()+1).padStart(2,"0"),Ut=String(U.getUTCDate()).padStart(2,"0");return `${ce}-${Se}-${Ut}`})():"",onChange:Ne,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Xe(!Bt),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:le.estimatedTime?`${le.estimatedTime}h`:"Not set"})]}),Bt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:le.estimatedTime||"",onChange:U=>se(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Xe(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),P?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:le.description||"",onChange:U=>{if(w){let ce={...w,description:U.target.value};B(ce);}},onBlur:Q,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:le.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:at(le.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"}),X.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Tt,"/",X.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ae(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:[X.map(U=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Le(U.id),children:U.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:U.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>$e(U.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},U.id)),ke&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Fe,onChange:U=>z(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Re(),U.key==="Escape"&&(Ae(false),z(""));},onBlur:Re,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(A||N.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx($a,{cardId:le.id,attachments:N,onUpload:A?U=>A(le.id,U):void 0,onDelete:v,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="all"?"active":""}`,onClick:()=>K("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>K("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>K("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:be,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:U=>W(U.target.value),onKeyDown:q,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:_,disabled:!F.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Ue.map(U=>{let ce=s.find(Ut=>Ut.id===U.userId);if(U.type.includes("COMMENT")){let Ut=l.find(ea=>ea.id===U.metadata?.commentId);return Ut?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ce&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ce.color},children:ce.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ce?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ut.content})]})]},U.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ce?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),Ue.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 Hm({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 ss({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(l=>({...l,average:l.average??e.reduce((c,p)=>c+p.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Hm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((l,c)=>l+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((l,c)=>l+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((l,c)=>l+(c.planned||0),0)})]})]})]})}function Jm({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 is({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=s>0?(s-l)/s*100:0,n=l<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Jm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",fill:n?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:n?"#10B981":"#EF4444"},children:l})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var su={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Wl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function iu({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,c=e+l*Math.cos(-a*(Math.PI/180)),p=t+l*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Hl({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 ls({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,n)=>p+n.value,0),l=e.map(p=>({...p,totalValue:s,color:p.color||su[p.name]||Wl[e.indexOf(p)%Wl.length]})),c=l.map(p=>p.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?iu:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Hl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Hl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((p,n)=>n.value>p.value?n:p).name})]})]})]})}var Ho=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let x=e.map(y=>y.id),f=y=>{r.onBulkUpdate?.(x,{priority:y}),c(false);},g=y=>{r.onBulkMove?.(x,y),n(false),a();},k=y=>{r.onBulkUpdate?.(x,{assignedUserIds:y}),d(false);},h=y=>{let D=new Set;e.forEach(A=>{A.labels?.forEach(v=>D.add(v));});let N=Array.from(new Set([...D,...y]));r.onBulkUpdate?.(x,{labels:N}),u(false);},b=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(y=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(y),children:[jsxRuntime.jsx("span",{className:C("asakaa-priority-dot",y==="LOW"&&"bg-asakaa-priority-low",y==="MEDIUM"&&"bg-asakaa-priority-medium",y==="HIGH"&&"bg-asakaa-priority-high",y==="URGENT"&&"bg-asakaa-priority-urgent")}),y]},y))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(y=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(y.id),children:y.title},y.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(y=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k([y.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:y.color},children:y.initials}),y.name]},y.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(y=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([y]),children:y},y))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:b,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"})})]})]})})});Ho.displayName="BulkOperationsToolbar";function mu(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,c,p,n;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let x=a?.find(f=>f.id===u);l=`assignee-${u}`,c=x?.name||`User ${u}`,p=x?.color,n=x?.avatar,r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",c="Unassigned",p="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",l=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,p=i.color,r.has(l)||r.set(l,{id:l,title:c,groupValue:s,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,c=u,p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);}):(l="label-none",c="No Labels",p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ds({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=react.useState(new Set),c=react.useMemo(()=>mu(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{l(m=>{let d=new Set(m);return d.has(n)?d.delete(n):d.add(n),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Qa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:C("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),d=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&p(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Qa,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var cs=[{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 ps({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null),c=cs.find(n=>n.value===e)||cs[0];react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:C("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:C("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:cs.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:C("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:n.label}),e===n.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:n.description})]})]},n.value))})]})]})}var co=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function fu(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&l&&c&&p}function Kl(e={}){let{shortcuts:t=co,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let l=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(n=>n.action!==p);},[]);return react.useEffect(()=>{function p(n){if(!s.current)return;let m=n.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let d of o.current)if(fu(n,d)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:l,unregisterShortcut:c,isEnabled:a}}function bu(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function yu(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 vu(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=yu(e),r=t?bu(t):"";return a?`${a} + ${r}`:r}function xu(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 ms({shortcuts:e=co,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let l=xu(e);return jsxRuntime.jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(l).map(([c,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:vu(n)})]},n.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var us=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
71
+ `,u.onmouseenter=()=>{u.style.opacity="1";},u.onmouseleave=()=>{u.style.opacity="0.5";},u.onclick=x=>{x.stopPropagation();let f=r<a.length-1?r+1:0;n(),o(f);},l.appendChild(d),l.appendChild(i),l.appendChild(u);}l.appendChild(c),l.appendChild(p),document.body.appendChild(l),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function hm(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 bm(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 Zn(e){return e.startsWith("image/")}function $a({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(null),i=react.useRef(null),u=react.useRef(e);u.current=e;let x=react.useCallback((v,R)=>{R.preventDefault(),R.stopPropagation();let T=u.current.filter(P=>Zn(P.type)),w=T.findIndex(P=>P.id===v.id),B=P=>{let H=u.current.filter(ye=>Zn(ye.type)),X=H[P];X&&Ml(X.url,X.name,H,P,B);};Ml(v.url,v.name,T,w,B);},[]),f=react.useCallback(v=>{let R=[],T=[];return e.length+v.length>s?(T.push(`Maximum ${s} files allowed`),{valid:R,errors:T}):(v.forEach(w=>{if(w.size/1048576>r){T.push(`${w.name} is too large (max ${r}MB)`);return}if(o&&!o.some(P=>w.type.match(P))){T.push(`${w.name} has invalid file type`);return}R.push(w);}),{valid:R,errors:T})},[e.length,s,r,o]),g=react.useCallback(async v=>{let{valid:R,errors:T}=f(v);if(T.length>0){d(T.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){n(true),d(null);try{await t?.(R);}catch(w){d(w instanceof Error?w.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{n(false);}}},[f,t]),k=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(true);},[]),h=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);},[]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),y=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);let R=Array.from(v.dataTransfer.files);g(R);},[g]),D=react.useCallback(v=>{let R=v.target.files?Array.from(v.target.files):[];g(R),i.current&&(i.current.value="");},[g]),N=react.useCallback(()=>{i.current?.click();},[]),A=react.useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${p?"uploading":""}`,onDragEnter:k,onDragLeave:h,onDragOver:b,onDrop:y,onClick:N,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:l?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Zn(v.type)&&v.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>x(v,R),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:v.thumbnailUrl||v.url,alt:v.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:bm(v.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:hm(v.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>A(v.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"})})})]},v.id))})]})}function Qn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:x,onGenerateSubtasks:f,onEstimateEffort:g,currentUserId:k="user-1"}){let[h,b]=react.useState("details"),[y,D]=react.useState(false),[N,A]=react.useState({}),[v,R]=react.useState(""),[T,w]=react.useState(false),[B,P]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{D(false),A({}),b("details"),R(""),P({}),a();},[a]),X=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),A({}),D(false));},[e.id,N,r]),ye=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),ke=react.useCallback(()=>{m&&v.trim()&&(m(e.id,v.trim()),R(""));},[e.id,v,m]),Ae=react.useCallback(async()=>{if(x){w(true);try{let E=await x(e);P(K=>({...K,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{w(false);}}},[e,x]),Fe=react.useCallback(async()=>{if(f){w(true);try{let E=await f(e);P(K=>({...K,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{w(false);}}},[e,f]),z=react.useCallback(async()=>{if(g){w(true);try{let E=await g(e);P(K=>({...K,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{w(false);}}},[e,g]),F={...e,...N},W=s.filter(E=>F.assignedUserIds?.includes(E.id));return jsxRuntime.jsx(rt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),y?jsxRuntime.jsx("input",{type:"text",value:N.title??F.title,onChange:E=>A({...N,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[y?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:ye,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:H,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>b("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>b("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),y?jsxRuntime.jsx("textarea",{value:N.description??F.description??"",onChange:E=>A({...N,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),y?jsxRuntime.jsx("select",{multiple:true,value:N.assignedUserIds??F.assignedUserIds??[],onChange:E=>{let K=Array.from(E.target.selectedOptions,ae=>ae.value);A({...N,assignedUserIds:K});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:W.length>0?W.map(E=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsxRuntime.jsx("span",{children:E.name})]},E.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),y?jsxRuntime.jsxs("select",{value:N.priority??F.priority??"",onChange:E=>A({...N,priority:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:F.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:F.labels&&F.labels.length>0?F.labels.map(E=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:E},E)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),y?jsxRuntime.jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:E=>A({...N,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),y?jsxRuntime.jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:E=>A({...N,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),y?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??F.estimatedTime??"",onChange:E=>A({...N,estimatedTime:E.target.value?parseFloat(E.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:F.dependencies&&F.dependencies.length>0?F.dependencies.map(E=>{let K=typeof E=="string"?E:E.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",K.slice(-4)]},K)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:F.createdAt?new Date(F.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:v,onChange:E=>R(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ke,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(E=>{let K=s.find(ae=>ae.id===E.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[K&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:K?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(E.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:E.content})]},E.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(E=>{let K=s.find(ae=>ae.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:K?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:E.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx($a,{cardId:e.id,attachments:n,onUpload:i?E=>i(e.id,E):void 0,onDelete:u,currentUserId:k,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ae,disabled:T||!x,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:Fe,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:z,disabled:T||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),B.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),B.assignees.map((E,K)=>{let ae=s.find(O=>O.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ae&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ae.color},children:ae.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ae?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:E.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},K)})]}),B.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),B.subtasks.map((E,K)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},K))]}),B.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[B.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(B.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(E=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!B.assignees&&!B.subtasks&&!B.effort&&p.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function io({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:l=""}){let[c,p]=react.useState({top:0,left:0}),n=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,x=4,f=d.left;f+o>u-10&&(f=u-o-10),f<10&&(f=10);let g=i-d.bottom,k=d.top,h;return g>=s+x?h=d.bottom+x:k>=s+x?h=d.top-s-x:g>=k?h=d.bottom+x:h=Math.max(10,d.top-s-x),{top:h,left:f}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let d=u=>{let x=u.target;n.current&&!n.current.contains(x)&&e.current&&!e.current.contains(x)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(rt,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${l}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Uo=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Ur({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:l=true}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[d,i]=react.useState(false),[u,x]=react.useState(Uo[10]||"#3B82F6"),[f,g]=react.useState({top:0,left:0}),k=react.useRef(null),h=react.useRef(null),b=react.useRef(null),y=react.useRef(null),D=t.filter(w=>w.name.toLowerCase().includes(n.toLowerCase())),N=t.some(w=>w.name.toLowerCase()===n.toLowerCase());react.useEffect(()=>{if(c&&h.current){let w=h.current.getBoundingClientRect();g({top:w.bottom+6,left:w.left});}},[c]),react.useEffect(()=>{let w=B=>{let P=B.target,H=k.current?.contains(P),X=b.current?.contains(P);!H&&!X&&(p(false),m(""),i(false));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{c&&y.current&&y.current.focus();},[c]);let A=w=>{let B=e.some(P=>P.id===w.id);a(B?e.filter(P=>P.id!==w.id):[...e,w]);},v=async()=>{if(!(!r||!n.trim())){i(true);try{let w=await r(n.trim(),u);w&&(a([...e,w]),m(""),x(Uo[Math.floor(Math.random()*Uo.length)]||"#3B82F6"));}finally{i(false);}}},R=(w,B)=>{B.stopPropagation(),a(e.filter(P=>P.id!==w));},T={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:k,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&p(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:T,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(w=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${w.color}20`,color:w.color},children:w.name},w.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Etiquetas"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:b,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:f.top,left:f.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:y,type:"text",value:n,onChange:w=>m(w.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:w=>{w.key==="Enter"&&n.trim()&&!N&&r&&v();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(w=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${w.color}20`,color:w.color},onClick:B=>R(w.id,B),children:[w.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},w.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(w=>{let B=e.some(P=>P.id===w.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(w),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:B?`${w.color}15`:"transparent",color:o.textPrimary},onMouseEnter:P=>{B||(P.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:P=>{B||(P.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:w.name}),B&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:w.color}})]},w.id)}):n.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),n.trim()&&!N&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Uo.map(w=>jsxRuntime.jsx("button",{type:"button",onClick:()=>x(w),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:w,outline:u===w?`2px solid ${w}`:"none",outlineOffset:"2px"}},w))}),jsxRuntime.jsxs("button",{type:"button",onClick:v,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:u,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',n.trim(),'"']})]})]})}),document.body)]})}function as({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Fl({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(as,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Ge={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Im=["LOW","MEDIUM","HIGH","URGENT"],Lm=["todo","in-progress","review","done"];function os({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:x=[],availableLabels:f=[],availableTags:g=[],onCreateTag:k,onUploadCoverImage:h,unsplashAccessKey:b,theme:y,onSubtasksChange:D,attachments:N=[],onUploadAttachments:A,onDeleteAttachment:v}){let R=Fr(),T=y||R?.themeName||"dark",[w,B]=react.useState(e),[P,H]=react.useState(false),[X,ye]=react.useState(e?.subtasks||[]),[ke,Ae]=react.useState(false),[Fe,z]=react.useState(""),[F,W]=react.useState(""),[E,K]=react.useState("all"),[ae,O]=react.useState(false),[Me,he]=react.useState(false),[qe,me]=react.useState(false),[tt,we]=react.useState(false),[st,ht]=react.useState(false),[Bt,Ze]=react.useState(false),$=react.useRef(null),ne=react.useRef(null),be=react.useRef(null),Te=react.useRef(null),De=react.useRef(null),Ye=react.useRef(null),mt=react.useRef(null),Ie=react.useRef(null),I=react.useRef(null),Y=react.useRef(null),He=react.useRef(null),We=react.useRef(null);react.useEffect(()=>{e&&!w?(B({...e}),ye(e.subtasks||[])):e&&w&&e.id!==w.id&&(B({...e}),ye(e.subtasks||[]));},[e,w]),react.useEffect(()=>{let U=ce=>{let Se=ce.target;Te.current&&!Te.current.contains(Se)&&O(false),De.current&&!De.current.contains(Se)&&he(false),Ye.current&&!Ye.current.contains(Se)&&me(false),mt.current&&!mt.current.contains(Se)&&we(false);};if(ae||Me||qe||tt)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[ae,Me,qe,tt]),react.useEffect(()=>{if(!t)return;let U=ce=>{let Se=ce.target,Ut=Se.tagName==="INPUT"||Se.tagName==="TEXTAREA"||Se.isContentEditable;if(ce.key==="Escape"){ce.preventDefault(),ae||Me||qe||tt||st||Bt?(O(false),he(false),me(false),we(false),ht(false),Ze(false)):Ut||a();return}if(Ut&&ce.key!=="Escape")return;let ea=ce.metaKey||ce.ctrlKey;switch(ce.key.toLowerCase()){case "s":ce.preventDefault(),O(true);break;case "a":ce.preventDefault(),me(true);break;case "p":ce.preventDefault(),he(true);break;case "l":ce.preventDefault(),we(true);break;case "d":ea||(ce.preventDefault(),ht(true),setTimeout(()=>Ie.current?.focus(),0));break;case "e":ea||(ce.preventDefault(),Ze(true));break;case "i":ce.preventDefault(),H(true),setTimeout(()=>ne.current?.focus(),0);break;case "t":ce.preventDefault(),Ae(true);break;case "c":ce.preventDefault(),be.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,ae,Me,qe,tt,st,Bt]);let bt=react.useCallback(U=>{let ce=U.currentTarget.textContent?.trim()||"";if(w&&ce!==w.title){let Se={...w,title:ce};B(Se),r?.(w.id,{title:ce});}},[w,r]),J=react.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=w?.title||"",U.currentTarget.blur());},[w]),Q=react.useCallback(()=>{w&&e&&w.description!==e.description&&r?.(w.id,{description:w.description}),H(false);},[w,e,r]),xe=react.useCallback(U=>{if(w){let ce={...w,columnId:U};B(ce),r?.(w.id,{columnId:U}),O(false);}},[w,r]),Ce=react.useCallback(U=>{if(w){let ce={...w,priority:U};B(ce),r?.(w.id,{priority:U}),he(false);}},[w,r]),re=react.useCallback(U=>{if(w){let ce=w.assignedUserIds||[],Se=ce.includes(U)?ce.filter(ea=>ea!==U):[...ce,U],Ut={...w,assignedUserIds:Se};B(Ut),r?.(w.id,{assignedUserIds:Se});}},[w,r]),Pe=react.useCallback(U=>{if(w){let ce=w.labels||[],Se=ce.includes(U)?ce.filter(ea=>ea!==U):[...ce,U],Ut={...w,labels:Se};B(Ut),r?.(w.id,{labels:Se});}},[w,r]),ve=react.useCallback(U=>{if(w){let ce={...w,tags:U};B(ce),r?.(w.id,{tags:U});}},[w,r]),Ne=react.useCallback(U=>{if(w){let ce=U.target.value,Se={...w,endDate:ce};B(Se),r?.(w.id,{endDate:ce}),ht(false);}},[w,r]),se=react.useCallback(U=>{if(w){let ce={...w,estimatedTime:parseFloat(U)||0};B(ce),r?.(w.id,{estimatedTime:parseFloat(U)||0});}},[w,r]),Re=react.useCallback(()=>{if(Fe.trim()&&w){let U={id:`subtask-${Date.now()}`,title:Fe.trim(),completed:false,createdAt:new Date},ce=[...X,U];ye(ce),z(""),Ae(false),D?.(w.id,ce);}},[Fe,X,w,D]),Le=react.useCallback(U=>{let ce=X.map(Se=>Se.id===U?{...Se,completed:!Se.completed,updatedAt:new Date}:Se);ye(ce),w&&D?.(w.id,ce);},[X,w,D]),$e=react.useCallback(U=>{let ce=X.filter(Se=>Se.id!==U);ye(ce),w&&D?.(w.id,ce);},[X,w,D]),V=react.useCallback(()=>{F.trim()&&w&&p&&(p(w.id,F.trim()),W(""));},[F,w,p]),q=react.useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),V());},[V]),at=U=>jsxRuntime.jsx(Pm__default.default,{remarkPlugins:[Mm__default.default],rehypePlugins:[Am__default.default],components:{a:({node:ce,...Se})=>jsxRuntime.jsx("a",{...Se,target:"_blank",rel:"noopener noreferrer"})},children:U}),Ue=c.filter(U=>E==="comments"?U.type.includes("COMMENT"):E==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let le=w||e,Xe=s.filter(U=>le.assignedUserIds?.includes(U.id)),Tt=X.filter(U=>U.completed).length;return jsxRuntime.jsx(rt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":T,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:$,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:bt,onKeyDown:J,children:le.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:Te,children:[jsxRuntime.jsxs("button",{ref:I,className:"modal-v2-field",onClick:()=>O(!ae),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:le.columnId||"No status"})]}),jsxRuntime.jsx(io,{triggerRef:I,isOpen:ae,onClose:()=>O(false),width:250,estimatedHeight:200,children:(x.length>0?x:Lm.map(U=>({id:U,title:U}))).map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${le.columnId===U.id?"active":""}`,onClick:()=>xe(U.id),children:U.title},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ye,children:[jsxRuntime.jsxs("button",{ref:Y,className:"modal-v2-field",onClick:()=>me(!qe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Xe.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Xe.map(U=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:Y,isOpen:qe,onClose:()=>me(false),width:280,estimatedHeight:300,children:s.map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${le.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>re(U.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,le.assignedUserIds?.includes(U.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:De,children:[jsxRuntime.jsxs("button",{ref:He,className:"modal-v2-field",onClick:()=>he(!Me),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:le.priority||"None"})]}),jsxRuntime.jsxs(io,{triggerRef:He,isOpen:Me,onClose:()=>he(false),width:180,estimatedHeight:220,children:[Im.map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${le.priority===U?"active":""}`,onClick:()=>Ce(U),children:U},U)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ce(""),children:"None"})]})]}),g.length>0||k?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Ur,{selectedTags:le.tags||[],availableTags:g,onChange:ve,onCreateTag:k,theme:Ge[T]||Ge.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:mt,children:[jsxRuntime.jsxs("button",{ref:We,className:"modal-v2-field",onClick:()=>we(!tt),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:le.labels&&le.labels.length>0?jsxRuntime.jsx("span",{children:le.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:We,isOpen:tt,onClose:()=>we(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${le.labels?.includes(U)?"active":""}`,onClick:()=>Pe(U),children:[U,le.labels?.includes(U)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},U))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ht(!st),setTimeout(()=>Ie.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:le.endDate?new Date(le.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Ie,type:"date",value:typeof le.endDate=="string"?le.endDate.split("T")[0]:le.endDate?(()=>{let U=new Date(le.endDate),ce=U.getUTCFullYear(),Se=String(U.getUTCMonth()+1).padStart(2,"0"),Ut=String(U.getUTCDate()).padStart(2,"0");return `${ce}-${Se}-${Ut}`})():"",onChange:Ne,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ze(!Bt),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:le.estimatedTime?`${le.estimatedTime}h`:"Not set"})]}),Bt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:le.estimatedTime||"",onChange:U=>se(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ze(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),P?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:le.description||"",onChange:U=>{if(w){let ce={...w,description:U.target.value};B(ce);}},onBlur:Q,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:le.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:at(le.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"}),X.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Tt,"/",X.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ae(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:[X.map(U=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Le(U.id),children:U.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:U.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>$e(U.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},U.id)),ke&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Fe,onChange:U=>z(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Re(),U.key==="Escape"&&(Ae(false),z(""));},onBlur:Re,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(A||N.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx($a,{cardId:le.id,attachments:N,onUpload:A?U=>A(le.id,U):void 0,onDelete:v,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="all"?"active":""}`,onClick:()=>K("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>K("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>K("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:be,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:U=>W(U.target.value),onKeyDown:q,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:V,disabled:!F.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Ue.map(U=>{let ce=s.find(Ut=>Ut.id===U.userId);if(U.type.includes("COMMENT")){let Ut=l.find(ea=>ea.id===U.metadata?.commentId);return Ut?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ce&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ce.color},children:ce.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ce?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ut.content})]})]},U.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ce?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),Ue.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 Hm({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 ss({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(l=>({...l,average:l.average??e.reduce((c,p)=>c+p.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Hm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((l,c)=>l+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((l,c)=>l+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((l,c)=>l+(c.planned||0),0)})]})]})]})}function Jm({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 is({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=s>0?(s-l)/s*100:0,n=l<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Jm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",fill:n?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:n?"#10B981":"#EF4444"},children:l})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var su={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Wl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function iu({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,c=e+l*Math.cos(-a*(Math.PI/180)),p=t+l*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Hl({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 ls({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,n)=>p+n.value,0),l=e.map(p=>({...p,totalValue:s,color:p.color||su[p.name]||Wl[e.indexOf(p)%Wl.length]})),c=l.map(p=>p.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?iu:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Hl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Hl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((p,n)=>n.value>p.value?n:p).name})]})]})]})}var Ho=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let x=e.map(y=>y.id),f=y=>{r.onBulkUpdate?.(x,{priority:y}),c(false);},g=y=>{r.onBulkMove?.(x,y),n(false),a();},k=y=>{r.onBulkUpdate?.(x,{assignedUserIds:y}),d(false);},h=y=>{let D=new Set;e.forEach(A=>{A.labels?.forEach(v=>D.add(v));});let N=Array.from(new Set([...D,...y]));r.onBulkUpdate?.(x,{labels:N}),u(false);},b=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(y=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(y),children:[jsxRuntime.jsx("span",{className:C("asakaa-priority-dot",y==="LOW"&&"bg-asakaa-priority-low",y==="MEDIUM"&&"bg-asakaa-priority-medium",y==="HIGH"&&"bg-asakaa-priority-high",y==="URGENT"&&"bg-asakaa-priority-urgent")}),y]},y))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(y=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(y.id),children:y.title},y.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(y=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k([y.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:y.color},children:y.initials}),y.name]},y.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(y=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([y]),children:y},y))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:b,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"})})]})]})})});Ho.displayName="BulkOperationsToolbar";function mu(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,c,p,n;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let x=a?.find(f=>f.id===u);l=`assignee-${u}`,c=x?.name||`User ${u}`,p=x?.color,n=x?.avatar,r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",c="Unassigned",p="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",l=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,p=i.color,r.has(l)||r.set(l,{id:l,title:c,groupValue:s,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,c=u,p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);}):(l="label-none",c="No Labels",p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ds({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=react.useState(new Set),c=react.useMemo(()=>mu(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{l(m=>{let d=new Set(m);return d.has(n)?d.delete(n):d.add(n),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Qa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:C("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),d=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&p(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Qa,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var cs=[{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 ps({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null),c=cs.find(n=>n.value===e)||cs[0];react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:C("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:C("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:cs.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:C("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:n.label}),e===n.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:n.description})]})]},n.value))})]})]})}var co=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function fu(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&l&&c&&p}function Kl(e={}){let{shortcuts:t=co,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let l=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(n=>n.action!==p);},[]);return react.useEffect(()=>{function p(n){if(!s.current)return;let m=n.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let d of o.current)if(fu(n,d)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:l,unregisterShortcut:c,isEnabled:a}}function bu(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function yu(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 vu(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=yu(e),r=t?bu(t):"";return a?`${a} + ${r}`:r}function xu(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 ms({shortcuts:e=co,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let l=xu(e);return jsxRuntime.jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(l).map(([c,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:vu(n)})]},n.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var us=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
72
72
  1.
73
73
 
74
74
  **Expected behavior:**
@@ -108,7 +108,7 @@
108
108
  1.
109
109
 
110
110
  **Action items:**
111
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function gs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},p=e.reduce((n,m)=>{let d=m.category||"Other";return n[d]||(n[d]=[]),n[d].push(m),n},{});return jsxRuntime.jsxs("div",{className:C("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:C("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(p).map(([n,m])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsxRuntime.jsx("div",{children:m.map(d=>jsxRuntime.jsxs("button",{onClick:()=>c(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},n)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function hs({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[l,c]=react.useState("export"),[p,n]=react.useState("json"),[m,d]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,g=await _i(e,p,f);Vi(g,p);},x=async f=>{let g=f.target.files?.[0];if(g){try{let k=await Yi(g),h=g.name.endsWith(".json")?"json":"csv",b=Ki(k,h);d(b),b.success&&r&&r(b,k);}catch(k){d({success:false,errors:[`Failed to read file: ${k instanceof Error?k.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:C("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:C("flex-1 px-6 py-4 font-semibold transition-colors",l==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[l==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(f=>jsxRuntime.jsxs("button",{onClick:()=>n(f),className:C("p-4 rounded-lg border-2 transition-all text-center",p===f?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),l==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxRuntime.jsxs("div",{className:C("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:C("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((f,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},g))})]})]})]})]})]})}var Du=["URGENT","HIGH","MEDIUM","LOW"],Nu=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Su=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function bs({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:l,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:d=true,compact:i=false,groupBy:u="none",onGroupByChange:x}){let[f,g]=react.useState(true),k=react.useCallback(N=>{a({search:N.target.value});},[a]),h=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),b=react.useCallback(N=>{r({by:N.target.value});},[r]),y=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!f&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:k,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:N=>{let A=N.target.value;a({priorities:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Du.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let A=N.target.value;a({assignees:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let A=N.target.value;a({labels:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:b,className:"filter-bar__select filter-bar__select--sm",children:Nu.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:N=>x(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Su.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ys({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:l,onExportGanttPNG:c,onExportGanttCSV:p}){let[n,m]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=x=>{d.current&&!d.current.contains(x.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:C("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),n&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>i(()=>p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var vs={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},xs={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ks={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},yr={dark:vs,light:xs,neutral:ks},_o="dark";var Vo=react.createContext(void 0),Ou="asakaa-theme";function Xl({children:e,defaultTheme:t=_o,storageKey:a=Ou}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=yr[r];Object.entries(p.colors).forEach(([m,d])=>{d&&c.style.setProperty(`--theme-${zu(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let i=p.colors[m];i&&c.style.setProperty(d,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:s,themes:yr};return jsxRuntime.jsx(Vo.Provider,{value:l,children:e})}function Gr(){let e=react.useContext(Vo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function zu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ws({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Gr();return e?jsxRuntime.jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(yr).map(([s,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:C("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Jl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ge[e]||Ge.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,l)=>a.getPropertyValue(s).trim()||l;return {bgPrimary:r("--theme-bg-primary",Ge[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ge[e].bgSecondary),bgGrid:r("--theme-bg-card",Ge[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ge[e].bgWeekend),border:r("--theme-border-primary",Ge[e].border),borderLight:r("--theme-border-subtle",Ge[e].borderLight),textPrimary:r("--theme-text-primary",Ge[e].textPrimary),textSecondary:r("--theme-text-secondary",Ge[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ge[e].textTertiary),accent:r("--theme-accent-primary",Ge[e].accent),accentHover:r("--theme-accent-hover",Ge[e].accentHover),accentLight:r("--theme-accent-primary",Ge[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ge[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ge[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ge[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ge[e].dependency),dependencyHover:r("--theme-border-secondary",Ge[e].dependencyHover),criticalPath:r("--theme-error",Ge[e].criticalPath),criticalPathLight:r("--theme-error",Ge[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ge[e].today):e==="neutral"?r("--theme-text-primary",Ge[e].today):r("--theme-error",Ge[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ge[e].todayLight):e==="neutral"?r("--theme-text-primary",Ge[e].todayLight):r("--theme-error",Ge[e].todayLight),milestone:r("--theme-warning",Ge[e].milestone),milestoneLight:r("--theme-warning",Ge[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ge[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ge[e].statusInProgress),statusCompleted:r("--theme-success",Ge[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ge[e].hoverBg),focusRing:r("--theme-accent-primary",Ge[e].focusRing)}}var jo={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Zl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Cs={en:jo,es:Zl};function Ql(e){return Cs[e]||Cs.en}function Ts(e,t){let a=Ql(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var Vr=react.createContext(jo);function po(){return react.useContext(Vr)}function tg({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:l}){let[c,p]=react.useState(false),[n,m]=react.useState(null),d=react.useRef(null),i=po();if(react.useEffect(()=>{let g=k=>{d.current&&!d.current.contains(k.target)&&p(false);};return c&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]),!(t||a||r||o||s||l))return null;let x=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(g=>g.handler),f=async(g,k)=>{if(k){m(g);try{await k();}catch(h){console.error(`Export ${g} failed:`,h);}finally{m(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:x.map((g,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(g.id,g.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:k<x.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function ag({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let l=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function rg({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function og({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=po();react.useEffect(()=>{let n=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],p=c.find(n=>n.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.density||"Density"}: ${p}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((n,m)=>{let d=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:n.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Ko({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:l,rowDensity:c,onRowDensityChange:p,showThemeSelector:n=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:i,onExportPNG:u,onExportPDF:x,onExportExcel:f,onExportCSV:g,onExportJSON:k,onExportMSProject:h}){let b=po(),y=u||x||f||g||k||h,D=[{value:"day",label:b.toolbar.day},{value:"week",label:b.toolbar.week},{value:"month",label:b.toolbar.month}],N=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(rg,{options:D,value:t,onChange:A=>a(A),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(og,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||b.toolbar.createTask})]}),(y||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(tg,{theme:e,onExportPNG:u,onExportPDF:x,onExportExcel:f,onExportCSV:g,onExportJSON:k,onExportMSProject:h}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(ag,{options:N,value:s,onChange:A=>l(A),theme:e})]})]})}function Yo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,l]=react.useState({x:0,y:0}),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let n=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();l({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(rt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function jr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let l=react.useRef(null),[c,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,i=8,u=window.innerWidth,x=window.innerHeight,f=t,g=a;t+m+i>u&&(f=t-m,f<i&&(f=i)),a+d+i>x&&(g=x-d-i,g<i&&(g=i)),p({x:f,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=i=>{l.current&&!l.current.contains(i.target)&&o();},d=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let n=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var wt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function md({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:l,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:i=true}){let u=react.useRef(false),x=react.useCallback(b=>{u.current=b;},[]),f=react.useCallback(b=>{let y=[],D=N=>{for(let A of N)y.push(A),A.subtasks&&A.subtasks.length>0&&A.isExpanded&&D(A.subtasks);};return D(b),y},[]),g=react.useCallback(()=>{let b=f(e);for(let y of b)if(t.has(y.id))return y;return null},[e,t,f]),k=react.useCallback((b,y)=>{let D=f(e);if(D.length===0)return;let N=g();if(!N){a(D[0].id,false);return}let A=D.findIndex(T=>T.id===N.id);if(A===-1)return;let v=b==="up"?A-1:A+1;if(v<0||v>=D.length)return;let R=D[v];a(R.id,y);},[e,g,f,a]),h=react.useCallback(b=>{if(!i)return;let y=b.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||u.current){b.key==="Escape"&&(y.blur(),u.current=false);return}let A=navigator.platform.toUpperCase().indexOf("MAC")>=0?b.metaKey:b.ctrlKey,v=Array.from(t),R=g();if(b.key==="ArrowUp"){b.preventDefault(),k("up",b.shiftKey);return}if(b.key==="ArrowDown"){b.preventDefault(),k("down",b.shiftKey);return}if(R&&(b.key==="ArrowRight"||b.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(b.preventDefault(),(b.key==="ArrowRight"&&!R.isExpanded||b.key==="ArrowLeft"&&R.isExpanded)&&m(R.id));return}if(b.altKey&&(b.key==="ArrowUp"||b.key==="ArrowDown")){v.length>0&&(b.preventDefault(),l(v,b.key==="ArrowUp"?"up":"down"));return}if(b.key==="Tab"&&!b.shiftKey){v.length>0&&(b.preventDefault(),c(v));return}if(b.key==="Tab"&&b.shiftKey){v.length>0&&(b.preventDefault(),p(v));return}if(b.key==="Enter"&&!b.shiftKey&&!A){R&&(b.preventDefault(),r(R.id,"below"));return}if(b.key==="Enter"&&b.shiftKey&&!A){R&&(b.preventDefault(),r(R.id,"above"));return}if(b.key==="Enter"&&A){R&&(b.preventDefault(),d(R.id));return}if(b.key==="F2"){R&&(b.preventDefault(),n(R.id));return}if(b.key==="Delete"||b.key==="Backspace"&&A){v.length>0&&(b.preventDefault(),o(v));return}if(b.key==="d"&&A&&!b.shiftKey){v.length>0&&(b.preventDefault(),s(v));return}},[i,t,g,k,r,o,s,l,c,p,n,m,d]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[i,h]),{setIsEditing:x}}function gd(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(i=>{let u=new Set(i);return u.has(d)?u.delete(d):u.add(d),u}),r(d);},[]),l=react.useCallback((d,i)=>{if(!a){o(d);return}let u=i.indexOf(a),x=i.indexOf(d);if(u===-1||x===-1){o(d);return}let f=Math.min(u,x),g=Math.max(u,x),k=i.slice(f,g+1);t(new Set(k)),r(d);},[a,o]),c=react.useCallback((d,i,u,x)=>{x?l(d,i):u?s(d):o(d);},[o,s,l]),p=react.useCallback((d,i)=>{i?t(u=>{let x=new Set(u);return x.add(d),x}):o(d);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function Kr(e){let t=[],a=(r,o,s=0)=>{for(let l=0;l<r.length;l++){let c={...r[l],parentId:o,level:s,position:l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function fd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=fd(a.subtasks,t);if(r)return r}}return null}function Ss(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ss(a.subtasks,t);if(r)return r}return null}function Es(e,t){if(t.length===0)return e;let a=Kr(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],l=(d,i)=>{let u=[];return {tasks:d.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let g=l(f.subtasks,i);f.subtasks=g.tasks,u.push(...g.removed);}return true}),removed:u}},c=(d,i,u)=>d.map(x=>x.id===i?{...x,subtasks:[...x.subtasks||[],...u],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,i,u)}:x),p=new Set(t),{tasks:n,removed:m}=l(e,p);return c(n,s.id,m)}function Ps(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ss(a,r);if(!o)continue;let s=Ss(a,o.id),l=(n,m,d)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===m&&u.subtasks){let x=u.subtasks.findIndex(f=>f.id===d);if(x!==-1){let[f]=u.subtasks.splice(x,1);return f}}if(u.subtasks){let x=l(u.subtasks,m,d);if(x)return x}}return null},c=(n,m,d)=>{let i=n.findIndex(u=>u.id===m);if(i!==-1)return n.splice(i+1,0,d),n;for(let u of n)u.subtasks&&c(u.subtasks,m,d);return n},p=l(a,o.id,r);p&&(s&&s.subtasks?c(s.subtasks,o.id,p):c(a,o.id,p));}return a}function Ms(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(l,c,p)=>{let n=l.findIndex(d=>d.id===c);if(n===-1){for(let d of l)if(d.subtasks&&s(d.subtasks,c,p))return true;return false}let m=p==="up"?n-1:n+1;return m<0||m>=l.length?false:([l[n],l[m]]=[l[m],l[n]],true)};return s(r,o,a),r}function As(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Is(e,t){let a=[...e];for(let r of t){let o=l=>{let c=l.findIndex(m=>m.id===r);if(c===-1){for(let m of l)if(m.subtasks&&o(m.subtasks))return true;return false}let p=l[c],n={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return l.splice(c+1,0,n),true},s=l=>l.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function hd(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=p=>{let n=p.findIndex(d=>d.id===t);if(n===-1){for(let d of p)if(d.subtasks&&c(d.subtasks))return true;return false}let m=a==="above"?n:n+1;return p.splice(m,0,l),true};return c(r),{tasks:r,newTask:l}}function Ls(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ls(r.subtasks,t,a)}:r)}function Fs(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Fs(a.subtasks,t)}:a)}function Bs(e,t){let a=m=>{for(let d of m){if(d.id===t)return d;if(d.subtasks){let i=a(d.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l=r?.startDate||o,c=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(c),color:r?.color||"#3B82F6"},n=m=>m.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,p],isExpanded:true}}return d.subtasks?{...d,subtasks:n(d.subtasks)}:d});return {tasks:n(e),newTask:p}}function bd(e,t,a,r){if(t===a)return e;let o=fd(e,t);if(!o)return e;if(a){let c=(p,n)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===n||c(m,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),l=s(e);if(a===null){let c=r!==void 0?r:l.length;l.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(n=>{if(n.id===a){let m=n.subtasks||[],d=r!==void 0?r:m.length,i=[...m];return i.splice(d,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});l=c(l);}return l}function Jo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:l,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:d,onColumnResize:i,onTaskUpdate:u,onTaskIndent:x,onTaskOutdent:f,onTaskMove:g,onMultiTaskDelete:k,onTaskDuplicate:h,onTaskCreate:b,onTaskRename:y,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:A,onTaskReparent:v}){let R=react.useContext(Vr),[T,w]=react.useState(null),[B,P]=react.useState(false),[H,X]=react.useState(null),[ye,ke]=react.useState(""),Ae=react.useRef(null),Fe=react.useRef(null),[z,F]=react.useState(null),[W,E]=react.useState(0),[K,ae]=react.useState(0),[O,Me]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[he,qe]=react.useState(null),[me,tt]=react.useState(null),[we,st]=react.useState(null),ht=react.useRef(0),Bt=5,Xe=react.useRef(false),[$,ne]=react.useState(null),[be,Te]=react.useState(false),[De,Ye]=react.useState(null);react.useEffect(()=>{function _(q){Ae.current&&!Ae.current.contains(q.target)&&P(false);}if(B)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[B]),react.useEffect(()=>{H&&Fe.current&&(Fe.current.focus(),Fe.current.select());},[H]),react.useEffect(()=>{if(!z)return;let _=at=>{let Ue=at.clientX-W,le=K+Ue;i?.(z,le);},q=()=>{F(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect="";}},[z,W,K,i]);let{selectedTaskIds:mt,handleTaskClick:Ie,isTaskSelected:I}=gd(),{setIsEditing:Y}=md({tasks:e,selectedTaskIds:mt,onTaskSelect:(_,q)=>{let Ue=Kr(e).map(le=>le.id);Ie(_,Ue,q||false,false);},onTaskCreate:b||(()=>{}),onTaskDelete:k||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:_=>{let q=Kr(e).find(at=>at.id===_);q&&Q(q);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:_=>{let q=Kr(e).find(at=>at.id===_);q&&N&&N(q);},enableKeyboard:true}),He=(_,q=0)=>{let at=[];for(let Ue of _)at.push({task:Ue,level:q}),Ue.subtasks&&Ue.subtasks.length>0&&Ue.isExpanded&&at.push(...He(Ue.subtasks,q+1));return at},We=He(e),bt=48,J=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,Q=_=>{X(_.id),ke(_.name),Y(true);},xe=_=>{ye.trim()&&ye!==e.find(q=>q.id===_)?.name&&y?.(_,ye.trim()),X(null),ke(""),Y(false);},Ce=()=>{X(null),ke(""),Y(false);},re=(_,q)=>{q.stopPropagation(),D?.(_.id);},Pe=(_,q)=>{q.preventDefault(),ht.current=q.clientY,qe(_),Xe.current=false,Te(false),ne({x:q.clientX,y:q.clientY});},ve=_=>{if(!he||(Math.abs(_.clientY-ht.current)>Bt&&!Xe.current&&(Xe.current=true,Te(true)),ne({x:_.clientX,y:_.clientY}),!Xe.current))return;let at=document.querySelectorAll("[data-task-row]"),Ue=null,le=null;at.forEach(Je=>{let Tt=Je.getBoundingClientRect(),U=Je.getAttribute("data-task-row");if(U&&U!==he&&_.clientY>=Tt.top&&_.clientY<=Tt.bottom){Ue=U;let ce=_.clientY-Tt.top,Se=Tt.height;ce<Se*.25?le="above":ce>Se*.75?le="below":le="child";}}),tt(Ue),st(le);},Ne=()=>{if(Xe.current&&he&&me&&we){if(we==="child")v?.(he,me);else if(we==="above"||we==="below"){let _=(Ue,le,Je=null)=>{for(let Tt of Ue){if(Tt.id===le)return Je;if(Tt.subtasks){let U=_(Tt.subtasks,le,Tt.id);if(U!==void 0)return U}}},q=_(e,me,null),at=(Ue,le)=>{let Je=Ue.findIndex(Tt=>Tt.id===le);return we==="below"?Je+1:Je};if(q===null){let Ue=at(e,me);v?.(he,null,Ue);}else {let Ue=We.find(le=>le.task.id===q)?.task;if(Ue?.subtasks){let le=at(Ue.subtasks,me);v?.(he,q,le);}}}}qe(null),tt(null),st(null),ne(null),Xe.current=false,Te(false);};react.useEffect(()=>{if(he)return document.addEventListener("mousemove",ve),document.addEventListener("mouseup",Ne),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",Ne),document.body.style.cursor="",document.body.style.userSelect="";}},[he,me,we]);let se=(_,q,at)=>{switch(_.id){case "name":let Ue=H===q.id,le=T===q.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${at*20}px`},children:[v&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:le?1:.3},onMouseDown:de=>Pe(q.id,de),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),q.subtasks&&q.subtasks.length>0?jsxRuntime.jsx("button",{onClick:de=>{de.stopPropagation(),p?.(q.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:q.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:q.color||"#3B82F6",opacity:q.parentId?.6:1,borderColor:q.isMilestone?t.accent:"transparent",borderWidth:q.isMilestone?"2px":"0px"},title:q.isMilestone?"Milestone":q.parentId?"Subtask":"Task"})}),Ue?jsxRuntime.jsx("input",{ref:Fe,type:"text",value:ye,onChange:de=>ke(de.target.value),onKeyDown:de=>{de.key==="Enter"?xe(q.id):de.key==="Escape"&&Ce();},onBlur:()=>xe(q.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:de=>de.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:q.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:q.parentId?"13px":"14px",fontWeight:q.isMilestone?600:q.parentId?400:600,letterSpacing:q.parentId?"0":"-0.01em"},title:q.name,children:q.name}),le&&!Ue&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:de=>re(q,de),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:de=>{de.stopPropagation(),Q(q);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Tt=_.id==="startDate"?"startDate":"endDate",U=q[Tt],ce=De?.taskId===q.id&&De?.field===Tt,Se=de=>de?(typeof de=="string"?new Date(de):de).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:de=>{if(ce)Ye(null);else {let Dt=de.currentTarget.getBoundingClientRect();Ye({taskId:q.id,field:Tt,month:U?typeof U=="string"?new Date(U):U:new Date,position:{top:Dt.bottom+4,left:Dt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Se(U)})]}),ce&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ye(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:De?.position.top,left:De?.position.left},onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let de=new Date,Dt=new Date(de);Dt.setDate(de.getDate()+1);let Jt=new Date(de);Jt.setDate(de.getDate()+7);let Mr=new Date(de);return Mr.setDate(de.getDate()+14),[{label:"Hoy",date:de},{label:"Ma\xF1ana",date:Dt},{label:"Pr\xF3xima semana",date:Jt},{label:"2 semanas",date:Mr}].map((Ir,Ha)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:lr=>lr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:lr=>lr.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(q.id,{[Tt]:Ir.date}),Ye(null);},children:Ir.label},Ha))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:de=>de.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:de=>de.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(q.id,{[Tt]:void 0}),Ye(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>Ye(de=>de?{...de,month:new Date(de.month.getFullYear(),de.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:De?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ye(de=>de?{...de,month:new Date(de.month.getFullYear(),de.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((de,Dt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:de},Dt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let de=De?.month||new Date,Dt=de.getFullYear(),Jt=de.getMonth(),Mr=new Date(Dt,Jt,1).getDay(),Ar=new Date(Dt,Jt+1,0).getDate(),Ir=new Date,Ha=[];for(let Nt=Mr-1;Nt>=0;Nt--)Ha.push({day:new Date(Dt,Jt,-Nt).getDate(),date:new Date(Dt,Jt-1,new Date(Dt,Jt,-Nt).getDate()),isCurrentMonth:false});for(let Nt=1;Nt<=Ar;Nt++)Ha.push({day:Nt,date:new Date(Dt,Jt,Nt),isCurrentMonth:true});let lr=42-Ha.length;for(let Nt=1;Nt<=lr;Nt++)Ha.push({day:Nt,date:new Date(Dt,Jt+1,Nt),isCurrentMonth:false});return Ha.map((Nt,Pn)=>{let Mn=Nt.date.toDateString()===Ir.toDateString(),Lr=(U?typeof U=="string"?new Date(U):U:null)?.toDateString()===Nt.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:Nt.isCurrentMonth?Lr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Lr?"#3B82F6":"transparent",boxShadow:Mn&&!Lr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(q.id,{[Tt]:Nt.date}),Ye(null);},children:Nt.day},Pn)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:J(q)})});case "assignees":let Ut=r.filter(de=>q.assignees?.some(Dt=>Dt.name===de.name||Dt.initials===de.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(ur,{assignedUsers:Ut,availableUsers:r,onChange:de=>{let Dt=de.map(Jt=>({id:Jt.id,name:Jt.name,initials:Jt.initials,color:Jt.color}));u?.(q.id,{assignees:Dt.length>0?Dt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(ul,{status:q.status||"todo",onChange:de=>{u?.(q.id,{status:de,progress:de==="completed"?100:q.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${q.progress}%`,backgroundColor:q.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[q.progress,"%"]})]});case "priority":let ea={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},qa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ra=ea[q.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(pr,{priority:Ra,onChange:de=>{de&&u?.(q.id,{priority:qa[de]||"medium"});}})});default:return null}},Re=_=>[{id:"hide",label:"Hide Column",icon:wt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:wt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:wt.SortDesc,onClick:()=>{}}],Le=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:wt.Add,onClick:()=>{D?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:wt.Delete,onClick:()=>{A?A(_.id,_.name):k?.([_.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:wt.Pencil,onClick:()=>{l?.(_);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:wt.Add,onClick:()=>{D?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:wt.MarkIncomplete,onClick:()=>{u?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:wt.SetInProgress,onClick:()=>{u?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:wt.MarkComplete,onClick:()=>{u?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:wt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:wt.Delete,onClick:()=>{A?A(_.id,_.name):k?.([_.id]);}}],$e=m.filter(_=>_.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${bt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[$e.map((_,q)=>{let at=q===$e.length-1,Ue=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ue?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(Ue?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:at?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:le=>{le.preventDefault(),Me({isOpen:true,x:le.clientX,y:le.clientY,type:"header",columnId:_.id});},onMouseEnter:le=>{le.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:le=>{le.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:Ue?"70px":"0"},title:_.label,children:_.label}),Ue&&jsxRuntime.jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsxRuntime.jsx(Yo,{columns:m,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>P(!B),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:z===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:le=>{le.preventDefault(),le.stopPropagation(),F(_.id),E(le.clientX),ae(_.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},_.id)}),B&&jsxRuntime.jsxs("div",{ref:Ae,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>P(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:We.map(({task:_,level:q},at)=>{let Ue=I(_.id),le=me===_.id,Je=le&&we==="above",Tt=le&&we==="below",U=le&&we==="child",ce={};return U&&(ce.backgroundColor=`${t.accent}15`,ce.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${he===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ue?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ue?t.accentLight:U?`${t.accent}15`:at%2===0?t.bgPrimary:t.bgGrid,...ce},onMouseEnter:()=>w(_.id),onMouseLeave:()=>w(null),onClick:Se=>{let ea=Kr(e).map(de=>de.id),Ra=navigator.platform.toUpperCase().indexOf("MAC")>=0?Se.metaKey:Se.ctrlKey;Ie(_.id,ea,Ra,Se.shiftKey),s?.(_);},onDoubleClick:Se=>{Se.stopPropagation(),l?.(_);},onContextMenu:Se=>{Se.preventDefault(),Me({isOpen:true,x:Se.clientX,y:Se.clientY,type:"task",task:_}),c?.(_,Se);},whileHover:{backgroundColor:Ue?t.accentLight:t.hoverBg},children:[Je&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Tt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),$e.map((Se,Ut)=>{let ea=Ut===$e.length-1,qa=Se.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${qa?"justify-start":"justify-center"}`,style:{width:`${Se.width}px`,minWidth:`${Se.minWidth??(qa?200:60)}px`,maxWidth:`${Se.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ea?"none":`1px solid ${T===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:se(Se,_,qa?q:0)},`${_.id}-${Se.id}`)})]},_.id)})}),jsxRuntime.jsx(jr,{isOpen:O.isOpen,x:O.x,y:O.y,items:O.type==="header"&&O.columnId?Re(O.columnId):O.type==="task"&&O.task?Le(O.task):[],onClose:()=>Me({...O,isOpen:false}),theme:t}),be&&$&&he&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:$.x+12,top:$.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=We.find(q=>q.task.id===he)?.task;return _?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:_.name})}):null})()}),document.body)]})}function wd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[l,c]=react.useState(e),[p,n]=react.useState(t),[m,d]=react.useState(null),[i,u]=react.useState(null),[x,f]=react.useState(null),[g,k]=react.useState(null),[h,b]=react.useState(0),[y,D]=react.useState(0),[N,A]=react.useState(null),[v,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:l,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:u,activeZone:x,setActiveZone:f,draggedSegmentIndex:g,setDraggedSegmentIndex:k,draggedSegmentStartX:h,setDraggedSegmentStartX:b,segmentDragOffsetX:y,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:A,isHovered:v,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,X)=>{r("none"),d(null),u(null),c(H),n(X),D(0),k(null),b(0);}}}function Zo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:l,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:x,onHoverChange:f}){let g=wd(t,r),k=react.useRef(null),{dragMode:h,setDragMode:b,dragOffset:y,setDragOffset:D,ghostX:N,setGhostX:A,ghostWidth:v,setGhostWidth:R,connectionLine:T,setConnectionLine:w,hoveredTaskId:B,setHoveredTaskId:P,activeZone:H,setActiveZone:X,draggedSegmentIndex:ye,setDraggedSegmentIndex:ke,draggedSegmentStartX:Ae,setDraggedSegmentStartX:Fe,segmentDragOffsetX:z,setSegmentDragOffsetX:F,hoveredSegmentIndex:W,setHoveredSegmentIndex:E,isHovered:K,setIsHovered:ae,isDragging:O,isResizing:Me,isConnecting:he,resetDragState:qe}=g,me=32,tt=8,we=e.endDate&&e.endDate<new Date&&e.progress<100,st=e.isCriticalPath,ht=o.name==="neutral"||o.today==="#1C1917",Bt=e.status==="completed"||e.progress===100,Xe={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ne=e.isCriticalPath||we?"#DC2626":e.color?e.color:e.priority&&Xe[e.priority]?Xe[e.priority]:o.taskBarPrimary,Te=(re=>re>=80?20:re>=60?15:re>=50?12:10)(r),De=r<50,Ye=r<40;react.useEffect(()=>{if(f)if(K&&!O&&!e.segments){let re=a<100;f({task:e,x:t,y:a,width:r,height:me,showBelow:re});}else f(null);},[K,O,e,t,a,r,me,f]);let mt=re=>re.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ie=()=>{let re=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${re} day${re!==1?"s":""}`},I=re=>Math.round(re/s)*s,Y=re=>{let Pe=Math.round(re/s),ve=new Date(l);return ve.setDate(ve.getDate()+Pe),ve},He=(re,Pe)=>{for(let ve of u){if(ve.id===e.id)continue;let Ne=5;if(re>=ve.x-Ne&&re<=ve.x+ve.width+Ne&&Pe>=ve.y-Ne&&Pe<=ve.y+ve.height+Ne)return ve.id}return null},We=react.useCallback((re,Pe,ve)=>{re.preventDefault(),re.stopPropagation();let Ne=k.current?.ownerSVGElement;if(!Ne)return;let se=Ne.createSVGPoint();se.x=re.clientX,se.y=re.clientY;let Re=se.matrixTransform(Ne.getScreenCTM()?.inverse()),Le=ve!==void 0?ve:t,$e=Pe;if(!$e){let _=Re.x-Le;re.shiftKey?($e="connect",w({x:t+r,y:a+me/2})):re.ctrlKey||re.metaKey?$e="move":re.altKey?$e=_<r/2?"resize-start":"resize-end":Ye?_<r/2?$e="move":$e="resize-end":De?_<=Te/2?$e="resize-start":_>=r-Te/2?$e="resize-end":$e="move":_<=Te?$e="resize-start":_>=r-Te?$e="resize-end":$e="move";}b($e),ae(false),X(null),$e==="move"?D(Re.x-Le):$e==="connect"?w({x:t+r,y:a+me/2}):D(0),A(Le),R(r);},[t,r,a,me]),bt=react.useCallback(re=>{if(h==="none")return;let Pe=k.current?.ownerSVGElement;if(!Pe)return;let ve=Pe.createSVGPoint();ve.x=re.clientX,ve.y=re.clientY;let Ne=ve.matrixTransform(Pe.getScreenCTM()?.inverse());if(h==="connect"){w({x:Ne.x,y:Ne.y});let se=He(Ne.x,Ne.y);P(se);}else if(h==="move"){let se=Ne.x-y,Re=I(se);A(Re),R(r);let Le=Math.round((Re-t)/s);if(x?.(e.id,Le,true),e.segments&&e.segments.length>0&&ye!==null){let $e=Re-Ae;F($e);}}else if(h==="resize-start"){let se=Ne.x,Re=I(se),Le=t+r-Re;Le>=s&&(A(Re),R(Le));}else if(h==="resize-end"){let se=Ne.x,Le=I(se)-t;Le>=s&&R(Le);}},[h,t,r,s,y,e,I,ye,Ae,He,P,w,A,R,F,x]),J=react.useCallback(()=>{if(h!=="none"){if(h==="connect")B&&i&&i(e,B),w(null),P(null);else {let re=e.endDate.getTime()-e.startDate.getTime(),Pe,ve,Ne=true;if(h==="move"){if(Pe=Y(N),ve=new Date(Pe.getTime()+re),e.segments&&e.segments.length>0&&ye!==null){let se=Math.round(z/s),Re=e.segments.map((q,at)=>{if(at===ye){let Ue=new Date(q.startDate),le=new Date(q.endDate);return Ue.setDate(Ue.getDate()+se),le.setDate(le.getDate()+se),{startDate:Ue,endDate:le}}return q}),Le=Re.flatMap(q=>[q.startDate,q.endDate]),$e=new Date(Math.min(...Le.map(q=>q.getTime()))),_=new Date(Math.max(...Le.map(q=>q.getTime())));d?.({...e,segments:Re},$e,_),qe(t,r);return}}else h==="resize-start"?(Pe=Y(N),ve=e.endDate,Pe>ve&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ne=false)):h==="resize-end"?(Pe=e.startDate,ve=Y(N+v),ve<Pe&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ne=false)):Ne=false;Ne&&Pe&&ve&&(ve.getTime()<Pe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,Pe,ve));}x?.(e.id,0,false),qe(t,r);}},[h,N,v,e,d,B,i,t,r,s,Y,z,ye,qe,x]);react.useEffect(()=>{if(h==="none")return;let re=ve=>{bt(ve);},Pe=()=>{J();};return window.addEventListener("mousemove",re),window.addEventListener("mouseup",Pe),()=>{window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",Pe);}},[h,bt,J]);let Q=O&&!he?N:t,xe=O&&!he?v:r,Ce=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,onMouseEnter:()=>!O&&ae(true),onMouseLeave:()=>{O||(ae(false),X(null));},onClick:()=>!O&&p?.(e),onDoubleClick:re=>{O||(re.stopPropagation(),n?.(e));},onContextMenu:re=>{re.preventDefault(),m?.(e,re);},children:[K&&!O&&!De&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Te,height:me,fill:H==="resize-start"?o.accent:"transparent",opacity:H==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-start"),onMouseDown:re=>We(re,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Te,y:a,width:r-Te*2,height:me,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>X("move"),onMouseDown:re=>We(re,"move")}),jsxRuntime.jsx("rect",{x:t+r-Te,y:a,width:Te,height:me,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-end"),onMouseDown:re=>We(re,"resize-end")})]}),K&&!O&&Ye&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:me,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>X("move"),onMouseDown:re=>We(re,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:me,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-end"),onMouseDown:re=>We(re,"resize-end")}),K&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+me-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),O&&!he&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:N,y:a,width:v,height:me,rx:tt,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q,y:a,width:xe,height:me,rx:tt,fill:ne,"data-task-class":Ce,initial:{opacity:0,scale:.95},animate:{opacity:O&&!he?.15:e.parentId?.6:K?.9:.8,scale:K&&!O?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:re=>We(re),style:{cursor:O?he?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe*(e.progress/100),height:me,rx:tt,fill:ne,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((re,Pe)=>{let ve=(re.startDate.getTime()-l.getTime())/864e5*s,se=(re.endDate.getTime()-l.getTime())/(1e3*60*60*24)*s-ve+s,Re=O&&h==="move"&&ye===Pe,Le=W===Pe,$e=Re?ve+z:ve;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!O&&E(Pe),onMouseLeave:()=>!O&&E(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:$e,y:a,width:se,height:me,rx:tt,fill:ne,initial:{opacity:0,scale:.95},animate:{opacity:Re||e.parentId?.6:Le?.9:.8,scale:Le&&!O?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_=>{_.stopPropagation(),ke(Pe),Fe(ve),We(_,void 0,ve);},style:{cursor:O?he?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:$e,y:a,width:se*(e.progress/100),height:me,rx:tt,fill:ne,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Pe}`)}),ht&&(we||st)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[st&&!we&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe,height:me,rx:tt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),we&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe,height:me,rx:tt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),xe>60&&!e.segments&&(()=>{let re=c.taskLabel(e),Pe=typeof re=="string"?re:e.name,ve=Pe.length>Math.floor(xe/8)?`${Pe.substring(0,Math.floor(xe/8))}...`:Pe;return jsxRuntime.jsx("text",{x:Q+12,y:a+me/2,dominantBaseline:"middle",fill:Bt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Bt?"line-through":"none"},children:ve})})(),xe>100&&e.progress>0&&e.progress<100&&!O&&!e.segments&&jsxRuntime.jsxs("text",{x:Q+xe-12,y:a+me/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&xe>80&&!O&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Q+xe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Q+xe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(K||Me)&&!he&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:De?Q-15:Q-10,y:a-5,width:De?25:20,height:me+10,fill:"transparent",onMouseDown:re=>We(re,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:De?Q-8:Q-3,y:a+6,width:De?8:6,height:De?me-12:me-16,rx:3,fill:h==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:h==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Q+xe-10,y:a-5,width:De?25:20,height:me+10,fill:"transparent",onMouseDown:re=>We(re,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:De?Q+xe:Q+xe-3,y:a+6,width:De?8:6,height:De?me-12:me-16,rx:3,fill:h==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:h==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&!O&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+me/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:re=>{re.stopPropagation(),We(re,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+me/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),he&&T&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+me/2,x2:T.x,y2:T.y,stroke:B?o.statusCompleted:o.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:T.x,cy:T.y,r:B?8:6,fill:B?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsxRuntime.jsx(framerMotion.motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(K||O)&&!he&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q-2,y:a-2,width:xe+4,height:me+4,rx:tt+2,fill:"none",stroke:O?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:O?.6:.4,initial:{opacity:0},animate:{opacity:O?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:N,y1:0,x2:N,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:N+v,y1:0,x2:N+v,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&!O&&!e.segments&&!f&&(()=>{let ve=a<100,Ne=ve?a+me+13:a-82-13,se=ve?`M ${Q+xe/2-6} ${a+me+3} L ${Q+xe/2} ${a+me+13} L ${Q+xe/2+6} ${a+me+3}`:`M ${Q+xe/2-6} ${a-13} L ${Q+xe/2} ${a-3} L ${Q+xe/2+6} ${a-13}`,Re=Ne+22,Le=Ne+40,$e=Ne+55,_=Ne+70,q=ve?Ne+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ve?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ve?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:se,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Q+xe/2-120,y:Ne,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Q+xe/2,y:Re,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Q+xe/2-110,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Q+xe/2-70,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.startDate)}),jsxRuntime.jsx("text",{x:Q+xe/2-110,y:$e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Q+xe/2-70,y:$e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.endDate)}),jsxRuntime.jsx("text",{x:Q+xe/2+10,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Q+xe/2+65,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ie()}),jsxRuntime.jsx("text",{x:Q+xe/2+10,y:$e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Q+xe/2+65,y:$e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Q+xe/2-110,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Q+xe/2-50,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(at=>at.name).join(", ").substring(0,30),e.assignees.map(at=>at.name).join(", ").length>30?"...":""]})]}),!ve&&jsxRuntime.jsx("text",{x:Q+xe/2,y:q,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ye?"Left: move \u2022 Right: resize":De?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Dd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:l,showBelow:c}=e,p=82,n=13,m=c?o+l+n:o-p-n,d=c?`M ${r+s/2-6} ${o+l+3} L ${r+s/2} ${o+l+13} L ${r+s/2+6} ${o+l+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=m+22,u=m+40,x=m+55,f=m+70,g=y=>y.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),k=()=>{if(!a.startDate||!a.endDate)return "N/A";let y=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${y} day${y!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:m,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:k()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(y=>y.name).join(", ").substring(0,30),a.assignees.map(y=>y.name).join(", ").length>30?"...":""]})]})]})})}function tn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:l}){let[c,p]=react.useState(false),n=a-e,m=r-t,d=e+n/2,i=`M ${e} ${t} C ${d} ${t}, ${d} ${r}, ${a} ${r}`,u=6,x=Math.atan2(m,n),f=a-u*Math.cos(x-Math.PI/6),g=r-u*Math.sin(x-Math.PI/6),k=a-u*Math.cos(x+Math.PI/6),h=r-u*Math.sin(x+Math.PI/6),b=o.dependency;react.useEffect(()=>{l&&s&&l(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,l]);let y=!s&&!l;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!y&&p(true),onMouseLeave:()=>!y&&p(false),style:{pointerEvents:y?"none":"auto"},children:[!y&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:b,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&l?0:c?1:.8,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${f} ${g} M ${a} ${r} L ${k} ${h}`,fill:"none",stroke:b,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&l?0:c?1:.8,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:b,initial:{scale:0},animate:{scale:c&&l?0:c?1.3:1,opacity:c&&l?0:c?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!l&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:D=>{D.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:d,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:d-4,y1:(t+r)/2-4,x2:d+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:d+4,y1:(t+r)/2-4,x2:d-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function rn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,l]=react.useState(false),c=16,p=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:p(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var ie={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=n=>{n.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let l=new Set,c=new Set,p=n=>{if(!l.has(n)){l.add(n),c.add(n);let m=r.get(n)||[];for(let d of m){if(!l.has(d)&&p(d))return true;if(c.has(d))return true}}return c.delete(n),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ie.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ie.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ie.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=ie.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
111
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function gs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},p=e.reduce((n,m)=>{let d=m.category||"Other";return n[d]||(n[d]=[]),n[d].push(m),n},{});return jsxRuntime.jsxs("div",{className:C("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:C("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(p).map(([n,m])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsxRuntime.jsx("div",{children:m.map(d=>jsxRuntime.jsxs("button",{onClick:()=>c(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},n)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function hs({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[l,c]=react.useState("export"),[p,n]=react.useState("json"),[m,d]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,g=await _i(e,p,f);Vi(g,p);},x=async f=>{let g=f.target.files?.[0];if(g){try{let k=await Yi(g),h=g.name.endsWith(".json")?"json":"csv",b=Ki(k,h);d(b),b.success&&r&&r(b,k);}catch(k){d({success:false,errors:[`Failed to read file: ${k instanceof Error?k.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:C("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:C("flex-1 px-6 py-4 font-semibold transition-colors",l==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[l==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(f=>jsxRuntime.jsxs("button",{onClick:()=>n(f),className:C("p-4 rounded-lg border-2 transition-all text-center",p===f?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),l==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxRuntime.jsxs("div",{className:C("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:C("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((f,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},g))})]})]})]})]})]})}var Du=["URGENT","HIGH","MEDIUM","LOW"],Nu=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Su=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function bs({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:l,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:d=true,compact:i=false,groupBy:u="none",onGroupByChange:x}){let[f,g]=react.useState(true),k=react.useCallback(N=>{a({search:N.target.value});},[a]),h=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),b=react.useCallback(N=>{r({by:N.target.value});},[r]),y=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!f&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:k,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:N=>{let A=N.target.value;a({priorities:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Du.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let A=N.target.value;a({assignees:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let A=N.target.value;a({labels:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:b,className:"filter-bar__select filter-bar__select--sm",children:Nu.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:N=>x(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Su.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ys({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:l,onExportGanttPNG:c,onExportGanttCSV:p}){let[n,m]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=x=>{d.current&&!d.current.contains(x.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:C("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),n&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>i(()=>p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var vs={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},xs={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ks={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},yr={dark:vs,light:xs,neutral:ks},_o="dark";var Vo=react.createContext(void 0),Ou="asakaa-theme";function Xl({children:e,defaultTheme:t=_o,storageKey:a=Ou}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=yr[r];Object.entries(p.colors).forEach(([m,d])=>{d&&c.style.setProperty(`--theme-${zu(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let i=p.colors[m];i&&c.style.setProperty(d,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:s,themes:yr};return jsxRuntime.jsx(Vo.Provider,{value:l,children:e})}function Gr(){let e=react.useContext(Vo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function zu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ws({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Gr();return e?jsxRuntime.jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(yr).map(([s,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:C("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Jl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ge[e]||Ge.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,l)=>a.getPropertyValue(s).trim()||l;return {bgPrimary:r("--theme-bg-primary",Ge[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ge[e].bgSecondary),bgGrid:r("--theme-bg-card",Ge[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ge[e].bgWeekend),border:r("--theme-border-primary",Ge[e].border),borderLight:r("--theme-border-subtle",Ge[e].borderLight),textPrimary:r("--theme-text-primary",Ge[e].textPrimary),textSecondary:r("--theme-text-secondary",Ge[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ge[e].textTertiary),accent:r("--theme-accent-primary",Ge[e].accent),accentHover:r("--theme-accent-hover",Ge[e].accentHover),accentLight:r("--theme-accent-primary",Ge[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ge[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ge[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ge[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ge[e].dependency),dependencyHover:r("--theme-border-secondary",Ge[e].dependencyHover),criticalPath:r("--theme-error",Ge[e].criticalPath),criticalPathLight:r("--theme-error",Ge[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ge[e].today):e==="neutral"?r("--theme-text-primary",Ge[e].today):r("--theme-error",Ge[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ge[e].todayLight):e==="neutral"?r("--theme-text-primary",Ge[e].todayLight):r("--theme-error",Ge[e].todayLight),milestone:r("--theme-warning",Ge[e].milestone),milestoneLight:r("--theme-warning",Ge[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ge[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ge[e].statusInProgress),statusCompleted:r("--theme-success",Ge[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ge[e].hoverBg),focusRing:r("--theme-accent-primary",Ge[e].focusRing)}}var jo={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Zl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Cs={en:jo,es:Zl};function Ql(e){return Cs[e]||Cs.en}function Ts(e,t){let a=Ql(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var Vr=react.createContext(jo);function po(){return react.useContext(Vr)}function tg({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:l}){let[c,p]=react.useState(false),[n,m]=react.useState(null),d=react.useRef(null),i=po();if(react.useEffect(()=>{let g=k=>{d.current&&!d.current.contains(k.target)&&p(false);};return c&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]),!(t||a||r||o||s||l))return null;let x=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(g=>g.handler),f=async(g,k)=>{if(k){m(g);try{await k();}catch(h){console.error(`Export ${g} failed:`,h);}finally{m(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:x.map((g,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(g.id,g.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:k<x.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function ag({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let l=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function rg({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function og({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=po();react.useEffect(()=>{let n=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],p=c.find(n=>n.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.density||"Density"}: ${p}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((n,m)=>{let d=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:n.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Ko({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:l,rowDensity:c,onRowDensityChange:p,showThemeSelector:n=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:i,onExportPNG:u,onExportPDF:x,onExportExcel:f,onExportCSV:g,onExportJSON:k,onExportMSProject:h}){let b=po(),y=u||x||f||g||k||h,D=[{value:"day",label:b.toolbar.day},{value:"week",label:b.toolbar.week},{value:"month",label:b.toolbar.month}],N=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(rg,{options:D,value:t,onChange:A=>a(A),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(og,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||b.toolbar.createTask})]}),(y||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(tg,{theme:e,onExportPNG:u,onExportPDF:x,onExportExcel:f,onExportCSV:g,onExportJSON:k,onExportMSProject:h}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(ag,{options:N,value:s,onChange:A=>l(A),theme:e})]})]})}function Yo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,l]=react.useState({x:0,y:0}),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let n=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();l({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(rt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function jr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let l=react.useRef(null),[c,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,i=8,u=window.innerWidth,x=window.innerHeight,f=t,g=a;t+m+i>u&&(f=t-m,f<i&&(f=i)),a+d+i>x&&(g=x-d-i,g<i&&(g=i)),p({x:f,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=i=>{l.current&&!l.current.contains(i.target)&&o();},d=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let n=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var wt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function md({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:l,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:i=true}){let u=react.useRef(false),x=react.useCallback(b=>{u.current=b;},[]),f=react.useCallback(b=>{let y=[],D=N=>{for(let A of N)y.push(A),A.subtasks&&A.subtasks.length>0&&A.isExpanded&&D(A.subtasks);};return D(b),y},[]),g=react.useCallback(()=>{let b=f(e);for(let y of b)if(t.has(y.id))return y;return null},[e,t,f]),k=react.useCallback((b,y)=>{let D=f(e);if(D.length===0)return;let N=g();if(!N){a(D[0].id,false);return}let A=D.findIndex(T=>T.id===N.id);if(A===-1)return;let v=b==="up"?A-1:A+1;if(v<0||v>=D.length)return;let R=D[v];a(R.id,y);},[e,g,f,a]),h=react.useCallback(b=>{if(!i)return;let y=b.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||u.current){b.key==="Escape"&&(y.blur(),u.current=false);return}let A=navigator.platform.toUpperCase().indexOf("MAC")>=0?b.metaKey:b.ctrlKey,v=Array.from(t),R=g();if(b.key==="ArrowUp"){b.preventDefault(),k("up",b.shiftKey);return}if(b.key==="ArrowDown"){b.preventDefault(),k("down",b.shiftKey);return}if(R&&(b.key==="ArrowRight"||b.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(b.preventDefault(),(b.key==="ArrowRight"&&!R.isExpanded||b.key==="ArrowLeft"&&R.isExpanded)&&m(R.id));return}if(b.altKey&&(b.key==="ArrowUp"||b.key==="ArrowDown")){v.length>0&&(b.preventDefault(),l(v,b.key==="ArrowUp"?"up":"down"));return}if(b.key==="Tab"&&!b.shiftKey){v.length>0&&(b.preventDefault(),c(v));return}if(b.key==="Tab"&&b.shiftKey){v.length>0&&(b.preventDefault(),p(v));return}if(b.key==="Enter"&&!b.shiftKey&&!A){R&&(b.preventDefault(),r(R.id,"below"));return}if(b.key==="Enter"&&b.shiftKey&&!A){R&&(b.preventDefault(),r(R.id,"above"));return}if(b.key==="Enter"&&A){R&&(b.preventDefault(),d(R.id));return}if(b.key==="F2"){R&&(b.preventDefault(),n(R.id));return}if(b.key==="Delete"||b.key==="Backspace"&&A){v.length>0&&(b.preventDefault(),o(v));return}if(b.key==="d"&&A&&!b.shiftKey){v.length>0&&(b.preventDefault(),s(v));return}},[i,t,g,k,r,o,s,l,c,p,n,m,d]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[i,h]),{setIsEditing:x}}function gd(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(i=>{let u=new Set(i);return u.has(d)?u.delete(d):u.add(d),u}),r(d);},[]),l=react.useCallback((d,i)=>{if(!a){o(d);return}let u=i.indexOf(a),x=i.indexOf(d);if(u===-1||x===-1){o(d);return}let f=Math.min(u,x),g=Math.max(u,x),k=i.slice(f,g+1);t(new Set(k)),r(d);},[a,o]),c=react.useCallback((d,i,u,x)=>{x?l(d,i):u?s(d):o(d);},[o,s,l]),p=react.useCallback((d,i)=>{i?t(u=>{let x=new Set(u);return x.add(d),x}):o(d);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function Kr(e){let t=[],a=(r,o,s=0)=>{for(let l=0;l<r.length;l++){let c={...r[l],parentId:o,level:s,position:l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function fd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=fd(a.subtasks,t);if(r)return r}}return null}function Ss(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ss(a.subtasks,t);if(r)return r}return null}function Es(e,t){if(t.length===0)return e;let a=Kr(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],l=(d,i)=>{let u=[];return {tasks:d.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let g=l(f.subtasks,i);f.subtasks=g.tasks,u.push(...g.removed);}return true}),removed:u}},c=(d,i,u)=>d.map(x=>x.id===i?{...x,subtasks:[...x.subtasks||[],...u],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,i,u)}:x),p=new Set(t),{tasks:n,removed:m}=l(e,p);return c(n,s.id,m)}function Ps(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ss(a,r);if(!o)continue;let s=Ss(a,o.id),l=(n,m,d)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===m&&u.subtasks){let x=u.subtasks.findIndex(f=>f.id===d);if(x!==-1){let[f]=u.subtasks.splice(x,1);return f}}if(u.subtasks){let x=l(u.subtasks,m,d);if(x)return x}}return null},c=(n,m,d)=>{let i=n.findIndex(u=>u.id===m);if(i!==-1)return n.splice(i+1,0,d),n;for(let u of n)u.subtasks&&c(u.subtasks,m,d);return n},p=l(a,o.id,r);p&&(s&&s.subtasks?c(s.subtasks,o.id,p):c(a,o.id,p));}return a}function Ms(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(l,c,p)=>{let n=l.findIndex(d=>d.id===c);if(n===-1){for(let d of l)if(d.subtasks&&s(d.subtasks,c,p))return true;return false}let m=p==="up"?n-1:n+1;return m<0||m>=l.length?false:([l[n],l[m]]=[l[m],l[n]],true)};return s(r,o,a),r}function As(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Is(e,t){let a=[...e];for(let r of t){let o=l=>{let c=l.findIndex(m=>m.id===r);if(c===-1){for(let m of l)if(m.subtasks&&o(m.subtasks))return true;return false}let p=l[c],n={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return l.splice(c+1,0,n),true},s=l=>l.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function hd(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=p=>{let n=p.findIndex(d=>d.id===t);if(n===-1){for(let d of p)if(d.subtasks&&c(d.subtasks))return true;return false}let m=a==="above"?n:n+1;return p.splice(m,0,l),true};return c(r),{tasks:r,newTask:l}}function Ls(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ls(r.subtasks,t,a)}:r)}function Fs(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Fs(a.subtasks,t)}:a)}function Bs(e,t){let a=m=>{for(let d of m){if(d.id===t)return d;if(d.subtasks){let i=a(d.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l=r?.startDate||o,c=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(c),color:r?.color||"#3B82F6"},n=m=>m.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,p],isExpanded:true}}return d.subtasks?{...d,subtasks:n(d.subtasks)}:d});return {tasks:n(e),newTask:p}}function bd(e,t,a,r){if(t===a)return e;let o=fd(e,t);if(!o)return e;if(a){let c=(p,n)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===n||c(m,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),l=s(e);if(a===null){let c=r!==void 0?r:l.length;l.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(n=>{if(n.id===a){let m=n.subtasks||[],d=r!==void 0?r:m.length,i=[...m];return i.splice(d,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});l=c(l);}return l}function Jo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:l,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:d,onColumnResize:i,onTaskUpdate:u,onTaskIndent:x,onTaskOutdent:f,onTaskMove:g,onMultiTaskDelete:k,onTaskDuplicate:h,onTaskCreate:b,onTaskRename:y,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:A,onTaskReparent:v}){let R=react.useContext(Vr),[T,w]=react.useState(null),[B,P]=react.useState(false),[H,X]=react.useState(null),[ye,ke]=react.useState(""),Ae=react.useRef(null),Fe=react.useRef(null),[z,F]=react.useState(null),[W,E]=react.useState(0),[K,ae]=react.useState(0),[O,Me]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[he,qe]=react.useState(null),[me,tt]=react.useState(null),[we,st]=react.useState(null),ht=react.useRef(0),Bt=5,Ze=react.useRef(false),[$,ne]=react.useState(null),[be,Te]=react.useState(false),[De,Ye]=react.useState(null);react.useEffect(()=>{function V(q){Ae.current&&!Ae.current.contains(q.target)&&P(false);}if(B)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[B]),react.useEffect(()=>{H&&Fe.current&&(Fe.current.focus(),Fe.current.select());},[H]),react.useEffect(()=>{if(!z)return;let V=at=>{let Ue=at.clientX-W,le=K+Ue;i?.(z,le);},q=()=>{F(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect="";}},[z,W,K,i]);let{selectedTaskIds:mt,handleTaskClick:Ie,isTaskSelected:I}=gd(),{setIsEditing:Y}=md({tasks:e,selectedTaskIds:mt,onTaskSelect:(V,q)=>{let Ue=Kr(e).map(le=>le.id);Ie(V,Ue,q||false,false);},onTaskCreate:b||(()=>{}),onTaskDelete:k||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:V=>{let q=Kr(e).find(at=>at.id===V);q&&Q(q);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:V=>{let q=Kr(e).find(at=>at.id===V);q&&N&&N(q);},enableKeyboard:true}),He=(V,q=0)=>{let at=[];for(let Ue of V)at.push({task:Ue,level:q}),Ue.subtasks&&Ue.subtasks.length>0&&Ue.isExpanded&&at.push(...He(Ue.subtasks,q+1));return at},We=He(e),bt=48,J=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,Q=V=>{X(V.id),ke(V.name),Y(true);},xe=V=>{ye.trim()&&ye!==e.find(q=>q.id===V)?.name&&y?.(V,ye.trim()),X(null),ke(""),Y(false);},Ce=()=>{X(null),ke(""),Y(false);},re=(V,q)=>{q.stopPropagation(),D?.(V.id);},Pe=(V,q)=>{q.preventDefault(),ht.current=q.clientY,qe(V),Ze.current=false,Te(false),ne({x:q.clientX,y:q.clientY});},ve=V=>{if(!he||(Math.abs(V.clientY-ht.current)>Bt&&!Ze.current&&(Ze.current=true,Te(true)),ne({x:V.clientX,y:V.clientY}),!Ze.current))return;let at=document.querySelectorAll("[data-task-row]"),Ue=null,le=null;at.forEach(Xe=>{let Tt=Xe.getBoundingClientRect(),U=Xe.getAttribute("data-task-row");if(U&&U!==he&&V.clientY>=Tt.top&&V.clientY<=Tt.bottom){Ue=U;let ce=V.clientY-Tt.top,Se=Tt.height;ce<Se*.25?le="above":ce>Se*.75?le="below":le="child";}}),tt(Ue),st(le);},Ne=()=>{if(Ze.current&&he&&me&&we){if(we==="child")v?.(he,me);else if(we==="above"||we==="below"){let V=(Ue,le,Xe=null)=>{for(let Tt of Ue){if(Tt.id===le)return Xe;if(Tt.subtasks){let U=V(Tt.subtasks,le,Tt.id);if(U!==void 0)return U}}},q=V(e,me,null),at=(Ue,le)=>{let Xe=Ue.findIndex(Tt=>Tt.id===le);return we==="below"?Xe+1:Xe};if(q===null){let Ue=at(e,me);v?.(he,null,Ue);}else {let Ue=We.find(le=>le.task.id===q)?.task;if(Ue?.subtasks){let le=at(Ue.subtasks,me);v?.(he,q,le);}}}}qe(null),tt(null),st(null),ne(null),Ze.current=false,Te(false);};react.useEffect(()=>{if(he)return document.addEventListener("mousemove",ve),document.addEventListener("mouseup",Ne),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",Ne),document.body.style.cursor="",document.body.style.userSelect="";}},[he,me,we]);let se=(V,q,at)=>{switch(V.id){case "name":let Ue=H===q.id,le=T===q.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${at*20}px`},children:[v&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:le?1:.3},onMouseDown:de=>Pe(q.id,de),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),q.subtasks&&q.subtasks.length>0?jsxRuntime.jsx("button",{onClick:de=>{de.stopPropagation(),p?.(q.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:q.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:q.color||"#3B82F6",opacity:q.parentId?.6:1,borderColor:q.isMilestone?t.accent:"transparent",borderWidth:q.isMilestone?"2px":"0px"},title:q.isMilestone?"Milestone":q.parentId?"Subtask":"Task"})}),Ue?jsxRuntime.jsx("input",{ref:Fe,type:"text",value:ye,onChange:de=>ke(de.target.value),onKeyDown:de=>{de.key==="Enter"?xe(q.id):de.key==="Escape"&&Ce();},onBlur:()=>xe(q.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:de=>de.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:q.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:q.parentId?"13px":"14px",fontWeight:q.isMilestone?600:q.parentId?400:600,letterSpacing:q.parentId?"0":"-0.01em"},title:q.name,children:q.name}),le&&!Ue&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:de=>re(q,de),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:de=>{de.stopPropagation(),Q(q);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Tt=V.id==="startDate"?"startDate":"endDate",U=q[Tt],ce=De?.taskId===q.id&&De?.field===Tt,Se=de=>de?(typeof de=="string"?new Date(de):de).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:de=>{if(ce)Ye(null);else {let Dt=de.currentTarget.getBoundingClientRect();Ye({taskId:q.id,field:Tt,month:U?typeof U=="string"?new Date(U):U:new Date,position:{top:Dt.bottom+4,left:Dt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Se(U)})]}),ce&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ye(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:De?.position.top,left:De?.position.left},onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let de=new Date,Dt=new Date(de);Dt.setDate(de.getDate()+1);let Jt=new Date(de);Jt.setDate(de.getDate()+7);let Mr=new Date(de);return Mr.setDate(de.getDate()+14),[{label:"Hoy",date:de},{label:"Ma\xF1ana",date:Dt},{label:"Pr\xF3xima semana",date:Jt},{label:"2 semanas",date:Mr}].map((Ir,Ha)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:lr=>lr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:lr=>lr.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(q.id,{[Tt]:Ir.date}),Ye(null);},children:Ir.label},Ha))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:de=>de.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:de=>de.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(q.id,{[Tt]:void 0}),Ye(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>Ye(de=>de?{...de,month:new Date(de.month.getFullYear(),de.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:De?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ye(de=>de?{...de,month:new Date(de.month.getFullYear(),de.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((de,Dt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:de},Dt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let de=De?.month||new Date,Dt=de.getFullYear(),Jt=de.getMonth(),Mr=new Date(Dt,Jt,1).getDay(),Ar=new Date(Dt,Jt+1,0).getDate(),Ir=new Date,Ha=[];for(let Nt=Mr-1;Nt>=0;Nt--)Ha.push({day:new Date(Dt,Jt,-Nt).getDate(),date:new Date(Dt,Jt-1,new Date(Dt,Jt,-Nt).getDate()),isCurrentMonth:false});for(let Nt=1;Nt<=Ar;Nt++)Ha.push({day:Nt,date:new Date(Dt,Jt,Nt),isCurrentMonth:true});let lr=42-Ha.length;for(let Nt=1;Nt<=lr;Nt++)Ha.push({day:Nt,date:new Date(Dt,Jt+1,Nt),isCurrentMonth:false});return Ha.map((Nt,Pn)=>{let Mn=Nt.date.toDateString()===Ir.toDateString(),Lr=(U?typeof U=="string"?new Date(U):U:null)?.toDateString()===Nt.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:Nt.isCurrentMonth?Lr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Lr?"#3B82F6":"transparent",boxShadow:Mn&&!Lr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(q.id,{[Tt]:Nt.date}),Ye(null);},children:Nt.day},Pn)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:J(q)})});case "assignees":let Ut=r.filter(de=>q.assignees?.some(Dt=>Dt.name===de.name||Dt.initials===de.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(ur,{assignedUsers:Ut,availableUsers:r,onChange:de=>{let Dt=de.map(Jt=>({id:Jt.id,name:Jt.name,initials:Jt.initials,color:Jt.color}));u?.(q.id,{assignees:Dt.length>0?Dt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(ul,{status:q.status||"todo",onChange:de=>{u?.(q.id,{status:de,progress:de==="completed"?100:q.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${q.progress}%`,backgroundColor:q.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[q.progress,"%"]})]});case "priority":let ea={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},qa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ra=ea[q.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(pr,{priority:Ra,onChange:de=>{de&&u?.(q.id,{priority:qa[de]||"medium"});}})});default:return null}},Re=V=>[{id:"hide",label:"Hide Column",icon:wt.Hide,onClick:()=>d(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:wt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:wt.SortDesc,onClick:()=>{}}],Le=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:wt.Add,onClick:()=>{D?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:wt.Delete,onClick:()=>{A?A(V.id,V.name):k?.([V.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:wt.Pencil,onClick:()=>{l?.(V);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:wt.Add,onClick:()=>{D?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:wt.MarkIncomplete,onClick:()=>{u?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:wt.SetInProgress,onClick:()=>{u?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:wt.MarkComplete,onClick:()=>{u?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:wt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:wt.Delete,onClick:()=>{A?A(V.id,V.name):k?.([V.id]);}}],$e=m.filter(V=>V.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${bt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[$e.map((V,q)=>{let at=q===$e.length-1,Ue=V.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ue?"":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.minWidth??(Ue?200:60)}px`,maxWidth:`${V.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:at?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:le=>{le.preventDefault(),Me({isOpen:true,x:le.clientX,y:le.clientY,type:"header",columnId:V.id});},onMouseEnter:le=>{le.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:le=>{le.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:Ue?"70px":"0"},title:V.label,children:V.label}),Ue&&jsxRuntime.jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsxRuntime.jsx(Yo,{columns:m,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>P(!B),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),V.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:z===V.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:le=>{le.preventDefault(),le.stopPropagation(),F(V.id),E(le.clientX),ae(V.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},V.id)}),B&&jsxRuntime.jsxs("div",{ref:Ae,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:V=>V.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>P(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:We.map(({task:V,level:q},at)=>{let Ue=I(V.id),le=me===V.id,Xe=le&&we==="above",Tt=le&&we==="below",U=le&&we==="child",ce={};return U&&(ce.backgroundColor=`${t.accent}15`,ce.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":V.id,className:`flex items-center cursor-pointer group ${he===V.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ue?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ue?t.accentLight:U?`${t.accent}15`:at%2===0?t.bgPrimary:t.bgGrid,...ce},onMouseEnter:()=>w(V.id),onMouseLeave:()=>w(null),onClick:Se=>{let ea=Kr(e).map(de=>de.id),Ra=navigator.platform.toUpperCase().indexOf("MAC")>=0?Se.metaKey:Se.ctrlKey;Ie(V.id,ea,Ra,Se.shiftKey),s?.(V);},onDoubleClick:Se=>{Se.stopPropagation(),l?.(V);},onContextMenu:Se=>{Se.preventDefault(),Me({isOpen:true,x:Se.clientX,y:Se.clientY,type:"task",task:V}),c?.(V,Se);},whileHover:{backgroundColor:Ue?t.accentLight:t.hoverBg},children:[Xe&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Tt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),$e.map((Se,Ut)=>{let ea=Ut===$e.length-1,qa=Se.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${qa?"justify-start":"justify-center"}`,style:{width:`${Se.width}px`,minWidth:`${Se.minWidth??(qa?200:60)}px`,maxWidth:`${Se.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ea?"none":`1px solid ${T===V.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:se(Se,V,qa?q:0)},`${V.id}-${Se.id}`)})]},V.id)})}),jsxRuntime.jsx(jr,{isOpen:O.isOpen,x:O.x,y:O.y,items:O.type==="header"&&O.columnId?Re(O.columnId):O.type==="task"&&O.task?Le(O.task):[],onClose:()=>Me({...O,isOpen:false}),theme:t}),be&&$&&he&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:$.x+12,top:$.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let V=We.find(q=>q.task.id===he)?.task;return V?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:V.name})}):null})()}),document.body)]})}function wd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[l,c]=react.useState(e),[p,n]=react.useState(t),[m,d]=react.useState(null),[i,u]=react.useState(null),[x,f]=react.useState(null),[g,k]=react.useState(null),[h,b]=react.useState(0),[y,D]=react.useState(0),[N,A]=react.useState(null),[v,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:l,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:u,activeZone:x,setActiveZone:f,draggedSegmentIndex:g,setDraggedSegmentIndex:k,draggedSegmentStartX:h,setDraggedSegmentStartX:b,segmentDragOffsetX:y,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:A,isHovered:v,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,X)=>{r("none"),d(null),u(null),c(H),n(X),D(0),k(null),b(0);}}}function Zo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:l,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:x,onHoverChange:f}){let g=wd(t,r),k=react.useRef(null),{dragMode:h,setDragMode:b,dragOffset:y,setDragOffset:D,ghostX:N,setGhostX:A,ghostWidth:v,setGhostWidth:R,connectionLine:T,setConnectionLine:w,hoveredTaskId:B,setHoveredTaskId:P,activeZone:H,setActiveZone:X,draggedSegmentIndex:ye,setDraggedSegmentIndex:ke,draggedSegmentStartX:Ae,setDraggedSegmentStartX:Fe,segmentDragOffsetX:z,setSegmentDragOffsetX:F,hoveredSegmentIndex:W,setHoveredSegmentIndex:E,isHovered:K,setIsHovered:ae,isDragging:O,isResizing:Me,isConnecting:he,resetDragState:qe}=g,me=32,tt=8,we=e.endDate&&e.endDate<new Date&&e.progress<100,st=e.isCriticalPath,ht=o.name==="neutral"||o.today==="#1C1917",Bt=e.status==="completed"||e.progress===100,Ze={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ne=e.isCriticalPath||we?"#DC2626":e.color?e.color:e.priority&&Ze[e.priority]?Ze[e.priority]:o.taskBarPrimary,Te=(re=>re>=80?20:re>=60?15:re>=50?12:10)(r),De=r<50,Ye=r<40;react.useEffect(()=>{if(f)if(K&&!O&&!e.segments){let re=a<100;f({task:e,x:t,y:a,width:r,height:me,showBelow:re});}else f(null);},[K,O,e,t,a,r,me,f]);let mt=re=>re.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ie=()=>{let re=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${re} day${re!==1?"s":""}`},I=re=>Math.round(re/s)*s,Y=re=>{let Pe=Math.round(re/s),ve=new Date(l);return ve.setDate(ve.getDate()+Pe),ve},He=(re,Pe)=>{for(let ve of u){if(ve.id===e.id)continue;let Ne=5;if(re>=ve.x-Ne&&re<=ve.x+ve.width+Ne&&Pe>=ve.y-Ne&&Pe<=ve.y+ve.height+Ne)return ve.id}return null},We=react.useCallback((re,Pe,ve)=>{re.preventDefault(),re.stopPropagation();let Ne=k.current?.ownerSVGElement;if(!Ne)return;let se=Ne.createSVGPoint();se.x=re.clientX,se.y=re.clientY;let Re=se.matrixTransform(Ne.getScreenCTM()?.inverse()),Le=ve!==void 0?ve:t,$e=Pe;if(!$e){let V=Re.x-Le;re.shiftKey?($e="connect",w({x:t+r,y:a+me/2})):re.ctrlKey||re.metaKey?$e="move":re.altKey?$e=V<r/2?"resize-start":"resize-end":Ye?V<r/2?$e="move":$e="resize-end":De?V<=Te/2?$e="resize-start":V>=r-Te/2?$e="resize-end":$e="move":V<=Te?$e="resize-start":V>=r-Te?$e="resize-end":$e="move";}b($e),ae(false),X(null),$e==="move"?D(Re.x-Le):$e==="connect"?w({x:t+r,y:a+me/2}):D(0),A(Le),R(r);},[t,r,a,me]),bt=react.useCallback(re=>{if(h==="none")return;let Pe=k.current?.ownerSVGElement;if(!Pe)return;let ve=Pe.createSVGPoint();ve.x=re.clientX,ve.y=re.clientY;let Ne=ve.matrixTransform(Pe.getScreenCTM()?.inverse());if(h==="connect"){w({x:Ne.x,y:Ne.y});let se=He(Ne.x,Ne.y);P(se);}else if(h==="move"){let se=Ne.x-y,Re=I(se);A(Re),R(r);let Le=Math.round((Re-t)/s);if(x?.(e.id,Le,true),e.segments&&e.segments.length>0&&ye!==null){let $e=Re-Ae;F($e);}}else if(h==="resize-start"){let se=Ne.x,Re=I(se),Le=t+r-Re;Le>=s&&(A(Re),R(Le));}else if(h==="resize-end"){let se=Ne.x,Le=I(se)-t;Le>=s&&R(Le);}},[h,t,r,s,y,e,I,ye,Ae,He,P,w,A,R,F,x]),J=react.useCallback(()=>{if(h!=="none"){if(h==="connect")B&&i&&i(e,B),w(null),P(null);else {let re=e.endDate.getTime()-e.startDate.getTime(),Pe,ve,Ne=true;if(h==="move"){if(Pe=Y(N),ve=new Date(Pe.getTime()+re),e.segments&&e.segments.length>0&&ye!==null){let se=Math.round(z/s),Re=e.segments.map((q,at)=>{if(at===ye){let Ue=new Date(q.startDate),le=new Date(q.endDate);return Ue.setDate(Ue.getDate()+se),le.setDate(le.getDate()+se),{startDate:Ue,endDate:le}}return q}),Le=Re.flatMap(q=>[q.startDate,q.endDate]),$e=new Date(Math.min(...Le.map(q=>q.getTime()))),V=new Date(Math.max(...Le.map(q=>q.getTime())));d?.({...e,segments:Re},$e,V),qe(t,r);return}}else h==="resize-start"?(Pe=Y(N),ve=e.endDate,Pe>ve&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ne=false)):h==="resize-end"?(Pe=e.startDate,ve=Y(N+v),ve<Pe&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ne=false)):Ne=false;Ne&&Pe&&ve&&(ve.getTime()<Pe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,Pe,ve));}x?.(e.id,0,false),qe(t,r);}},[h,N,v,e,d,B,i,t,r,s,Y,z,ye,qe,x]);react.useEffect(()=>{if(h==="none")return;let re=ve=>{bt(ve);},Pe=()=>{J();};return window.addEventListener("mousemove",re),window.addEventListener("mouseup",Pe),()=>{window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",Pe);}},[h,bt,J]);let Q=O&&!he?N:t,xe=O&&!he?v:r,Ce=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,onMouseEnter:()=>!O&&ae(true),onMouseLeave:()=>{O||(ae(false),X(null));},onClick:()=>!O&&p?.(e),onDoubleClick:re=>{O||(re.stopPropagation(),n?.(e));},onContextMenu:re=>{re.preventDefault(),m?.(e,re);},children:[K&&!O&&!De&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Te,height:me,fill:H==="resize-start"?o.accent:"transparent",opacity:H==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-start"),onMouseDown:re=>We(re,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Te,y:a,width:r-Te*2,height:me,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>X("move"),onMouseDown:re=>We(re,"move")}),jsxRuntime.jsx("rect",{x:t+r-Te,y:a,width:Te,height:me,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-end"),onMouseDown:re=>We(re,"resize-end")})]}),K&&!O&&Ye&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:me,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>X("move"),onMouseDown:re=>We(re,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:me,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-end"),onMouseDown:re=>We(re,"resize-end")}),K&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+me-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),O&&!he&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:N,y:a,width:v,height:me,rx:tt,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q,y:a,width:xe,height:me,rx:tt,fill:ne,"data-task-class":Ce,initial:{opacity:0,scale:.95},animate:{opacity:O&&!he?.15:e.parentId?.6:K?.9:.8,scale:K&&!O?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:re=>We(re),style:{cursor:O?he?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe*(e.progress/100),height:me,rx:tt,fill:ne,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((re,Pe)=>{let ve=(re.startDate.getTime()-l.getTime())/864e5*s,se=(re.endDate.getTime()-l.getTime())/(1e3*60*60*24)*s-ve+s,Re=O&&h==="move"&&ye===Pe,Le=W===Pe,$e=Re?ve+z:ve;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!O&&E(Pe),onMouseLeave:()=>!O&&E(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:$e,y:a,width:se,height:me,rx:tt,fill:ne,initial:{opacity:0,scale:.95},animate:{opacity:Re||e.parentId?.6:Le?.9:.8,scale:Le&&!O?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V=>{V.stopPropagation(),ke(Pe),Fe(ve),We(V,void 0,ve);},style:{cursor:O?he?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:$e,y:a,width:se*(e.progress/100),height:me,rx:tt,fill:ne,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Pe}`)}),ht&&(we||st)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[st&&!we&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe,height:me,rx:tt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),we&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe,height:me,rx:tt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),xe>60&&!e.segments&&(()=>{let re=c.taskLabel(e),Pe=typeof re=="string"?re:e.name,ve=Pe.length>Math.floor(xe/8)?`${Pe.substring(0,Math.floor(xe/8))}...`:Pe;return jsxRuntime.jsx("text",{x:Q+12,y:a+me/2,dominantBaseline:"middle",fill:Bt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Bt?"line-through":"none"},children:ve})})(),xe>100&&e.progress>0&&e.progress<100&&!O&&!e.segments&&jsxRuntime.jsxs("text",{x:Q+xe-12,y:a+me/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&xe>80&&!O&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Q+xe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Q+xe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(K||Me)&&!he&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:De?Q-15:Q-10,y:a-5,width:De?25:20,height:me+10,fill:"transparent",onMouseDown:re=>We(re,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:De?Q-8:Q-3,y:a+6,width:De?8:6,height:De?me-12:me-16,rx:3,fill:h==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:h==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Q+xe-10,y:a-5,width:De?25:20,height:me+10,fill:"transparent",onMouseDown:re=>We(re,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:De?Q+xe:Q+xe-3,y:a+6,width:De?8:6,height:De?me-12:me-16,rx:3,fill:h==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:h==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&!O&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+me/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:re=>{re.stopPropagation(),We(re,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+me/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),he&&T&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+me/2,x2:T.x,y2:T.y,stroke:B?o.statusCompleted:o.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:T.x,cy:T.y,r:B?8:6,fill:B?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsxRuntime.jsx(framerMotion.motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(K||O)&&!he&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q-2,y:a-2,width:xe+4,height:me+4,rx:tt+2,fill:"none",stroke:O?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:O?.6:.4,initial:{opacity:0},animate:{opacity:O?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:N,y1:0,x2:N,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:N+v,y1:0,x2:N+v,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&!O&&!e.segments&&!f&&(()=>{let ve=a<100,Ne=ve?a+me+13:a-82-13,se=ve?`M ${Q+xe/2-6} ${a+me+3} L ${Q+xe/2} ${a+me+13} L ${Q+xe/2+6} ${a+me+3}`:`M ${Q+xe/2-6} ${a-13} L ${Q+xe/2} ${a-3} L ${Q+xe/2+6} ${a-13}`,Re=Ne+22,Le=Ne+40,$e=Ne+55,V=Ne+70,q=ve?Ne+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ve?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ve?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:se,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Q+xe/2-120,y:Ne,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Q+xe/2,y:Re,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Q+xe/2-110,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Q+xe/2-70,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.startDate)}),jsxRuntime.jsx("text",{x:Q+xe/2-110,y:$e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Q+xe/2-70,y:$e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.endDate)}),jsxRuntime.jsx("text",{x:Q+xe/2+10,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Q+xe/2+65,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ie()}),jsxRuntime.jsx("text",{x:Q+xe/2+10,y:$e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Q+xe/2+65,y:$e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Q+xe/2-110,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Q+xe/2-50,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(at=>at.name).join(", ").substring(0,30),e.assignees.map(at=>at.name).join(", ").length>30?"...":""]})]}),!ve&&jsxRuntime.jsx("text",{x:Q+xe/2,y:q,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ye?"Left: move \u2022 Right: resize":De?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Dd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:l,showBelow:c}=e,p=82,n=13,m=c?o+l+n:o-p-n,d=c?`M ${r+s/2-6} ${o+l+3} L ${r+s/2} ${o+l+13} L ${r+s/2+6} ${o+l+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=m+22,u=m+40,x=m+55,f=m+70,g=y=>y.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),k=()=>{if(!a.startDate||!a.endDate)return "N/A";let y=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${y} day${y!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:m,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:k()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(y=>y.name).join(", ").substring(0,30),a.assignees.map(y=>y.name).join(", ").length>30?"...":""]})]})]})})}function tn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:l}){let[c,p]=react.useState(false),n=a-e,m=r-t,d=e+n/2,i=`M ${e} ${t} C ${d} ${t}, ${d} ${r}, ${a} ${r}`,u=6,x=Math.atan2(m,n),f=a-u*Math.cos(x-Math.PI/6),g=r-u*Math.sin(x-Math.PI/6),k=a-u*Math.cos(x+Math.PI/6),h=r-u*Math.sin(x+Math.PI/6),b=o.dependency;react.useEffect(()=>{l&&s&&l(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,l]);let y=!s&&!l;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!y&&p(true),onMouseLeave:()=>!y&&p(false),style:{pointerEvents:y?"none":"auto"},children:[!y&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:b,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&l?0:c?1:.8,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${f} ${g} M ${a} ${r} L ${k} ${h}`,fill:"none",stroke:b,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&l?0:c?1:.8,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:b,initial:{scale:0},animate:{scale:c&&l?0:c?1.3:1,opacity:c&&l?0:c?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!l&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:D=>{D.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:d,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:d-4,y1:(t+r)/2-4,x2:d+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:d+4,y1:(t+r)/2-4,x2:d-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function rn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,l]=react.useState(false),c=16,p=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:p(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var ie={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=n=>{n.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let l=new Set,c=new Set,p=n=>{if(!l.has(n)){l.add(n),c.add(n);let m=r.get(n)||[];for(let d of m){if(!l.has(d)&&p(d))return true;if(c.has(d))return true}}return c.delete(n),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ie.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ie.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ie.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=ie.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
112
112
  `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=ie.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=ie.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>ie.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ie.findTaskById(e,t);return !a||!a.dependencies?[]:ie.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ie.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ie.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=ie.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>ie.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=ie.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let l=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(p=>{let n=p.startDate&&p.endDate?ie.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?ie.formatDate(p.startDate):"N/A",p.endDate?ie.formatDate(p.endDate):"N/A",n>0?`${n} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:l,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ie.flattenTasks(e).map(p=>{let n=p.startDate&&p.endDate?ie.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?ie.formatDate(p.startDate):"","End Date":p.endDate?ie.formatDate(p.endDate):"","Duration (days)":n>0?n:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(m=>m.name).join(", ")||"",Dependencies:p.dependencies?.join(", ")||"","Is Milestone":p.isMilestone?"Yes":"No","Parent ID":p.parentId||"",Level:p.level||0}}),s=a.utils.json_to_sheet(o),l=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=l;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ie.flattenTasks(e),o=new Map;r.forEach((i,u)=>{o.set(i.id,u+1);});let s=i=>i.toISOString().replace("Z",""),l=ie.getEarliestStartDate(e)||new Date,c=ie.getLatestEndDate(e)||new Date,p=r.map((i,u)=>{let x=o.get(i.id),f=i.startDate&&i.endDate?ie.calculateDuration(i.startDate,i.endDate):0,g=(i.dependencies||[]).filter(k=>o.has(k)).map(k=>`
113
113
  <PredecessorLink>
114
114
  <PredecessorUID>${o.get(k)}</PredecessorUID>
@@ -339,9 +339,9 @@
339
339
  </Calendars>
340
340
  <Tasks>${p}
341
341
  </Tasks>
342
- </Project>`,m=new Blob([n],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ie.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let m=n.startDate&&n.endDate?ie.calculateDuration(n.startDate,n.endDate):0,d=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let x=t.find(f=>f.id===u);if(x){o(x);let f=r.get(u)?.ef||0;d=Math.max(d,f);}}let i=d+m;r.set(n.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),l=new Map,c=n=>{if(l.has(n.id))return;let m=n.startDate&&n.endDate?ie.calculateDuration(n.startDate,n.endDate):0,d=t.filter(x=>x.dependencies&&x.dependencies.includes(n.id)),i=s;if(d.length>0)for(let x of d){c(x);let f=l.get(x.id)?.ls||0;i=Math.min(i,f);}let u=i-m;l.set(n.id,{ls:u,lf:i});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),d=l.get(n.id);if(m&&d){let i=d.ls-m.es;Math.abs(i)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=ie.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ie.calculateCriticalPath(e).includes(t))return 0;let o=ie.getDependentTasks(e,t);if(o.length===0){let c=ie.getLatestEndDate(e);if(!c)return null;let p=ie.calculateDuration(a.endDate,c);return Math.max(0,p)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!s)return null;let l=ie.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>ie.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ie.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ie.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let c=ie.calculateDuration(l.startDate,l.endDate),p;a!==void 0?(p=new Date(l.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let n=ie.calculateEndDate(p,c),m=d=>d.map(i=>i.id===l.id?{...i,startDate:p,endDate:n}:i.subtasks?{...i,subtasks:m(i.subtasks)}:i);s=m(s),s=ie.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,c)=>{if(a===0)return [];let p=[],n=o.getTime(),m=1e3*60*60*24,d=ie.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(u,x,f=new Set)=>{if(f.has(u))return;f.add(u);let g=ie.getDependentTasks(e,u);for(let k of g){if(!k.startDate||!k.endDate)continue;let h=r.findIndex(w=>w.id===k.id);if(h===-1)continue;let b=k.startDate.getTime(),D=(k.endDate.getTime()-b)/m,A=(b-n)/m*s,v=A+x*s,R=Math.max(D*s,s),T=c+h*l+12;p.push({taskId:k.id,taskName:k.name,originalX:A,previewX:v,width:R,y:T,rowIndex:h,daysDelta:x,color:k.color}),i(k.id,x,f);}};return i(t,a),p},splitTask:(e,t,a,r=3)=>{let o=ie.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:c}],n=m=>m.map(d=>d.id===o.id?{...d,endDate:c,segments:p}:d.subtasks?{...d,subtasks:n(d.subtasks)}:d);return n(e)}};function nn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:u}){let[f,g]=react.useState([]),[k,h]=react.useState(null),[b,y]=react.useState(null),D=react.useCallback(z=>{h(z);},[]),N=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),A=r==="day"?60:r==="week"?20:8,v=N*A*l,R=z=>{let F=new Date(Date.UTC(z.getFullYear(),z.getMonth(),z.getDate())),W=F.getUTCDay()||7;F.setUTCDate(F.getUTCDate()+4-W);let E=new Date(Date.UTC(F.getUTCFullYear(),0,1));return Math.ceil(((F.getTime()-E.getTime())/864e5+1)/7)},T=z=>{let F=z.getDay();return F===0||F===6},w=react.useCallback(z=>{let F=Math.round(z/(A*l)),W=new Date(o);return W.setDate(W.getDate()+F),W},[o,A,l]),B=react.useCallback((z,F)=>{if(F.startDate&&F.endDate)return;let W=z.currentTarget.ownerSVGElement;if(!W)return;let E=W.createSVGPoint();E.x=z.clientX,E.y=z.clientY;let K=E.matrixTransform(W.getScreenCTM()?.inverse()),ae=w(K.x),O=new Date(ae);O.setDate(O.getDate()+1),d?.(F,ae,O);},[w,d]),P=react.useMemo(()=>{let z=K=>K.map(ae=>{if(ae.subtasks&&ae.subtasks.length>0){let O=z(ae.subtasks),Me=O.filter(he=>he.startDate&&he.endDate);if(Me.length>0){let he=Me.map(we=>we.startDate.getTime()),qe=Me.map(we=>we.endDate.getTime()),me=new Date(Math.min(...he)),tt=new Date(Math.max(...qe));return {...ae,subtasks:O,startDate:me,endDate:tt}}return {...ae,subtasks:O}}return ae}),F=(K,ae=[])=>{for(let O of K)ae.push(O),O.subtasks&&O.subtasks.length>0&&(O.isExpanded===void 0||O.isExpanded)&&F(O.subtasks,ae);return ae},W=z(e);return F(W)},[e]),H=react.useCallback(z=>{if(!z.startDate||!z.endDate)return {x:0,width:0};let F=z.startDate.getTime(),W=z.endDate.getTime(),E=o.getTime(),K=(F-E)/(1e3*60*60*24),ae=(W-F)/(1e3*60*60*24),O=K*A*l,Me=Math.max(A*l,40),he=Math.max(ae*A*l,Me);return {x:O,width:he}},[o,A,l]),X=react.useMemo(()=>P.filter(z=>z.startDate&&z.endDate).map(z=>{let{x:F,width:W}=H(z),K=P.findIndex(ae=>ae.id===z.id)*a+12;return {id:z.id,x:F,y:K,width:W,height:32}}),[P,H]),ye=react.useCallback((z,F,W)=>{if(!W||F===0){g([]);return}let E=ie.calculateCascadePreview(e,z,F,P,o,A*l,a,48);g(E);},[e,P,o,A,l,a,48]),ke=react.useMemo(()=>{let z=[],F=new Date(o);for(;F<=s;){let K=(F.getTime()-o.getTime())/864e5*A*l;if(r==="day")z.push({date:new Date(F),label:F.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:K}),F.setDate(F.getDate()+1);else if(r==="week"){let ae=R(F);z.push({date:new Date(F),label:`Week ${ae}`,x:K}),F.setDate(F.getDate()+7);}else z.push({date:new Date(F),label:F.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:K}),F.setMonth(F.getMonth()+1);}return z},[o,s,r,A,l]),Ae=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*A*l,[o,A,l]),Fe=Math.max(P.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(v,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(v,1e3),height:48,fill:t.bgGrid}),ke.map((z,F)=>jsxRuntime.jsxs("g",{children:[F>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:z.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:z.label})]},`header-${F}`)),Ae>=0&&Ae<=v&&jsxRuntime.jsx("circle",{cx:Ae,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(v,1e3),height:Fe,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(v,1e3),height:Fe,fill:t.bgPrimary}),ke.map((z,F)=>{let W=ke[F+1]?.x||v,E=T(z.date);return jsxRuntime.jsxs("g",{children:[E&&jsxRuntime.jsx("rect",{x:z.x,y:0,width:W-z.x,height:P.length*a,fill:t.bgWeekend,opacity:1}),F>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:P.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},F)}),P.map((z,F)=>{let W=z.startDate&&z.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:v,height:a,fill:F%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${z.id}`),!W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:v,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:E=>B(E,z),onMouseEnter:E=>{E.currentTarget.setAttribute("fill",t.accentLight),E.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:E=>{E.currentTarget.setAttribute("fill","transparent"),E.currentTarget.setAttribute("opacity","1");}},`clickable-${z.id}`),jsxRuntime.jsx("text",{x:Ae>0?Ae: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-${z.id}`)]})]},`row-group-${z.id}`)}),P.map((z,F)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map(W=>{let E=P.find(Me=>Me.id===W);if(!E||!E.startDate||!E.endDate)return null;let K=P.findIndex(Me=>Me.id===W),ae=H(E),O=H(z);return jsxRuntime.jsx(tn,{x1:ae.x+ae.width,y1:K*a+a/2,x2:O.x,y2:F*a+a/2,theme:t},`dep-${W}-${z.id}`)})),P.map((z,F)=>{if(!z.startDate||!z.endDate)return null;let{x:W,width:E}=H(z),K=F*a+12,ae=z.subtasks&&z.subtasks.length>0&&!z.isMilestone;return z.isMilestone?jsxRuntime.jsx(rn,{task:z,x:W+E/2,y:K+16,theme:t,onClick:p},z.id):ae?jsxRuntime.jsxs("g",{onClick:()=>p?.(z),onContextMenu:O=>{O.preventDefault(),O.stopPropagation(),m?.(z,O);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:W,y:K,width:E,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:W,y1:K,x2:W+E,y2:K,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:K,x2:W,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W+E,y1:K,x2:W+E,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:K+32,x2:W+E,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),E>60&&jsxRuntime.jsx("text",{x:W+12,y:K+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:z.name})]},z.id):jsxRuntime.jsx(Zo,{task:z,x:W,y:K,width:E,theme:t,dayWidth:A*l,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:X,onDragMove:ye,onHoverChange:D},z.id)}),P.map((z,F)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map(W=>{let E=P.find(be=>be.id===W);if(!E||!E.startDate||!E.endDate)return null;let K=P.findIndex(be=>be.id===W),ae=H(E),O=H(z),Me=ae.x+ae.width,he=K*a+a/2,qe=O.x,me=F*a+a/2,tt=qe-Me,we=Me+tt/2,st=be=>{let Te=1-be,De=Te*Te,Ye=De*Te,mt=be*be,Ie=mt*be,I=Ye*Me+3*De*be*we+3*Te*mt*we+Ie*qe,Y=Ye*he+3*De*be*he+3*Te*mt*me+Ie*me;return {x:I,y:Y}},ht=20,Bt=[];for(let be=0;be<=ht;be++){let Te=.1+be/ht*.8;Bt.push(st(Te));}let Xe=Bt[0],$=`M ${Xe.x} ${Xe.y} `+Bt.slice(1).map(be=>`L ${be.x} ${be.y}`).join(" ");return b&&b.x1===Me&&b.y1===he&&b.x2===qe&&b.y2===me?null:jsxRuntime.jsx("path",{d:$,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{y({x1:Me,y1:he,x2:qe,y2:me,onDelete:()=>u?.(z.id,W)});}},`dep-hover-${W}-${z.id}`)})),f.map(z=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:z.previewX,y:z.y-48,width:z.width,height:32,rx:8,fill:z.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(z.daysDelta)>0&&jsxRuntime.jsx("text",{x:z.previewX+z.width/2,y:z.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:z.daysDelta>0?`+${z.daysDelta}d`:`${z.daysDelta}d`})]},`cascade-preview-${z.taskId}`)),b&&(()=>{let{x1:z,y1:F,x2:W,y2:E,onDelete:K}=b,ae=W-z,O=E-F,Me=z+ae/2,he=(F+E)/2,qe=`M ${z} ${F} C ${Me} ${F}, ${Me} ${E}, ${W} ${E}`,me=6,tt=Math.atan2(O,ae),we=W-me*Math.cos(tt-Math.PI/6),st=E-me*Math.sin(tt-Math.PI/6),ht=W-me*Math.cos(tt+Math.PI/6),Bt=E-me*Math.sin(tt+Math.PI/6),Xe=t.dependency,$="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>y(null),children:[jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:Me,cy:he,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:Xe,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:Xe,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${W} ${E} L ${we} ${st} M ${W} ${E} L ${ht} ${Bt}`,fill:"none",stroke:Xe,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:W,cy:E,r:4,fill:Xe,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:be=>{be.stopPropagation(),y(null),K();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:Me,cy:he,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:$,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:Me-3,y1:he-3,x2:Me+3,y2:he+3,stroke:$,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Me+3,y1:he-3,x2:Me-3,y2:he+3,stroke:$,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),Ae>=0&&Ae<=v&&jsxRuntime.jsx("line",{x1:Ae,y1:0,x2:Ae,y2:Fe,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),k&&jsxRuntime.jsx(Dd,{tooltipData:k,theme:t})]})]})}var sn=[{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 Us=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ws=[{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 ln({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:n=[],availableTags:m=[],onCreateTag:d,attachments:i=[],onUploadAttachments:u,onDeleteAttachment:x}){let f=[...Us,...n.filter($=>!Us.some(ne=>ne.id===$.id))],g=Ge[p]||Ge.dark,[k,h]=react.useState(false),[b,y]=react.useState(false),[D,N]=react.useState(false),[A,v]=react.useState(false),[R,T]=react.useState({top:0,left:0}),[w,B]=react.useState(null),[P,H]=react.useState(new Date),[X,ye]=react.useState({top:0,left:0}),[ke,Ae]=react.useState(false),[Fe,z]=react.useState([]),F=react.useRef(null),W=react.useRef(null),E=react.useRef(null),K=react.useRef(null),ae=react.useRef(null),[O,Me]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[he,qe]=react.useState({});react.useEffect(()=>{a?(Me({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Ae(true)):(Me({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Ae(false),z([]));},[a,e]),react.useEffect(()=>{let $=ne=>{F.current&&!F.current.contains(ne.target)&&h(false),W.current&&!W.current.contains(ne.target)&&y(false),E.current&&!E.current.contains(ne.target)&&N(false),K.current&&!K.current.contains(ne.target)&&v(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let me=()=>{let $={};return O.name.trim()||($.name="El nombre es requerido"),O.startDate&&O.endDate&&O.startDate>O.endDate&&($.endDate="La fecha de fin debe ser posterior a la de inicio"),qe($),Object.keys($).length===0},tt=async $=>{if($.preventDefault(),!!me())try{let ne=c==="create"&&Fe.length>0?{...O,pendingFiles:Fe}:O;await s(ne),z([]),t();}catch(ne){console.error("Error submitting task:",ne);}},we=($,ne)=>{Me(be=>{let Te={...be,[$]:ne};if($==="status"){let De=ne;De==="todo"?Te.progress=0:De==="in-progress"?(be.progress===0||be.progress===100)&&(Te.progress=50):De==="completed"||De==="closed"?Te.progress=100:(De==="in-review"||De==="review")&&(Te.progress=75);}if($==="progress"){let De=typeof ne=="number"?ne:parseInt(ne,10);De===100&&be.status!=="completed"?Te.status="completed":De>0&&De<100&&be.status==="todo"?Te.status="in-progress":De===0&&be.status!=="todo"&&(Te.status="todo");}return Te}),he[$]&&qe(be=>{let Te={...be};return delete Te[$],Te});},st=f.find($=>$.id===O.status)??Us[0],ht=Ws.find($=>$.id===O.priority)??Ws[1],Bt=sn.find($=>$.value===O.color)??sn[0],Xe={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":p,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:st.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:$=>{$.currentTarget.style.backgroundColor=g.hoverBg,$.currentTarget.style.color=g.textPrimary;},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent",$.currentTarget.style.color=g.textTertiary;},disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:tt,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:O.name,onChange:$=>we("name",$.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:l,autoFocus:true}),he.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"}),he.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:O.description||"",onChange:$=>we("description",$.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:l})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:F,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&h(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Xe,borderColor:st.color,backgroundColor:`${st.color}15`},disabled:l,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:st.color}}),jsxRuntime.jsx("span",{style:{color:st.color},children:st.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:st.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:f.map($=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ne=>ne.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("status",$.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:$.color}}),$.title,O.status===$.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},$.id))})})]}),jsxRuntime.jsxs("div",{ref:W,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&y(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Xe,disabled:l,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ht.color}}),jsxRuntime.jsx("span",{children:ht.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.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},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Ws.map($=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ne=>ne.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("priority",$.id),y(false);},children:[jsxRuntime.jsx("span",{children:$.icon}),$.label,O.priority===$.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},$.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:E,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Xe,disabled:l,children:[O.assignees&&O.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:O.assignees.slice(0,3).map(($,ne)=>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:$.color||g.accent,borderColor:g.bgSecondary},children:$.initials},ne))}),O.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",O.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map($=>{let ne=O.assignees?.some(be=>be.name===$.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:be=>be.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:be=>be.currentTarget.style.backgroundColor="transparent",onClick:()=>{let be=ne?(O.assignees||[]).filter(Te=>Te.name!==$.name):[...O.assignees||[],{name:$.name,avatar:$.avatar,initials:$.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:g.accent}];we("assignees",be);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:$.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:$.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ne&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},$.id)})})})]}),jsxRuntime.jsxs("div",{ref:K,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!l)if(A)v(false);else {if(K.current){let $=K.current.getBoundingClientRect(),ne=window.innerHeight,be=120,De=ne-$.bottom<be?$.top-be-8:$.bottom+8;T({top:De,left:$.left});}v(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Xe,disabled:l,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:O.color}}),jsxRuntime.jsx("span",{children:Bt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>v(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:$=>$.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:sn.slice(0,18).map($=>{let ne=O.color===$.value;return jsxRuntime.jsx("button",{type:"button",onClick:be=>{be.preventDefault(),be.stopPropagation(),we("color",$.value),v(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:$.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:$.value,outline:ne?`2px solid ${$.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},$.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(Ur,{selectedTags:O.tags||[],availableTags:m,onChange:$=>we("tags",$),onCreateTag:d,theme:g,disabled:l}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:ae,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!O.isMilestone)if(w==="start")B(null);else {if(ae.current){let $=ae.current.getBoundingClientRect(),ne=window.innerHeight,be=320,De=ne-$.bottom<be?$.top-be-8:$.bottom+8;ye({top:De,left:$.left});}B("start"),H(O.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Xe,opacity:O.isMilestone?.5:1,cursor:O.isMilestone?"not-allowed":"pointer"},disabled:l||O.isMilestone,children:O.startDate?O.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!O.isMilestone)if(w==="end")B(null);else {if(ae.current){let $=ae.current.getBoundingClientRect(),ne=window.innerHeight,be=320,De=ne-$.bottom<be?$.top-be-8:$.bottom+8;ye({top:De,left:$.left});}B("end"),H(O.endDate||O.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Xe,opacity:O.isMilestone?.5:1,cursor:O.isMilestone?"not-allowed":"pointer"},disabled:l||O.isMilestone,children:O.endDate?O.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>B(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${X.top}px`,left:`${X.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let $=new Date,ne=new Date($);ne.setDate($.getDate()+1);let be=new Date($);be.setDate($.getDate()+7);let Te=new Date($);return Te.setDate($.getDate()+14),[{label:"Hoy",date:$},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:be},{label:"2 semanas",date:Te}].map((Ye,mt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:Ie=>Ie.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Ie=>Ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{w==="start"?(we("startDate",Ye.date),(!O.endDate||Ye.date>O.endDate)&&we("endDate",Ye.date),B("end")):(we("endDate",Ye.date),(!O.startDate||Ye.date<O.startDate)&&we("startDate",Ye.date),B(null));},children:Ye.label},mt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:$=>$.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:$=>$.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("startDate",void 0),we("endDate",void 0),B(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>H(new Date(P.getFullYear(),P.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:P.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>H(new Date(P.getFullYear(),P.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map(($,ne)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:$},ne))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let $=P.getFullYear(),ne=P.getMonth(),be=new Date($,ne,1).getDay(),Te=new Date($,ne+1,0).getDate(),De=new Date,Ye=[];for(let Ie=be-1;Ie>=0;Ie--)Ye.push({day:new Date($,ne,-Ie).getDate(),date:new Date($,ne-1,new Date($,ne,-Ie).getDate()),isCurrentMonth:false});for(let Ie=1;Ie<=Te;Ie++)Ye.push({day:Ie,date:new Date($,ne,Ie),isCurrentMonth:true});let mt=42-Ye.length;for(let Ie=1;Ie<=mt;Ie++)Ye.push({day:Ie,date:new Date($,ne+1,Ie),isCurrentMonth:false});return Ye.map((Ie,I)=>{let Y=Ie.date.toDateString()===De.toDateString(),He=O.startDate?.toDateString()===Ie.date.toDateString(),We=O.endDate?.toDateString()===Ie.date.toDateString(),bt=O.startDate&&O.endDate&&Ie.date>=O.startDate&&Ie.date<=O.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:Ie.isCurrentMonth?He||We?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:He?"#3B82F6":We?"#7C3AED":bt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Y&&!He&&!We?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{w==="start"?(we("startDate",Ie.date),O.endDate&&Ie.date>O.endDate&&we("endDate",Ie.date),B("end")):(we("endDate",Ie.date),O.startDate&&Ie.date<O.startDate&&we("startDate",Ie.date),B(null));},children:Ie.day},I)})})()})]})]})]})})]}),he.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:he.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:O.progress,onChange:$=>we("progress",parseInt($.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:O.progress<30?"#EF4444":O.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${O.progress<30?"#EF4444":O.progress<70?"#F59E0B":"#10B981"}20`,color:O.progress<30?"#EF4444":O.progress<70?"#F59E0B":"#10B981"},children:[O.progress,"%"]})]})]}),(u||i.length>0||c==="create")&&jsxRuntime.jsxs("div",{className:"pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",c==="create"?Fe.length>0&&`(${Fe.length})`:i.length>0&&`(${i.length})`]})]}),c==="create"?jsxRuntime.jsx($a,{cardId:"pending",attachments:Fe.map(($,ne)=>({id:`pending-${ne}`,cardId:"pending",name:$.name,size:$.size,type:$.type,url:URL.createObjectURL($),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:$=>z(ne=>[...ne,...$]),onDelete:$=>{let ne=parseInt($.replace("pending-",""),10);z(be=>be.filter((Te,De)=>De!==ne));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx($a,{cardId:a?.id||"new",attachments:i,onUpload:u&&a?.id?$=>u(a.id,$):void 0,onDelete:x,maxSizeMB:10,maxFiles:20}),c==="create"&&Fe.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Fe.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ae(!ke),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${ke?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke&&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:O.isMilestone,onChange:$=>we("isMilestone",$.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:l}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:g.bgSecondary},children:r.filter($=>$.id!==a?.id).map($=>{let ne=O.dependencies?.includes($.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let be=ne?(O.dependencies||[]).filter(Te=>Te!==$.id):[...O.dependencies||[],$.id];we("dependencies",be);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:ne?`${g.accent}30`:g.bgPrimary,color:ne?g.accent:g.textSecondary,border:`1px solid ${ne?g.accent:g.borderLight}`},disabled:l,children:$.name},$.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:$=>$.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:$=>$.currentTarget.style.backgroundColor="transparent",disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:$=>!l&&($.currentTarget.style.opacity="0.9"),onMouseLeave:$=>!l&&($.currentTarget.style.opacity="1"),children:l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var lf=['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"})]}),df=()=>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"})}),cf=()=>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"})}),pf=()=>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"})}),mf=()=>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 dn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[d,i]=react.useState(false),[u,x]=react.useState([]),[f,g]=react.useState(""),[k,h]=react.useState(false),[b,y]=react.useState(true),D=react.useRef(null),N=react.useRef(null),A=react.useRef(null),{enabled:v=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:w,suggestions:B=lf,maxHistory:P=50,persistHistory:H}=a,X=H?.storageKey||"gantt-ai-history",ye=H?.maxMessages??5;react.useEffect(()=>{if(H?.enabled)try{let W=localStorage.getItem(X);if(W){let K=JSON.parse(W).map(ae=>({...ae,timestamp:new Date(ae.timestamp)}));x(K.slice(-ye));}}catch(W){console.warn("[GanttAIAssistant] Failed to load persisted history:",W);}},[H?.enabled,X,ye]),react.useEffect(()=>{if(H?.enabled&&u.length>0)try{let W=u.filter(E=>!E.isLoading).slice(-ye);localStorage.setItem(X,JSON.stringify(W));}catch(W){console.warn("[GanttAIAssistant] Failed to persist history:",W);}},[u,H?.enabled,X,ye]),react.useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,d]);let ke=react.useCallback(W=>{if(W.success)switch(W.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":W.taskId&&W.updates&&o?.(W.taskId,W.updates);break;case "create_task":W.newTask&&s?.(W.newTask);break;case "delete_task":W.taskId&&l?.(W.taskId);break;case "link_tasks":W.dependencyFrom&&W.dependencyTo&&c?.(W.dependencyFrom,W.dependencyTo);break;case "unlink_tasks":W.taskId&&W.dependencyFrom&&p?.(W.taskId,W.dependencyFrom);break}},[o,s,l,c,p]),Ae=react.useCallback(async W=>{if(!W.trim()||k)return;let E={id:`user-${Date.now()}`,role:"user",content:W,timestamp:new Date};x(ae=>[...ae.slice(-(P-1)),E]),g(""),y(false),h(true);let K={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(ae=>[...ae,K]);try{if(w){let ae=await w(W,e);x(O=>{let Me=O.filter(qe=>!qe.isLoading),he={id:`assistant-${Date.now()}`,role:"assistant",content:ae.message,timestamp:new Date,command:ae};return [...Me,he]}),ke(ae);}else x(ae=>[...ae.filter(Me=>!Me.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(ae){x(O=>[...O.filter(he=>!he.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ae instanceof Error?ae.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[k,P,w,e,ke]),Fe=W=>{W.preventDefault(),Ae(f);},z=W=>{g(W),D.current?.focus();};if(react.useEffect(()=>{let W=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),m(K=>!K),n||i(false)),E.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[n]),react.useEffect(()=>{if(!n)return;let W=K=>{let ae=K.target;A.current&&!A.current.contains(ae)&&m(false);},E=setTimeout(()=>{document.addEventListener("mousedown",W);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",W);}},[n]),!v)return null;let F={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[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:()=>m(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:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${F[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(W=>!W),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(pf,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(cf,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&b&&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:B.slice(0,4).map((W,E)=>jsxRuntime.jsx("button",{onClick:()=>z(W),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:W.length>30?W.slice(0,30)+"...":W},E))})]}),u.map(W=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${W.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${W.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:W.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:W.role==="user"?"white":t.textPrimary},children:[W.isLoading?jsxRuntime.jsx(mf,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:W.content}),W.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:W.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:W.command.success?"#10B981":"#EF4444"},children:[W.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:W.command.type.replace(/_/g," ")})]})]})},W.id)),jsxRuntime.jsx("div",{ref:N})]}),jsxRuntime.jsxs("form",{onSubmit:Fe,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:W=>g(W.target.value),placeholder:R,disabled:k,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||k,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(df,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ad(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(d=>{let i=typeof n=="function"?n(d.present):n;if(o.current)return {...d,present:i};if(!m)return {...d,present:i};let u=[...d.past,d.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),l=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],d=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],d=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:d}});},[]),p=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function Id({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=l=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?l.metaKey:l.ctrlKey;if(p&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!c&&p&&l.key==="y"){l.preventDefault(),t();return}if(c&&p&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var hf={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ie.formatDate(e.startDate)} - ${ie.formatDate(e.endDate)}`);let a=ie.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=>ie.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Ld(e){return {...hf,...e}}var Cf=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Rd=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:n=true,availableUsers:m=[],templates:d,enableAutoCriticalPath:i=true,persistExpandedState:u,aiAssistant:x,locale:f="en",customTranslations:g,showCreateTaskButton:k=false,createTaskLabel:h,onCreateTask:b,onThemeChange:y,onTaskClick:D,onTaskDblClick:N,onTaskContextMenu:A,onTaskUpdate:v,onProgressChange:R,onTaskEdit:T,onTaskAddSubtask:w,onTaskMarkIncomplete:B,onTaskSetInProgress:P,onDependencyCreate:H,onDependencyDelete:X,onBeforeTaskAdd:ye,onAfterTaskAdd:ke,onBeforeTaskUpdate:Ae,onAfterTaskUpdate:Fe,onBeforeTaskDelete:z,onAfterTaskDelete:F}=a,E=react.useContext(Vo)?.theme,[K,ae]=react.useState(E||s||"dark"),[O,Me]=react.useState(l),[he,qe]=react.useState(c),[me,tt]=react.useState(1),[we,st]=react.useState(0),[ht,Bt]=react.useState(false),[Xe,$]=react.useState(null),[ne,be]=react.useState({isOpen:false,x:0,y:0,task:null}),[Te,De]=react.useState(null),[Ye,mt]=react.useState(null);react.useEffect(()=>{E&&E!==K&&ae(E);},[E]),react.useEffect(()=>{s&&s!==K&&ae(s);},[s]);let Ie=react.useCallback(S=>{ae(S),y?.(S);},[y]),{state:I,setState:Y,undo:He,redo:We,canUndo:bt,canRedo:J,clearHistory:Q}=Ad(t,50),xe=react.useCallback(()=>u?typeof u=="string"?u:"gantt-expanded-tasks":null,[u]),Ce=react.useRef(new Map),re=react.useRef(false);if(!re.current&&u){re.current=true;let S=typeof u=="string"?u:"gantt-expanded-tasks";try{let M=localStorage.getItem(S);if(M){let j=JSON.parse(M);Array.isArray(j)&&(Ce.current=new Map(j));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let Pe=react.useCallback(()=>{let S=xe();if(S)try{let M=Array.from(Ce.current.entries());localStorage.setItem(S,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[xe]);react.useEffect(()=>{let S=M=>M.map(j=>{let ee=Ce.current.get(j.id),pe=ee!==void 0?{...j,isExpanded:ee}:j;return pe.subtasks?.length?{...pe,subtasks:S(pe.subtasks)}:pe});Ce.current.size>0?Y(S(t)):Y(t);},[t,Y]);let ve=react.useRef(t),Ne=react.useRef(true);react.useEffect(()=>{if(Ne.current){Ne.current=false,ve.current=I;return}if(!r)return;let S=JSON.stringify(ve.current),M=JSON.stringify(I);S!==M&&(ve.current=I,r(I));},[I,r]);let se=react.useMemo(()=>Ts(f,g),[f,g]),Re=react.useCallback(S=>[{id:"name",label:S.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:S.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:S.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:S.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:S.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:S.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:S.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:S.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Le,$e]=react.useState(()=>Re(se));react.useEffect(()=>{$e(S=>S.map(M=>({...M,label:se.columns[M.id==="name"?"taskName":M.id]||M.label})));},[se]);let _=react.useMemo(()=>{let S=Le.filter(ee=>ee.visible),M=S.some(ee=>ee.id!=="name");return S.reduce((ee,pe)=>ee+pe.width,0)+(M?20:0)},[Le]);react.useEffect(()=>{Xe!==null&&Xe>_&&(Le.filter(j=>j.visible).some(j=>j.id!=="name")||$(null));},[Le,_,Xe]);let q=react.useMemo(()=>Xe!==null?Math.max(280,Xe,_):Math.max(280,_),[Xe,_]),at=react.useRef(null),Ue=react.useRef(null),le=react.useRef(null),Je=react.useMemo(()=>Jl(K),[K]),Tt=react.useMemo(()=>({theme:Je,themeName:K}),[Je,K]),U=react.useMemo(()=>Ld(d),[d]),ce=react.useMemo(()=>{if(!i)return I;let S=ie.calculateCriticalPath(I),M=j=>j.map(ee=>({...ee,isCriticalPath:S.includes(ee.id),subtasks:ee.subtasks?M(ee.subtasks):void 0}));return M(I)},[I,i]),Se=Cf(he);Id({undo:He,redo:We,canUndo:bt,canRedo:J,enabled:true}),react.useImperativeHandle(o,()=>({getTask:S=>ie.findTaskById(I,S),addTask:(S,M)=>{Y(j=>{if(!M)return [...j,{...S,level:0}];let ee=pe=>pe.map(Ee=>Ee.id===M?{...Ee,subtasks:[...Ee.subtasks||[],{...S,parentId:M,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:ee(Ee.subtasks)}:Ee);return ee(j)});},updateTask:(S,M)=>{Y(j=>{let ee=pe=>pe.map(Ee=>Ee.id===S?{...Ee,...M}:Ee.subtasks?{...Ee,subtasks:ee(Ee.subtasks)}:Ee);return ee(j)});},deleteTask:S=>{Y(M=>{let j=ee=>ee.filter(pe=>pe.id===S?false:(pe.subtasks&&(pe.subtasks=j(pe.subtasks)),true));return j(M)});},deleteTasks:S=>{Y(M=>As(M,S));},duplicateTask:S=>{Y(M=>Is(M,[S]));},splitTask:(S,M,j=3)=>{Y(ee=>ie.splitTask(ee,S,M,j));},calculateEndDate:ie.calculateEndDate,calculateDuration:ie.calculateDuration,validateDependency:(S,M)=>!ie.validateDependencies(I,S,M),getAllTasks:()=>ie.flattenTasks(I),getTasksByStatus:S=>ie.flattenTasks(I).filter(M=>M.status===S),getTasksByParent:S=>S?ie.findTaskById(I,S)?.subtasks||[]:I.filter(j=>!j.parentId),getCriticalPath:()=>ie.flattenTasks(I).filter(S=>S.isCriticalPath),indentTask:S=>{Y(M=>Es(M,[S]));},outdentTask:S=>{Y(M=>Ps(M,[S]));},moveTask:(S,M)=>{Y(j=>Ms(j,[S],M));},createSubtask:async S=>{let{tasks:M,newTask:j}=Bs(I,S);if(ye){let ee=ye({...j,parentId:S});if((ee instanceof Promise?await ee:ee)===false)return}Y(M),ke&&ke({...j,parentId:S});},scrollToTask:S=>{let j=ie.flattenTasks(I).findIndex(ee=>ee.id===S);if(j!==-1&&at.current){let ee=j*Se;at.current.scrollTo({top:ee,behavior:"smooth"}),Ue.current&&Ue.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(S,M=2e3)=>{},expandTask:S=>{Y(M=>{let j=ee=>ee.map(pe=>pe.id===S?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe);return j(M)});},collapseTask:S=>{Y(M=>{let j=ee=>ee.map(pe=>pe.id===S?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe);return j(M)});},expandAll:()=>{Y(S=>{let M=j=>j.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?M(ee.subtasks):void 0}));return M(S)});},collapseAll:()=>{Y(S=>{let M=j=>j.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?M(ee.subtasks):void 0}));return M(S)});},undo:He,redo:We,canUndo:()=>bt,canRedo:()=>J,clearHistory:Q,exportToPNG:async()=>{if(!le.current)throw new Error("Gantt container not found");let S=await Bd__default.default(le.current,{backgroundColor:Je.bgPrimary,scale:2});return new Promise((M,j)=>{S.toBlob(ee=>{ee?M(ee):j(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async S=>{await ie.exportToPDF(I,S);},exportToExcel:async S=>{await ie.exportToExcel(I,S);},exportToJSON:()=>ie.exportToJSON(I),exportToCSV:()=>ie.exportToCSV(I),importFromJSON:S=>{let M=ie.importFromJSON(S);Y(M);},getTasks:()=>I,refresh:()=>{Y(S=>[...S]);},clearAll:()=>{Y([]);}}),[I,He,We,bt,J,Q,Je,Se]);let Ut=react.useCallback(S=>{$e(M=>M.map(j=>j.id===S?{...j,visible:!j.visible}:j));},[]),ea=react.useCallback((S,M)=>{$e(j=>j.map(ee=>{if(ee.id!==S)return ee;let pe=ee.minWidth??100,Ee=ee.maxWidth??800,Ot=Math.max(pe,Math.min(Ee,M));return {...ee,width:Ot}}));},[]),qa=react.useCallback(S=>{Y(M=>{let j=Fs(M,S),ee=pe=>{for(let Ee of pe){if(Ee.id===S){Ce.current.set(S,Ee.isExpanded??true);return}Ee.subtasks?.length&&ee(Ee.subtasks);}};return ee(j),Pe(),j}),a.onTaskToggleExpand?.(S);},[a,Pe]),Ra=react.useCallback((S,M)=>{if(Ae&&Ae(S,M)===false)return;let ee=ie.findTaskById(I,S)?.progress,pe=Ot=>Ot.map(_t=>_t.id===S?{..._t,...M}:_t.subtasks?{..._t,subtasks:pe(_t.subtasks)}:_t);Y(pe(I));let Ee=ie.findTaskById(pe(I),S);Ee&&(v?.(Ee),Fe?.(Ee),M.progress!==void 0&&ee!==void 0&&M.progress!==ee&&R?.(S,ee,M.progress));},[I,v,Ae,Fe,R]),de=react.useCallback(S=>{S.length!==0&&(Y(M=>Es(M,S)),a.onTaskIndent?.(S[0]));},[a]),Dt=react.useCallback(S=>{S.length!==0&&(Y(M=>Ps(M,S)),a.onTaskOutdent?.(S[0]));},[a]),Jt=react.useCallback((S,M,j)=>{Y(ee=>bd(ee,S,M,j)),a.onTaskReparent?.(S,M,j);},[a]),Mr=react.useCallback((S,M)=>{S.length!==0&&(Y(j=>Ms(j,S,M)),a.onTaskMove?.(S[0],M));},[a]),Ar=react.useCallback(async S=>{let M=[];for(let j of S)z&&await Promise.resolve(z(j))===false||M.push(j);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(Y(j=>As(j,M)),M.forEach(j=>a.onTaskDelete?.(j))),F&&M.forEach(j=>F(j)));},[a,z,F]),Ir=react.useCallback(S=>{Y(M=>Is(M,S)),S.forEach(M=>a.onTaskDuplicate?.(M));},[a]),Ha=react.useCallback((S,M)=>{Y(j=>{let{tasks:ee,newTask:pe}=hd(j,S,M);return ye&&ye(pe)===false?j:(a.onTaskCreate?.(pe.parentId,pe.position||0),ke?.(pe),ee)});},[a,ye,ke]),lr=react.useCallback((S,M)=>{Y(j=>Ls(j,S,M)),a.onTaskRename?.(S,M);},[a]),Nt=react.useCallback(S=>{Y(M=>{let{tasks:j}=Bs(M,S);return a.onTaskCreate?.(S,0),j});},[a]),Pn=react.useCallback((S,M,j)=>{let ee=S.startDate?Math.round((M.getTime()-S.startDate.getTime())/864e5):0,pe=_t=>_t.map(Zt=>Zt.id===S.id?{...Zt,startDate:M,endDate:j,...S.segments&&{segments:S.segments}}:Zt.subtasks?{...Zt,subtasks:pe(Zt.subtasks)}:Zt),Ee=pe(I);Ee=ie.autoScheduleDependents(Ee,S.id,ee),Y(Ee);let Ot={...S,startDate:M,endDate:j};v?.(Ot);},[I,v]),Mn=react.useCallback((S,M)=>{A?.(S,M),be({isOpen:true,x:M.clientX,y:M.clientY,task:S});},[A]),Ri=react.useCallback((S,M)=>{let j=ie.splitTask(I,S.id,M);Y(j),be({isOpen:false,x:0,y:0,task:null});},[I]),Lr=react.useCallback(S=>{let M=ie.findTaskById(I,S.id)||S;N?.(M),T||De(M);},[I,N,T]),Oi=react.useCallback((S,M,j)=>{let ee=new Map,pe=Da=>{Da.forEach(Ga=>{Ga.dependencies&&ee.set(Ga.id,Ga.dependencies),Ga.subtasks&&pe(Ga.subtasks);});};pe(j);let Ee=ee.get(M)||[];ee.set(M,[...Ee,S]);let Ot=new Set,_t=new Set,Zt=Da=>{if(!Ot.has(Da)){Ot.add(Da),_t.add(Da);let Ga=ee.get(Da)||[];for(let dr of Ga){if(!Ot.has(dr)&&Zt(dr))return true;if(_t.has(dr))return true}}return _t.delete(Da),false};return Zt(M)},[]),zi=react.useCallback((S,M)=>{if(Oi(S.id,M,I)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
342
+ </Project>`,m=new Blob([n],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ie.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let m=n.startDate&&n.endDate?ie.calculateDuration(n.startDate,n.endDate):0,d=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let x=t.find(f=>f.id===u);if(x){o(x);let f=r.get(u)?.ef||0;d=Math.max(d,f);}}let i=d+m;r.set(n.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),l=new Map,c=n=>{if(l.has(n.id))return;let m=n.startDate&&n.endDate?ie.calculateDuration(n.startDate,n.endDate):0,d=t.filter(x=>x.dependencies&&x.dependencies.includes(n.id)),i=s;if(d.length>0)for(let x of d){c(x);let f=l.get(x.id)?.ls||0;i=Math.min(i,f);}let u=i-m;l.set(n.id,{ls:u,lf:i});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),d=l.get(n.id);if(m&&d){let i=d.ls-m.es;Math.abs(i)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=ie.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ie.calculateCriticalPath(e).includes(t))return 0;let o=ie.getDependentTasks(e,t);if(o.length===0){let c=ie.getLatestEndDate(e);if(!c)return null;let p=ie.calculateDuration(a.endDate,c);return Math.max(0,p)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!s)return null;let l=ie.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>ie.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ie.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ie.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let c=ie.calculateDuration(l.startDate,l.endDate),p;a!==void 0?(p=new Date(l.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let n=ie.calculateEndDate(p,c),m=d=>d.map(i=>i.id===l.id?{...i,startDate:p,endDate:n}:i.subtasks?{...i,subtasks:m(i.subtasks)}:i);s=m(s),s=ie.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,c)=>{if(a===0)return [];let p=[],n=o.getTime(),m=1e3*60*60*24,d=ie.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(u,x,f=new Set)=>{if(f.has(u))return;f.add(u);let g=ie.getDependentTasks(e,u);for(let k of g){if(!k.startDate||!k.endDate)continue;let h=r.findIndex(w=>w.id===k.id);if(h===-1)continue;let b=k.startDate.getTime(),D=(k.endDate.getTime()-b)/m,A=(b-n)/m*s,v=A+x*s,R=Math.max(D*s,s),T=c+h*l+12;p.push({taskId:k.id,taskName:k.name,originalX:A,previewX:v,width:R,y:T,rowIndex:h,daysDelta:x,color:k.color}),i(k.id,x,f);}};return i(t,a),p},splitTask:(e,t,a,r=3)=>{let o=ie.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:c}],n=m=>m.map(d=>d.id===o.id?{...d,endDate:c,segments:p}:d.subtasks?{...d,subtasks:n(d.subtasks)}:d);return n(e)}};function nn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:u}){let[f,g]=react.useState([]),[k,h]=react.useState(null),[b,y]=react.useState(null),D=react.useCallback(z=>{h(z);},[]),N=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),A=r==="day"?60:r==="week"?20:8,v=N*A*l,R=z=>{let F=new Date(Date.UTC(z.getFullYear(),z.getMonth(),z.getDate())),W=F.getUTCDay()||7;F.setUTCDate(F.getUTCDate()+4-W);let E=new Date(Date.UTC(F.getUTCFullYear(),0,1));return Math.ceil(((F.getTime()-E.getTime())/864e5+1)/7)},T=z=>{let F=z.getDay();return F===0||F===6},w=react.useCallback(z=>{let F=Math.round(z/(A*l)),W=new Date(o);return W.setDate(W.getDate()+F),W},[o,A,l]),B=react.useCallback((z,F)=>{if(F.startDate&&F.endDate)return;let W=z.currentTarget.ownerSVGElement;if(!W)return;let E=W.createSVGPoint();E.x=z.clientX,E.y=z.clientY;let K=E.matrixTransform(W.getScreenCTM()?.inverse()),ae=w(K.x),O=new Date(ae);O.setDate(O.getDate()+1),d?.(F,ae,O);},[w,d]),P=react.useMemo(()=>{let z=K=>K.map(ae=>{if(ae.subtasks&&ae.subtasks.length>0){let O=z(ae.subtasks),Me=O.filter(he=>he.startDate&&he.endDate);if(Me.length>0){let he=Me.map(we=>we.startDate.getTime()),qe=Me.map(we=>we.endDate.getTime()),me=new Date(Math.min(...he)),tt=new Date(Math.max(...qe));return {...ae,subtasks:O,startDate:me,endDate:tt}}return {...ae,subtasks:O}}return ae}),F=(K,ae=[])=>{for(let O of K)ae.push(O),O.subtasks&&O.subtasks.length>0&&(O.isExpanded===void 0||O.isExpanded)&&F(O.subtasks,ae);return ae},W=z(e);return F(W)},[e]),H=react.useCallback(z=>{if(!z.startDate||!z.endDate)return {x:0,width:0};let F=z.startDate.getTime(),W=z.endDate.getTime(),E=o.getTime(),K=(F-E)/(1e3*60*60*24),ae=(W-F)/(1e3*60*60*24),O=K*A*l,Me=Math.max(A*l,40),he=Math.max(ae*A*l,Me);return {x:O,width:he}},[o,A,l]),X=react.useMemo(()=>P.filter(z=>z.startDate&&z.endDate).map(z=>{let{x:F,width:W}=H(z),K=P.findIndex(ae=>ae.id===z.id)*a+12;return {id:z.id,x:F,y:K,width:W,height:32}}),[P,H]),ye=react.useCallback((z,F,W)=>{if(!W||F===0){g([]);return}let E=ie.calculateCascadePreview(e,z,F,P,o,A*l,a,48);g(E);},[e,P,o,A,l,a,48]),ke=react.useMemo(()=>{let z=[],F=new Date(o);for(;F<=s;){let K=(F.getTime()-o.getTime())/864e5*A*l;if(r==="day")z.push({date:new Date(F),label:F.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:K}),F.setDate(F.getDate()+1);else if(r==="week"){let ae=R(F);z.push({date:new Date(F),label:`Week ${ae}`,x:K}),F.setDate(F.getDate()+7);}else z.push({date:new Date(F),label:F.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:K}),F.setMonth(F.getMonth()+1);}return z},[o,s,r,A,l]),Ae=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*A*l,[o,A,l]),Fe=Math.max(P.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(v,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(v,1e3),height:48,fill:t.bgGrid}),ke.map((z,F)=>jsxRuntime.jsxs("g",{children:[F>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:z.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:z.label})]},`header-${F}`)),Ae>=0&&Ae<=v&&jsxRuntime.jsx("circle",{cx:Ae,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(v,1e3),height:Fe,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(v,1e3),height:Fe,fill:t.bgPrimary}),ke.map((z,F)=>{let W=ke[F+1]?.x||v,E=T(z.date);return jsxRuntime.jsxs("g",{children:[E&&jsxRuntime.jsx("rect",{x:z.x,y:0,width:W-z.x,height:P.length*a,fill:t.bgWeekend,opacity:1}),F>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:P.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},F)}),P.map((z,F)=>{let W=z.startDate&&z.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:v,height:a,fill:F%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${z.id}`),!W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:v,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:E=>B(E,z),onMouseEnter:E=>{E.currentTarget.setAttribute("fill",t.accentLight),E.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:E=>{E.currentTarget.setAttribute("fill","transparent"),E.currentTarget.setAttribute("opacity","1");}},`clickable-${z.id}`),jsxRuntime.jsx("text",{x:Ae>0?Ae: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-${z.id}`)]})]},`row-group-${z.id}`)}),P.map((z,F)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map(W=>{let E=P.find(Me=>Me.id===W);if(!E||!E.startDate||!E.endDate)return null;let K=P.findIndex(Me=>Me.id===W),ae=H(E),O=H(z);return jsxRuntime.jsx(tn,{x1:ae.x+ae.width,y1:K*a+a/2,x2:O.x,y2:F*a+a/2,theme:t},`dep-${W}-${z.id}`)})),P.map((z,F)=>{if(!z.startDate||!z.endDate)return null;let{x:W,width:E}=H(z),K=F*a+12,ae=z.subtasks&&z.subtasks.length>0&&!z.isMilestone;return z.isMilestone?jsxRuntime.jsx(rn,{task:z,x:W+E/2,y:K+16,theme:t,onClick:p},z.id):ae?jsxRuntime.jsxs("g",{onClick:()=>p?.(z),onContextMenu:O=>{O.preventDefault(),O.stopPropagation(),m?.(z,O);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:W,y:K,width:E,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:W,y1:K,x2:W+E,y2:K,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:K,x2:W,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W+E,y1:K,x2:W+E,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:K+32,x2:W+E,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),E>60&&jsxRuntime.jsx("text",{x:W+12,y:K+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:z.name})]},z.id):jsxRuntime.jsx(Zo,{task:z,x:W,y:K,width:E,theme:t,dayWidth:A*l,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:X,onDragMove:ye,onHoverChange:D},z.id)}),P.map((z,F)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map(W=>{let E=P.find(be=>be.id===W);if(!E||!E.startDate||!E.endDate)return null;let K=P.findIndex(be=>be.id===W),ae=H(E),O=H(z),Me=ae.x+ae.width,he=K*a+a/2,qe=O.x,me=F*a+a/2,tt=qe-Me,we=Me+tt/2,st=be=>{let Te=1-be,De=Te*Te,Ye=De*Te,mt=be*be,Ie=mt*be,I=Ye*Me+3*De*be*we+3*Te*mt*we+Ie*qe,Y=Ye*he+3*De*be*he+3*Te*mt*me+Ie*me;return {x:I,y:Y}},ht=20,Bt=[];for(let be=0;be<=ht;be++){let Te=.1+be/ht*.8;Bt.push(st(Te));}let Ze=Bt[0],$=`M ${Ze.x} ${Ze.y} `+Bt.slice(1).map(be=>`L ${be.x} ${be.y}`).join(" ");return b&&b.x1===Me&&b.y1===he&&b.x2===qe&&b.y2===me?null:jsxRuntime.jsx("path",{d:$,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{y({x1:Me,y1:he,x2:qe,y2:me,onDelete:()=>u?.(z.id,W)});}},`dep-hover-${W}-${z.id}`)})),f.map(z=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:z.previewX,y:z.y-48,width:z.width,height:32,rx:8,fill:z.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(z.daysDelta)>0&&jsxRuntime.jsx("text",{x:z.previewX+z.width/2,y:z.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:z.daysDelta>0?`+${z.daysDelta}d`:`${z.daysDelta}d`})]},`cascade-preview-${z.taskId}`)),b&&(()=>{let{x1:z,y1:F,x2:W,y2:E,onDelete:K}=b,ae=W-z,O=E-F,Me=z+ae/2,he=(F+E)/2,qe=`M ${z} ${F} C ${Me} ${F}, ${Me} ${E}, ${W} ${E}`,me=6,tt=Math.atan2(O,ae),we=W-me*Math.cos(tt-Math.PI/6),st=E-me*Math.sin(tt-Math.PI/6),ht=W-me*Math.cos(tt+Math.PI/6),Bt=E-me*Math.sin(tt+Math.PI/6),Ze=t.dependency,$="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>y(null),children:[jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:Me,cy:he,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:Ze,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:Ze,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${W} ${E} L ${we} ${st} M ${W} ${E} L ${ht} ${Bt}`,fill:"none",stroke:Ze,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:W,cy:E,r:4,fill:Ze,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:be=>{be.stopPropagation(),y(null),K();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:Me,cy:he,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:$,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:Me-3,y1:he-3,x2:Me+3,y2:he+3,stroke:$,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Me+3,y1:he-3,x2:Me-3,y2:he+3,stroke:$,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),Ae>=0&&Ae<=v&&jsxRuntime.jsx("line",{x1:Ae,y1:0,x2:Ae,y2:Fe,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),k&&jsxRuntime.jsx(Dd,{tooltipData:k,theme:t})]})]})}var sn=[{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 Us=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ws=[{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 ln({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:n=[],availableTags:m=[],onCreateTag:d,attachments:i=[],onUploadAttachments:u,onDeleteAttachment:x}){let f=[...Us,...n.filter($=>!Us.some(ne=>ne.id===$.id))],g=Ge[p]||Ge.dark,[k,h]=react.useState(false),[b,y]=react.useState(false),[D,N]=react.useState(false),[A,v]=react.useState(false),[R,T]=react.useState({top:0,left:0}),[w,B]=react.useState(null),[P,H]=react.useState(new Date),[X,ye]=react.useState({top:0,left:0}),[ke,Ae]=react.useState(false),[Fe,z]=react.useState([]),F=react.useRef(null),W=react.useRef(null),E=react.useRef(null),K=react.useRef(null),ae=react.useRef(null),[O,Me]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[he,qe]=react.useState({});react.useEffect(()=>{a?(Me({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Ae(true)):(Me({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Ae(false),z([]));},[a,e]),react.useEffect(()=>{let $=ne=>{F.current&&!F.current.contains(ne.target)&&h(false),W.current&&!W.current.contains(ne.target)&&y(false),E.current&&!E.current.contains(ne.target)&&N(false),K.current&&!K.current.contains(ne.target)&&v(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let me=()=>{let $={};return O.name.trim()||($.name="El nombre es requerido"),O.startDate&&O.endDate&&O.startDate>O.endDate&&($.endDate="La fecha de fin debe ser posterior a la de inicio"),qe($),Object.keys($).length===0},tt=async $=>{if($.preventDefault(),!!me())try{let ne=c==="create"&&Fe.length>0?{...O,pendingFiles:Fe}:O;await s(ne),z([]),t();}catch(ne){console.error("Error submitting task:",ne);}},we=($,ne)=>{Me(be=>{let Te={...be,[$]:ne};if($==="status"){let De=ne;De==="todo"?Te.progress=0:De==="in-progress"?(be.progress===0||be.progress===100)&&(Te.progress=50):De==="completed"||De==="closed"?Te.progress=100:(De==="in-review"||De==="review")&&(Te.progress=75);}if($==="progress"){let De=typeof ne=="number"?ne:parseInt(ne,10);De===100&&be.status!=="completed"?Te.status="completed":De>0&&De<100&&be.status==="todo"?Te.status="in-progress":De===0&&be.status!=="todo"&&(Te.status="todo");}return Te}),he[$]&&qe(be=>{let Te={...be};return delete Te[$],Te});},st=f.find($=>$.id===O.status)??Us[0],ht=Ws.find($=>$.id===O.priority)??Ws[1],Bt=sn.find($=>$.value===O.color)??sn[0],Ze={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":p,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:st.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:$=>{$.currentTarget.style.backgroundColor=g.hoverBg,$.currentTarget.style.color=g.textPrimary;},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent",$.currentTarget.style.color=g.textTertiary;},disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:tt,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:O.name,onChange:$=>we("name",$.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:l,autoFocus:true}),he.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"}),he.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:O.description||"",onChange:$=>we("description",$.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:l})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:F,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&h(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Ze,borderColor:st.color,backgroundColor:`${st.color}15`},disabled:l,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:st.color}}),jsxRuntime.jsx("span",{style:{color:st.color},children:st.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:st.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:f.map($=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ne=>ne.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("status",$.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:$.color}}),$.title,O.status===$.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},$.id))})})]}),jsxRuntime.jsxs("div",{ref:W,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&y(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ze,disabled:l,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ht.color}}),jsxRuntime.jsx("span",{children:ht.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.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},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Ws.map($=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ne=>ne.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("priority",$.id),y(false);},children:[jsxRuntime.jsx("span",{children:$.icon}),$.label,O.priority===$.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},$.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:E,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ze,disabled:l,children:[O.assignees&&O.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:O.assignees.slice(0,3).map(($,ne)=>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:$.color||g.accent,borderColor:g.bgSecondary},children:$.initials},ne))}),O.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",O.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map($=>{let ne=O.assignees?.some(be=>be.name===$.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:be=>be.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:be=>be.currentTarget.style.backgroundColor="transparent",onClick:()=>{let be=ne?(O.assignees||[]).filter(Te=>Te.name!==$.name):[...O.assignees||[],{name:$.name,avatar:$.avatar,initials:$.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:g.accent}];we("assignees",be);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:$.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:$.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ne&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},$.id)})})})]}),jsxRuntime.jsxs("div",{ref:K,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!l)if(A)v(false);else {if(K.current){let $=K.current.getBoundingClientRect(),ne=window.innerHeight,be=120,De=ne-$.bottom<be?$.top-be-8:$.bottom+8;T({top:De,left:$.left});}v(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ze,disabled:l,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:O.color}}),jsxRuntime.jsx("span",{children:Bt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>v(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:$=>$.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:sn.slice(0,18).map($=>{let ne=O.color===$.value;return jsxRuntime.jsx("button",{type:"button",onClick:be=>{be.preventDefault(),be.stopPropagation(),we("color",$.value),v(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:$.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:$.value,outline:ne?`2px solid ${$.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},$.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(Ur,{selectedTags:O.tags||[],availableTags:m,onChange:$=>we("tags",$),onCreateTag:d,theme:g,disabled:l}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:ae,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!O.isMilestone)if(w==="start")B(null);else {if(ae.current){let $=ae.current.getBoundingClientRect(),ne=window.innerHeight,be=320,De=ne-$.bottom<be?$.top-be-8:$.bottom+8;ye({top:De,left:$.left});}B("start"),H(O.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ze,opacity:O.isMilestone?.5:1,cursor:O.isMilestone?"not-allowed":"pointer"},disabled:l||O.isMilestone,children:O.startDate?O.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!O.isMilestone)if(w==="end")B(null);else {if(ae.current){let $=ae.current.getBoundingClientRect(),ne=window.innerHeight,be=320,De=ne-$.bottom<be?$.top-be-8:$.bottom+8;ye({top:De,left:$.left});}B("end"),H(O.endDate||O.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ze,opacity:O.isMilestone?.5:1,cursor:O.isMilestone?"not-allowed":"pointer"},disabled:l||O.isMilestone,children:O.endDate?O.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>B(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${X.top}px`,left:`${X.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let $=new Date,ne=new Date($);ne.setDate($.getDate()+1);let be=new Date($);be.setDate($.getDate()+7);let Te=new Date($);return Te.setDate($.getDate()+14),[{label:"Hoy",date:$},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:be},{label:"2 semanas",date:Te}].map((Ye,mt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:Ie=>Ie.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Ie=>Ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{w==="start"?(we("startDate",Ye.date),(!O.endDate||Ye.date>O.endDate)&&we("endDate",Ye.date),B("end")):(we("endDate",Ye.date),(!O.startDate||Ye.date<O.startDate)&&we("startDate",Ye.date),B(null));},children:Ye.label},mt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:$=>$.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:$=>$.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("startDate",void 0),we("endDate",void 0),B(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>H(new Date(P.getFullYear(),P.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:P.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>H(new Date(P.getFullYear(),P.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map(($,ne)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:$},ne))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let $=P.getFullYear(),ne=P.getMonth(),be=new Date($,ne,1).getDay(),Te=new Date($,ne+1,0).getDate(),De=new Date,Ye=[];for(let Ie=be-1;Ie>=0;Ie--)Ye.push({day:new Date($,ne,-Ie).getDate(),date:new Date($,ne-1,new Date($,ne,-Ie).getDate()),isCurrentMonth:false});for(let Ie=1;Ie<=Te;Ie++)Ye.push({day:Ie,date:new Date($,ne,Ie),isCurrentMonth:true});let mt=42-Ye.length;for(let Ie=1;Ie<=mt;Ie++)Ye.push({day:Ie,date:new Date($,ne+1,Ie),isCurrentMonth:false});return Ye.map((Ie,I)=>{let Y=Ie.date.toDateString()===De.toDateString(),He=O.startDate?.toDateString()===Ie.date.toDateString(),We=O.endDate?.toDateString()===Ie.date.toDateString(),bt=O.startDate&&O.endDate&&Ie.date>=O.startDate&&Ie.date<=O.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:Ie.isCurrentMonth?He||We?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:He?"#3B82F6":We?"#7C3AED":bt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Y&&!He&&!We?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{w==="start"?(we("startDate",Ie.date),O.endDate&&Ie.date>O.endDate&&we("endDate",Ie.date),B("end")):(we("endDate",Ie.date),O.startDate&&Ie.date<O.startDate&&we("startDate",Ie.date),B(null));},children:Ie.day},I)})})()})]})]})]})})]}),he.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:he.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:O.progress,onChange:$=>we("progress",parseInt($.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:O.progress<30?"#EF4444":O.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${O.progress<30?"#EF4444":O.progress<70?"#F59E0B":"#10B981"}20`,color:O.progress<30?"#EF4444":O.progress<70?"#F59E0B":"#10B981"},children:[O.progress,"%"]})]})]}),(u||i.length>0||c==="create")&&jsxRuntime.jsxs("div",{className:"pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",c==="create"?Fe.length>0&&`(${Fe.length})`:i.length>0&&`(${i.length})`]})]}),c==="create"?jsxRuntime.jsx($a,{cardId:"pending",attachments:Fe.map(($,ne)=>({id:`pending-${ne}`,cardId:"pending",name:$.name,size:$.size,type:$.type,url:URL.createObjectURL($),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:$=>z(ne=>[...ne,...$]),onDelete:$=>{let ne=parseInt($.replace("pending-",""),10);z(be=>be.filter((Te,De)=>De!==ne));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx($a,{cardId:a?.id||"new",attachments:i,onUpload:u&&a?.id?$=>u(a.id,$):void 0,onDelete:x,maxSizeMB:10,maxFiles:20}),c==="create"&&Fe.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Fe.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ae(!ke),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${ke?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke&&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:O.isMilestone,onChange:$=>we("isMilestone",$.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:l}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:g.bgSecondary},children:r.filter($=>$.id!==a?.id).map($=>{let ne=O.dependencies?.includes($.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let be=ne?(O.dependencies||[]).filter(Te=>Te!==$.id):[...O.dependencies||[],$.id];we("dependencies",be);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:ne?`${g.accent}30`:g.bgPrimary,color:ne?g.accent:g.textSecondary,border:`1px solid ${ne?g.accent:g.borderLight}`},disabled:l,children:$.name},$.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:$=>$.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:$=>$.currentTarget.style.backgroundColor="transparent",disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:$=>!l&&($.currentTarget.style.opacity="0.9"),onMouseLeave:$=>!l&&($.currentTarget.style.opacity="1"),children:l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var lf=['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"})]}),df=()=>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"})}),cf=()=>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"})}),pf=()=>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"})}),mf=()=>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 dn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[d,i]=react.useState(false),[u,x]=react.useState([]),[f,g]=react.useState(""),[k,h]=react.useState(false),[b,y]=react.useState(true),D=react.useRef(null),N=react.useRef(null),A=react.useRef(null),{enabled:v=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:w,suggestions:B=lf,maxHistory:P=50,persistHistory:H}=a,X=H?.storageKey||"gantt-ai-history",ye=H?.maxMessages??5;react.useEffect(()=>{if(H?.enabled)try{let W=localStorage.getItem(X);if(W){let K=JSON.parse(W).map(ae=>({...ae,timestamp:new Date(ae.timestamp)}));x(K.slice(-ye));}}catch(W){console.warn("[GanttAIAssistant] Failed to load persisted history:",W);}},[H?.enabled,X,ye]),react.useEffect(()=>{if(H?.enabled&&u.length>0)try{let W=u.filter(E=>!E.isLoading).slice(-ye);localStorage.setItem(X,JSON.stringify(W));}catch(W){console.warn("[GanttAIAssistant] Failed to persist history:",W);}},[u,H?.enabled,X,ye]),react.useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,d]);let ke=react.useCallback(W=>{if(W.success)switch(W.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":W.taskId&&W.updates&&o?.(W.taskId,W.updates);break;case "create_task":W.newTask&&s?.(W.newTask);break;case "delete_task":W.taskId&&l?.(W.taskId);break;case "link_tasks":W.dependencyFrom&&W.dependencyTo&&c?.(W.dependencyFrom,W.dependencyTo);break;case "unlink_tasks":W.taskId&&W.dependencyFrom&&p?.(W.taskId,W.dependencyFrom);break}},[o,s,l,c,p]),Ae=react.useCallback(async W=>{if(!W.trim()||k)return;let E={id:`user-${Date.now()}`,role:"user",content:W,timestamp:new Date};x(ae=>[...ae.slice(-(P-1)),E]),g(""),y(false),h(true);let K={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(ae=>[...ae,K]);try{if(w){let ae=await w(W,e);x(O=>{let Me=O.filter(qe=>!qe.isLoading),he={id:`assistant-${Date.now()}`,role:"assistant",content:ae.message,timestamp:new Date,command:ae};return [...Me,he]}),ke(ae);}else x(ae=>[...ae.filter(Me=>!Me.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(ae){x(O=>[...O.filter(he=>!he.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ae instanceof Error?ae.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[k,P,w,e,ke]),Fe=W=>{W.preventDefault(),Ae(f);},z=W=>{g(W),D.current?.focus();};if(react.useEffect(()=>{let W=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),m(K=>!K),n||i(false)),E.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[n]),react.useEffect(()=>{if(!n)return;let W=K=>{let ae=K.target;A.current&&!A.current.contains(ae)&&m(false);},E=setTimeout(()=>{document.addEventListener("mousedown",W);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",W);}},[n]),!v)return null;let F={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[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:()=>m(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:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${F[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(W=>!W),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(pf,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(cf,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&b&&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:B.slice(0,4).map((W,E)=>jsxRuntime.jsx("button",{onClick:()=>z(W),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:W.length>30?W.slice(0,30)+"...":W},E))})]}),u.map(W=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${W.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${W.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:W.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:W.role==="user"?"white":t.textPrimary},children:[W.isLoading?jsxRuntime.jsx(mf,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:W.content}),W.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:W.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:W.command.success?"#10B981":"#EF4444"},children:[W.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:W.command.type.replace(/_/g," ")})]})]})},W.id)),jsxRuntime.jsx("div",{ref:N})]}),jsxRuntime.jsxs("form",{onSubmit:Fe,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:W=>g(W.target.value),placeholder:R,disabled:k,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||k,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(df,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ad(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(d=>{let i=typeof n=="function"?n(d.present):n;if(o.current)return {...d,present:i};if(!m)return {...d,present:i};let u=[...d.past,d.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),l=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],d=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],d=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:d}});},[]),p=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function Id({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=l=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?l.metaKey:l.ctrlKey;if(p&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!c&&p&&l.key==="y"){l.preventDefault(),t();return}if(c&&p&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var hf={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ie.formatDate(e.startDate)} - ${ie.formatDate(e.endDate)}`);let a=ie.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=>ie.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Ld(e){return {...hf,...e}}var Cf=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Rd=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:n=true,availableUsers:m=[],templates:d,enableAutoCriticalPath:i=true,persistExpandedState:u,aiAssistant:x,locale:f="en",customTranslations:g,showCreateTaskButton:k=false,createTaskLabel:h,onCreateTask:b,onThemeChange:y,onTaskClick:D,onTaskDblClick:N,onTaskContextMenu:A,onTaskUpdate:v,onProgressChange:R,onTaskEdit:T,onTaskAddSubtask:w,onTaskMarkIncomplete:B,onTaskSetInProgress:P,onDependencyCreate:H,onDependencyDelete:X,onBeforeTaskAdd:ye,onAfterTaskAdd:ke,onBeforeTaskUpdate:Ae,onAfterTaskUpdate:Fe,onBeforeTaskDelete:z,onAfterTaskDelete:F}=a,E=react.useContext(Vo)?.theme,[K,ae]=react.useState(E||s||"dark"),[O,Me]=react.useState(l),[he,qe]=react.useState(c),[me,tt]=react.useState(1),[we,st]=react.useState(0),[ht,Bt]=react.useState(false),[Ze,$]=react.useState(null),[ne,be]=react.useState({isOpen:false,x:0,y:0,task:null}),[Te,De]=react.useState(null),[Ye,mt]=react.useState(null);react.useEffect(()=>{E&&E!==K&&ae(E);},[E]),react.useEffect(()=>{s&&s!==K&&ae(s);},[s]);let Ie=react.useCallback(S=>{ae(S),y?.(S);},[y]),{state:I,setState:Y,undo:He,redo:We,canUndo:bt,canRedo:J,clearHistory:Q}=Ad(t,50),xe=react.useCallback(()=>u?typeof u=="string"?u:"gantt-expanded-tasks":null,[u]),Ce=react.useRef(new Map),re=react.useRef(false);if(!re.current&&u){re.current=true;let S=typeof u=="string"?u:"gantt-expanded-tasks";try{let M=localStorage.getItem(S);if(M){let j=JSON.parse(M);Array.isArray(j)&&(Ce.current=new Map(j));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let Pe=react.useCallback(()=>{let S=xe();if(S)try{let M=Array.from(Ce.current.entries());localStorage.setItem(S,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[xe]);react.useEffect(()=>{let S=M=>M.map(j=>{let ee=Ce.current.get(j.id),pe=ee!==void 0?{...j,isExpanded:ee}:j;return pe.subtasks?.length?{...pe,subtasks:S(pe.subtasks)}:pe});Ce.current.size>0?Y(S(t)):Y(t);},[t,Y]);let ve=react.useRef(t),Ne=react.useRef(true);react.useEffect(()=>{if(Ne.current){Ne.current=false,ve.current=I;return}if(!r)return;let S=JSON.stringify(ve.current),M=JSON.stringify(I);S!==M&&(ve.current=I,r(I));},[I,r]);let se=react.useMemo(()=>Ts(f,g),[f,g]),Re=react.useCallback(S=>[{id:"name",label:S.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:S.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:S.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:S.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:S.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:S.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:S.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:S.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Le,$e]=react.useState(()=>Re(se));react.useEffect(()=>{$e(S=>S.map(M=>({...M,label:se.columns[M.id==="name"?"taskName":M.id]||M.label})));},[se]);let V=react.useMemo(()=>{let S=Le.filter(ee=>ee.visible),M=S.some(ee=>ee.id!=="name");return S.reduce((ee,pe)=>ee+pe.width,0)+(M?20:0)},[Le]);react.useEffect(()=>{!Le.filter(j=>j.visible).some(j=>j.id!=="name")&&Ze!==null&&$(null);},[Le,Ze]);let q=react.useMemo(()=>Ze!==null?Math.max(280,Ze):Math.max(280,V),[Ze,V]),at=react.useRef(null),Ue=react.useRef(null),le=react.useRef(null),Xe=react.useMemo(()=>Jl(K),[K]),Tt=react.useMemo(()=>({theme:Xe,themeName:K}),[Xe,K]),U=react.useMemo(()=>Ld(d),[d]),ce=react.useMemo(()=>{if(!i)return I;let S=ie.calculateCriticalPath(I),M=j=>j.map(ee=>({...ee,isCriticalPath:S.includes(ee.id),subtasks:ee.subtasks?M(ee.subtasks):void 0}));return M(I)},[I,i]),Se=Cf(he);Id({undo:He,redo:We,canUndo:bt,canRedo:J,enabled:true}),react.useImperativeHandle(o,()=>({getTask:S=>ie.findTaskById(I,S),addTask:(S,M)=>{Y(j=>{if(!M)return [...j,{...S,level:0}];let ee=pe=>pe.map(Ee=>Ee.id===M?{...Ee,subtasks:[...Ee.subtasks||[],{...S,parentId:M,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:ee(Ee.subtasks)}:Ee);return ee(j)});},updateTask:(S,M)=>{Y(j=>{let ee=pe=>pe.map(Ee=>Ee.id===S?{...Ee,...M}:Ee.subtasks?{...Ee,subtasks:ee(Ee.subtasks)}:Ee);return ee(j)});},deleteTask:S=>{Y(M=>{let j=ee=>ee.filter(pe=>pe.id===S?false:(pe.subtasks&&(pe.subtasks=j(pe.subtasks)),true));return j(M)});},deleteTasks:S=>{Y(M=>As(M,S));},duplicateTask:S=>{Y(M=>Is(M,[S]));},splitTask:(S,M,j=3)=>{Y(ee=>ie.splitTask(ee,S,M,j));},calculateEndDate:ie.calculateEndDate,calculateDuration:ie.calculateDuration,validateDependency:(S,M)=>!ie.validateDependencies(I,S,M),getAllTasks:()=>ie.flattenTasks(I),getTasksByStatus:S=>ie.flattenTasks(I).filter(M=>M.status===S),getTasksByParent:S=>S?ie.findTaskById(I,S)?.subtasks||[]:I.filter(j=>!j.parentId),getCriticalPath:()=>ie.flattenTasks(I).filter(S=>S.isCriticalPath),indentTask:S=>{Y(M=>Es(M,[S]));},outdentTask:S=>{Y(M=>Ps(M,[S]));},moveTask:(S,M)=>{Y(j=>Ms(j,[S],M));},createSubtask:async S=>{let{tasks:M,newTask:j}=Bs(I,S);if(ye){let ee=ye({...j,parentId:S});if((ee instanceof Promise?await ee:ee)===false)return}Y(M),ke&&ke({...j,parentId:S});},scrollToTask:S=>{let j=ie.flattenTasks(I).findIndex(ee=>ee.id===S);if(j!==-1&&at.current){let ee=j*Se;at.current.scrollTo({top:ee,behavior:"smooth"}),Ue.current&&Ue.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(S,M=2e3)=>{},expandTask:S=>{Y(M=>{let j=ee=>ee.map(pe=>pe.id===S?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe);return j(M)});},collapseTask:S=>{Y(M=>{let j=ee=>ee.map(pe=>pe.id===S?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe);return j(M)});},expandAll:()=>{Y(S=>{let M=j=>j.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?M(ee.subtasks):void 0}));return M(S)});},collapseAll:()=>{Y(S=>{let M=j=>j.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?M(ee.subtasks):void 0}));return M(S)});},undo:He,redo:We,canUndo:()=>bt,canRedo:()=>J,clearHistory:Q,exportToPNG:async()=>{if(!le.current)throw new Error("Gantt container not found");let S=await Bd__default.default(le.current,{backgroundColor:Xe.bgPrimary,scale:2});return new Promise((M,j)=>{S.toBlob(ee=>{ee?M(ee):j(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async S=>{await ie.exportToPDF(I,S);},exportToExcel:async S=>{await ie.exportToExcel(I,S);},exportToJSON:()=>ie.exportToJSON(I),exportToCSV:()=>ie.exportToCSV(I),importFromJSON:S=>{let M=ie.importFromJSON(S);Y(M);},getTasks:()=>I,refresh:()=>{Y(S=>[...S]);},clearAll:()=>{Y([]);}}),[I,He,We,bt,J,Q,Xe,Se]);let Ut=react.useCallback(S=>{$e(M=>M.map(j=>j.id===S?{...j,visible:!j.visible}:j));},[]),ea=react.useCallback((S,M)=>{$e(j=>j.map(ee=>{if(ee.id!==S)return ee;let pe=ee.minWidth??100,Ee=ee.maxWidth??800,Ot=Math.max(pe,Math.min(Ee,M));return {...ee,width:Ot}}));},[]),qa=react.useCallback(S=>{Y(M=>{let j=Fs(M,S),ee=pe=>{for(let Ee of pe){if(Ee.id===S){Ce.current.set(S,Ee.isExpanded??true);return}Ee.subtasks?.length&&ee(Ee.subtasks);}};return ee(j),Pe(),j}),a.onTaskToggleExpand?.(S);},[a,Pe]),Ra=react.useCallback((S,M)=>{if(Ae&&Ae(S,M)===false)return;let ee=ie.findTaskById(I,S)?.progress,pe=Ot=>Ot.map(_t=>_t.id===S?{..._t,...M}:_t.subtasks?{..._t,subtasks:pe(_t.subtasks)}:_t);Y(pe(I));let Ee=ie.findTaskById(pe(I),S);Ee&&(v?.(Ee),Fe?.(Ee),M.progress!==void 0&&ee!==void 0&&M.progress!==ee&&R?.(S,ee,M.progress));},[I,v,Ae,Fe,R]),de=react.useCallback(S=>{S.length!==0&&(Y(M=>Es(M,S)),a.onTaskIndent?.(S[0]));},[a]),Dt=react.useCallback(S=>{S.length!==0&&(Y(M=>Ps(M,S)),a.onTaskOutdent?.(S[0]));},[a]),Jt=react.useCallback((S,M,j)=>{Y(ee=>bd(ee,S,M,j)),a.onTaskReparent?.(S,M,j);},[a]),Mr=react.useCallback((S,M)=>{S.length!==0&&(Y(j=>Ms(j,S,M)),a.onTaskMove?.(S[0],M));},[a]),Ar=react.useCallback(async S=>{let M=[];for(let j of S)z&&await Promise.resolve(z(j))===false||M.push(j);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(Y(j=>As(j,M)),M.forEach(j=>a.onTaskDelete?.(j))),F&&M.forEach(j=>F(j)));},[a,z,F]),Ir=react.useCallback(S=>{Y(M=>Is(M,S)),S.forEach(M=>a.onTaskDuplicate?.(M));},[a]),Ha=react.useCallback((S,M)=>{Y(j=>{let{tasks:ee,newTask:pe}=hd(j,S,M);return ye&&ye(pe)===false?j:(a.onTaskCreate?.(pe.parentId,pe.position||0),ke?.(pe),ee)});},[a,ye,ke]),lr=react.useCallback((S,M)=>{Y(j=>Ls(j,S,M)),a.onTaskRename?.(S,M);},[a]),Nt=react.useCallback(S=>{Y(M=>{let{tasks:j}=Bs(M,S);return a.onTaskCreate?.(S,0),j});},[a]),Pn=react.useCallback((S,M,j)=>{let ee=S.startDate?Math.round((M.getTime()-S.startDate.getTime())/864e5):0,pe=_t=>_t.map(Zt=>Zt.id===S.id?{...Zt,startDate:M,endDate:j,...S.segments&&{segments:S.segments}}:Zt.subtasks?{...Zt,subtasks:pe(Zt.subtasks)}:Zt),Ee=pe(I);Ee=ie.autoScheduleDependents(Ee,S.id,ee),Y(Ee);let Ot={...S,startDate:M,endDate:j};v?.(Ot);},[I,v]),Mn=react.useCallback((S,M)=>{A?.(S,M),be({isOpen:true,x:M.clientX,y:M.clientY,task:S});},[A]),Ri=react.useCallback((S,M)=>{let j=ie.splitTask(I,S.id,M);Y(j),be({isOpen:false,x:0,y:0,task:null});},[I]),Lr=react.useCallback(S=>{let M=ie.findTaskById(I,S.id)||S;N?.(M),T||De(M);},[I,N,T]),Oi=react.useCallback((S,M,j)=>{let ee=new Map,pe=Da=>{Da.forEach(Ga=>{Ga.dependencies&&ee.set(Ga.id,Ga.dependencies),Ga.subtasks&&pe(Ga.subtasks);});};pe(j);let Ee=ee.get(M)||[];ee.set(M,[...Ee,S]);let Ot=new Set,_t=new Set,Zt=Da=>{if(!Ot.has(Da)){Ot.add(Da),_t.add(Da);let Ga=ee.get(Da)||[];for(let dr of Ga){if(!Ot.has(dr)&&Zt(dr))return true;if(_t.has(dr))return true}}return _t.delete(Da),false};return Zt(M)},[]),zi=react.useCallback((S,M)=>{if(Oi(S.id,M,I)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
343
343
 
344
- Task dependencies must flow in one direction only.`);return}let j=ee=>ee.map(pe=>{if(pe.id===M){let Ee=pe.dependencies||[];if(!Ee.includes(S.id))return {...pe,dependencies:[...Ee,S.id]}}return pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe});Y(j(I)),H?.(S.id,M);},[I,H,Oi]),$i=react.useCallback((S,M)=>{let j=ee=>ee.map(pe=>{if(pe.id===S&&pe.dependencies){let Ee=pe.dependencies.filter(Ot=>Ot!==M);return {...pe,dependencies:Ee}}return pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe});Y(j(I)),X?.(S,M);},[I,X]),{startDate:Xc,endDate:Jc}=react.useMemo(()=>{let S=I.filter(Ee=>Ee.startDate&&Ee.endDate);if(S.length===0){let Ee=new Date,Ot=new Date(Ee);Ot.setDate(Ot.getDate()-30);let _t=new Date(Ee);return _t.setDate(_t.getDate()+60),{startDate:Ot,endDate:_t}}let M=S.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),j=new Date(Math.min(...M.map(Ee=>Ee.getTime()))),ee=new Date(Math.max(...M.map(Ee=>Ee.getTime()))),pe=O==="day"?7:O==="week"?14:30;return j.setDate(j.getDate()-pe),ee.setDate(ee.getDate()+pe),{startDate:j,endDate:ee}},[I,O]),Zc=react.useCallback(async()=>{if(!le.current)return;let S=await Bd__default.default(le.current,{backgroundColor:Je.bgPrimary,scale:2}),M=document.createElement("a");M.download="gantt-chart.png",M.href=S.toDataURL("image/png"),M.click();},[Je]),Qc=react.useCallback(async()=>{await ie.exportToPDF(I);},[I]),ep=react.useCallback(async()=>{await ie.exportToExcel(I);},[I]),tp=react.useCallback(()=>{let S=ie.exportToCSV(I),M=new Blob([S],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(M),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href);},[I]),ap=react.useCallback(()=>{let S=ie.exportToJSON(I),M=new Blob([S],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(M),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href);},[I]),rp=react.useCallback(()=>{ie.exportToMSProject(I,"Gantt Project","project.xml");},[I]),op=S=>{S.preventDefault(),Bt(true);};return react.useEffect(()=>{let S=Ue.current,M=at.current;if(!S||!M)return;let j=M.querySelector(".gantt-taskgrid-content"),ee=()=>{let Zt=S.scrollTop;st(Zt),j&&(j.style.transform=`translateY(-${Zt}px)`);},pe=Zt=>{if(ht&&M){let Ga=M.parentElement?.getBoundingClientRect()?.left||0,dr=Zt.clientX-Ga,np=280,sp=Math.min(window.innerWidth-300,800);dr>=np&&dr<=sp&&$(dr);}},Ee=()=>{Bt(false);},Ot=M.querySelector(".gantt-grid-scroll")||M,_t=Zt=>{let Da=Zt;Da.deltaY!==0&&(S.scrollTop+=Da.deltaY,Zt.preventDefault());};return S.addEventListener("scroll",ee),Ot.addEventListener("wheel",_t,{passive:false}),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",Ee),()=>{S.removeEventListener("scroll",ee),Ot.removeEventListener("wheel",_t),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",Ee);}},[ht]),jsxRuntime.jsx(Vr.Provider,{value:se,children:jsxRuntime.jsx(Bn.Provider,{value:Tt,children:jsxRuntime.jsxs("div",{ref:le,className:"flex flex-col h-full w-full",style:{backgroundColor:Je.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Ko,{theme:Je,timeScale:O,onTimeScaleChange:Me,zoom:me,onZoomChange:tt,currentTheme:K,onThemeChange:Ie,rowDensity:he,onRowDensityChange:qe,showThemeSelector:p,showCreateTaskButton:k,createTaskLabel:h,onCreateTask:b,onExportPNG:n?Zc:void 0,onExportPDF:n?Qc:void 0,onExportExcel:n?ep:void 0,onExportCSV:n?tp:void 0,onExportJSON:n?ap:void 0,onExportMSProject:n?rp:void 0}),jsxRuntime.jsxs("div",{ref:at,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:q,overflow:"hidden"},children:jsxRuntime.jsx(Jo,{tasks:ce,theme:Je,rowHeight:Se,availableUsers:m,templates:U,onTaskClick:D,onTaskDblClick:Lr,onTaskContextMenu:A,onTaskToggle:qa,scrollTop:we,columns:Le,onToggleColumn:Ut,onColumnResize:ea,onTaskUpdate:Ra,onTaskIndent:de,onTaskOutdent:Dt,onTaskMove:Mr,onMultiTaskDelete:Ar,onTaskDuplicate:Ir,onTaskCreate:Ha,onTaskRename:lr,onCreateSubtask:Nt,onOpenTaskModal:D?S=>D(S):void 0,onDeleteRequest:(S,M)=>mt({taskId:S,taskName:M}),onTaskReparent:Jt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/20 transition-colors",style:{width:5,backgroundColor:"transparent",borderLeft:`1px solid ${Je.border}`,zIndex:10},onMouseDown:op}),jsxRuntime.jsx("div",{ref:Ue,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(nn,{tasks:ce,theme:Je,rowHeight:Se,timeScale:O,startDate:Xc,endDate:Jc,zoom:me,templates:U,onTaskClick:D,onTaskDblClick:Lr,onTaskContextMenu:Mn,onTaskDateChange:Pn,onDependencyCreate:zi,onDependencyDelete:$i})})]}),ne.task&&jsxRuntime.jsx(jr,{isOpen:ne.isOpen,x:ne.x,y:ne.y,theme:Je,onClose:()=>be({isOpen:false,x:0,y:0,task:null}),items:(()=>{let S=ne.task;if(!S)return [];let M=ie.findTaskById(I,S.id)||S;return M.subtasks&&M.subtasks.length>0?[{id:"addSubtask",label:se.contextMenu?.addSubtask||"Add Subtask",icon:wt.Add,onClick:()=>{w?w(M):Nt(M.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:se.contextMenu?.deleteTask||"Delete Task",icon:wt.Delete,onClick:()=>{mt({taskId:M.id,taskName:M.name});}}]:[{id:"edit",label:se.contextMenu?.editTask||"Edit Task",icon:wt.Pencil,onClick:()=>{T?T(M):De(M);}},{id:"addSubtask",label:se.contextMenu?.addSubtask||"Add Subtask",icon:wt.Add,onClick:()=>{w?w(M):Nt(M.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:se.contextMenu?.markIncomplete||"Mark Incomplete",icon:wt.MarkIncomplete,onClick:()=>{B?B(M):Ra(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"},{id:"setInProgress",label:se.contextMenu?.setInProgress||"Set In Progress",icon:wt.SetInProgress,onClick:()=>{P?P(M):Ra(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"},{id:"markComplete",label:se.contextMenu?.markComplete||"Mark Complete",icon:wt.MarkComplete,onClick:()=>{Ra(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:se.contextMenu?.splitTask||"Split Task",icon:wt.Split,onClick:()=>{if(!M.startDate||!M.endDate){console.warn("Cannot split task without dates");return}let ee=M.startDate.getTime(),pe=M.endDate.getTime(),Ee=ee+(pe-ee)/2,Ot=new Date(Ee);Ri(M,Ot);},disabled:!M.startDate||!M.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:se.contextMenu?.deleteTask||"Delete Task",icon:wt.Delete,onClick:()=>{mt({taskId:M.id,taskName:M.name});}}]})()}),Te&&jsxRuntime.jsx(ln,{isOpen:true,onClose:()=>De(null),task:Te,onSubmit:S=>{Ra(Te.id,S),De(null);},mode:"edit",theme:K}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ye&&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:()=>mt(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:S=>S.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Je.bgSecondary,border:`1px solid ${Je.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Je.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:Je.textPrimary,fontFamily:"Inter, sans-serif"},children:[se.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Je.textSecondary,fontFamily:"Inter, sans-serif"},children:f==="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:Je.textSecondary,fontFamily:"Inter, sans-serif"},children:[f==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Je.textPrimary},children:['"',Ye.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Je.bgPrimary,borderTop:`1px solid ${Je.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>mt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Je.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=Je.hoverBg;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:f==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Ar([Ye.taskId]),mt(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:S=>{S.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),f==="es"?"Eliminar":"Delete"]})]})]})})}),x?.enabled&&jsxRuntime.jsx(dn,{tasks:I,theme:Je,config:x,onTasksUpdate:Y,onTaskUpdate:Ra,onTaskCreate:S=>{Y(M=>[...M,S]);},onTaskDelete:S=>{Ar([S]);},onDependencyCreate:(S,M)=>{let j=ie.findTaskById(I,S);j&&zi(j,M);},onDependencyDelete:$i})]})})})});var Od=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
344
+ Task dependencies must flow in one direction only.`);return}let j=ee=>ee.map(pe=>{if(pe.id===M){let Ee=pe.dependencies||[];if(!Ee.includes(S.id))return {...pe,dependencies:[...Ee,S.id]}}return pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe});Y(j(I)),H?.(S.id,M);},[I,H,Oi]),$i=react.useCallback((S,M)=>{let j=ee=>ee.map(pe=>{if(pe.id===S&&pe.dependencies){let Ee=pe.dependencies.filter(Ot=>Ot!==M);return {...pe,dependencies:Ee}}return pe.subtasks?{...pe,subtasks:j(pe.subtasks)}:pe});Y(j(I)),X?.(S,M);},[I,X]),{startDate:Xc,endDate:Jc}=react.useMemo(()=>{let S=I.filter(Ee=>Ee.startDate&&Ee.endDate);if(S.length===0){let Ee=new Date,Ot=new Date(Ee);Ot.setDate(Ot.getDate()-30);let _t=new Date(Ee);return _t.setDate(_t.getDate()+60),{startDate:Ot,endDate:_t}}let M=S.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),j=new Date(Math.min(...M.map(Ee=>Ee.getTime()))),ee=new Date(Math.max(...M.map(Ee=>Ee.getTime()))),pe=O==="day"?7:O==="week"?14:30;return j.setDate(j.getDate()-pe),ee.setDate(ee.getDate()+pe),{startDate:j,endDate:ee}},[I,O]),Zc=react.useCallback(async()=>{if(!le.current)return;let S=await Bd__default.default(le.current,{backgroundColor:Xe.bgPrimary,scale:2}),M=document.createElement("a");M.download="gantt-chart.png",M.href=S.toDataURL("image/png"),M.click();},[Xe]),Qc=react.useCallback(async()=>{await ie.exportToPDF(I);},[I]),ep=react.useCallback(async()=>{await ie.exportToExcel(I);},[I]),tp=react.useCallback(()=>{let S=ie.exportToCSV(I),M=new Blob([S],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(M),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href);},[I]),ap=react.useCallback(()=>{let S=ie.exportToJSON(I),M=new Blob([S],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(M),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href);},[I]),rp=react.useCallback(()=>{ie.exportToMSProject(I,"Gantt Project","project.xml");},[I]),op=S=>{S.preventDefault(),Bt(true);};return react.useEffect(()=>{let S=Ue.current,M=at.current;if(!S||!M)return;let j=M.querySelector(".gantt-taskgrid-content"),ee=()=>{let Zt=S.scrollTop;st(Zt),j&&(j.style.transform=`translateY(-${Zt}px)`);},pe=Zt=>{if(ht&&M){let Ga=M.parentElement?.getBoundingClientRect()?.left||0,dr=Zt.clientX-Ga,np=280,sp=Math.min(window.innerWidth-300,800);dr>=np&&dr<=sp&&$(dr);}},Ee=()=>{Bt(false);},Ot=M.querySelector(".gantt-grid-scroll")||M,_t=Zt=>{let Da=Zt;Da.deltaY!==0&&(S.scrollTop+=Da.deltaY,Zt.preventDefault());};return S.addEventListener("scroll",ee),Ot.addEventListener("wheel",_t,{passive:false}),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",Ee),()=>{S.removeEventListener("scroll",ee),Ot.removeEventListener("wheel",_t),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",Ee);}},[ht]),jsxRuntime.jsx(Vr.Provider,{value:se,children:jsxRuntime.jsx(Bn.Provider,{value:Tt,children:jsxRuntime.jsxs("div",{ref:le,className:"flex flex-col h-full w-full",style:{backgroundColor:Xe.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Ko,{theme:Xe,timeScale:O,onTimeScaleChange:Me,zoom:me,onZoomChange:tt,currentTheme:K,onThemeChange:Ie,rowDensity:he,onRowDensityChange:qe,showThemeSelector:p,showCreateTaskButton:k,createTaskLabel:h,onCreateTask:b,onExportPNG:n?Zc:void 0,onExportPDF:n?Qc:void 0,onExportExcel:n?ep:void 0,onExportCSV:n?tp:void 0,onExportJSON:n?ap:void 0,onExportMSProject:n?rp:void 0}),jsxRuntime.jsxs("div",{ref:at,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:q,overflow:"hidden"},children:jsxRuntime.jsx(Jo,{tasks:ce,theme:Xe,rowHeight:Se,availableUsers:m,templates:U,onTaskClick:D,onTaskDblClick:Lr,onTaskContextMenu:A,onTaskToggle:qa,scrollTop:we,columns:Le,onToggleColumn:Ut,onColumnResize:ea,onTaskUpdate:Ra,onTaskIndent:de,onTaskOutdent:Dt,onTaskMove:Mr,onMultiTaskDelete:Ar,onTaskDuplicate:Ir,onTaskCreate:Ha,onTaskRename:lr,onCreateSubtask:Nt,onOpenTaskModal:D?S=>D(S):void 0,onDeleteRequest:(S,M)=>mt({taskId:S,taskName:M}),onTaskReparent:Jt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/20 transition-colors",style:{width:5,backgroundColor:"transparent",borderLeft:`1px solid ${Xe.border}`,zIndex:10},onMouseDown:op}),jsxRuntime.jsx("div",{ref:Ue,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(nn,{tasks:ce,theme:Xe,rowHeight:Se,timeScale:O,startDate:Xc,endDate:Jc,zoom:me,templates:U,onTaskClick:D,onTaskDblClick:Lr,onTaskContextMenu:Mn,onTaskDateChange:Pn,onDependencyCreate:zi,onDependencyDelete:$i})})]}),ne.task&&jsxRuntime.jsx(jr,{isOpen:ne.isOpen,x:ne.x,y:ne.y,theme:Xe,onClose:()=>be({isOpen:false,x:0,y:0,task:null}),items:(()=>{let S=ne.task;if(!S)return [];let M=ie.findTaskById(I,S.id)||S;return M.subtasks&&M.subtasks.length>0?[{id:"addSubtask",label:se.contextMenu?.addSubtask||"Add Subtask",icon:wt.Add,onClick:()=>{w?w(M):Nt(M.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:se.contextMenu?.deleteTask||"Delete Task",icon:wt.Delete,onClick:()=>{mt({taskId:M.id,taskName:M.name});}}]:[{id:"edit",label:se.contextMenu?.editTask||"Edit Task",icon:wt.Pencil,onClick:()=>{T?T(M):De(M);}},{id:"addSubtask",label:se.contextMenu?.addSubtask||"Add Subtask",icon:wt.Add,onClick:()=>{w?w(M):Nt(M.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:se.contextMenu?.markIncomplete||"Mark Incomplete",icon:wt.MarkIncomplete,onClick:()=>{B?B(M):Ra(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"},{id:"setInProgress",label:se.contextMenu?.setInProgress||"Set In Progress",icon:wt.SetInProgress,onClick:()=>{P?P(M):Ra(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"},{id:"markComplete",label:se.contextMenu?.markComplete||"Mark Complete",icon:wt.MarkComplete,onClick:()=>{Ra(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:se.contextMenu?.splitTask||"Split Task",icon:wt.Split,onClick:()=>{if(!M.startDate||!M.endDate){console.warn("Cannot split task without dates");return}let ee=M.startDate.getTime(),pe=M.endDate.getTime(),Ee=ee+(pe-ee)/2,Ot=new Date(Ee);Ri(M,Ot);},disabled:!M.startDate||!M.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:se.contextMenu?.deleteTask||"Delete Task",icon:wt.Delete,onClick:()=>{mt({taskId:M.id,taskName:M.name});}}]})()}),Te&&jsxRuntime.jsx(ln,{isOpen:true,onClose:()=>De(null),task:Te,onSubmit:S=>{Ra(Te.id,S),De(null);},mode:"edit",theme:K}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ye&&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:()=>mt(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:S=>S.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Xe.bgSecondary,border:`1px solid ${Xe.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Xe.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:Xe.textPrimary,fontFamily:"Inter, sans-serif"},children:[se.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Xe.textSecondary,fontFamily:"Inter, sans-serif"},children:f==="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:Xe.textSecondary,fontFamily:"Inter, sans-serif"},children:[f==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Xe.textPrimary},children:['"',Ye.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Xe.bgPrimary,borderTop:`1px solid ${Xe.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>mt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Xe.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=Xe.hoverBg;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:f==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Ar([Ye.taskId]),mt(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:S=>{S.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),f==="es"?"Eliminar":"Delete"]})]})]})})}),x?.enabled&&jsxRuntime.jsx(dn,{tasks:I,theme:Xe,config:x,onTasksUpdate:Y,onTaskUpdate:Ra,onTaskCreate:S=>{Y(M=>[...M,S]);},onTaskDelete:S=>{Ar([S]);},onDependencyCreate:(S,M)=>{let j=ie.findTaskById(I,S);j&&zi(j,M);},onDependencyDelete:$i})]})})})});var Od=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
345
345
 
346
346
  AVAILABLE COMMANDS:
347
347
  1. move_task - Move a task to a different date
@@ -386,7 +386,7 @@ If ambiguous, ask for clarification in the message field.`;function zd(e){return
386
386
  ${$d(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",l=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${l}`}).join(`
387
387
  `)}
388
388
 
389
- Today's date: ${new Date().toISOString().split("T")[0]}`}function $d(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ka(e,t){let a=$d(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let l=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return l.every(n=>p.includes(n))})}function _s(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let u={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(u!==void 0){let x=new Date(r),f=x.getDay(),g=u-f;return g<=0&&(g+=7),x.setDate(x.getDate()+g),x}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),x=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?x.setDate(x.getDate()+i):u==="week"||u==="semana"||u==="semanas"?x.setDate(x.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&x.setMonth(x.getMonth()+i),x}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,x=parseInt(c[3],10);return new Date(x,u,i)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=p[n[2].toLowerCase()],x=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(x,u,i)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let i=m[d[1].toLowerCase()],u=parseInt(d[2],10),x=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(x,i,u)}return null}function Vs(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function js(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Ud(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function Wd(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let n=r[1].trim(),m=r[2].trim(),d=Ka(t,n),i=_s(m);if(!d)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(i);return x.setDate(x.getDate()+u),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:x},message:`Moved "${d.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),m=o[2].trim(),d=Ka(t,n),i=Vs(m);if(!d)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(d.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:u},message:`Extended "${d.name}" by ${i} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let n=s[1].trim(),m=s[2].trim(),d=Ka(t,n),i=js(m);return d?i===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:i},message:`Set "${d.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let l=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let n=l[1].trim(),m=l[2].trim(),d=Ka(t,n);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),m=c[2].trim(),d=Ka(t,n),i=Ka(t,m);return d?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:d.id,dependencyTo:i.id,message:`Linked "${d.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let n=p[1].trim(),m=Ka(t,n);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Hd(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function Tf(e){if(e)switch(e.toUpperCase()){case "TODO":case "BLOCKED":return "todo";case "IN_PROGRESS":case "REVIEW":return "in-progress";case "DONE":return "completed";default:return "todo"}}function Df(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function pn(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(i=>i.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>pn(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let l=m=>{if(m)return typeof m=="string"?new Date(m):m},c=l(e.startDate),p=l(e.endDate),n=e.metadata?.isMilestone===true||c&&p&&Math.abs(p.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:p,progress:e.progress||0,status:Tf(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function Gd(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:Df(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function _d(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>pn(r,e,t))}var Ks={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Ys={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},mn={en:Ks,es:Ys};function qs(e){return mn[e]||mn.en}function un(e,t){let a=qs(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function Yd(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Yd(r.subtasks,t+1));return a}function Rf({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function qd({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:l}){let{theme:c="dark",locale:p="en",customTranslations:n,showSearch:m=true,showHierarchy:d=true}=t,i=un(p,n),u=c==="dark",[x,f]=react.useState(new Set),[g,k]=react.useState("startDate"),[h,b]=react.useState("asc"),[y,D]=react.useState("");react.useMemo(()=>{let T=new Set;function w(B){for(let P of B)P.subtasks?.length&&(T.add(P.id),w(P.subtasks));}w(e),f(T);},[e]);let N=react.useCallback(T=>{f(w=>{let B=new Set(w);return B.has(T)?B.delete(T):B.add(T),B}),a.onTaskToggleExpand?.(T);},[a]),A=react.useCallback(T=>{g===T?b(w=>w==="asc"?"desc":"asc"):(k(T),b("asc")),a.onSortChange?.({column:T,direction:h==="asc"?"desc":"asc"});},[g,h,a]),v=react.useMemo(()=>{let T=Yd(e);if(y.trim()){let B=y.toLowerCase();T=T.filter(P=>P.name.toLowerCase().includes(B));}let w=[];for(let B of T){let P=B.level===0;B.level>0&&(P=true),(P||y.trim())&&w.push(B);}return y.trim()&&w.sort((B,P)=>{let H,X;switch(g){case "name":H=B.name.toLowerCase(),X=P.name.toLowerCase();break;case "startDate":H=B.startDate?.getTime()||0,X=P.startDate?.getTime()||0;break;case "endDate":H=B.endDate?.getTime()||0,X=P.endDate?.getTime()||0;break;case "progress":H=B.progress||0,X=P.progress||0;break;case "status":H=B.status||"todo",X=P.status||"todo";break;default:return 0}return H<X?h==="asc"?-1:1:H>X?h==="asc"?1:-1:0}),w},[e,y,g,h]),R=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:C("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:l,children:[jsxRuntime.jsx("div",{className:C("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[m&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:C("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:y,onChange:T=>D(T.target.value),placeholder:i.toolbar.searchPlaceholder,className:C("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[v.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:C("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>A("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v.map((T,w)=>{let B=x.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:w*.02},className:C("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:P=>{P.stopPropagation(),N(T.id);},className:C("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:B?jsxRuntime.jsx(lucideReact.ChevronDown,{className:C("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:C("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),d&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:P=>{P.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Rf,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:C("truncate",u?"text-white":"text-gray-900",T.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:C("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?i.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:C("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),R(T.startDate)]}),jsxRuntime.jsxs("div",{className:C("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),R(T.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:C("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:C("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:C("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),v.length===0&&y&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:C("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:C(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Xs={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Js={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da"},Zs={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},fn={dark:Xs,light:Js,neutral:Zs};function Xd(e){return fn[e]||fn.dark}var Qs={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},ei={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},hn={en:Qs,es:ei};function vo(e){return hn[e]||hn.en}function bn(e,t){let a=vo(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function Jd(e){let t=vo(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function Zd(e,t=0,a=true){let r=vo(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function qf(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function ni(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function tc({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function rc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:l,style:c}){let{theme:p="dark",locale:n="en",customTranslations:m}=t,d=bn(n,m),i=p==="dark",[u,x]=react.useState(r||new Date),[f,g]=react.useState(null),[k,h]=react.useState(null),[b,y]=react.useState(null),[D,N]=react.useState(new Date),[A,v]=react.useState({}),R=4,T=3,[w,B]=react.useState(false),[P,H]=react.useState(false),[X,ye]=react.useState(false),[ke,Ae]=react.useState(null),[Fe,z]=react.useState(""),[F,W]=react.useState(void 0),[E,K]=react.useState(null),[ae,O]=react.useState(false),[Me,he]=react.useState(false),[qe,me]=react.useState(null),[tt,we]=react.useState(false),[st,ht]=react.useState(new Date),Bt=react.useCallback(()=>{x(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),Xe=react.useCallback(()=>{x(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),$=react.useCallback(()=>{x(new Date);},[]),ne=react.useMemo(()=>{let I=u.getFullYear(),Y=u.getMonth(),He=new Date(I,Y,1),We=new Date(I,Y+1,0),bt=He.getDay(),J=We.getDate(),Q=qf(e),xe=new Date;xe.setHours(0,0,0,0);let Ce=[],re=bt,Pe=new Date(I,Y,0).getDate();for(let Ne=re-1;Ne>=0;Ne--){let se=new Date(I,Y-1,Pe-Ne);Ce.push({date:se,isCurrentMonth:false,isToday:false,isWeekend:se.getDay()===0||se.getDay()===6,events:Q.filter(Re=>ni(se,Re)).map(Re=>({id:Re.id,title:Re.name,start:Re.startDate,end:Re.endDate,task:Re}))});}for(let Ne=1;Ne<=J;Ne++){let se=new Date(I,Y,Ne),Re=se.getTime()===xe.getTime();Ce.push({date:se,isCurrentMonth:true,isToday:Re,isWeekend:se.getDay()===0||se.getDay()===6,events:Q.filter(Le=>ni(se,Le)).map(Le=>({id:Le.id,title:Le.name,start:Le.startDate,end:Le.endDate,task:Le}))});}let ve=42-Ce.length;for(let Ne=1;Ne<=ve;Ne++){let se=new Date(I,Y+1,Ne);Ce.push({date:se,isCurrentMonth:false,isToday:false,isWeekend:se.getDay()===0||se.getDay()===6,events:Q.filter(Re=>ni(se,Re)).map(Re=>({id:Re.id,title:Re.name,start:Re.startDate,end:Re.endDate,task:Re}))});}return Ce},[u,e]),be=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Te=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),De=react.useCallback((I,Y)=>{if(!f)return;let He={...f,[I]:Y};g(He),a.onTaskUpdate?.(He);},[f,a]),Ye=react.useCallback(I=>{if(!f)return;let Y=f.progress||0;I==="completed"?Y=100:I==="todo"&&(Y=0);let He={...f,status:I,progress:Y};g(He),a.onTaskUpdate?.(He),B(false);},[f,a]),mt=react.useCallback((I,Y)=>{if(!f)return;let He={...f,startDate:I,endDate:Y};g(He),a.onTaskUpdate?.(He);},[f,a]),Ie=react.useCallback(()=>{B(false),H(false),y(null);},[]);return o?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsxRuntime.jsx("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:C("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",l),style:c,children:[jsxRuntime.jsx("div",{className:C("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:C("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:Te}),jsxRuntime.jsx("button",{onClick:$,className:C("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:d.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Bt,className:C("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:C("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Xe,className:C("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:C("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:be.map(I=>jsxRuntime.jsx("div",{className:C("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:I},I))}),jsxRuntime.jsx("div",{className:C("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:ne.map((I,Y)=>{let He=I.date.getDay()===0||I.date.getDay()===6;return jsxRuntime.jsxs("div",{className:C("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?He?"bg-[#1C1F26]":I.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":He?"bg-gray-100":I.isCurrentMonth?"bg-white":"bg-gray-50",I.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let We=A[Y]||R,bt=I.events.slice(0,We),J=I.events.length-We;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[bt.map(Q=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{g(Q.task),a.onEventClick?.(Q);},whileHover:{scale:1.02},className:C("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Q.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(tc,{task:Q.task}),jsxRuntime.jsx("span",{className:"truncate",children:Q.title})]})},Q.id)),J>0&&jsxRuntime.jsxs("button",{onClick:Q=>{Q.stopPropagation(),v(xe=>({...xe,[Y]:We+T}));},className:C("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",J," ",n==="es"?"M\xC1S":"MORE"]}),We>R&&I.events.length>R&&jsxRuntime.jsx("button",{onClick:Q=>{Q.stopPropagation(),v(xe=>({...xe,[Y]:R}));},className:C("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let We=Y>=28,bt=Y%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),ke===Y?Ae(null):(Ae(Y),z(""),W(void 0),K(null),me(null),O(false),he(false),we(false),ht(I.date));},className:C("w-5 h-5 rounded flex items-center justify-center transition-all",ke===Y?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:C("w-3.5 h-3.5 transition-transform",ke===Y&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke===Y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ae(null),z(""),W(void 0),K(null),me(null),O(false),he(false),we(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:We?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:We?-5:5,scale:.95},transition:{duration:.12},className:C("absolute w-[320px] rounded-lg shadow-2xl z-50",We?"bottom-full mb-1":"top-full mt-1",bt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>{J.stopPropagation(),O(false),he(false),we(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Fe,onChange:J=>z(J.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:C("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:J=>{if(J.key==="Enter"&&Fe.trim()){let Q=t.availableUsers?.find(Ce=>Ce.id===E),xe=qe||I.date;a.onTaskCreate?.({name:Fe.trim(),startDate:xe,endDate:xe,priority:F,assignees:Q?[Q]:void 0}),z(""),W(void 0),K(null),me(null),Ae(null);}J.key==="Escape"&&(Ae(null),z(""),W(void 0),K(null),me(null));}})}),jsxRuntime.jsxs("div",{className:C("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),O(!ae),he(false);},className:C("p-1 rounded transition-colors",F?F==="urgent"||F==="high"?"text-red-400 bg-red-500/20":F==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxRuntime.jsxs("button",{onClick:()=>{W(J.id),O(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",F===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",J.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:J=>{J.stopPropagation(),we(!tt),O(false),he(false),ht(qe||I.date);},className:C("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",qe?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(qe||I.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("div",{className:C("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,Q=new Date(J);Q.setDate(J.getDate()+1);let xe=new Date(J);xe.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let Ce=new Date(J);Ce.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let re=new Date(J);re.setDate(J.getDate()+14);let Pe=new Date(J);return Pe.setDate(J.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:xe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ce,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:re,display:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Pe,display:Pe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ne,se)=>jsxRuntime.jsxs("button",{className:C("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{me(Ne.date),we(false);},children:[jsxRuntime.jsx("span",{children:Ne.label}),jsxRuntime.jsx("span",{className:C("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Ne.display})]},se))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:C("text-xs font-medium",i?"text-white":"text-gray-900"),children:st.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>ht(new Date),className:C("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ht(new Date(st.getFullYear(),st.getMonth()-1)),className:C("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>ht(new Date(st.getFullYear(),st.getMonth()+1)),className:C("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsxRuntime.jsx("div",{className:C("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:J},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=st.getFullYear(),Q=st.getMonth(),xe=new Date(J,Q,1).getDay(),Ce=new Date(J,Q+1,0).getDate(),re=new Date(J,Q,0).getDate(),Pe=new Date,ve=[];for(let se=xe-1;se>=0;se--)ve.push({dayNum:re-se,isCurrentMonth:false,date:new Date(J,Q-1,re-se)});for(let se=1;se<=Ce;se++)ve.push({dayNum:se,isCurrentMonth:true,date:new Date(J,Q,se)});let Ne=42-ve.length;for(let se=1;se<=Ne;se++)ve.push({dayNum:se,isCurrentMonth:false,date:new Date(J,Q+1,se)});return ve.map((se,Re)=>{let Le=se.date.toDateString()===Pe.toDateString(),$e=(qe||I.date).toDateString()===se.date.toDateString();return jsxRuntime.jsx("button",{className:C("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!se.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),se.isCurrentMonth&&(i?"text-white":"text-gray-900"),Le&&"ring-1 ring-[#3B82F6]",$e&&"bg-[#7C3AED] text-white",!$e&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{me(se.date),we(false);},children:se.dayNum},Re)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),he(!Me),O(false);},className:C("p-1 rounded transition-colors",E?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:E?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(J=>J.id===E)?.color||"#7C3AED"},children:t.availableUsers?.find(J=>J.id===E)?.initials||t.availableUsers?.find(J=>J.id===E)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Me&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{K(null),he(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!E&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:C("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(J=>jsxRuntime.jsxs("button",{onClick:()=>{K(J.id),he(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",E===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:J.color||"#7C3AED"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.name})]},J.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:C("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Fe.trim()){let J=t.availableUsers?.find(xe=>xe.id===E),Q=qe||I.date;a.onTaskCreate?.({name:Fe.trim(),startDate:Q,endDate:Q,priority:F,assignees:J?[J]:void 0}),z(""),W(void 0),K(null),me(null),Ae(null);}},disabled:!Fe.trim(),className:C("px-2.5 py-1 rounded text-xs font-medium transition-colors",Fe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:C("text-sm font-medium",I.isToday?"text-[#3B82F6]":I.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:I.date.getDate()})]})]},Y)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>g(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:C("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:C("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:C("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:C("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:C("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:C("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:C("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:C("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>g(null),className:C("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let I=f.progress===100?0:100,He={...f,progress:I,status:I===100?"completed":"todo"};g(He),a.onTaskUpdate?.(He);},className:C("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:C("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ie(),B(!w);},className:C("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?n==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>B(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(I=>jsxRuntime.jsxs("button",{onClick:()=>Ye(I.id),className:C("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===I.id||I.id==="completed"&&f.progress===100||I.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||I.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",I.id==="completed"?"bg-green-500":I.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:I.label})]},I.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((I,Y)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:I.color||"#8B5CF6"},title:I.name,children:I.initials||I.name.slice(0,2).toUpperCase()},Y)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:C("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{y(b?null:"start"),N(f.startDate||new Date);},className:C("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:C("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:I=>{I.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>y(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:C("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:C("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let I=new Date,Y=new Date(I);Y.setDate(I.getDate()+1);let He=new Date(I);He.setDate(I.getDate()+((6-I.getDay()+7)%7||7));let We=new Date(I);We.setDate(I.getDate()+((1-I.getDay()+7)%7||7));let bt=new Date(I);bt.setDate(I.getDate()+(6-I.getDay()+7)%7+7);let J=new Date(I);J.setDate(I.getDate()+14);let Q=new Date(I);return Q.setDate(I.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:I,display:I.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Y,display:Y.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:He,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:We,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:bt,display:bt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ce,re)=>jsxRuntime.jsxs("button",{className:C("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(b==="start"){let Pe=f.endDate&&Ce.date>f.endDate?Ce.date:f.endDate;mt(Ce.date,Pe),y("end");}else {let Pe=f.startDate&&Ce.date<f.startDate?Ce.date:f.startDate;mt(Pe,Ce.date),y(null);}},children:[jsxRuntime.jsx("span",{children:Ce.label}),jsxRuntime.jsx("span",{className:C("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:Ce.display})]},re))})(),jsxRuntime.jsx("div",{className:C("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{mt(void 0,void 0),y(null);},className:C("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:C("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:b==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>N(new Date),className:C("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>N(new Date(D.getFullYear(),D.getMonth()-1)),className:C("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>N(new Date(D.getFullYear(),D.getMonth()+1)),className:C("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(I=>jsxRuntime.jsx("div",{className:C("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:I},I))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let I=D.getFullYear(),Y=D.getMonth(),He=new Date(I,Y,1).getDay(),We=new Date(I,Y+1,0).getDate(),bt=new Date(I,Y,0).getDate(),J=new Date,Q=[];for(let Ce=He-1;Ce>=0;Ce--)Q.push({day:bt-Ce,isCurrentMonth:false,date:new Date(I,Y-1,bt-Ce)});for(let Ce=1;Ce<=We;Ce++)Q.push({day:Ce,isCurrentMonth:true,date:new Date(I,Y,Ce)});let xe=42-Q.length;for(let Ce=1;Ce<=xe;Ce++)Q.push({day:Ce,isCurrentMonth:false,date:new Date(I,Y+1,Ce)});return Q.map((Ce,re)=>{let Pe=Ce.date.toDateString()===J.toDateString(),ve=f.startDate?.toDateString()===Ce.date.toDateString(),Ne=f.endDate?.toDateString()===Ce.date.toDateString(),se=ve||Ne,Re=f.startDate&&f.endDate&&Ce.date>=f.startDate&&Ce.date<=f.endDate;return jsxRuntime.jsx("button",{className:C("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Ce.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),Ce.isCurrentMonth&&(i?"text-white":"text-gray-900"),Pe&&"ring-2 ring-[#3B82F6]",ve&&"bg-[#3B82F6] text-white",Ne&&!ve&&"bg-[#7C3AED] text-white",Re&&!se&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!se&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let Le=new Date(Ce.date);if(b==="start"){let $e=f.endDate&&Le>f.endDate?Le:f.endDate;mt(Le,$e),y("end");}else {let $e=f.startDate&&Le<f.startDate?Le:f.startDate;mt($e,Le),y(null);}},children:Ce.day},re)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ie(),H(!P);},className:C("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>H(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(I=>jsxRuntime.jsxs("button",{onClick:()=>{De("priority",I.id),H(false);},className:C("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===I.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",I.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:I.label})]},I.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:C("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[X?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:I=>{let Y=parseInt(I.target.value),He=f.status;Y===100?He="completed":Y>0?He="in-progress":He="todo";let We={...f,progress:Y,status:He};g(We),a.onTaskUpdate?.(We);},onBlur:()=>ye(false),className:C("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>ye(true),className:C("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:C("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:C("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:C("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:C("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(I=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:C("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",I.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:I.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:C("text-sm",I.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:I.name})]},I.id))}),jsxRuntime.jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:C("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:C("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:C("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:C("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:C("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:C("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:C("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:C("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:C("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:C("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:C("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:C("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:k.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:C("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:k.events.map(I=>jsxRuntime.jsxs("button",{onClick:()=>{h(null),g(I.task);},className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(tc,{task:I.task}),jsxRuntime.jsx("span",{className:C("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:I.title}),I.task.priority==="high"||I.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},I.id))})]})]})})]})}var si={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},ii={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da"},li={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1"},kn={dark:si,light:ii,neutral:li};function oc(e){return kn[e]||kn.dark}function Jf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:l,className:c}){let[p,n]=react.useState(false),m=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),d=react.useMemo(()=>{let u=m.length,x=new Set(m.flatMap(k=>k.assignedUserIds||[])).size,f=m.map(k=>k.priority).filter(Boolean),g=new Set(m.flatMap(k=>k.labels||[])).size;return {totalCards:u,uniqueAssignees:x,priorities:f,labels:g}},[m]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:C("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:C("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),p&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),l?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:m.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:m.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),s?.(e.id,u.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},u.id))})})]})}var sc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function xo(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function ko(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function ic(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function lc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:l,className:c}){let p=react.useMemo(()=>({...sc,...l}),[l]),[n,m]=react.useState(new Set),d=react.useRef(null),i=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(b=>{let y=b.timestamp.toISOString().split("T")[0],D=h.get(y);D?D.push(b):h.set(y,[b]);}),Array.from(h.entries()).sort((b,y)=>y[0].localeCompare(b[0])).map(([b,y])=>({date:new Date(b),events:y.sort((D,N)=>N.timestamp.getTime()-D.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:x}=react.useMemo(()=>{let h=new Set,b=new Set;return e.forEach(y=>{h.add(y.userId),b.add(y.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(b)}},[e]),f=h=>{m(b=>{let y=new Set(b);return y.has(h)?y.delete(h):y.add(h),y});},g=h=>{let y=new Date().getTime()-h.getTime(),D=Math.floor(y/6e4),N=Math.floor(y/36e5),A=Math.floor(y/864e5);return D<1?"just now":D<60?`${D}m ago`:N<24?`${N}h ago`:A<7?`${A}d ago`:h.toLocaleDateString()},k=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:C("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:C("history-timeline",p.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,types:b?[b]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),x.map(h=>jsxRuntime.jsxs("option",{value:h,children:[ko(h)," ",h.replace("_"," ")]},h))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,users:b?[b]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),k>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",k,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:i.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((b,y)=>{let D=n.has(b.id),N=s===b.id,A=ic(b.type);return jsxRuntime.jsxs("div",{"data-event-id":b.id,className:C("history-timeline-event",D&&"expanded",N&&"selected"),onClick:()=>o?.(b),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:A},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ko(b.type)})}),y<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:A}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[p.showAvatars&&b.userAvatar&&jsxRuntime.jsx("img",{src:b.userAvatar,alt:b.userName||b.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:b.userName||b.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:xo(b)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?g(b.timestamp):b.timestamp.toLocaleString()})]}),Object.keys(b.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),f(b.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(b.changes).map(([v,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},v)),b.metadata&&Object.keys(b.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(b.metadata).map(([v,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},v))]})]})]})]},b.id)})})]},h.date?.toISOString()||"all"))})]})}function cc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:l,onGoToEvent:c,onSpeedChange:p,className:n}){let m=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:C("history-replay-empty",n),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:C("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&ko(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&xo(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,x)=>jsxRuntime.jsx("div",{className:C("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>c(x),title:xo(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:l,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(u=>jsxRuntime.jsxs("button",{className:C("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>p(u),children:[u,"x"]},u))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:C("history-replay-start",n),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function di(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function ci(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function pc(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function mc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function rh(e,t,a,r,o,s=100){let l=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(l.map(p=>[p.id,p]));for(let p=0;p<s;p++){let n=1-p/s;l.forEach(m=>{let d=a/2,i=r/2;m.vx+=(d-m.x)*o.centerForce*n,m.vy+=(i-m.y)*o.centerForce*n,l.forEach(u=>{if(m.id===u.id)return;let x=m.x-u.x,f=m.y-u.y,g=Math.sqrt(x*x+f*f)||1,k=o.chargeStrength*n/(g*g);m.vx+=x/g*k,m.vy+=f/g*k;});}),t.forEach(m=>{let d=c.get(typeof m.source=="string"?m.source:m.source.id),i=c.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!i)return;let u=i.x-d.x,x=i.y-d.y,f=Math.sqrt(u*u+x*x)||1,g=(f-o.linkDistance)/f*o.forceStrength*n;d.vx+=u*g,d.vy+=x*g,i.vx-=u*g,i.vy-=x*g;}),l.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return l}function uc({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:l,onInteraction:c,className:p}){let n=react.useRef(null),[m,d]=react.useState([]),[i,u]=react.useState(null),[x,f]=react.useState(null),[g,k]=react.useState(null),[h,b]=react.useState(1),[y,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let P=rh(e,t,a.width,a.height,a,150);d(P);},[e,t,a]);let N=react.useCallback((P,H)=>{a.enableDragging&&(H.stopPropagation(),u(P));},[a.enableDragging]),A=react.useCallback(P=>{if(!i||!n.current)return;let X=n.current.getBoundingClientRect(),ye=(P.clientX-X.left-y.x)/h,ke=(P.clientY-X.top-y.y)/h;d(Ae=>Ae.map(Fe=>Fe.id===i?{...Fe,x:ye,y:ke,fx:ye,fy:ke}:Fe));},[i,h,y]),v=react.useCallback(()=>{u(null);},[]),R=react.useCallback((P,H)=>{H.stopPropagation(),c?.({type:"node-click",node:P,position:{x:H.clientX,y:H.clientY}});},[c]),T=react.useCallback((P,H)=>{H.stopPropagation(),c?.({type:"edge-click",edge:P,position:{x:H.clientX,y:H.clientY}});},[c]),w=react.useCallback(P=>{let H=m.find(X=>X.id===P);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),B=react.useCallback(P=>{if(P.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return P.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=P.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return P.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:C("relationships-graph-empty",p),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:C("relationships-graph",p),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(P=>Math.min(P+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(P=>Math.max(P-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{b(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(P=>P.type))).map(P=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:di(P)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[pc(P)," ",ci(P)]})]},P))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:A,onMouseUp:v,onMouseLeave:v,children:[jsxRuntime.jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(P=>{let H=w(typeof P.source=="string"?P.source:P.source.id),X=w(typeof P.target=="string"?P.target:P.target.id),ye=mc(P.type),ke=g===P.id,Ae=P.onCriticalPath;return jsxRuntime.jsxs("g",{className:C("relationships-graph-edge",ke&&"hovered",Ae&&"critical"),onMouseEnter:()=>k(P.id),onMouseLeave:()=>k(null),onClick:Fe=>T(P,Fe),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:X.x,y2:X.y,stroke:di(P.type),strokeWidth:Ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ke?1:.6,markerEnd:ye?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ke&&jsxRuntime.jsx("text",{x:(H.x+X.x)/2,y:(H.y+X.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ci(P.type)})]},P.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(P=>{let H=x===P.id,X=P.onCriticalPath;return jsxRuntime.jsxs("g",{className:C("relationships-graph-node",H&&"hovered",X&&"critical"),transform:`translate(${P.x}, ${P.y})`,onMouseDown:ye=>N(P.id,ye),onMouseEnter:()=>f(P.id),onMouseLeave:()=>f(null),onClick:ye=>R(P,ye),children:[jsxRuntime.jsx("circle",{r:X?a.nodeSize*1.2:a.nodeSize,fill:B(P),stroke:X?"#fbbf24":"#ffffff",strokeWidth:X?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:P.card.title.length>20?P.card.title.substring(0,20)+"...":P.card.title})]},P.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function hc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,l]=react.useState(""),[c,p]=react.useState(false),[n,m]=react.useState(null),[d,i]=react.useState(null),u=react.useRef(null),x=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&!x&&f();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,x]);let f=()=>{x||(l(""),m(null),i(null),t());},g=async()=>{if(!(!s.trim()||x)){p(true),m(null),i(null);try{let h=await r(s.trim());i(h);}catch(h){m(h instanceof Error?h.message:"Failed to generate plan");}finally{p(false);}}},k=()=>{d&&(a(d),f());};return e?jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:f,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,b)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},b))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,b)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},b)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:u,value:s,onChange:h=>l(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,b)=>jsxRuntime.jsx("button",{onClick:()=>l(h),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},b))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:f,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var pi={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var nh={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},sh={generatePlan:{enabled:true,minPlanTier:"hobby",estimatedTokens:2e3},predictRisks:{enabled:true,minPlanTier:"pro",estimatedTokens:1500},suggestAssignee:{enabled:true,minPlanTier:"hobby",estimatedTokens:800},generateReport:{enabled:true,minPlanTier:"enterprise",estimatedTokens:3e3},generateSubtasks:{enabled:true,minPlanTier:"hobby",estimatedTokens:1e3}};function ih(e,t,a){let r=pi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function wo(e){return `$${e.toFixed(4)}`}var mi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=ih(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,i)=>d+i.cost,0),s=a.reduce((d,i)=>d+i.inputTokens,0),l=a.reduce((d,i)=>d+i.outputTokens,0),c=a.filter(d=>d.success),p=a.reduce((d,i)=>d+i.duration,0),n={},m={};return a.forEach(d=>{n[d.feature]=(n[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:l,operationsByFeature:n,costsByFeature:m,averageDuration:r>0?p/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,l=new Date;a==="month"?l.setMonth(s.getMonth()-1):l.setDate(s.getDate()-1);let c=this.operations.filter(m=>m.timestamp>=l).length,p=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:n,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Nr=new mi;function vc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Nr.getStats()),[s,l]=react.useState(Nr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Nr.getStats()),l(Nr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=Nr.getRecentOperations(5);return jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:wo(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([p,n])=>{let m=r.costsByFeature[p]||0,d=r.totalOperations>0?n/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:p.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:wo(m)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(p=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:wo(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function wc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[l,c]=react.useState(""),[p,n]=react.useState(""),[m,d]=react.useState(""),[i,u]=react.useState(false),[x,f]=react.useState(null),[g,k]=react.useState(null),[h,b]=react.useState(null),y=react.useRef(null),D=i||o;react.useEffect(()=>{e&&y.current&&y.current.focus();},[e]),react.useEffect(()=>{let T=w=>{w.key==="Escape"&&!D&&N();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,D]);let N=()=>{D||(c(""),n(""),d(""),f(null),k(null),b(null),t());},A=async()=>{if(!(!l.trim()||D)){u(true),f(null),k(null),b(null);try{let T=await r({prompt:l.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});k(T.tasks.tasks),b({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){f(T instanceof Error?T.message:"Failed to generate tasks");}finally{u(false);}}},v=()=>{g&&(a(g),N());};if(!e)return null;let R=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:N,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((T,w)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",w+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:y,value:l,onChange:T=>c(T.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:T=>n(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:T=>d(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),x&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((T,w)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:T},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:N,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:A,disabled:!l.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Tn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&Mo(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(k,h,b)=>{console.warn(`Retry attempt ${h} after ${b}ms: ${k.message}`);}}).then(k=>{k.success||console.error(`Failed to persist board after ${k.attempts} attempts:`,k.error);});},[t]),s=react.useCallback(async(g,k,h)=>{r(b=>{let y=b.cards.find(T=>T.id===g);if(!y)return b;let D=y.columnId,N={...y,columnId:k,position:h},A=b.cards.map(T=>T.id===g?N:T),v=b.columns.map(T=>{if(T.id===D)return {...T,cardIds:T.cardIds.filter(w=>w!==g)};if(T.id===k){let w=A.filter(B=>B.columnId===k).sort((B,P)=>B.position-P.position);return {...T,cardIds:w.map(B=>B.id)}}return T}),R={...b,cards:A,columns:v};return o(R),R});},[o]),l=react.useCallback(async(g,k)=>{r(h=>{let b=h.cards.map(D=>D.id===g?{...D,...k}:D),y={...h,cards:b};return o(y),y});},[o]),c=react.useCallback(async g=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:k},y=h.columns.map(N=>N.id===g.columnId?{...N,cardIds:[...N.cardIds,k]}:N),D={...h,cards:[...h.cards,b],columns:y};return o(D),D});},[o]),p=react.useCallback(async g=>{r(k=>{let h=k.cards.find(N=>N.id===g);if(!h)return k;let b=k.cards.filter(N=>N.id!==g),y=k.columns.map(N=>N.id===h.columnId?{...N,cardIds:N.cardIds.filter(A=>A!==g)}:N),D={...k,cards:b,columns:y};return o(D),D});},[o]),n=react.useCallback(async g=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:k,cardIds:[]},y={...h,columns:[...h.columns,b]};return o(y),y});},[o]),m=react.useCallback(async(g,k)=>{r(h=>{let b=h.columns.map(D=>D.id===g?{...D,...k}:D),y={...h,columns:b};return o(y),y});},[o]),d=react.useCallback(async g=>{r(k=>{let h=k.cards.filter(D=>D.columnId!==g),b=k.columns.filter(D=>D.id!==g),y={...k,cards:h,columns:b};return o(y),y});},[o]),i=react.useCallback(g=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(g),k},[c]),u=react.useCallback(g=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(g),k},[n]),x=react.useCallback(()=>{r(g=>{let k={...g,cards:[],columns:[]};return o(k),k});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:l,onCardCreate:c,onCardDelete:p,onColumnCreate:n,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:p,deleteColumn:d,clearBoard:x}}}function Tc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Tn({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(p,n,m={})=>{s.addCard({title:n,columnId:p,position:r.cards.filter(d=>d.columnId===p).length,...m});},addColumn:(p,n)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:p,position:n??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:l}}var Co={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Nc={by:"none",order:"asc"};function Sc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Co,...e}),[s,l]=react.useState({...Nc,...t}),c=react.useCallback(f=>{o(g=>({...g,...f}));},[]),p=react.useCallback(f=>{l(g=>({...g,...f}));},[]),n=react.useCallback(()=>{o(Co),l(Nc);},[]),m=react.useCallback(()=>{a&&o({...Co,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Co,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...Co,priorities:["HIGH","URGENT"]});},[]),u=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),x=react.useCallback(f=>{let g=[...f];if(r.search){let k=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(k)||h.description?.toLowerCase().includes(k));}if(r.dateFilter!=="all"){let k=new Date,h=k.getFullYear(),b=String(k.getMonth()+1).padStart(2,"0"),y=String(k.getDate()).padStart(2,"0"),D=`${h}-${b}-${y}`;g=g.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let A=N.endDate||N.dueDate;if(!A)return false;let v;if(typeof A=="string")v=A.split("T")[0]||A;else {let R=A.getUTCFullYear(),T=String(A.getUTCMonth()+1).padStart(2,"0"),w=String(A.getUTCDate()).padStart(2,"0");v=`${R}-${T}-${w}`;}switch(r.dateFilter){case "overdue":return v<D;case "today":return v===D;case "this-week":let R=new Date(D+"T00:00:00"),T=new Date(v+"T00:00:00"),w=new Date(R);return w.setDate(w.getDate()+7),T>=R&&T<=w;case "custom":if(r.dateRange){let B=typeof A=="string"?new Date(A):A;return B>=r.dateRange.start&&B<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(k=>k.priority&&r.priorities.includes(k.priority))),r.assignees.length>0&&(g=g.filter(k=>(k.assignedUserIds||(k.assigneeId?[k.assigneeId]:[])).some(b=>r.assignees.includes(b)))),r.labels.length>0&&(g=g.filter(k=>k.labels&&k.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(k=>r.columns.includes(k.columnId))),s.by!=="none"&&g.sort((k,h)=>{let b=0;switch(s.by){case "created":let y=k.createdAt?new Date(k.createdAt).getTime():0,D=h.createdAt?new Date(h.createdAt).getTime():0;b=y-D;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},A=N[k.priority||"LOW"],v=N[h.priority||"LOW"];b=A-v;break;case "dueDate":let R=k.endDate||k.dueDate,T=h.endDate||h.dueDate;if(!R)return 1;if(!T)return -1;let w=typeof R=="string"?new Date(R).getTime():R.getTime(),B=typeof T=="string"?new Date(T).getTime():T.getTime();b=w-B;break;case "title":b=k.title.localeCompare(h.title);break;case "estimate":let P=k.estimatedTime||0,H=h.estimatedTime||0;b=P-H;break;default:b=0;}return s.order==="asc"?b:-b}),g},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:p,resetFilters:n,filterMyTasks:m,filterOverdue:d,filterHighPriority:i,applyFilters:x,hasActiveFilters:u}}var Pc,Mc;if(typeof window<"u")try{let e=So("ai");Pc=e.generateObject,Mc=e.generateText;}catch{}function Ac(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Pc&&Mc&&e.apiKey),l=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:l,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:n,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function gi(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function Ic(e){let{cards:t}=e,[a,r]=gi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let u=i.ctrlKey||i.metaKey,x=i.shiftKey;if(u)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(x&&a.lastSelectedCardId){let f=t.find(k=>k.id===d),g=t.find(k=>k.id===a.lastSelectedCardId);if(f&&g&&f.columnId===g.columnId){let k=t.filter(v=>v.columnId===f.columnId).sort((v,R)=>v.position-R.position),h=k.findIndex(v=>v.id===a.lastSelectedCardId),b=k.findIndex(v=>v.id===d),[y,D]=h<b?[h,b]:[b,h],N=k.slice(y,D+1).map(v=>v.id),A=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:A,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),l=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(d=>{a.selectedCardIds.includes(d)?l(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,l,r]),m=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:l,clearSelection:c,selectAll:p,toggleCard:n,getSelectedCards:m}}var Lc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Fc(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Lc,...a}),[a]),[s,l]=react.useState([]),c=react.useCallback((f,g,k,h,b)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let y={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:g,columnId:k,strategy:h,color:b,isExpanded:true,position:s.filter(D=>D.columnId===k).length,createdAt:new Date};l(D=>[...D,y]);},[o.minCardsPerStack,s]),p=react.useCallback(f=>{l(g=>g.filter(k=>k.id!==f));},[]),n=react.useCallback(f=>{l(g=>g.map(k=>k.id===f?{...k,isExpanded:!k.isExpanded}:k));},[]),m=react.useCallback((f,g)=>{l(k=>k.map(h=>h.id===f&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=react.useCallback((f,g)=>{l(k=>k.map(h=>{if(h.id===f){let b=h.cardIds.filter(y=>y!==g);return b.length<o.minCardsPerStack?null:{...h,cardIds:b}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),i=react.useCallback(f=>s.filter(g=>g.columnId===f).sort((g,k)=>g.position-k.position),[s]),u=react.useCallback(async f=>{let g=t.filter(D=>D.columnId===f);if(g.length<o.minCardsPerStack*2)return [];let k=[],h=new Map;g.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(D);});}),h.forEach((D,N)=>{D.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${N}"`,confidence:.85});});let b=new Map;g.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(N=>{b.has(N)||b.set(N,[]),b.get(N).push(D);});}),b.forEach((D,N)=>{D.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let y=new Map;if(g.forEach(D=>{D.priority&&(y.has(D.priority)||y.set(D.priority,[]),y.get(D.priority).push(D));}),y.forEach((D,N)=>{if(D.length>=o.minCardsPerStack){let A={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";k.push({stack:{title:`${A} ${N} Priority`,cardIds:D.map(v=>v.id),columnId:f,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of g){let A=(await r.findSimilar(D,g)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(A.length>=o.minCardsPerStack-1){let v=[D.id,...A.map(T=>T.card.id)],R=A.reduce((T,w)=>T+w.similarity,0)/A.length;k.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:v,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${A.length+1} similar tasks`,confidence:R});}}return k.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,N)=>N.confidence-D.confidence).slice(0,5)},[t,o,r]),x=react.useCallback(f=>{c(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let k=await u(g),h=k[0];k.length>0&&h&&h.confidence>=.9&&x(h);});},[]),{stacks:s,createStack:c,deleteStack:p,toggleStack:n,addToStack:m,removeFromStack:d,getStacksForColumn:i,getSuggestions:u,applySuggestion:x,config:o}}var Bc=react.createContext(null);function Rc({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,l=new Map;t?.columns?.forEach(p=>{let{Column:n}=So("@libxai/core");s.set(p.id,new n(p));}),t?.cards?.forEach(p=>{let{Card:n}=So("@libxai/core");l.set(p.id,new n(p));});let c=null;if(t?.board){let{Board:p}=So("@libxai/core");c=new p(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Bc.Provider,{value:{store:o},children:e})}function Dn(){let e=react.useContext(Bc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Do(){let e=Dn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,l]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let c=react.useCallback(h=>{e.updateBoard(h);},[e]),p=react.useCallback(h=>{e.addColumn(h);},[e]),n=react.useCallback((h,b)=>{e.updateColumn(h,b);},[e]),m=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),i=react.useCallback(h=>{e.addCard(h);},[e]),u=react.useCallback((h,b)=>{e.updateCard(h,b);},[e]),x=react.useCallback(h=>{e.deleteCard(h);},[e]),f=react.useCallback((h,b,y)=>{e.moveCard(h,b,y);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),k=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:p,updateColumn:n,deleteColumn:m,getColumn:d,addCard:i,updateCard:u,deleteCard:x,moveCard:f,getCard:g,getCardsByColumn:k}}function zc(e){let{cards:t}=Do();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function $c(e="position",t="asc"){let{cards:a}=Do();return react.useMemo(()=>[...a].sort((o,s)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;l=p-n;break}case "createdAt":l=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":l=o.position-s.position;break}return t==="asc"?l:-l}),[a,e,t])}var Nn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Hi.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let l=s[t];if(typeof l=="function")try{let c=await Promise.resolve(l.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Th=new Nn;function Wc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:l=false,gap:c=0,getItemKey:p}){let n=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:l,gap:c}),d=m.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:d.map(x=>{let f=e[x.index];if(!f)return null;let g=p?p(f,x.index):x.index,k={position:"absolute",top:l?0:x.start,left:l?x.start:0,width:l?x.size:"100%",height:l?"100%":x.size};return jsxRuntime.jsx("div",{style:k,"data-index":x.index,children:r(f,x.index)},g)})})})}function Hc(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function _c({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:l=3,gap:c=16,getItemKey:p,horizontal:n=true}){let m=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:l,gap:c}),i=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:s,children:jsxRuntime.jsx("div",{style:x,children:i.map(f=>{let g=e[f.index];if(!g)return null;let k=p?p(g,f.index):f.index,h={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":f.index,children:o(g,f.index)},k)})})})}function Vc(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function jc(e,t=10){return e>t}var yi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},vi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},xi={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ki={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},wi={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ci={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ti={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Di={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},Ni={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},Si={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Ei={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},Pi={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},Sn={spacing:yi,borderRadius:vi,fontSize:xi,fontWeight:ki,lineHeight:wi,zIndex:Ci,duration:Ti,easing:Di,shadows:Ni,opacity:Si,kanban:Ei,gantt:Pi};function Kc(e,t,a){return e[t]??a}function Mi(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Mi(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Sh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ai(e="asakaa"){let t=Mi(Sn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,l=Sh(o);a.push(` ${s}: ${l};`);}return `:root {
389
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function $d(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ka(e,t){let a=$d(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let l=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return l.every(n=>p.includes(n))})}function _s(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let u={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(u!==void 0){let x=new Date(r),f=x.getDay(),g=u-f;return g<=0&&(g+=7),x.setDate(x.getDate()+g),x}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),x=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?x.setDate(x.getDate()+i):u==="week"||u==="semana"||u==="semanas"?x.setDate(x.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&x.setMonth(x.getMonth()+i),x}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,x=parseInt(c[3],10);return new Date(x,u,i)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=p[n[2].toLowerCase()],x=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(x,u,i)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let i=m[d[1].toLowerCase()],u=parseInt(d[2],10),x=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(x,i,u)}return null}function Vs(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function js(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Ud(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function Wd(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let n=r[1].trim(),m=r[2].trim(),d=Ka(t,n),i=_s(m);if(!d)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(i);return x.setDate(x.getDate()+u),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:x},message:`Moved "${d.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),m=o[2].trim(),d=Ka(t,n),i=Vs(m);if(!d)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(d.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:u},message:`Extended "${d.name}" by ${i} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let n=s[1].trim(),m=s[2].trim(),d=Ka(t,n),i=js(m);return d?i===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:i},message:`Set "${d.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let l=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let n=l[1].trim(),m=l[2].trim(),d=Ka(t,n);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),m=c[2].trim(),d=Ka(t,n),i=Ka(t,m);return d?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:d.id,dependencyTo:i.id,message:`Linked "${d.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let n=p[1].trim(),m=Ka(t,n);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Hd(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function Tf(e){if(e)switch(e.toUpperCase()){case "TODO":case "BLOCKED":return "todo";case "IN_PROGRESS":case "REVIEW":return "in-progress";case "DONE":return "completed";default:return "todo"}}function Df(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function pn(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(i=>i.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>pn(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let l=m=>{if(m)return typeof m=="string"?new Date(m):m},c=l(e.startDate),p=l(e.endDate),n=e.metadata?.isMilestone===true||c&&p&&Math.abs(p.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:p,progress:e.progress||0,status:Tf(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function Gd(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:Df(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function _d(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>pn(r,e,t))}var Ks={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Ys={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},mn={en:Ks,es:Ys};function qs(e){return mn[e]||mn.en}function un(e,t){let a=qs(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function Yd(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Yd(r.subtasks,t+1));return a}function Rf({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function qd({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:l}){let{theme:c="dark",locale:p="en",customTranslations:n,showSearch:m=true,showHierarchy:d=true}=t,i=un(p,n),u=c==="dark",[x,f]=react.useState(new Set),[g,k]=react.useState("startDate"),[h,b]=react.useState("asc"),[y,D]=react.useState("");react.useMemo(()=>{let T=new Set;function w(B){for(let P of B)P.subtasks?.length&&(T.add(P.id),w(P.subtasks));}w(e),f(T);},[e]);let N=react.useCallback(T=>{f(w=>{let B=new Set(w);return B.has(T)?B.delete(T):B.add(T),B}),a.onTaskToggleExpand?.(T);},[a]),A=react.useCallback(T=>{g===T?b(w=>w==="asc"?"desc":"asc"):(k(T),b("asc")),a.onSortChange?.({column:T,direction:h==="asc"?"desc":"asc"});},[g,h,a]),v=react.useMemo(()=>{let T=Yd(e);if(y.trim()){let B=y.toLowerCase();T=T.filter(P=>P.name.toLowerCase().includes(B));}let w=[];for(let B of T){let P=B.level===0;B.level>0&&(P=true),(P||y.trim())&&w.push(B);}return y.trim()&&w.sort((B,P)=>{let H,X;switch(g){case "name":H=B.name.toLowerCase(),X=P.name.toLowerCase();break;case "startDate":H=B.startDate?.getTime()||0,X=P.startDate?.getTime()||0;break;case "endDate":H=B.endDate?.getTime()||0,X=P.endDate?.getTime()||0;break;case "progress":H=B.progress||0,X=P.progress||0;break;case "status":H=B.status||"todo",X=P.status||"todo";break;default:return 0}return H<X?h==="asc"?-1:1:H>X?h==="asc"?1:-1:0}),w},[e,y,g,h]),R=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:C("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:l,children:[jsxRuntime.jsx("div",{className:C("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[m&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:C("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:y,onChange:T=>D(T.target.value),placeholder:i.toolbar.searchPlaceholder,className:C("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[v.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:C("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>A("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v.map((T,w)=>{let B=x.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:w*.02},className:C("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:P=>{P.stopPropagation(),N(T.id);},className:C("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:B?jsxRuntime.jsx(lucideReact.ChevronDown,{className:C("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:C("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),d&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:P=>{P.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Rf,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:C("truncate",u?"text-white":"text-gray-900",T.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:C("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?i.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:C("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),R(T.startDate)]}),jsxRuntime.jsxs("div",{className:C("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),R(T.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:C("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:C("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:C("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),v.length===0&&y&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:C("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:C(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Xs={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Js={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da"},Zs={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},fn={dark:Xs,light:Js,neutral:Zs};function Xd(e){return fn[e]||fn.dark}var Qs={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},ei={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},hn={en:Qs,es:ei};function vo(e){return hn[e]||hn.en}function bn(e,t){let a=vo(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function Jd(e){let t=vo(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function Zd(e,t=0,a=true){let r=vo(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function qf(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function ni(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function tc({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function rc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:l,style:c}){let{theme:p="dark",locale:n="en",customTranslations:m}=t,d=bn(n,m),i=p==="dark",[u,x]=react.useState(r||new Date),[f,g]=react.useState(null),[k,h]=react.useState(null),[b,y]=react.useState(null),[D,N]=react.useState(new Date),[A,v]=react.useState({}),R=4,T=3,[w,B]=react.useState(false),[P,H]=react.useState(false),[X,ye]=react.useState(false),[ke,Ae]=react.useState(null),[Fe,z]=react.useState(""),[F,W]=react.useState(void 0),[E,K]=react.useState(null),[ae,O]=react.useState(false),[Me,he]=react.useState(false),[qe,me]=react.useState(null),[tt,we]=react.useState(false),[st,ht]=react.useState(new Date),Bt=react.useCallback(()=>{x(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),Ze=react.useCallback(()=>{x(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),$=react.useCallback(()=>{x(new Date);},[]),ne=react.useMemo(()=>{let I=u.getFullYear(),Y=u.getMonth(),He=new Date(I,Y,1),We=new Date(I,Y+1,0),bt=He.getDay(),J=We.getDate(),Q=qf(e),xe=new Date;xe.setHours(0,0,0,0);let Ce=[],re=bt,Pe=new Date(I,Y,0).getDate();for(let Ne=re-1;Ne>=0;Ne--){let se=new Date(I,Y-1,Pe-Ne);Ce.push({date:se,isCurrentMonth:false,isToday:false,isWeekend:se.getDay()===0||se.getDay()===6,events:Q.filter(Re=>ni(se,Re)).map(Re=>({id:Re.id,title:Re.name,start:Re.startDate,end:Re.endDate,task:Re}))});}for(let Ne=1;Ne<=J;Ne++){let se=new Date(I,Y,Ne),Re=se.getTime()===xe.getTime();Ce.push({date:se,isCurrentMonth:true,isToday:Re,isWeekend:se.getDay()===0||se.getDay()===6,events:Q.filter(Le=>ni(se,Le)).map(Le=>({id:Le.id,title:Le.name,start:Le.startDate,end:Le.endDate,task:Le}))});}let ve=42-Ce.length;for(let Ne=1;Ne<=ve;Ne++){let se=new Date(I,Y+1,Ne);Ce.push({date:se,isCurrentMonth:false,isToday:false,isWeekend:se.getDay()===0||se.getDay()===6,events:Q.filter(Re=>ni(se,Re)).map(Re=>({id:Re.id,title:Re.name,start:Re.startDate,end:Re.endDate,task:Re}))});}return Ce},[u,e]),be=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Te=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),De=react.useCallback((I,Y)=>{if(!f)return;let He={...f,[I]:Y};g(He),a.onTaskUpdate?.(He);},[f,a]),Ye=react.useCallback(I=>{if(!f)return;let Y=f.progress||0;I==="completed"?Y=100:I==="todo"&&(Y=0);let He={...f,status:I,progress:Y};g(He),a.onTaskUpdate?.(He),B(false);},[f,a]),mt=react.useCallback((I,Y)=>{if(!f)return;let He={...f,startDate:I,endDate:Y};g(He),a.onTaskUpdate?.(He);},[f,a]),Ie=react.useCallback(()=>{B(false),H(false),y(null);},[]);return o?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsxRuntime.jsx("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:C("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",l),style:c,children:[jsxRuntime.jsx("div",{className:C("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:C("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:Te}),jsxRuntime.jsx("button",{onClick:$,className:C("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:d.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Bt,className:C("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:C("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Ze,className:C("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:C("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:be.map(I=>jsxRuntime.jsx("div",{className:C("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:I},I))}),jsxRuntime.jsx("div",{className:C("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:ne.map((I,Y)=>{let He=I.date.getDay()===0||I.date.getDay()===6;return jsxRuntime.jsxs("div",{className:C("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?He?"bg-[#1C1F26]":I.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":He?"bg-gray-100":I.isCurrentMonth?"bg-white":"bg-gray-50",I.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let We=A[Y]||R,bt=I.events.slice(0,We),J=I.events.length-We;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[bt.map(Q=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{g(Q.task),a.onEventClick?.(Q);},whileHover:{scale:1.02},className:C("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Q.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(tc,{task:Q.task}),jsxRuntime.jsx("span",{className:"truncate",children:Q.title})]})},Q.id)),J>0&&jsxRuntime.jsxs("button",{onClick:Q=>{Q.stopPropagation(),v(xe=>({...xe,[Y]:We+T}));},className:C("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",J," ",n==="es"?"M\xC1S":"MORE"]}),We>R&&I.events.length>R&&jsxRuntime.jsx("button",{onClick:Q=>{Q.stopPropagation(),v(xe=>({...xe,[Y]:R}));},className:C("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let We=Y>=28,bt=Y%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),ke===Y?Ae(null):(Ae(Y),z(""),W(void 0),K(null),me(null),O(false),he(false),we(false),ht(I.date));},className:C("w-5 h-5 rounded flex items-center justify-center transition-all",ke===Y?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:C("w-3.5 h-3.5 transition-transform",ke===Y&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke===Y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ae(null),z(""),W(void 0),K(null),me(null),O(false),he(false),we(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:We?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:We?-5:5,scale:.95},transition:{duration:.12},className:C("absolute w-[320px] rounded-lg shadow-2xl z-50",We?"bottom-full mb-1":"top-full mt-1",bt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>{J.stopPropagation(),O(false),he(false),we(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Fe,onChange:J=>z(J.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:C("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:J=>{if(J.key==="Enter"&&Fe.trim()){let Q=t.availableUsers?.find(Ce=>Ce.id===E),xe=qe||I.date;a.onTaskCreate?.({name:Fe.trim(),startDate:xe,endDate:xe,priority:F,assignees:Q?[Q]:void 0}),z(""),W(void 0),K(null),me(null),Ae(null);}J.key==="Escape"&&(Ae(null),z(""),W(void 0),K(null),me(null));}})}),jsxRuntime.jsxs("div",{className:C("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),O(!ae),he(false);},className:C("p-1 rounded transition-colors",F?F==="urgent"||F==="high"?"text-red-400 bg-red-500/20":F==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxRuntime.jsxs("button",{onClick:()=>{W(J.id),O(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",F===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",J.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:J=>{J.stopPropagation(),we(!tt),O(false),he(false),ht(qe||I.date);},className:C("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",qe?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(qe||I.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("div",{className:C("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,Q=new Date(J);Q.setDate(J.getDate()+1);let xe=new Date(J);xe.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let Ce=new Date(J);Ce.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let re=new Date(J);re.setDate(J.getDate()+14);let Pe=new Date(J);return Pe.setDate(J.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:xe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ce,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:re,display:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Pe,display:Pe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ne,se)=>jsxRuntime.jsxs("button",{className:C("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{me(Ne.date),we(false);},children:[jsxRuntime.jsx("span",{children:Ne.label}),jsxRuntime.jsx("span",{className:C("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Ne.display})]},se))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:C("text-xs font-medium",i?"text-white":"text-gray-900"),children:st.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>ht(new Date),className:C("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ht(new Date(st.getFullYear(),st.getMonth()-1)),className:C("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>ht(new Date(st.getFullYear(),st.getMonth()+1)),className:C("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsxRuntime.jsx("div",{className:C("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:J},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=st.getFullYear(),Q=st.getMonth(),xe=new Date(J,Q,1).getDay(),Ce=new Date(J,Q+1,0).getDate(),re=new Date(J,Q,0).getDate(),Pe=new Date,ve=[];for(let se=xe-1;se>=0;se--)ve.push({dayNum:re-se,isCurrentMonth:false,date:new Date(J,Q-1,re-se)});for(let se=1;se<=Ce;se++)ve.push({dayNum:se,isCurrentMonth:true,date:new Date(J,Q,se)});let Ne=42-ve.length;for(let se=1;se<=Ne;se++)ve.push({dayNum:se,isCurrentMonth:false,date:new Date(J,Q+1,se)});return ve.map((se,Re)=>{let Le=se.date.toDateString()===Pe.toDateString(),$e=(qe||I.date).toDateString()===se.date.toDateString();return jsxRuntime.jsx("button",{className:C("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!se.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),se.isCurrentMonth&&(i?"text-white":"text-gray-900"),Le&&"ring-1 ring-[#3B82F6]",$e&&"bg-[#7C3AED] text-white",!$e&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{me(se.date),we(false);},children:se.dayNum},Re)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),he(!Me),O(false);},className:C("p-1 rounded transition-colors",E?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:E?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(J=>J.id===E)?.color||"#7C3AED"},children:t.availableUsers?.find(J=>J.id===E)?.initials||t.availableUsers?.find(J=>J.id===E)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Me&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{K(null),he(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!E&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:C("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(J=>jsxRuntime.jsxs("button",{onClick:()=>{K(J.id),he(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",E===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:J.color||"#7C3AED"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.name})]},J.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:C("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Fe.trim()){let J=t.availableUsers?.find(xe=>xe.id===E),Q=qe||I.date;a.onTaskCreate?.({name:Fe.trim(),startDate:Q,endDate:Q,priority:F,assignees:J?[J]:void 0}),z(""),W(void 0),K(null),me(null),Ae(null);}},disabled:!Fe.trim(),className:C("px-2.5 py-1 rounded text-xs font-medium transition-colors",Fe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:C("text-sm font-medium",I.isToday?"text-[#3B82F6]":I.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:I.date.getDate()})]})]},Y)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>g(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:C("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:C("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:C("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:C("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:C("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:C("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:C("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:C("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>g(null),className:C("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let I=f.progress===100?0:100,He={...f,progress:I,status:I===100?"completed":"todo"};g(He),a.onTaskUpdate?.(He);},className:C("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:C("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ie(),B(!w);},className:C("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?n==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>B(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(I=>jsxRuntime.jsxs("button",{onClick:()=>Ye(I.id),className:C("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===I.id||I.id==="completed"&&f.progress===100||I.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||I.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",I.id==="completed"?"bg-green-500":I.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:I.label})]},I.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((I,Y)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:I.color||"#8B5CF6"},title:I.name,children:I.initials||I.name.slice(0,2).toUpperCase()},Y)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:C("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{y(b?null:"start"),N(f.startDate||new Date);},className:C("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:C("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:I=>{I.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>y(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:C("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:C("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let I=new Date,Y=new Date(I);Y.setDate(I.getDate()+1);let He=new Date(I);He.setDate(I.getDate()+((6-I.getDay()+7)%7||7));let We=new Date(I);We.setDate(I.getDate()+((1-I.getDay()+7)%7||7));let bt=new Date(I);bt.setDate(I.getDate()+(6-I.getDay()+7)%7+7);let J=new Date(I);J.setDate(I.getDate()+14);let Q=new Date(I);return Q.setDate(I.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:I,display:I.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Y,display:Y.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:He,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:We,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:bt,display:bt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ce,re)=>jsxRuntime.jsxs("button",{className:C("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(b==="start"){let Pe=f.endDate&&Ce.date>f.endDate?Ce.date:f.endDate;mt(Ce.date,Pe),y("end");}else {let Pe=f.startDate&&Ce.date<f.startDate?Ce.date:f.startDate;mt(Pe,Ce.date),y(null);}},children:[jsxRuntime.jsx("span",{children:Ce.label}),jsxRuntime.jsx("span",{className:C("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:Ce.display})]},re))})(),jsxRuntime.jsx("div",{className:C("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{mt(void 0,void 0),y(null);},className:C("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:C("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:b==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>N(new Date),className:C("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>N(new Date(D.getFullYear(),D.getMonth()-1)),className:C("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>N(new Date(D.getFullYear(),D.getMonth()+1)),className:C("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(I=>jsxRuntime.jsx("div",{className:C("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:I},I))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let I=D.getFullYear(),Y=D.getMonth(),He=new Date(I,Y,1).getDay(),We=new Date(I,Y+1,0).getDate(),bt=new Date(I,Y,0).getDate(),J=new Date,Q=[];for(let Ce=He-1;Ce>=0;Ce--)Q.push({day:bt-Ce,isCurrentMonth:false,date:new Date(I,Y-1,bt-Ce)});for(let Ce=1;Ce<=We;Ce++)Q.push({day:Ce,isCurrentMonth:true,date:new Date(I,Y,Ce)});let xe=42-Q.length;for(let Ce=1;Ce<=xe;Ce++)Q.push({day:Ce,isCurrentMonth:false,date:new Date(I,Y+1,Ce)});return Q.map((Ce,re)=>{let Pe=Ce.date.toDateString()===J.toDateString(),ve=f.startDate?.toDateString()===Ce.date.toDateString(),Ne=f.endDate?.toDateString()===Ce.date.toDateString(),se=ve||Ne,Re=f.startDate&&f.endDate&&Ce.date>=f.startDate&&Ce.date<=f.endDate;return jsxRuntime.jsx("button",{className:C("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Ce.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),Ce.isCurrentMonth&&(i?"text-white":"text-gray-900"),Pe&&"ring-2 ring-[#3B82F6]",ve&&"bg-[#3B82F6] text-white",Ne&&!ve&&"bg-[#7C3AED] text-white",Re&&!se&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!se&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let Le=new Date(Ce.date);if(b==="start"){let $e=f.endDate&&Le>f.endDate?Le:f.endDate;mt(Le,$e),y("end");}else {let $e=f.startDate&&Le<f.startDate?Le:f.startDate;mt($e,Le),y(null);}},children:Ce.day},re)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ie(),H(!P);},className:C("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>H(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(I=>jsxRuntime.jsxs("button",{onClick:()=>{De("priority",I.id),H(false);},className:C("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===I.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",I.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:I.label})]},I.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:C("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[X?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:I=>{let Y=parseInt(I.target.value),He=f.status;Y===100?He="completed":Y>0?He="in-progress":He="todo";let We={...f,progress:Y,status:He};g(We),a.onTaskUpdate?.(We);},onBlur:()=>ye(false),className:C("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>ye(true),className:C("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:C("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:C("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:C("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:C("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(I=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:C("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",I.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:I.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:C("text-sm",I.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:I.name})]},I.id))}),jsxRuntime.jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:C("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:C("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:C("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:C("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:C("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:C("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:C("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:C("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:C("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:C("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:C("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:C("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:k.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:C("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:k.events.map(I=>jsxRuntime.jsxs("button",{onClick:()=>{h(null),g(I.task);},className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(tc,{task:I.task}),jsxRuntime.jsx("span",{className:C("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:I.title}),I.task.priority==="high"||I.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},I.id))})]})]})})]})}var si={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},ii={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da"},li={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1"},kn={dark:si,light:ii,neutral:li};function oc(e){return kn[e]||kn.dark}function Jf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:l,className:c}){let[p,n]=react.useState(false),m=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),d=react.useMemo(()=>{let u=m.length,x=new Set(m.flatMap(k=>k.assignedUserIds||[])).size,f=m.map(k=>k.priority).filter(Boolean),g=new Set(m.flatMap(k=>k.labels||[])).size;return {totalCards:u,uniqueAssignees:x,priorities:f,labels:g}},[m]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:C("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:C("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),p&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),l?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:m.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:m.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),s?.(e.id,u.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},u.id))})})]})}var sc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function xo(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function ko(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function ic(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function lc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:l,className:c}){let p=react.useMemo(()=>({...sc,...l}),[l]),[n,m]=react.useState(new Set),d=react.useRef(null),i=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(b=>{let y=b.timestamp.toISOString().split("T")[0],D=h.get(y);D?D.push(b):h.set(y,[b]);}),Array.from(h.entries()).sort((b,y)=>y[0].localeCompare(b[0])).map(([b,y])=>({date:new Date(b),events:y.sort((D,N)=>N.timestamp.getTime()-D.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:x}=react.useMemo(()=>{let h=new Set,b=new Set;return e.forEach(y=>{h.add(y.userId),b.add(y.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(b)}},[e]),f=h=>{m(b=>{let y=new Set(b);return y.has(h)?y.delete(h):y.add(h),y});},g=h=>{let y=new Date().getTime()-h.getTime(),D=Math.floor(y/6e4),N=Math.floor(y/36e5),A=Math.floor(y/864e5);return D<1?"just now":D<60?`${D}m ago`:N<24?`${N}h ago`:A<7?`${A}d ago`:h.toLocaleDateString()},k=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:C("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:C("history-timeline",p.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,types:b?[b]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),x.map(h=>jsxRuntime.jsxs("option",{value:h,children:[ko(h)," ",h.replace("_"," ")]},h))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,users:b?[b]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),k>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",k,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:i.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((b,y)=>{let D=n.has(b.id),N=s===b.id,A=ic(b.type);return jsxRuntime.jsxs("div",{"data-event-id":b.id,className:C("history-timeline-event",D&&"expanded",N&&"selected"),onClick:()=>o?.(b),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:A},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ko(b.type)})}),y<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:A}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[p.showAvatars&&b.userAvatar&&jsxRuntime.jsx("img",{src:b.userAvatar,alt:b.userName||b.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:b.userName||b.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:xo(b)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?g(b.timestamp):b.timestamp.toLocaleString()})]}),Object.keys(b.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),f(b.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(b.changes).map(([v,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},v)),b.metadata&&Object.keys(b.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(b.metadata).map(([v,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},v))]})]})]})]},b.id)})})]},h.date?.toISOString()||"all"))})]})}function cc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:l,onGoToEvent:c,onSpeedChange:p,className:n}){let m=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:C("history-replay-empty",n),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:C("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&ko(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&xo(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,x)=>jsxRuntime.jsx("div",{className:C("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>c(x),title:xo(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:l,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(u=>jsxRuntime.jsxs("button",{className:C("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>p(u),children:[u,"x"]},u))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:C("history-replay-start",n),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function di(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function ci(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function pc(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function mc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function rh(e,t,a,r,o,s=100){let l=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(l.map(p=>[p.id,p]));for(let p=0;p<s;p++){let n=1-p/s;l.forEach(m=>{let d=a/2,i=r/2;m.vx+=(d-m.x)*o.centerForce*n,m.vy+=(i-m.y)*o.centerForce*n,l.forEach(u=>{if(m.id===u.id)return;let x=m.x-u.x,f=m.y-u.y,g=Math.sqrt(x*x+f*f)||1,k=o.chargeStrength*n/(g*g);m.vx+=x/g*k,m.vy+=f/g*k;});}),t.forEach(m=>{let d=c.get(typeof m.source=="string"?m.source:m.source.id),i=c.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!i)return;let u=i.x-d.x,x=i.y-d.y,f=Math.sqrt(u*u+x*x)||1,g=(f-o.linkDistance)/f*o.forceStrength*n;d.vx+=u*g,d.vy+=x*g,i.vx-=u*g,i.vy-=x*g;}),l.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return l}function uc({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:l,onInteraction:c,className:p}){let n=react.useRef(null),[m,d]=react.useState([]),[i,u]=react.useState(null),[x,f]=react.useState(null),[g,k]=react.useState(null),[h,b]=react.useState(1),[y,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let P=rh(e,t,a.width,a.height,a,150);d(P);},[e,t,a]);let N=react.useCallback((P,H)=>{a.enableDragging&&(H.stopPropagation(),u(P));},[a.enableDragging]),A=react.useCallback(P=>{if(!i||!n.current)return;let X=n.current.getBoundingClientRect(),ye=(P.clientX-X.left-y.x)/h,ke=(P.clientY-X.top-y.y)/h;d(Ae=>Ae.map(Fe=>Fe.id===i?{...Fe,x:ye,y:ke,fx:ye,fy:ke}:Fe));},[i,h,y]),v=react.useCallback(()=>{u(null);},[]),R=react.useCallback((P,H)=>{H.stopPropagation(),c?.({type:"node-click",node:P,position:{x:H.clientX,y:H.clientY}});},[c]),T=react.useCallback((P,H)=>{H.stopPropagation(),c?.({type:"edge-click",edge:P,position:{x:H.clientX,y:H.clientY}});},[c]),w=react.useCallback(P=>{let H=m.find(X=>X.id===P);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),B=react.useCallback(P=>{if(P.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return P.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=P.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return P.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:C("relationships-graph-empty",p),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:C("relationships-graph",p),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(P=>Math.min(P+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(P=>Math.max(P-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{b(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(P=>P.type))).map(P=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:di(P)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[pc(P)," ",ci(P)]})]},P))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:A,onMouseUp:v,onMouseLeave:v,children:[jsxRuntime.jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(P=>{let H=w(typeof P.source=="string"?P.source:P.source.id),X=w(typeof P.target=="string"?P.target:P.target.id),ye=mc(P.type),ke=g===P.id,Ae=P.onCriticalPath;return jsxRuntime.jsxs("g",{className:C("relationships-graph-edge",ke&&"hovered",Ae&&"critical"),onMouseEnter:()=>k(P.id),onMouseLeave:()=>k(null),onClick:Fe=>T(P,Fe),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:X.x,y2:X.y,stroke:di(P.type),strokeWidth:Ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ke?1:.6,markerEnd:ye?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ke&&jsxRuntime.jsx("text",{x:(H.x+X.x)/2,y:(H.y+X.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ci(P.type)})]},P.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(P=>{let H=x===P.id,X=P.onCriticalPath;return jsxRuntime.jsxs("g",{className:C("relationships-graph-node",H&&"hovered",X&&"critical"),transform:`translate(${P.x}, ${P.y})`,onMouseDown:ye=>N(P.id,ye),onMouseEnter:()=>f(P.id),onMouseLeave:()=>f(null),onClick:ye=>R(P,ye),children:[jsxRuntime.jsx("circle",{r:X?a.nodeSize*1.2:a.nodeSize,fill:B(P),stroke:X?"#fbbf24":"#ffffff",strokeWidth:X?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:P.card.title.length>20?P.card.title.substring(0,20)+"...":P.card.title})]},P.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function hc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,l]=react.useState(""),[c,p]=react.useState(false),[n,m]=react.useState(null),[d,i]=react.useState(null),u=react.useRef(null),x=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&!x&&f();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,x]);let f=()=>{x||(l(""),m(null),i(null),t());},g=async()=>{if(!(!s.trim()||x)){p(true),m(null),i(null);try{let h=await r(s.trim());i(h);}catch(h){m(h instanceof Error?h.message:"Failed to generate plan");}finally{p(false);}}},k=()=>{d&&(a(d),f());};return e?jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:f,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,b)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},b))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,b)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},b)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:u,value:s,onChange:h=>l(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,b)=>jsxRuntime.jsx("button",{onClick:()=>l(h),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},b))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:f,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var pi={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var nh={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},sh={generatePlan:{enabled:true,minPlanTier:"hobby",estimatedTokens:2e3},predictRisks:{enabled:true,minPlanTier:"pro",estimatedTokens:1500},suggestAssignee:{enabled:true,minPlanTier:"hobby",estimatedTokens:800},generateReport:{enabled:true,minPlanTier:"enterprise",estimatedTokens:3e3},generateSubtasks:{enabled:true,minPlanTier:"hobby",estimatedTokens:1e3}};function ih(e,t,a){let r=pi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function wo(e){return `$${e.toFixed(4)}`}var mi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=ih(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,i)=>d+i.cost,0),s=a.reduce((d,i)=>d+i.inputTokens,0),l=a.reduce((d,i)=>d+i.outputTokens,0),c=a.filter(d=>d.success),p=a.reduce((d,i)=>d+i.duration,0),n={},m={};return a.forEach(d=>{n[d.feature]=(n[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:l,operationsByFeature:n,costsByFeature:m,averageDuration:r>0?p/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,l=new Date;a==="month"?l.setMonth(s.getMonth()-1):l.setDate(s.getDate()-1);let c=this.operations.filter(m=>m.timestamp>=l).length,p=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:n,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Nr=new mi;function vc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Nr.getStats()),[s,l]=react.useState(Nr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Nr.getStats()),l(Nr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=Nr.getRecentOperations(5);return jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:wo(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([p,n])=>{let m=r.costsByFeature[p]||0,d=r.totalOperations>0?n/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:p.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:wo(m)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(p=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:wo(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function wc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[l,c]=react.useState(""),[p,n]=react.useState(""),[m,d]=react.useState(""),[i,u]=react.useState(false),[x,f]=react.useState(null),[g,k]=react.useState(null),[h,b]=react.useState(null),y=react.useRef(null),D=i||o;react.useEffect(()=>{e&&y.current&&y.current.focus();},[e]),react.useEffect(()=>{let T=w=>{w.key==="Escape"&&!D&&N();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,D]);let N=()=>{D||(c(""),n(""),d(""),f(null),k(null),b(null),t());},A=async()=>{if(!(!l.trim()||D)){u(true),f(null),k(null),b(null);try{let T=await r({prompt:l.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});k(T.tasks.tasks),b({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){f(T instanceof Error?T.message:"Failed to generate tasks");}finally{u(false);}}},v=()=>{g&&(a(g),N());};if(!e)return null;let R=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(rt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:N,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((T,w)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",w+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:y,value:l,onChange:T=>c(T.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:T=>n(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:T=>d(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),x&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((T,w)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:T},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:N,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:A,disabled:!l.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Tn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&Mo(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(k,h,b)=>{console.warn(`Retry attempt ${h} after ${b}ms: ${k.message}`);}}).then(k=>{k.success||console.error(`Failed to persist board after ${k.attempts} attempts:`,k.error);});},[t]),s=react.useCallback(async(g,k,h)=>{r(b=>{let y=b.cards.find(T=>T.id===g);if(!y)return b;let D=y.columnId,N={...y,columnId:k,position:h},A=b.cards.map(T=>T.id===g?N:T),v=b.columns.map(T=>{if(T.id===D)return {...T,cardIds:T.cardIds.filter(w=>w!==g)};if(T.id===k){let w=A.filter(B=>B.columnId===k).sort((B,P)=>B.position-P.position);return {...T,cardIds:w.map(B=>B.id)}}return T}),R={...b,cards:A,columns:v};return o(R),R});},[o]),l=react.useCallback(async(g,k)=>{r(h=>{let b=h.cards.map(D=>D.id===g?{...D,...k}:D),y={...h,cards:b};return o(y),y});},[o]),c=react.useCallback(async g=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:k},y=h.columns.map(N=>N.id===g.columnId?{...N,cardIds:[...N.cardIds,k]}:N),D={...h,cards:[...h.cards,b],columns:y};return o(D),D});},[o]),p=react.useCallback(async g=>{r(k=>{let h=k.cards.find(N=>N.id===g);if(!h)return k;let b=k.cards.filter(N=>N.id!==g),y=k.columns.map(N=>N.id===h.columnId?{...N,cardIds:N.cardIds.filter(A=>A!==g)}:N),D={...k,cards:b,columns:y};return o(D),D});},[o]),n=react.useCallback(async g=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:k,cardIds:[]},y={...h,columns:[...h.columns,b]};return o(y),y});},[o]),m=react.useCallback(async(g,k)=>{r(h=>{let b=h.columns.map(D=>D.id===g?{...D,...k}:D),y={...h,columns:b};return o(y),y});},[o]),d=react.useCallback(async g=>{r(k=>{let h=k.cards.filter(D=>D.columnId!==g),b=k.columns.filter(D=>D.id!==g),y={...k,cards:h,columns:b};return o(y),y});},[o]),i=react.useCallback(g=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(g),k},[c]),u=react.useCallback(g=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(g),k},[n]),x=react.useCallback(()=>{r(g=>{let k={...g,cards:[],columns:[]};return o(k),k});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:l,onCardCreate:c,onCardDelete:p,onColumnCreate:n,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:p,deleteColumn:d,clearBoard:x}}}function Tc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Tn({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(p,n,m={})=>{s.addCard({title:n,columnId:p,position:r.cards.filter(d=>d.columnId===p).length,...m});},addColumn:(p,n)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:p,position:n??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:l}}var Co={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Nc={by:"none",order:"asc"};function Sc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Co,...e}),[s,l]=react.useState({...Nc,...t}),c=react.useCallback(f=>{o(g=>({...g,...f}));},[]),p=react.useCallback(f=>{l(g=>({...g,...f}));},[]),n=react.useCallback(()=>{o(Co),l(Nc);},[]),m=react.useCallback(()=>{a&&o({...Co,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Co,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...Co,priorities:["HIGH","URGENT"]});},[]),u=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),x=react.useCallback(f=>{let g=[...f];if(r.search){let k=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(k)||h.description?.toLowerCase().includes(k));}if(r.dateFilter!=="all"){let k=new Date,h=k.getFullYear(),b=String(k.getMonth()+1).padStart(2,"0"),y=String(k.getDate()).padStart(2,"0"),D=`${h}-${b}-${y}`;g=g.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let A=N.endDate||N.dueDate;if(!A)return false;let v;if(typeof A=="string")v=A.split("T")[0]||A;else {let R=A.getUTCFullYear(),T=String(A.getUTCMonth()+1).padStart(2,"0"),w=String(A.getUTCDate()).padStart(2,"0");v=`${R}-${T}-${w}`;}switch(r.dateFilter){case "overdue":return v<D;case "today":return v===D;case "this-week":let R=new Date(D+"T00:00:00"),T=new Date(v+"T00:00:00"),w=new Date(R);return w.setDate(w.getDate()+7),T>=R&&T<=w;case "custom":if(r.dateRange){let B=typeof A=="string"?new Date(A):A;return B>=r.dateRange.start&&B<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(k=>k.priority&&r.priorities.includes(k.priority))),r.assignees.length>0&&(g=g.filter(k=>(k.assignedUserIds||(k.assigneeId?[k.assigneeId]:[])).some(b=>r.assignees.includes(b)))),r.labels.length>0&&(g=g.filter(k=>k.labels&&k.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(k=>r.columns.includes(k.columnId))),s.by!=="none"&&g.sort((k,h)=>{let b=0;switch(s.by){case "created":let y=k.createdAt?new Date(k.createdAt).getTime():0,D=h.createdAt?new Date(h.createdAt).getTime():0;b=y-D;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},A=N[k.priority||"LOW"],v=N[h.priority||"LOW"];b=A-v;break;case "dueDate":let R=k.endDate||k.dueDate,T=h.endDate||h.dueDate;if(!R)return 1;if(!T)return -1;let w=typeof R=="string"?new Date(R).getTime():R.getTime(),B=typeof T=="string"?new Date(T).getTime():T.getTime();b=w-B;break;case "title":b=k.title.localeCompare(h.title);break;case "estimate":let P=k.estimatedTime||0,H=h.estimatedTime||0;b=P-H;break;default:b=0;}return s.order==="asc"?b:-b}),g},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:p,resetFilters:n,filterMyTasks:m,filterOverdue:d,filterHighPriority:i,applyFilters:x,hasActiveFilters:u}}var Pc,Mc;if(typeof window<"u")try{let e=So("ai");Pc=e.generateObject,Mc=e.generateText;}catch{}function Ac(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Pc&&Mc&&e.apiKey),l=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:l,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:n,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function gi(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function Ic(e){let{cards:t}=e,[a,r]=gi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let u=i.ctrlKey||i.metaKey,x=i.shiftKey;if(u)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(x&&a.lastSelectedCardId){let f=t.find(k=>k.id===d),g=t.find(k=>k.id===a.lastSelectedCardId);if(f&&g&&f.columnId===g.columnId){let k=t.filter(v=>v.columnId===f.columnId).sort((v,R)=>v.position-R.position),h=k.findIndex(v=>v.id===a.lastSelectedCardId),b=k.findIndex(v=>v.id===d),[y,D]=h<b?[h,b]:[b,h],N=k.slice(y,D+1).map(v=>v.id),A=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:A,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),l=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(d=>{a.selectedCardIds.includes(d)?l(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,l,r]),m=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:l,clearSelection:c,selectAll:p,toggleCard:n,getSelectedCards:m}}var Lc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Fc(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Lc,...a}),[a]),[s,l]=react.useState([]),c=react.useCallback((f,g,k,h,b)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let y={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:g,columnId:k,strategy:h,color:b,isExpanded:true,position:s.filter(D=>D.columnId===k).length,createdAt:new Date};l(D=>[...D,y]);},[o.minCardsPerStack,s]),p=react.useCallback(f=>{l(g=>g.filter(k=>k.id!==f));},[]),n=react.useCallback(f=>{l(g=>g.map(k=>k.id===f?{...k,isExpanded:!k.isExpanded}:k));},[]),m=react.useCallback((f,g)=>{l(k=>k.map(h=>h.id===f&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=react.useCallback((f,g)=>{l(k=>k.map(h=>{if(h.id===f){let b=h.cardIds.filter(y=>y!==g);return b.length<o.minCardsPerStack?null:{...h,cardIds:b}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),i=react.useCallback(f=>s.filter(g=>g.columnId===f).sort((g,k)=>g.position-k.position),[s]),u=react.useCallback(async f=>{let g=t.filter(D=>D.columnId===f);if(g.length<o.minCardsPerStack*2)return [];let k=[],h=new Map;g.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(D);});}),h.forEach((D,N)=>{D.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${N}"`,confidence:.85});});let b=new Map;g.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(N=>{b.has(N)||b.set(N,[]),b.get(N).push(D);});}),b.forEach((D,N)=>{D.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let y=new Map;if(g.forEach(D=>{D.priority&&(y.has(D.priority)||y.set(D.priority,[]),y.get(D.priority).push(D));}),y.forEach((D,N)=>{if(D.length>=o.minCardsPerStack){let A={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";k.push({stack:{title:`${A} ${N} Priority`,cardIds:D.map(v=>v.id),columnId:f,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of g){let A=(await r.findSimilar(D,g)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(A.length>=o.minCardsPerStack-1){let v=[D.id,...A.map(T=>T.card.id)],R=A.reduce((T,w)=>T+w.similarity,0)/A.length;k.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:v,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${A.length+1} similar tasks`,confidence:R});}}return k.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,N)=>N.confidence-D.confidence).slice(0,5)},[t,o,r]),x=react.useCallback(f=>{c(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let k=await u(g),h=k[0];k.length>0&&h&&h.confidence>=.9&&x(h);});},[]),{stacks:s,createStack:c,deleteStack:p,toggleStack:n,addToStack:m,removeFromStack:d,getStacksForColumn:i,getSuggestions:u,applySuggestion:x,config:o}}var Bc=react.createContext(null);function Rc({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,l=new Map;t?.columns?.forEach(p=>{let{Column:n}=So("@libxai/core");s.set(p.id,new n(p));}),t?.cards?.forEach(p=>{let{Card:n}=So("@libxai/core");l.set(p.id,new n(p));});let c=null;if(t?.board){let{Board:p}=So("@libxai/core");c=new p(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Bc.Provider,{value:{store:o},children:e})}function Dn(){let e=react.useContext(Bc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Do(){let e=Dn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,l]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let c=react.useCallback(h=>{e.updateBoard(h);},[e]),p=react.useCallback(h=>{e.addColumn(h);},[e]),n=react.useCallback((h,b)=>{e.updateColumn(h,b);},[e]),m=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),i=react.useCallback(h=>{e.addCard(h);},[e]),u=react.useCallback((h,b)=>{e.updateCard(h,b);},[e]),x=react.useCallback(h=>{e.deleteCard(h);},[e]),f=react.useCallback((h,b,y)=>{e.moveCard(h,b,y);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),k=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:p,updateColumn:n,deleteColumn:m,getColumn:d,addCard:i,updateCard:u,deleteCard:x,moveCard:f,getCard:g,getCardsByColumn:k}}function zc(e){let{cards:t}=Do();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function $c(e="position",t="asc"){let{cards:a}=Do();return react.useMemo(()=>[...a].sort((o,s)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;l=p-n;break}case "createdAt":l=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":l=o.position-s.position;break}return t==="asc"?l:-l}),[a,e,t])}var Nn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Hi.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let l=s[t];if(typeof l=="function")try{let c=await Promise.resolve(l.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Th=new Nn;function Wc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:l=false,gap:c=0,getItemKey:p}){let n=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:l,gap:c}),d=m.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:d.map(x=>{let f=e[x.index];if(!f)return null;let g=p?p(f,x.index):x.index,k={position:"absolute",top:l?0:x.start,left:l?x.start:0,width:l?x.size:"100%",height:l?"100%":x.size};return jsxRuntime.jsx("div",{style:k,"data-index":x.index,children:r(f,x.index)},g)})})})}function Hc(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function _c({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:l=3,gap:c=16,getItemKey:p,horizontal:n=true}){let m=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:l,gap:c}),i=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:s,children:jsxRuntime.jsx("div",{style:x,children:i.map(f=>{let g=e[f.index];if(!g)return null;let k=p?p(g,f.index):f.index,h={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":f.index,children:o(g,f.index)},k)})})})}function Vc(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function jc(e,t=10){return e>t}var yi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},vi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},xi={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ki={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},wi={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ci={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ti={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Di={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},Ni={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},Si={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Ei={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},Pi={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},Sn={spacing:yi,borderRadius:vi,fontSize:xi,fontWeight:ki,lineHeight:wi,zIndex:Ci,duration:Ti,easing:Di,shadows:Ni,opacity:Si,kanban:Ei,gantt:Pi};function Kc(e,t,a){return e[t]??a}function Mi(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Mi(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Sh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ai(e="asakaa"){let t=Mi(Sn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,l=Sh(o);a.push(` ${s}: ${l};`);}return `:root {
390
390
  ${a.join(`
391
391
  `)}
392
392
  }`}function No(e,t="asakaa"){let a=[],r=Mi(e);for(let[o,s]of Object.entries(r)){let l=`--${t}-color-${o}`;a.push(` ${l}: ${s};`);}return `:root {