@libxai/board 0.17.442 → 0.17.443
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 +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function nd(e,t,a,r){switch(t){case "json":return
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=id(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=id(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((b,y)=>{i[b]=d[y]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let l=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),l.cardIds.push(p.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function id(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function ld(e,t){switch(t){case "json":return Gu(e);case "csv":return _u(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function dd(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var Is=react.createContext(null);function cd(){return react.useContext(Is)}var md=react.createContext(null);function pd({children:e,themeName:t}){return jsxRuntime.jsx(md.Provider,{value:{themeName:t},children:e})}function uo(){return react.useContext(md)}function lt({children:e,container:t}){let[a,r]=react.useState(false),o=cd(),s=uo();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:d,themeName:m}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var hd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Zu="#BDC3C7",Qu=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function jr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),i=()=>{if(!m.current)return;let b=m.current.getBoundingClientRect(),y=window.innerHeight,C=window.innerWidth,g=160,v=220,h=4,u=b.right-g;u<10&&(u=b.left),u+g>C-10&&(u=C-g-10);let k=y-b.bottom,x=b.top,D;k>=v+h?D=b.bottom+h:x>=v+h?D=b.top-v-h:D=k>=x?b.bottom+h:Math.max(10,b.top-v-h),n({top:D,left:u}),o(true);};react.useEffect(()=>{let b=y=>{d.current&&!d.current.contains(y.target)&&!m.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[r]),react.useEffect(()=>{let b=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]);let c=b=>{t(b),o(false);},l=e?hd[e]:null,p=l?.color||Zu;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:d,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(hd).map(([b,y])=>jsxRuntime.jsxs("button",{onClick:()=>c(b),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:y.color,background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Qu,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===b&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},b)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>c(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var eg=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function Ro({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),p=(uo()?.themeName||"dark")==="dark",b=()=>{if(!i.current)return;let u=i.current.getBoundingClientRect(),k=window.innerHeight,x=window.innerWidth,D=320,T=380,w=4,L=u.left;L+D>x-10&&(L=x-D-10),L<10&&(L=10);let B=k-u.bottom,N=u.top,W;B>=T+w?W=u.bottom+w:N>=T+w?W=u.top-T-w:W=B>=N?u.bottom+w:Math.max(10,u.top-T-w),d({top:W,left:L}),s(true);};react.useEffect(()=>{let u=k=>{m.current&&!m.current.contains(k.target)&&!i.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),react.useEffect(()=>{let u=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[o]);let y=u=>{let k=new Date,x=L=>{let B=L.getFullYear(),N=String(L.getMonth()+1).padStart(2,"0"),W=String(L.getDate()).padStart(2,"0");return `${B}-${N}-${W}`},D=x(k),T=new Date(k);T.setDate(T.getDate()+u);let w=x(T);a(D,w),s(false);},C=()=>{if(!e||!t)return "Set date";let u=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=T.split("-").map(Number);if(w.length!==3||w.some(W=>isNaN(W)))return null;let L=w[0],B=w[1],N=w[2];return L===void 0||B===void 0||N===void 0?null:new Date(L,B-1,N)},k=u(e),x=u(t);if(!k||!x||isNaN(k.getTime())||isNaN(x.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[k.getMonth()]} ${k.getDate()} \u2013 ${D[x.getMonth()]} ${x.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let u=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),u<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):b(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${C()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:C()})]}),o&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:p?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:eg.map(u=>jsxRuntime.jsx("button",{onClick:()=>y(u.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:u.label},u.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:u=>a(u.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:u=>a(e,u.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:u=>{u.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:u=>{u.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Yr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[d,m]=react.useState(""),[i,c]=react.useState({top:0,left:0}),l=react.useRef(null),p=react.useRef(null),b=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),u=window.innerHeight,k=window.innerWidth,x=300,D=380,T=4,w=h.right-x;w<10&&(w=h.left),w+x>k-10&&(w=k-x-10);let L=u-h.bottom,B=h.top,N;L>=D+T?N=h.bottom+T:B>=D+T?N=h.top-D-T:N=L>=B?h.bottom+T:Math.max(10,h.top-D-T),c({top:N,left:w}),n(true);};react.useEffect(()=>{let h=u=>{l.current&&!l.current.contains(u.target)&&!p.current?.contains(u.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=u=>{u.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let y=h=>{let u=e.some(k=>k.id===h.id);a(u?e.filter(k=>k.id!==h.id):[...e,h]);},C=t.filter(h=>h.name.toLowerCase().includes(d.toLowerCase())),g=e.slice(0,o),v=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>s?n(false):b(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[g.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),v>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",v]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:d,onChange:h=>m(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:C.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):C.map(h=>{let u=e.some(k=>k.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>y(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:u?"#3b82f6":"transparent"},children:u?"\u2713":""})]},h.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function yn(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(c=>{if(typeof c=="string")return c;let l=c;return l.taskId||l.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,d=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let c of i){if(!s.has(c)&&d(c))return true;if(n.has(c))return true}}return n.delete(m),false};return d(a)}function zo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,m]=react.useState(false),[i,c]=react.useState(""),[l,p]=react.useState(t.length>0),[b,y]=react.useState({top:0,left:0}),[C,g]=react.useState(null),v=react.useRef(null),h=react.useRef(null),u=()=>{if(!h.current)return;let w=h.current.getBoundingClientRect(),L=window.innerHeight,B=window.innerWidth,N=300,W=l?380:120,$=4,j=w.right-N;j<10&&(j=w.left),j+N>B-10&&(j=B-N-10);let de=L-w.bottom,Q=w.top,ne;de>=W+$?ne=w.bottom+$:Q>=W+$?ne=w.top-W-$:ne=de>=Q?w.bottom+$:Math.max(10,w.top-W-$),y({top:ne,left:j}),m(true);};react.useEffect(()=>{if(!d||!h.current)return;let w=h.current.getBoundingClientRect(),L=window.innerHeight,B=window.innerWidth,N=300,W=l?380:120,$=4,j=w.right-N;j<10&&(j=w.left),j+N>B-10&&(j=B-N-10);let de=L-w.bottom,Q=w.top,ne;de>=W+$?ne=w.bottom+$:Q>=W+$?ne=w.top-W-$:ne=de>=Q?w.bottom+$:Math.max(10,w.top-W-$),y({top:ne,left:j});},[l,d]),react.useEffect(()=>{let w=L=>{v.current&&!v.current.contains(L.target)&&!h.current?.contains(L.target)&&(m(false),c(""));};if(d)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d]),react.useEffect(()=>{let w=L=>{L.key==="Escape"&&(m(false),c(""));};if(d)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[d]);let k=w=>{let L=t.includes(w),B=a.find(N=>N.id===w);if(g(null),L){let N=t.filter(W=>W!==w);r(N),N.length===0&&p(false);}else {if(s&&yn(a,w,e)){let W=`Cannot add "${B?.title||w}" as dependency - would create circular reference`;g(W),n?.(w,B?.title||w),setTimeout(()=>g(null),3e3);return}r([...t,w]),p(true);}},x=()=>{let w=!l;p(w),w||r([]);},D=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>d?m(false):u(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),d&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:v,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${b.top}px`,left:`${b.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[C&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:C})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:x,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>c(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):D.map(w=>{let L=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>k(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:B=>{B.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var cr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:l,transform:p,transition:b,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),C={transform:gn.Transform.toString(p),transition:b};if(t)return jsxRuntime.jsx("div",{ref:l,style:C,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=d.filter(k=>e.assignedUserIds?.includes(k.id)),v=e.progress===100,h=(e.attachments||[]).filter(k=>k.type.startsWith("image/")),u={...C,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:u,className:f("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:k=>{k.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:k=>{k.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:k=>{k.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((k,x)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:k.url,alt:k.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),x===3&&h.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},k.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:v?"line-through":"none",opacity:v?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(jr,{priority:e.priority,onChange:k=>n?.(e.id,{priority:k})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ro,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(k,x)=>n?.(e.id,{startDate:k,endDate:x})})}),d.length>0&&jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Yr,{assignedUsers:g,availableUsers:d,onChange:k=>n?.(e.id,{assignedUserIds:k.map(x=>x.id)})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(zo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(k=>typeof k=="string"?k:k.taskId):[],availableTasks:m,onChange:k=>n?.(e.id,{dependencies:k})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(k=>jsxRuntime.jsx("span",{className:"asakaa-label",children:k},k))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));cr.displayName="Card";var vn={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Sd=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Ed({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),c=[...Object.entries(vn).map(([g,v])=>({id:g,label:v.label,color:v.color,icon:v.icon})),...r.filter(g=>!Object.keys(vn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let g=vn[e];if(g)return {...g,id:e};let v=r.find(h=>h.id===e);return v?{id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}:{...vn.todo,id:"todo"}},p=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),v=window.innerHeight,h=window.innerWidth,u=180,k=280,x=4,D=g.right-u;D<10&&(D=g.left),D+u>h-10&&(D=h-u-10);let T=v-g.bottom,w=g.top,L;T>=k+x?L=g.bottom+x:w>=k+x?L=g.top-k-x:L=T>=w?g.bottom+x:Math.max(10,g.top-k-x),d({top:L,left:D}),s(true);};react.useEffect(()=>{let g=v=>{m.current&&!m.current.contains(v.target)&&!i.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let b=g=>{t(g),s(false);},y=l(),C=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):p(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${C}10`,boxShadow:`0 0 0 2px ${C}30 inset`},title:y.label,children:jsxRuntime.jsx(Sd,{icon:y.icon,color:C})}),o&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:c.map(g=>jsxRuntime.jsxs("button",{onClick:()=>b(g.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:g.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Sd,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===g.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function Pd({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[d,m]=react.useState(false),[i,c]=react.useState(e),[l,p]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),C=react.useRef(null);react.useEffect(()=>{if(s&&y.current){let u=y.current.getBoundingClientRect();p({top:u.bottom+window.scrollY+8,left:u.left+window.scrollX});}},[s]),react.useEffect(()=>{let u=k=>{b.current&&!b.current.contains(k.target)&&!y.current?.contains(k.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),react.useEffect(()=>{let u=k=>{k.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[s,e]),react.useEffect(()=>{d&&C.current&&(C.current.focus(),C.current.select());},[d]);let g=()=>{m(true),c(e);},v=()=>{let u=i.trim();u&&u!==e&&t(u),m(false),n(false),c(e);},h=u=>{u.key==="Enter"?v():u.key==="Escape"&&(m(false),c(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:d?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:C,type:"text",value:i,onChange:u=>c(u.target.value),onKeyDown:h,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var bo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:l=120,isCollapsed:p,onToggleCollapse:b,onColumnRename:y,onColumnDelete:C,isDeletable:g=false,className:v})=>{let{setNodeRef:h,isOver:u}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),x=c??td(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>l,enabled:x});if(a)return jsxRuntime.jsx("div",{ref:h,className:v,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let N=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:N}:N>=80?{state:"warning",percentage:N}:N>=60?{state:"approaching",percentage:N}:{state:"ok",percentage:N}})(),L=w.state==="exceeded",B=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:f("asakaa-column",u&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",v),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:f(B()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),w.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),w.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||C)&&jsxRuntime.jsx(Pd,{columnTitle:e.title,onRename:N=>y?.(e.id,N),onDelete:C?()=>C(e.id):void 0,isDeletable:g}),b&&jsxRuntime.jsx("button",{onClick:b,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:x?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(N=>N.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):x?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(N=>{let W=t[N.index];return W?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(cr,{card:W,render:r,onClick:n,onUpdate:d,availableUsers:m,allCards:i})},W.id):null})}):t.map(N=>jsxRuntime.jsx(cr,{card:N,render:r,onClick:n,onUpdate:d,availableUsers:m,allCards:i},N.id))})})]})});bo.displayName="Column";function Us({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),d=react.useRef(null);react.useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let m=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?m():c.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:d,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:m,onKeyDown:i,className:f("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:f("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function xg(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Bd(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let m=d.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function kg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Cg=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Rd({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:l=true,pendingFiles:p=[],onFilesSelect:b,onRemoveFile:y,maxFileSizeMB:C=10}){let g=d==="dark",[v,h]=react.useState(false),[u,k]=react.useState([]),[x,D]=react.useState(0),[T,w]=react.useState(null),[L,B]=react.useState(false),N=react.useRef(null),W=react.useRef(null),$=react.useRef(null),j=react.useRef(null),de=react.useCallback((S,R)=>{let V=xg(S,R);if(w(V),V){let ee=r.filter(se=>se.name.toLowerCase().includes(V.query)||se.email&&se.email.toLowerCase().includes(V.query)).slice(0,5);k(ee),h(ee.length>0),D(0);}else h(false),k([]);},[r]),Q=S=>{let R=S.target.value;t(R),de(R,S.target.selectionStart||0);},ne=()=>{N.current&&de(e,N.current.selectionStart||0);},he=react.useCallback(S=>{if(!T||!N.current)return;let R=e.slice(0,T.start),V=e.slice(T.end),ee=`@${S.name.replace(/\s+/g,"")} `,se=R+ee+V;t(se),h(false),w(null),setTimeout(()=>{if(N.current){let le=T.start+ee.length;N.current.selectionStart=le,N.current.selectionEnd=le,N.current.focus();}},0);},[T,e,t]),ke=S=>{if(v&&u.length>0)switch(S.key){case "ArrowDown":S.preventDefault(),D(R=>R<u.length-1?R+1:0);break;case "ArrowUp":S.preventDefault(),D(R=>R>0?R-1:u.length-1);break;case "Enter":{S.preventDefault();let R=u[x];R&&he(R);break}case "Tab":{S.preventDefault();let R=u[x];R&&he(R);break}case "Escape":S.preventDefault(),h(false);break}else S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),a());};react.useEffect(()=>{let S=R=>{W.current&&!W.current.contains(R.target)&&N.current&&!N.current.contains(R.target)&&h(false),j.current&&!j.current.contains(R.target)&&B(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let Ae=react.useCallback(S=>{if(!N.current)return;let R=N.current.selectionStart||e.length,V=e.slice(0,R)+S+e.slice(R);t(V),B(false),setTimeout(()=>{if(N.current){let ee=R+S.length;N.current.selectionStart=ee,N.current.selectionEnd=ee,N.current.focus();}},0);},[e,t]),F=react.useCallback(S=>{if(!b||!S.target.files)return;let R=Array.from(S.target.files),V=C*1024*1024,ee=R.filter(se=>se.size>V?(console.warn(`File ${se.name} exceeds max size of ${C}MB`),false):true);ee.length>0&&b(ee),S.target.value="";},[b,C]),O=react.useCallback(S=>S.type.startsWith("image/")?lucideReact.Image:S.type.includes("pdf")||S.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(v&&W.current){let S=W.current.children[x];S&&S.scrollIntoView({block:"nearest"});}},[x,v]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(S=>{let R=O(S.file),V=S.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[V&&S.preview?jsxRuntime.jsx("img",{src:S.preview,alt:S.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(R,{className:f("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:f("text-xs truncate",g?"text-white":"text-gray-900"),children:S.file.name}),jsxRuntime.jsx("p",{className:f("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:wg(S.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y(S.id),className:f("p-0.5 rounded-full transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>B(!L),disabled:s||n,className:f("p-1 rounded transition-colors flex-shrink-0",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsx(framerMotion.motion.div,{ref:j,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Cg.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Ae(S),className:f("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:S},S))})})})]}),l&&b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||n,className:f("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:m==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:$,type:"file",multiple:true,onChange:F,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("input",{ref:N,type:"text",value:e,onChange:Q,onSelect:ne,onKeyDown:ke,placeholder:o||(m==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:f("flex-1 bg-transparent text-sm outline-none min-w-[100px]",g?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&p.length===0||s,className:f("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&u.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:W,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:u.map((S,R)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>he(S),className:f("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",R===x?g?"bg-white/10":"bg-gray-100":g?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:kg(S.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:f("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:S.name}),S.email&&jsxRuntime.jsx("p",{className:f("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:S.email})]})]},S.id))})})]})]})]})}function Od({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((d,m)=>d.type==="mention"?jsxRuntime.jsx("span",{className:f("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:d.value},m):jsxRuntime.jsx("span",{children:d.value},m))})}var Tn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Nr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[d,m]=react.useState(false),[i,c]=react.useState(""),[l,p]=react.useState(false),[b,y]=react.useState(Tn[10]||"#3B82F6"),[C,g]=react.useState({top:0,left:0}),v=react.useRef(null),h=react.useRef(null),u=react.useRef(null),k=react.useRef(null),x=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),D=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(d&&h.current){let N=h.current.getBoundingClientRect();g({top:N.bottom+6,left:N.left});}},[d]),react.useEffect(()=>{let N=W=>{let $=W.target,j=v.current?.contains($),de=u.current?.contains($);!j&&!de&&(m(false),c(""),p(false));};if(d)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[d]),react.useEffect(()=>{d&&k.current&&k.current.focus();},[d]);let T=N=>{let W=e.some($=>$.id===N.id);a(W?e.filter($=>$.id!==N.id):[...e,N]);},w=async()=>{if(!(!r||!i.trim())){p(true);try{let N=await r(i.trim(),b);N&&(a([...e,N]),c(""),y(Tn[Math.floor(Math.random()*Tn.length)]||"#3B82F6"));}finally{p(false);}}},L=(N,W)=>{W.stopPropagation(),a(e.filter($=>$.id!==N));},B={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&m(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:B,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:u,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:C.top,left:C.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:k,type:"text",value:i,onChange:N=>c(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&i.trim()&&!D&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(N=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${N.color}20`,color:N.color},onClick:W=>L(N.id,W),children:[N.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},N.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:x.length>0?x.map(N=>{let W=e.some($=>$.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>T(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:W?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{W||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{W||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.name}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!D&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Tn.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:b===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:b,color:"#FFFFFF",opacity:l?.7:1},children:[l?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function $s({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 Ud({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($s,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Xr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function _d(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function qg(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function mr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:l,onDeleteAttachment:p,availableTasks:b=[],comments:y=[],onAddComment:C,currentUser:g,mentionableUsers:v=[],onUploadCommentAttachments:h}){let u=s==="dark",k={textTertiary:u?"#6B7280":"#9CA3AF",textSecondary:u?"#9CA3AF":"#6B7280",textPrimary:u?"#FFFFFF":"#111827",borderLight:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:u?"#1A1D25":"#FFFFFF",bgSecondary:u?"#0F1117":"#F9FAFB",hoverBg:u?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},x=e&&"title"in e&&!("name"in e),D=e,[T,w]=react.useState(e?_d(e,d):null),[L,B]=react.useState(false),[N,W]=react.useState(false),[$,j]=react.useState(false),[de,Q]=react.useState(null),[ne,he]=react.useState(new Date),[ke,Ae]=react.useState(false),[F,O]=react.useState(false),[S,R]=react.useState(""),[V,ee]=react.useState(false),[se,le]=react.useState(false),[Pe,Z]=react.useState(false),[_e,we]=react.useState(""),je=react.useRef(null),yt=react.useRef(null),[It,at]=react.useState(""),kt=react.useRef(null),[mt,Ot]=react.useState(""),[me,I]=react.useState(false),[ae,xe]=react.useState([]);react.useEffect(()=>{if(e){let P=_d(e,d);w(P),we(P.description||""),at(P.name||"");}},[e?.id,d]),react.useEffect(()=>{if(!t||!_e)return;let P=setTimeout(()=>{let A=yt.current;A&&(A.style.height="auto",A.style.height=`${Math.max(100,A.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,_e]),react.useEffect(()=>()=>{je.current&&clearTimeout(je.current),kt.current&&clearTimeout(kt.current);},[]);let Be=react.useCallback(P=>{w(P),x&&o&&D?o(qg(P,D)):r&&r(P);},[x,D,o,r]),X=react.useCallback(()=>{B(false),W(false),j(false),Q(null),O(false),R(""),ee(false);},[]),Me=react.useCallback((P,A)=>{if(!T)return;let z={...T,[P]:A};Be(z);},[T,Be]),_=react.useCallback(()=>{let P=yt.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),Y=react.useCallback(P=>{we(P),setTimeout(_,0),je.current&&clearTimeout(je.current),je.current=setTimeout(()=>{if(T){let A={...T,description:P};Be(A);}},800);},[T,Be,_]),Ue=react.useCallback(P=>{at(P),kt.current&&clearTimeout(kt.current),kt.current=setTimeout(()=>{if(T&&P.trim()){let A={...T,name:P.trim()};Be(A);}},800);},[T,Be]),Re=react.useCallback(P=>{let A=P.map(z=>{let re={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:z};return z.type.startsWith("image/")&&(re.preview=URL.createObjectURL(z)),re});xe(z=>[...z,...A]);},[]),Ve=react.useCallback(P=>{xe(A=>{let z=A.find(re=>re.id===P);return z?.preview&&URL.revokeObjectURL(z.preview),A.filter(re=>re.id!==P)});},[]),He=react.useCallback(async()=>{if(!(!T||!mt.trim()&&ae.length===0||!C)){I(true);try{let P=Bd(mt,v),A=[];if(ae.length>0&&h){let z=ae.map(re=>re.file);A=await h(z);}await C(T.id,mt.trim(),P.length>0?P:void 0,A.length>0?A:void 0),Ot(""),ae.forEach(z=>{z.preview&&URL.revokeObjectURL(z.preview);}),xe([]);}finally{I(false);}}},[T,mt,ae,C,v,h]),ce=react.useCallback(P=>{let A=typeof P=="string"?new Date(P):P,re=new Date().getTime()-A.getTime(),Le=Math.floor(re/6e4),Ne=Math.floor(re/36e5),U=Math.floor(re/864e5);return Le<1?n==="es"?"Ahora":"Just now":Le<60?n==="es"?`Hace ${Le} min`:`${Le}m ago`:Ne<24?n==="es"?`Hace ${Ne}h`:`${Ne}h ago`:U<7?n==="es"?`Hace ${U}d`:`${U}d ago`:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ie=react.useCallback(P=>{if(!T)return;let A=T.progress||0;P==="completed"?A=100:P==="in-progress"&&A===0?A=10:P==="todo"&&(A=0);let z={...T,status:P,progress:A};Be(z),B(false);},[T,Be]),J=react.useCallback((P,A)=>{if(!T)return;let z={...T,startDate:P,endDate:A};Be(z);},[T,Be]),We=react.useCallback(()=>{let P=ne.getFullYear(),A=ne.getMonth(),z=new Date(P,A,1),Le=new Date(P,A+1,0).getDate(),Ne=z.getDay(),U=[],te=new Date(P,A,0).getDate();for(let Ze=Ne-1;Ze>=0;Ze--)U.push({date:new Date(P,A-1,te-Ze),isCurrentMonth:false});for(let Ze=1;Ze<=Le;Ze++)U.push({date:new Date(P,A,Ze),isCurrentMonth:true});let Fe=42-U.length;for(let Ze=1;Ze<=Fe;Ze++)U.push({date:new Date(P,A+1,Ze),isCurrentMonth:false});return U},[ne]),Na=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),le(false),!T||!l)return;let A=Array.from(P.dataTransfer.files);if(A.length!==0){Z(true);try{await l(T.id,A);}finally{Z(false);}}},[T,l]),pe=react.useCallback(async P=>{if(!T||!l||!P.target.files)return;let A=Array.from(P.target.files);if(A.length!==0){Z(true);try{await l(T.id,A);}finally{Z(false);}P.target.value="";}},[T,l]),Ge=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),le(true);},[]),Oe=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),le(false);},[]),Ke=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Je=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!T?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",u?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",u?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",u?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:f("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let P=T.progress===100?0:100,z={...T,progress:P,status:P===100?"completed":"todo"};Be(z);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",T.progress===100?"bg-green-500 border-green-500":u?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:It,onChange:P=>Ue(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:f("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",T.progress===100?"line-through text-[#6B7280]":u?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{X(),B(!L);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",T.progress===100||T.status==="completed"?"bg-green-500/20 text-green-400":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/20 text-blue-400":u?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.progress===100||T.status==="completed"?n==="es"?"COMPLETADO":"DONE":T.progress&&T.progress>0||T.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&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:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>Ie(P.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",T.status===P.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:u?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{X(),j(!$);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[T.assignees&&T.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[T.assignees.slice(0,3).map((P,A)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},A)),T.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:["+",T.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",u?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>j(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:d.length>0?d.map(P=>{let A=T.assignees?.some(z=>z.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let z=T.assignees||[],re;A?re=z.filter(Le=>Le.name!==P.name):re=[...z,P],Me("assignees",re);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",A&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1",u?"text-white":"text-gray-900"),children:P.name}),A&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Q(de?null:"start"),he(T.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[T.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",u?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),T.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Q(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",u?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,A=new Date(P);A.setDate(P.getDate()+1);let z=new Date(P);z.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let re=new Date(P);re.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let Le=new Date(P);Le.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let Ne=new Date(P);Ne.setDate(P.getDate()+14);let U=new Date(P);return U.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:z,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:re,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Le,display:Le.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Ne,display:Ne.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:U,display:U.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Fe,Ze)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(de==="start"){let rt=T.endDate&&Fe.date>T.endDate?Fe.date:T.endDate;J(Fe.date,rt),Q("end");}else {let rt=T.startDate&&Fe.date<T.startDate?Fe.date:T.startDate;J(rt,Fe.date),Q(null);}},children:[jsxRuntime.jsx("span",{children:Fe.label}),jsxRuntime.jsx("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:Fe.display})]},Ze))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{J(void 0,void 0),Q(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",u?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:de==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:f("font-medium",u?"text-white":"text-gray-900"),children:ne.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:()=>he(new Date),className:f("p-1 rounded text-sm transition-colors",u?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>he(new Date(ne.getFullYear(),ne.getMonth()-1)),className:f("p-1 rounded",u?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>he(new Date(ne.getFullYear(),ne.getMonth()+1)),className:f("p-1 rounded",u?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",u?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:We().map((P,A)=>{let z=P.date.toDateString()===new Date().toDateString(),re=T.startDate?.toDateString()===P.date.toDateString(),Le=T.endDate?.toDateString()===P.date.toDateString(),Ne=re||Le,U=T.startDate&&T.endDate&&P.date>=T.startDate&&P.date<=T.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let te=new Date(P.date);if(de==="start"){let Fe=T.endDate&&te>T.endDate?te:T.endDate;J(te,Fe),Q("end");}else {let Fe=T.startDate&&te<T.startDate?te:T.startDate;J(Fe,te),Q(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(u?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(u?"text-white":"text-gray-900"),z&&"ring-2 ring-[#3B82F6]",re&&"bg-[#3B82F6] text-white",Le&&!re&&"bg-[#7C3AED] text-white",U&&!Ne&&(u?"bg-[#7C3AED]/20":"bg-purple-100"),!Ne&&(u?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},A)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{X(),W(!N);},className:f("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",T.priority==="high"||T.priority==="urgent"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":T.priority==="low"?"bg-green-500/20 text-green-400":u?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.priority?T.priority==="high"||T.priority==="urgent"?n==="es"?"Alta":"High":T.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>W(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{Me("priority",P.id),W(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",T.priority===P.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:u?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-white":"text-gray-900"),children:T.startDate&&T.endDate?`${Math.ceil((T.endDate.getTime()-T.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full border-2",u?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ke?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:T.progress||0,onChange:P=>{let A=parseInt(P.target.value),z=T.status;A===100?z="completed":A>0?z="in-progress":z="todo";let re={...T,progress:A,status:z};Be(re);},onBlur:()=>Ae(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",u?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Ae(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",u?"text-white":"text-gray-900"),children:[T.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Nr,{selectedTags:T.tags||[],availableTags:m,onChange:P=>{Me("tags",P);},onCreateTag:i,theme:k})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[T.dependencies&&T.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:T.dependencies.map(P=>{let A=b.find(z=>z.id===P);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",u?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[A?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let z=(T.dependencies||[]).filter(re=>re!==P);Me("dependencies",z);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},P)})}),jsxRuntime.jsxs("button",{onClick:()=>{X(),O(!F);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(false),R("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:P=>R(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",u?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:b.length>0?b.filter(P=>P.id!==T.id).filter(P=>S===""||P.name.toLowerCase().includes(S.toLowerCase())).map(P=>{let A=T.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let z=T.dependencies||[],re;A?re=z.filter(Le=>Le!==P.id):re=[...z,P.id],Me("dependencies",re);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",A&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",A?"bg-blue-500 border-blue-500":u?"border-white/30":"border-gray-300"),children:A&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:f("block truncate",u?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{X(),ee(!V);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:T.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-white":"text-gray-900"),children:Xr.find(P=>P.value===T.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ee(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Xr.map(P=>{let A=T.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{Me("color",P.value),ee(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",A&&"ring-2 ring-offset-2",u?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:A?P.value:void 0},title:P.name,children:A&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:T.isMilestone||false,onChange:P=>Me("isMilestone",P.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",T.isMilestone?"bg-purple-500 border-purple-500":u?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:yt,value:_e,onChange:P=>Y(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",u?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",u?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),T.subtasks&&T.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:T.subtasks.map(P=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",P.progress===100?"bg-green-500 border-green-500":u?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",P.progress===100?"line-through text-[#6B7280]":u?"text-white":"text-gray-900"),children:P.name})]},P.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let A=Je(P.type),z=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[z&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(A,{className:f("w-5 h-5",u?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",u?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:Ke(P.size)})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(P.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",u?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ge,onDragLeave:Oe,onDrop:Na,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",se?u?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":u?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Pe&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:pe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||Pe}),Pe?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:f("w-6 h-6 mx-auto mb-2",se?"text-blue-500":u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:se?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!l&&jsxRuntime.jsx("p",{className:f("text-xs mt-1",u?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:f("w-80 border-l flex flex-col",u?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",u?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:y.map(P=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:f("text-sm font-medium",u?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:ce(P.createdAt)})]}),jsxRuntime.jsx("div",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Od,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(A=>{let z=A.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:f("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[z?jsxRuntime.jsx(lucideReact.Image,{className:f("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:f("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:f("text-xs truncate max-w-[100px]",u?"text-white":"text-gray-900"),children:A.name})]},A.id)})})]})]},P.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:f("w-10 h-10 mb-3",u?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Rd,{value:mt,onChange:Ot,onSubmit:He,users:v,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!C,isSubmitting:me,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:ae,onFilesSelect:Re,onRemoveFile:Ve})})]})]})]})})}function Ys(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function Er({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:d,isLoading:m,error:i,children:c,availableTags:l=[],onCreateTag:p,attachmentsByCard:b,onUploadAttachments:y,onDeleteAttachment:C,comments:g,onAddComment:v,currentUser:h,mentionableUsers:u,onTaskOpen:k}){let[x,D]=Ys(),[T,w]=react.useState(null),L=o?.theme||"dark",B=L==="dark"||L==="neutral",N=B?"dark":"",W=react.useCallback((R,V)=>{t.onCardUpdate?.(R,V);},[t]),$=react.useCallback((R,V)=>{t.onColumnUpdate?.(R,{title:V});},[t]),j=react.useCallback(R=>{t.onColumnDelete?.(R);},[t]),de=["todo","in-progress","completed"],Q=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),ne=react.useMemo(()=>{let R=new Map;return e.columns.forEach(V=>{let ee=V.cardIds.map(se=>e.cards.find(le=>le.id===se)).filter(se=>se!==void 0).sort((se,le)=>se.position-le.position);R.set(V.id,ee);}),R},[e.cards,e.columns]),he=react.useMemo(()=>e.cards.map(R=>({id:R.id,name:R.title,startDate:R.startDate?new Date(R.startDate):void 0,endDate:R.endDate?new Date(R.endDate):void 0,progress:R.progress||0,status:R.columnId,priority:R.priority?.toLowerCase(),dependencies:Array.isArray(R.dependencies)?R.dependencies.map(V=>typeof V=="string"?V:V.taskId):[]})),[e.cards]),ke=react.useCallback(R=>{let{active:V}=R,ee=e.cards.find(se=>se.id===V.id);ee&&D({isDragging:true,draggedCardId:ee.id,sourceColumnId:ee.columnId,targetColumnId:ee.columnId});},[e.cards,D]),Ae=react.useCallback(R=>{let{active:V,over:ee}=R;if(!ee||!e.cards.find(Pe=>Pe.id===V.id))return;let le=null;ee.data.current?.type==="column"?le=ee.id:ee.data.current?.type==="card"&&(le=e.cards.find(Z=>Z.id===ee.id)?.columnId||null),le&&le!==x.targetColumnId&&D({...x,targetColumnId:le});},[e.cards,x,D]),F=react.useCallback(async R=>{let{active:V,over:ee}=R;if(D({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ee)return;let se=e.cards.find(_e=>_e.id===V.id);if(!se)return;let le,Pe;if(ee.data.current?.type==="column"){le=ee.id;let _e=ne.get(le)||[];Pe=Ms(_e,0);}else {let _e=e.cards.find(yt=>yt.id===ee.id);if(!_e)return;le=_e.columnId;let we=ne.get(le)||[],je=we.findIndex(yt=>yt.id===ee.id);Pe=Ms(we,je);}let Z=e.columns.find(_e=>_e.id===le);if(Z&&Z.wipLimit&&Z.wipLimitType==="hard"){let _e=ne.get(le)||[];if(se.columnId!==le&&_e.length>=Z.wipLimit){t.onWipLimitExceeded?.(Z,se);return}}(se.columnId!==le||se.position!==Pe)&&await t.onCardMove?.(se.id,le,Pe);},[e.cards,e.columns,ne,t,D]),O=react.useCallback(R=>{w(R),a?.(R),k?.(R.id);},[a,k]),S=react.useCallback(R=>{t.onCardUpdate?.(R.id,R),w(R);},[t]);return m?jsxRuntime.jsx("div",{className:f("asakaa-board",N,n),style:d,children:jsxRuntime.jsx(lf,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:f("asakaa-board",N,n),style:d,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(pd,{themeName:L,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:Q,collisionDetection:core$1.closestCorners,onDragStart:ke,onDragOver:Ae,onDragEnd:F,children:[jsxRuntime.jsxs("div",{className:f("asakaa-board",N,n),style:d,"data-theme":L,children:[e.columns.sort((R,V)=>R.position-V.position).map(R=>{let V=ne.get(R.id)||[],ee=!de.includes(R.id);return jsxRuntime.jsx(bo,{column:R,cards:V,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:O,onCardUpdate:W,onColumnRename:$,onColumnDelete:j,isDeletable:ee,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},R.id)}),c]}),jsxRuntime.jsx(core$1.DragOverlay,{children:x.draggedCardId?jsxRuntime.jsx(cr,{card:e.cards.find(R=>R.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(mr,{task:T,isOpen:!!T,onClose:()=>w(null),onCardUpdate:S,theme:B?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:p,attachments:T?b?.get(T.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:C,availableTasks:he,comments:g,onAddComment:v,currentUser:h,mentionableUsers:u})]})}function lf({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var uf={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},gf={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},ff={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},bf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function hf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let i=c=>{d.current&&!d.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,c)=>i.position-c.position).map((i,c)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function yf({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[d,m]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let b=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(b=>b.handler),p=async(b,y)=>{if(y){m(b);try{await y();}catch(C){console.error(`Export ${b} failed:`,C);}finally{m(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((b,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(b.id,b.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===b.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):b.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function vf({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function Xs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:d,onExportExcel:m,translations:i}){let c=r==="dark"?uf:gf,l={...o==="es"?ff:bf,...i},p=n||d||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(yf,{theme:c,t:l,onExportCSV:n,onExportJSON:d,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsxRuntime.jsx(hf,{columns:e,onSelect:t,theme:c,t:l,createTaskLabel:a}):jsxRuntime.jsx(vf,{onClick:()=>t(),label:a||l.newTask}))]})})}function Zs({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(""),i=react.useCallback(()=>{let p=d.trim();p&&(e(p),m(""),n(false));},[d,e]),c=react.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(m(""),n(false));},[i]),l=react.useCallback(()=>{setTimeout(()=>{d.trim()||n(false);},150);},[d]);return s?jsxRuntime.jsx("div",{className:f("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:d,onChange:p=>m(p.target.value),onKeyDown:c,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!d.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:f("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Qs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:d="dark",locale:m="es"}){let[i,c]=react.useState(false),[l,p]=react.useState(false),[b,y]=react.useState(""),[C,g]=react.useState([]),[v,h]=react.useState(""),[u,k]=react.useState(""),[x,D]=react.useState(""),[T,w]=react.useState(false),[L,B]=react.useState(false),[N,W]=react.useState(false),$=react.useRef(null),j=react.useRef(null),de={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},Q=react.useCallback(()=>{y(""),g([]),h(""),k(""),D(""),w(false),B(false),W(false),c(false);},[]);react.useEffect(()=>{i&&$.current&&$.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let F=O=>{j.current&&!j.current.contains(O.target)&&(b.trim()||Q());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[i,b,Q]);let ne=react.useCallback(async()=>{let F=b.trim();if(!(!F||l)){p(true);try{await t({name:F,columnId:e,assigneeIds:C.length>0?C:void 0,startDate:v?new Date(v):void 0,endDate:u?new Date(u):void 0,priority:x||void 0}),y(""),g([]),h(""),k(""),D(""),w(!1),B(!1),W(!1),$.current?.focus();}catch(O){console.error("Error creating card:",O);}finally{p(false);}}},[b,e,C,v,u,x,t,l]),he=react.useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),ne()):F.key==="Escape"&&Q();},[ne,Q]),ke=react.useCallback(F=>{g(O=>O.includes(F)?O.filter(S=>S!==F):[...O,F]);},[]),Ae=d==="dark";return i?jsxRuntime.jsxs("div",{ref:j,className:f("rounded-lg overflow-hidden shadow-lg",Ae?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:b,onChange:F=>y(F.target.value),onKeyDown:he,placeholder:de.placeholder,disabled:l,className:f("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ae?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>w(!T),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||C.length>0?"bg-emerald-500/20 text-emerald-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:de.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),C.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:C.length})]}),jsxRuntime.jsx("button",{onClick:()=>B(!L),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||v||u?"bg-blue-500/20 text-blue-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:de.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>W(!N),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||x?x==="urgent"?"bg-red-500/20 text-red-400":x==="high"?"bg-orange-500/20 text-orange-400":x==="medium"?"bg-yellow-500/20 text-yellow-400":x==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:de.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:ne,disabled:!b.trim()||l,className:f("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):de.save})]})]}),T&&a.length>0&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxRuntime.jsxs("button",{onClick:()=>ke(F.id),className:f("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",C.includes(F.id)?"bg-emerald-500 text-white":Ae?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsxRuntime.jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",C.includes(F.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:F.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:F.name.split(" ")[0]})]},F.id))})}),L&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:de.startDate}),jsxRuntime.jsx("input",{type:"date",value:v,onChange:F=>h(F.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:de.endDate}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:F=>k(F.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),N&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsxRuntime.jsx("button",{onClick:()=>D(x===F?"":F),className:f("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",x===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:Ae?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:de[F]},F))})})]}):jsxRuntime.jsxs("button",{onClick:()=>c(true),disabled:n,className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ae?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:de.buttonLabel})]})}var _o=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(Er,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
5
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function ac(e={}){return new _o(e)}var yo=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function ei(e,t){let a=r=>jsxRuntime.jsx(yo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ai({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:d,onOpenAIUsage:m,shortcut:i="k",className:c=""}){let[l,p]=react.useState(false),[b,y]=react.useState(""),[C,g]=react.useState("home"),[v,h]=react.useState(""),[u,k]=react.useState("");react.useEffect(()=>{let w=L=>{(L.metaKey||L.ctrlKey)&&L.key===i&&(L.preventDefault(),p(B=>!B)),L.key==="Escape"&&(p(false),g("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{l||(g("home"),y(""),h(""),k(""));},[l]);let x=react.useCallback(()=>{p(false);},[]),D=react.useCallback(w=>{let[L,B]=w.split(":");switch(L){case "create-card":g("create-card");break;case "create-card-in":h(B||"");break;case "navigate":B?(a?.(B),x()):g("navigate");break;case "search":r?.(b),x();break;case "priority":g("priority");break;case "set-priority":u&&B&&(o?.(u,B),x());break;case "assign":g("assign");break;case "assign-user":u&&B&&(s?.(u,B),x());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),x();break;case "ai-predict-risks":d?.(),x();break;case "ai-usage":m?.(),x();break;case "back":g("home");break;}},[b,u,t,a,r,o,s,n,d,m,x]),T=react.useCallback(()=>{v&&b.trim()&&(t?.(v,b.trim()),x());},[v,b,t,x]);return l?jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:x,children:jsxRuntime.jsx("div",{className:`command-palette ${c}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:b,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:C==="create-card"&&v?"Type card title and press Enter...":C==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&C==="create-card"&&v&&T();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),C==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},w.id))})]}),C==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),C==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let L=e.columns.find(B=>B.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:L?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},w.id)})})]}),C==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function nc(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
1
|
+
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),nm=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Lf=require('react-markdown'),If=require('remark-gfm'),Bf=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var nm__default=/*#__PURE__*/_interopDefault(nm);var Lf__default=/*#__PURE__*/_interopDefault(Lf);var If__default=/*#__PURE__*/_interopDefault(If);var Bf__default=/*#__PURE__*/_interopDefault(Bf);var un=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var gn=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return "scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return [gn.Translate.toString(e),gn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function f(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function fn(e,t){return e===null&&t===null?1e3:e===null&&t!==null?t/2:e!==null&&t===null?e+1e3:e!==null&&t!==null?(e+t)/2:1e3}function Ru(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Ms(e,t){return e.length===0?1e3:t===0?fn(null,e[0].position):t>=e.length?fn(e[e.length-1].position,null):fn(e[t-1].position,e[t].position)}function td(e,t=100){return e>t}var Ou=e=>{if(e.message.includes("network")||e.message.includes("fetch"))return true;if("status"in e){let t=e.status;return t>=500||t===429}return false};function zu(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function bn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Ou,onRetry:d}=t,m,i=0;for(let c=1;c<=a;c++){i=c;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(m=l,c===a||!n(m,c))return {error:m,attempts:i,success:false};let b=zu(c,r,o,s);if(d)try{d(m,c,b);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,b));}}return {error:m||new Error("Unknown error"),attempts:i,success:false}}function Uu(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Hu(e,t={}){return async(...a)=>bn(()=>e(...a),t)}var Fs=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var ad=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.NONE=4]="NONE",s))(ad||{}),Vr=class Vr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,d=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(d,o,m?n:"");break;case "INFO":console.info(d,o,m?n:"");break;case "WARN":console.warn(d,o,m?n:"");break;case "ERROR":console.error(d,o,m?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Vr.globalOptions};}static configure(t){Vr.globalOptions={...Vr.globalOptions,...t};}child(t){return new Vr({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new hn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new hn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:ad[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Vr.globalOptions={};var As=Vr,hn=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},rd=new As;function Wu(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function Gu(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(d=>d.id===s.columnId);return [s.id,Ls(s.title),Ls(s.description||""),Ls(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function _u(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await nm__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),d=n.toDataURL("image/png"),m=297,i=210,c=n.width/n.height,l=m-20,p=l/c;p>i-20&&(p=i-20,l=p*c);let b=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});b.setFontSize(16),b.setTextColor(255,255,255),b.setFillColor(10,10,10),b.rect(0,0,m,15,"F"),b.text(e.title||"Kanban Board",10,10);let y=(m-l)/2;return b.addImage(d,"PNG",y,20,l,p),b}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let d=e.cards.filter(m=>m.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,d.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):d.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let c=o.splitTextToSize(m.description,160);o.text(c,25,s),s+=c.length*5;}let i=[];if(m.priority&&i.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&i.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&i.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let c=[];m.startDate&&c.push(`Start: ${m.startDate}`),m.endDate&&c.push(`End: ${m.endDate}`),i.push(c.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Ls(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function nd(e,t,a,r){switch(t){case "json":return Wu(e,r);case "csv":return Gu(e);case "pdf":return await _u(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function sd(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let c=`${r}.pdf`;e.save(c);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},d=new Blob([e],{type:n[t]}),m=URL.createObjectURL(d),i=document.createElement("a");i.href=m,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(m);}function Vu(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function ju(e){try{let t=e.trim().split(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=id(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=id(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((b,y)=>{i[b]=d[y]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let l=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),l.cardIds.push(p.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function id(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function ld(e,t){switch(t){case "json":return Vu(e);case "csv":return ju(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function dd(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var Is=react.createContext(null);function cd(){return react.useContext(Is)}var md=react.createContext(null);function pd({children:e,themeName:t}){return jsxRuntime.jsx(md.Provider,{value:{themeName:t},children:e})}function uo(){return react.useContext(md)}function mt({children:e,container:t}){let[a,r]=react.useState(false),o=cd(),s=uo();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:d,themeName:m}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var hd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},eg="#BDC3C7",tg=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function jr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),i=()=>{if(!m.current)return;let b=m.current.getBoundingClientRect(),y=window.innerHeight,C=window.innerWidth,g=160,v=220,h=4,u=b.right-g;u<10&&(u=b.left),u+g>C-10&&(u=C-g-10);let k=y-b.bottom,x=b.top,D;k>=v+h?D=b.bottom+h:x>=v+h?D=b.top-v-h:D=k>=x?b.bottom+h:Math.max(10,b.top-v-h),n({top:D,left:u}),o(true);};react.useEffect(()=>{let b=y=>{d.current&&!d.current.contains(y.target)&&!m.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[r]),react.useEffect(()=>{let b=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]);let c=b=>{t(b),o(false);},l=e?hd[e]:null,p=l?.color||eg;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:d,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(hd).map(([b,y])=>jsxRuntime.jsxs("button",{onClick:()=>c(b),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:y.color,background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(tg,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===b&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},b)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>c(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var ag=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function Ro({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),p=(uo()?.themeName||"dark")==="dark",b=()=>{if(!i.current)return;let u=i.current.getBoundingClientRect(),k=window.innerHeight,x=window.innerWidth,D=320,T=380,w=4,L=u.left;L+D>x-10&&(L=x-D-10),L<10&&(L=10);let B=k-u.bottom,N=u.top,$;B>=T+w?$=u.bottom+w:N>=T+w?$=u.top-T-w:$=B>=N?u.bottom+w:Math.max(10,u.top-T-w),d({top:$,left:L}),s(true);};react.useEffect(()=>{let u=k=>{m.current&&!m.current.contains(k.target)&&!i.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),react.useEffect(()=>{let u=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[o]);let y=u=>{let k=new Date,x=L=>{let B=L.getFullYear(),N=String(L.getMonth()+1).padStart(2,"0"),$=String(L.getDate()).padStart(2,"0");return `${B}-${N}-${$}`},D=x(k),T=new Date(k);T.setDate(T.getDate()+u);let w=x(T);a(D,w),s(false);},C=()=>{if(!e||!t)return "Set date";let u=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=T.split("-").map(Number);if(w.length!==3||w.some($=>isNaN($)))return null;let L=w[0],B=w[1],N=w[2];return L===void 0||B===void 0||N===void 0?null:new Date(L,B-1,N)},k=u(e),x=u(t);if(!k||!x||isNaN(k.getTime())||isNaN(x.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[k.getMonth()]} ${k.getDate()} \u2013 ${D[x.getMonth()]} ${x.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let u=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),u<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):b(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${C()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:C()})]}),o&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:p?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:ag.map(u=>jsxRuntime.jsx("button",{onClick:()=>y(u.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:u.label},u.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:u=>a(u.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:u=>a(e,u.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:u=>{u.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:u=>{u.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Yr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[d,m]=react.useState(""),[i,c]=react.useState({top:0,left:0}),l=react.useRef(null),p=react.useRef(null),b=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),u=window.innerHeight,k=window.innerWidth,x=300,D=380,T=4,w=h.right-x;w<10&&(w=h.left),w+x>k-10&&(w=k-x-10);let L=u-h.bottom,B=h.top,N;L>=D+T?N=h.bottom+T:B>=D+T?N=h.top-D-T:N=L>=B?h.bottom+T:Math.max(10,h.top-D-T),c({top:N,left:w}),n(true);};react.useEffect(()=>{let h=u=>{l.current&&!l.current.contains(u.target)&&!p.current?.contains(u.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=u=>{u.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let y=h=>{let u=e.some(k=>k.id===h.id);a(u?e.filter(k=>k.id!==h.id):[...e,h]);},C=t.filter(h=>h.name.toLowerCase().includes(d.toLowerCase())),g=e.slice(0,o),v=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>s?n(false):b(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[g.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),v>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",v]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:d,onChange:h=>m(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:C.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):C.map(h=>{let u=e.some(k=>k.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>y(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:u?"#3b82f6":"transparent"},children:u?"\u2713":""})]},h.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function yn(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(c=>{if(typeof c=="string")return c;let l=c;return l.taskId||l.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,d=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let c of i){if(!s.has(c)&&d(c))return true;if(n.has(c))return true}}return n.delete(m),false};return d(a)}function zo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,m]=react.useState(false),[i,c]=react.useState(""),[l,p]=react.useState(t.length>0),[b,y]=react.useState({top:0,left:0}),[C,g]=react.useState(null),v=react.useRef(null),h=react.useRef(null),u=()=>{if(!h.current)return;let w=h.current.getBoundingClientRect(),L=window.innerHeight,B=window.innerWidth,N=300,$=l?380:120,U=4,j=w.right-N;j<10&&(j=w.left),j+N>B-10&&(j=B-N-10);let se=L-w.bottom,ee=w.top,ie;se>=$+U?ie=w.bottom+U:ee>=$+U?ie=w.top-$-U:ie=se>=ee?w.bottom+U:Math.max(10,w.top-$-U),y({top:ie,left:j}),m(true);};react.useEffect(()=>{if(!d||!h.current)return;let w=h.current.getBoundingClientRect(),L=window.innerHeight,B=window.innerWidth,N=300,$=l?380:120,U=4,j=w.right-N;j<10&&(j=w.left),j+N>B-10&&(j=B-N-10);let se=L-w.bottom,ee=w.top,ie;se>=$+U?ie=w.bottom+U:ee>=$+U?ie=w.top-$-U:ie=se>=ee?w.bottom+U:Math.max(10,w.top-$-U),y({top:ie,left:j});},[l,d]),react.useEffect(()=>{let w=L=>{v.current&&!v.current.contains(L.target)&&!h.current?.contains(L.target)&&(m(false),c(""));};if(d)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d]),react.useEffect(()=>{let w=L=>{L.key==="Escape"&&(m(false),c(""));};if(d)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[d]);let k=w=>{let L=t.includes(w),B=a.find(N=>N.id===w);if(g(null),L){let N=t.filter($=>$!==w);r(N),N.length===0&&p(false);}else {if(s&&yn(a,w,e)){let $=`Cannot add "${B?.title||w}" as dependency - would create circular reference`;g($),n?.(w,B?.title||w),setTimeout(()=>g(null),3e3);return}r([...t,w]),p(true);}},x=()=>{let w=!l;p(w),w||r([]);},D=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>d?m(false):u(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),d&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:v,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${b.top}px`,left:`${b.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[C&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:C})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:x,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>c(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):D.map(w=>{let L=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>k(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:B=>{B.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var cr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:l,transform:p,transition:b,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),C={transform:gn.Transform.toString(p),transition:b};if(t)return jsxRuntime.jsx("div",{ref:l,style:C,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=d.filter(k=>e.assignedUserIds?.includes(k.id)),v=e.progress===100,h=(e.attachments||[]).filter(k=>k.type.startsWith("image/")),u={...C,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:u,className:f("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:k=>{k.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:k=>{k.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:k=>{k.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((k,x)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:k.url,alt:k.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),x===3&&h.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},k.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:v?"line-through":"none",opacity:v?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(jr,{priority:e.priority,onChange:k=>n?.(e.id,{priority:k})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ro,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(k,x)=>n?.(e.id,{startDate:k,endDate:x})})}),d.length>0&&jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Yr,{assignedUsers:g,availableUsers:d,onChange:k=>n?.(e.id,{assignedUserIds:k.map(x=>x.id)})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(zo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(k=>typeof k=="string"?k:k.taskId):[],availableTasks:m,onChange:k=>n?.(e.id,{dependencies:k})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(k=>jsxRuntime.jsx("span",{className:"asakaa-label",children:k},k))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));cr.displayName="Card";var vn={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Sd=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Ed({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),c=[...Object.entries(vn).map(([g,v])=>({id:g,label:v.label,color:v.color,icon:v.icon})),...r.filter(g=>!Object.keys(vn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let g=vn[e];if(g)return {...g,id:e};let v=r.find(h=>h.id===e);return v?{id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}:{...vn.todo,id:"todo"}},p=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),v=window.innerHeight,h=window.innerWidth,u=180,k=280,x=4,D=g.right-u;D<10&&(D=g.left),D+u>h-10&&(D=h-u-10);let T=v-g.bottom,w=g.top,L;T>=k+x?L=g.bottom+x:w>=k+x?L=g.top-k-x:L=T>=w?g.bottom+x:Math.max(10,g.top-k-x),d({top:L,left:D}),s(true);};react.useEffect(()=>{let g=v=>{m.current&&!m.current.contains(v.target)&&!i.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let b=g=>{t(g),s(false);},y=l(),C=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):p(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${C}10`,boxShadow:`0 0 0 2px ${C}30 inset`},title:y.label,children:jsxRuntime.jsx(Sd,{icon:y.icon,color:C})}),o&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:c.map(g=>jsxRuntime.jsxs("button",{onClick:()=>b(g.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:g.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Sd,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===g.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function Pd({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[d,m]=react.useState(false),[i,c]=react.useState(e),[l,p]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),C=react.useRef(null);react.useEffect(()=>{if(s&&y.current){let u=y.current.getBoundingClientRect();p({top:u.bottom+window.scrollY+8,left:u.left+window.scrollX});}},[s]),react.useEffect(()=>{let u=k=>{b.current&&!b.current.contains(k.target)&&!y.current?.contains(k.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),react.useEffect(()=>{let u=k=>{k.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[s,e]),react.useEffect(()=>{d&&C.current&&(C.current.focus(),C.current.select());},[d]);let g=()=>{m(true),c(e);},v=()=>{let u=i.trim();u&&u!==e&&t(u),m(false),n(false),c(e);},h=u=>{u.key==="Enter"?v():u.key==="Escape"&&(m(false),c(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:d?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:C,type:"text",value:i,onChange:u=>c(u.target.value),onKeyDown:h,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var bo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:l=120,isCollapsed:p,onToggleCollapse:b,onColumnRename:y,onColumnDelete:C,isDeletable:g=false,className:v})=>{let{setNodeRef:h,isOver:u}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),x=c??td(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>l,enabled:x});if(a)return jsxRuntime.jsx("div",{ref:h,className:v,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let N=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:N}:N>=80?{state:"warning",percentage:N}:N>=60?{state:"approaching",percentage:N}:{state:"ok",percentage:N}})(),L=w.state==="exceeded",B=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:f("asakaa-column",u&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",v),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:f(B()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),w.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),w.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||C)&&jsxRuntime.jsx(Pd,{columnTitle:e.title,onRename:N=>y?.(e.id,N),onDelete:C?()=>C(e.id):void 0,isDeletable:g}),b&&jsxRuntime.jsx("button",{onClick:b,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:x?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(N=>N.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):x?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(N=>{let $=t[N.index];return $?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(cr,{card:$,render:r,onClick:n,onUpdate:d,availableUsers:m,allCards:i})},$.id):null})}):t.map(N=>jsxRuntime.jsx(cr,{card:N,render:r,onClick:n,onUpdate:d,availableUsers:m,allCards:i},N.id))})})]})});bo.displayName="Column";function Us({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),d=react.useRef(null);react.useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let m=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?m():c.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:d,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:m,onKeyDown:i,className:f("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:f("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function wg(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Bd(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let m=d.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Cg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Tg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ng=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Rd({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:l=true,pendingFiles:p=[],onFilesSelect:b,onRemoveFile:y,maxFileSizeMB:C=10}){let g=d==="dark",[v,h]=react.useState(false),[u,k]=react.useState([]),[x,D]=react.useState(0),[T,w]=react.useState(null),[L,B]=react.useState(false),N=react.useRef(null),$=react.useRef(null),U=react.useRef(null),j=react.useRef(null),se=react.useCallback((S,_)=>{let J=wg(S,_);if(w(J),J){let ce=r.filter(pe=>pe.name.toLowerCase().includes(J.query)||pe.email&&pe.email.toLowerCase().includes(J.query)).slice(0,5);k(ce),h(ce.length>0),D(0);}else h(false),k([]);},[r]),ee=S=>{let _=S.target.value;t(_),se(_,S.target.selectionStart||0);},ie=()=>{N.current&&se(e,N.current.selectionStart||0);},ve=react.useCallback(S=>{if(!T||!N.current)return;let _=e.slice(0,T.start),J=e.slice(T.end),ce=`@${S.name.replace(/\s+/g,"")} `,pe=_+ce+J;t(pe),h(false),w(null),setTimeout(()=>{if(N.current){let V=T.start+ce.length;N.current.selectionStart=V,N.current.selectionEnd=V,N.current.focus();}},0);},[T,e,t]),Ce=S=>{if(v&&u.length>0)switch(S.key){case "ArrowDown":S.preventDefault(),D(_=>_<u.length-1?_+1:0);break;case "ArrowUp":S.preventDefault(),D(_=>_>0?_-1:u.length-1);break;case "Enter":{S.preventDefault();let _=u[x];_&&ve(_);break}case "Tab":{S.preventDefault();let _=u[x];_&&ve(_);break}case "Escape":S.preventDefault(),h(false);break}else S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),a());};react.useEffect(()=>{let S=_=>{$.current&&!$.current.contains(_.target)&&N.current&&!N.current.contains(_.target)&&h(false),j.current&&!j.current.contains(_.target)&&B(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let Ae=react.useCallback(S=>{if(!N.current)return;let _=N.current.selectionStart||e.length,J=e.slice(0,_)+S+e.slice(_);t(J),B(false),setTimeout(()=>{if(N.current){let ce=_+S.length;N.current.selectionStart=ce,N.current.selectionEnd=ce,N.current.focus();}},0);},[e,t]),F=react.useCallback(S=>{if(!b||!S.target.files)return;let _=Array.from(S.target.files),J=C*1024*1024,ce=_.filter(pe=>pe.size>J?(console.warn(`File ${pe.name} exceeds max size of ${C}MB`),false):true);ce.length>0&&b(ce),S.target.value="";},[b,C]),R=react.useCallback(S=>S.type.startsWith("image/")?lucideReact.Image:S.type.includes("pdf")||S.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(v&&$.current){let S=$.current.children[x];S&&S.scrollIntoView({block:"nearest"});}},[x,v]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(S=>{let _=R(S.file),J=S.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[J&&S.preview?jsxRuntime.jsx("img",{src:S.preview,alt:S.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(_,{className:f("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:f("text-xs truncate",g?"text-white":"text-gray-900"),children:S.file.name}),jsxRuntime.jsx("p",{className:f("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Tg(S.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y(S.id),className:f("p-0.5 rounded-full transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>B(!L),disabled:s||n,className:f("p-1 rounded transition-colors flex-shrink-0",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsx(framerMotion.motion.div,{ref:j,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Ng.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Ae(S),className:f("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:S},S))})})})]}),l&&b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:s||n,className:f("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:m==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:U,type:"file",multiple:true,onChange:F,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("input",{ref:N,type:"text",value:e,onChange:ee,onSelect:ie,onKeyDown:Ce,placeholder:o||(m==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:f("flex-1 bg-transparent text-sm outline-none min-w-[100px]",g?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&p.length===0||s,className:f("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&u.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:$,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:u.map((S,_)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>ve(S),className:f("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",_===x?g?"bg-white/10":"bg-gray-100":g?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:Cg(S.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:f("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:S.name}),S.email&&jsxRuntime.jsx("p",{className:f("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:S.email})]})]},S.id))})})]})]})]})}function Od({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((d,m)=>d.type==="mention"?jsxRuntime.jsx("span",{className:f("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:d.value},m):jsxRuntime.jsx("span",{children:d.value},m))})}var Tn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Nr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[d,m]=react.useState(false),[i,c]=react.useState(""),[l,p]=react.useState(false),[b,y]=react.useState(Tn[10]||"#3B82F6"),[C,g]=react.useState({top:0,left:0}),v=react.useRef(null),h=react.useRef(null),u=react.useRef(null),k=react.useRef(null),x=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),D=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(d&&h.current){let N=h.current.getBoundingClientRect();g({top:N.bottom+6,left:N.left});}},[d]),react.useEffect(()=>{let N=$=>{let U=$.target,j=v.current?.contains(U),se=u.current?.contains(U);!j&&!se&&(m(false),c(""),p(false));};if(d)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[d]),react.useEffect(()=>{d&&k.current&&k.current.focus();},[d]);let T=N=>{let $=e.some(U=>U.id===N.id);a($?e.filter(U=>U.id!==N.id):[...e,N]);},w=async()=>{if(!(!r||!i.trim())){p(true);try{let N=await r(i.trim(),b);N&&(a([...e,N]),c(""),y(Tn[Math.floor(Math.random()*Tn.length)]||"#3B82F6"));}finally{p(false);}}},L=(N,$)=>{$.stopPropagation(),a(e.filter(U=>U.id!==N));},B={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&m(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:B,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:u,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:C.top,left:C.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:k,type:"text",value:i,onChange:N=>c(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&i.trim()&&!D&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(N=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${N.color}20`,color:N.color},onClick:$=>L(N.id,$),children:[N.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},N.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:x.length>0?x.map(N=>{let $=e.some(U=>U.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>T(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:$?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:U=>{$||(U.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:U=>{$||(U.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.name}),$&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!D&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Tn.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:b===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:b,color:"#FFFFFF",opacity:l?.7:1},children:[l?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function $s({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 Ud({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($s,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Xr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function _d(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function Jg(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function mr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:l,onDeleteAttachment:p,availableTasks:b=[],comments:y=[],onAddComment:C,currentUser:g,mentionableUsers:v=[],onUploadCommentAttachments:h}){let u=s==="dark",k={textTertiary:u?"#6B7280":"#9CA3AF",textSecondary:u?"#9CA3AF":"#6B7280",textPrimary:u?"#FFFFFF":"#111827",borderLight:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:u?"#1A1D25":"#FFFFFF",bgSecondary:u?"#0F1117":"#F9FAFB",hoverBg:u?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},x=e&&"title"in e&&!("name"in e),D=e,[T,w]=react.useState(e?_d(e,d):null),[L,B]=react.useState(false),[N,$]=react.useState(false),[U,j]=react.useState(false),[se,ee]=react.useState(null),[ie,ve]=react.useState(new Date),[Ce,Ae]=react.useState(false),[F,R]=react.useState(false),[S,_]=react.useState(""),[J,ce]=react.useState(false),[pe,V]=react.useState(false),[ue,K]=react.useState(false),[He,le]=react.useState(""),Re=react.useRef(null),rt=react.useRef(null),[ot,Ke]=react.useState(""),yt=react.useRef(null),[lt,Ot]=react.useState(""),[me,I]=react.useState(false),[ae,we]=react.useState([]);react.useEffect(()=>{if(e){let P=_d(e,d);w(P),le(P.description||""),Ke(P.name||"");}},[e?.id,d]),react.useEffect(()=>{if(!t||!He)return;let P=setTimeout(()=>{let A=rt.current;A&&(A.style.height="auto",A.style.height=`${Math.max(100,A.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,He]),react.useEffect(()=>()=>{Re.current&&clearTimeout(Re.current),yt.current&&clearTimeout(yt.current);},[]);let Be=react.useCallback(P=>{w(P),x&&o&&D?o(Jg(P,D)):r&&r(P);},[x,D,o,r]),Z=react.useCallback(()=>{B(false),$(false),j(false),ee(null),R(false),_(""),ce(false);},[]),Me=react.useCallback((P,A)=>{if(!T)return;let O={...T,[P]:A};Be(O);},[T,Be]),G=react.useCallback(()=>{let P=rt.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),q=react.useCallback(P=>{le(P),setTimeout(G,0),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{if(T){let A={...T,description:P};Be(A);}},800);},[T,Be,G]),$e=react.useCallback(P=>{Ke(P),yt.current&&clearTimeout(yt.current),yt.current=setTimeout(()=>{if(T&&P.trim()){let A={...T,name:P.trim()};Be(A);}},800);},[T,Be]),Oe=react.useCallback(P=>{let A=P.map(O=>{let re={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:O};return O.type.startsWith("image/")&&(re.preview=URL.createObjectURL(O)),re});we(O=>[...O,...A]);},[]),je=react.useCallback(P=>{we(A=>{let O=A.find(re=>re.id===P);return O?.preview&&URL.revokeObjectURL(O.preview),A.filter(re=>re.id!==P)});},[]),We=react.useCallback(async()=>{if(!(!T||!lt.trim()&&ae.length===0||!C)){I(true);try{let P=Bd(lt,v),A=[];if(ae.length>0&&h){let O=ae.map(re=>re.file);A=await h(O);}await C(T.id,lt.trim(),P.length>0?P:void 0,A.length>0?A:void 0),Ot(""),ae.forEach(O=>{O.preview&&URL.revokeObjectURL(O.preview);}),we([]);}finally{I(false);}}},[T,lt,ae,C,v,h]),de=react.useCallback(P=>{let A=typeof P=="string"?new Date(P):P,re=new Date().getTime()-A.getTime(),Le=Math.floor(re/6e4),De=Math.floor(re/36e5),z=Math.floor(re/864e5);return Le<1?n==="es"?"Ahora":"Just now":Le<60?n==="es"?`Hace ${Le} min`:`${Le}m ago`:De<24?n==="es"?`Hace ${De}h`:`${De}h ago`:z<7?n==="es"?`Hace ${z}d`:`${z}d ago`:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ie=react.useCallback(P=>{if(!T)return;let A=T.progress||0;P==="completed"?A=100:P==="in-progress"&&A===0?A=10:P==="todo"&&(A=0);let O={...T,status:P,progress:A};Be(O),B(false);},[T,Be]),Q=react.useCallback((P,A)=>{if(!T)return;let O={...T,startDate:P,endDate:A};Be(O);},[T,Be]),_e=react.useCallback(()=>{let P=ie.getFullYear(),A=ie.getMonth(),O=new Date(P,A,1),Le=new Date(P,A+1,0).getDate(),De=O.getDay(),z=[],te=new Date(P,A,0).getDate();for(let Qe=De-1;Qe>=0;Qe--)z.push({date:new Date(P,A-1,te-Qe),isCurrentMonth:false});for(let Qe=1;Qe<=Le;Qe++)z.push({date:new Date(P,A,Qe),isCurrentMonth:true});let Fe=42-z.length;for(let Qe=1;Qe<=Fe;Qe++)z.push({date:new Date(P,A+1,Qe),isCurrentMonth:false});return z},[ie]),Na=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),V(false),!T||!l)return;let A=Array.from(P.dataTransfer.files);if(A.length!==0){K(true);try{await l(T.id,A);}finally{K(false);}}},[T,l]),ge=react.useCallback(async P=>{if(!T||!l||!P.target.files)return;let A=Array.from(P.target.files);if(A.length!==0){K(true);try{await l(T.id,A);}finally{K(false);}P.target.value="";}},[T,l]),Ve=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),V(true);},[]),ze=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),V(false);},[]),Ye=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Ze=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!T?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",u?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",u?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",u?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:f("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let P=T.progress===100?0:100,O={...T,progress:P,status:P===100?"completed":"todo"};Be(O);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",T.progress===100?"bg-green-500 border-green-500":u?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:ot,onChange:P=>$e(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:f("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",T.progress===100?"line-through text-[#6B7280]":u?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Z(),B(!L);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",T.progress===100||T.status==="completed"?"bg-green-500/20 text-green-400":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/20 text-blue-400":u?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.progress===100||T.status==="completed"?n==="es"?"COMPLETADO":"DONE":T.progress&&T.progress>0||T.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&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:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>Ie(P.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",T.status===P.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:u?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Z(),j(!U);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[T.assignees&&T.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[T.assignees.slice(0,3).map((P,A)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},A)),T.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:["+",T.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",u?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>j(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:d.length>0?d.map(P=>{let A=T.assignees?.some(O=>O.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let O=T.assignees||[],re;A?re=O.filter(Le=>Le.name!==P.name):re=[...O,P],Me("assignees",re);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",A&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1",u?"text-white":"text-gray-900"),children:P.name}),A&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{ee(se?null:"start"),ve(T.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[T.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",u?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),T.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ee(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",u?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,A=new Date(P);A.setDate(P.getDate()+1);let O=new Date(P);O.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let re=new Date(P);re.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let Le=new Date(P);Le.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let De=new Date(P);De.setDate(P.getDate()+14);let z=new Date(P);return z.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:O,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:re,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Le,display:Le.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:De,display:De.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:z,display:z.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Fe,Qe)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(se==="start"){let nt=T.endDate&&Fe.date>T.endDate?Fe.date:T.endDate;Q(Fe.date,nt),ee("end");}else {let nt=T.startDate&&Fe.date<T.startDate?Fe.date:T.startDate;Q(nt,Fe.date),ee(null);}},children:[jsxRuntime.jsx("span",{children:Fe.label}),jsxRuntime.jsx("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:Fe.display})]},Qe))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Q(void 0,void 0),ee(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",u?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:se==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:f("font-medium",u?"text-white":"text-gray-900"),children:ie.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:()=>ve(new Date),className:f("p-1 rounded text-sm transition-colors",u?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ve(new Date(ie.getFullYear(),ie.getMonth()-1)),className:f("p-1 rounded",u?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>ve(new Date(ie.getFullYear(),ie.getMonth()+1)),className:f("p-1 rounded",u?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",u?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:_e().map((P,A)=>{let O=P.date.toDateString()===new Date().toDateString(),re=T.startDate?.toDateString()===P.date.toDateString(),Le=T.endDate?.toDateString()===P.date.toDateString(),De=re||Le,z=T.startDate&&T.endDate&&P.date>=T.startDate&&P.date<=T.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let te=new Date(P.date);if(se==="start"){let Fe=T.endDate&&te>T.endDate?te:T.endDate;Q(te,Fe),ee("end");}else {let Fe=T.startDate&&te<T.startDate?te:T.startDate;Q(Fe,te),ee(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(u?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(u?"text-white":"text-gray-900"),O&&"ring-2 ring-[#3B82F6]",re&&"bg-[#3B82F6] text-white",Le&&!re&&"bg-[#7C3AED] text-white",z&&!De&&(u?"bg-[#7C3AED]/20":"bg-purple-100"),!De&&(u?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},A)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Z(),$(!N);},className:f("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",T.priority==="high"||T.priority==="urgent"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":T.priority==="low"?"bg-green-500/20 text-green-400":u?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.priority?T.priority==="high"||T.priority==="urgent"?n==="es"?"Alta":"High":T.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{Me("priority",P.id),$(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",T.priority===P.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:u?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-white":"text-gray-900"),children:T.startDate&&T.endDate?`${Math.ceil((T.endDate.getTime()-T.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full border-2",u?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Ce?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:T.progress||0,onChange:P=>{let A=parseInt(P.target.value),O=T.status;A===100?O="completed":A>0?O="in-progress":O="todo";let re={...T,progress:A,status:O};Be(re);},onBlur:()=>Ae(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",u?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Ae(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",u?"text-white":"text-gray-900"),children:[T.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Nr,{selectedTags:T.tags||[],availableTags:m,onChange:P=>{Me("tags",P);},onCreateTag:i,theme:k})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[T.dependencies&&T.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:T.dependencies.map(P=>{let A=b.find(O=>O.id===P);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",u?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[A?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let O=(T.dependencies||[]).filter(re=>re!==P);Me("dependencies",O);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},P)})}),jsxRuntime.jsxs("button",{onClick:()=>{Z(),R(!F);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{R(false),_("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:P=>_(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",u?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:b.length>0?b.filter(P=>P.id!==T.id).filter(P=>S===""||P.name.toLowerCase().includes(S.toLowerCase())).map(P=>{let A=T.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let O=T.dependencies||[],re;A?re=O.filter(Le=>Le!==P.id):re=[...O,P.id],Me("dependencies",re);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",A&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",A?"bg-blue-500 border-blue-500":u?"border-white/30":"border-gray-300"),children:A&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:f("block truncate",u?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Z(),ce(!J);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:T.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-white":"text-gray-900"),children:Xr.find(P=>P.value===T.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ce(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Xr.map(P=>{let A=T.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{Me("color",P.value),ce(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",A&&"ring-2 ring-offset-2",u?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:A?P.value:void 0},title:P.name,children:A&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:T.isMilestone||false,onChange:P=>Me("isMilestone",P.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",T.isMilestone?"bg-purple-500 border-purple-500":u?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:rt,value:He,onChange:P=>q(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",u?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",u?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),T.subtasks&&T.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:T.subtasks.map(P=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",P.progress===100?"bg-green-500 border-green-500":u?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",P.progress===100?"line-through text-[#6B7280]":u?"text-white":"text-gray-900"),children:P.name})]},P.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let A=Ze(P.type),O=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[O&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(A,{className:f("w-5 h-5",u?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",u?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:Ye(P.size)})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(P.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",u?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ve,onDragLeave:ze,onDrop:Na,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",pe?u?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":u?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ue&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ge,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||ue}),ue?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:f("w-6 h-6 mx-auto mb-2",pe?"text-blue-500":u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:pe?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!l&&jsxRuntime.jsx("p",{className:f("text-xs mt-1",u?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:f("w-80 border-l flex flex-col",u?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",u?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:y.map(P=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:f("text-sm font-medium",u?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:de(P.createdAt)})]}),jsxRuntime.jsx("div",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Od,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(A=>{let O=A.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:f("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[O?jsxRuntime.jsx(lucideReact.Image,{className:f("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:f("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:f("text-xs truncate max-w-[100px]",u?"text-white":"text-gray-900"),children:A.name})]},A.id)})})]})]},P.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:f("w-10 h-10 mb-3",u?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Rd,{value:lt,onChange:Ot,onSubmit:We,users:v,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!C,isSubmitting:me,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:ae,onFilesSelect:Oe,onRemoveFile:je})})]})]})]})})}function Ys(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function Er({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:d,isLoading:m,error:i,children:c,availableTags:l=[],onCreateTag:p,attachmentsByCard:b,onUploadAttachments:y,onDeleteAttachment:C,comments:g,onAddComment:v,currentUser:h,mentionableUsers:u,onTaskOpen:k}){let[x,D]=Ys(),[T,w]=react.useState(null),[L,B]=react.useState(false),N=react.useRef(null),$=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),U=o?.theme||"dark",j=U==="dark"||U==="neutral",se=j?"dark":"",ee=react.useCallback((V,ue)=>{t.onCardUpdate?.(V,ue);},[t]),ie=react.useCallback((V,ue)=>{t.onColumnUpdate?.(V,{title:ue});},[t]),ve=react.useCallback(V=>{t.onColumnDelete?.(V);},[t]),Ce=["todo","in-progress","completed"],Ae=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),F=react.useMemo(()=>{let V=new Map;return e.columns.forEach(ue=>{let K=ue.cardIds.map(He=>e.cards.find(le=>le.id===He)).filter(He=>He!==void 0).sort((He,le)=>He.position-le.position);V.set(ue.id,K);}),V},[e.cards,e.columns]);react.useEffect(()=>{let V=N.current;if(!V)return;let ue=Re=>{let rt=Re.target,ot=Re.button===1,Ke=rt===V||rt.classList.contains("asakaa-column")&&!rt.closest(".asakaa-card");(ot||Re.button===0&&Ke&&!x.isDragging)&&(Re.preventDefault(),B(true),$.current={x:Re.clientX,y:Re.clientY,scrollLeft:V.scrollLeft,scrollTop:V.scrollTop},V.style.cursor="grabbing",V.style.userSelect="none");},K=Re=>{if(!L)return;let rt=Re.clientX-$.current.x,ot=Re.clientY-$.current.y;V.scrollLeft=$.current.scrollLeft-rt,V.scrollTop=$.current.scrollTop-ot;},He=()=>{L&&(B(false),V.style.cursor="",V.style.userSelect="");},le=()=>{L&&(B(false),V.style.cursor="",V.style.userSelect="");};return V.addEventListener("mousedown",ue),document.addEventListener("mousemove",K),document.addEventListener("mouseup",He),V.addEventListener("mouseleave",le),()=>{V.removeEventListener("mousedown",ue),document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",He),V.removeEventListener("mouseleave",le);}},[L,x.isDragging]);let R=react.useMemo(()=>e.cards.map(V=>({id:V.id,name:V.title,startDate:V.startDate?new Date(V.startDate):void 0,endDate:V.endDate?new Date(V.endDate):void 0,progress:V.progress||0,status:V.columnId,priority:V.priority?.toLowerCase(),dependencies:Array.isArray(V.dependencies)?V.dependencies.map(ue=>typeof ue=="string"?ue:ue.taskId):[]})),[e.cards]),S=react.useCallback(V=>{let{active:ue}=V,K=e.cards.find(He=>He.id===ue.id);K&&D({isDragging:true,draggedCardId:K.id,sourceColumnId:K.columnId,targetColumnId:K.columnId});},[e.cards,D]),_=react.useCallback(V=>{let{active:ue,over:K}=V;if(!K||!e.cards.find(Re=>Re.id===ue.id))return;let le=null;K.data.current?.type==="column"?le=K.id:K.data.current?.type==="card"&&(le=e.cards.find(rt=>rt.id===K.id)?.columnId||null),le&&le!==x.targetColumnId&&D({...x,targetColumnId:le});},[e.cards,x,D]),J=react.useCallback(async V=>{let{active:ue,over:K}=V;if(D({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!K)return;let He=e.cards.find(ot=>ot.id===ue.id);if(!He)return;let le,Re;if(K.data.current?.type==="column"){le=K.id;let ot=F.get(le)||[];Re=Ms(ot,0);}else {let ot=e.cards.find(lt=>lt.id===K.id);if(!ot)return;le=ot.columnId;let Ke=F.get(le)||[],yt=Ke.findIndex(lt=>lt.id===K.id);Re=Ms(Ke,yt);}let rt=e.columns.find(ot=>ot.id===le);if(rt&&rt.wipLimit&&rt.wipLimitType==="hard"){let ot=F.get(le)||[];if(He.columnId!==le&&ot.length>=rt.wipLimit){t.onWipLimitExceeded?.(rt,He);return}}(He.columnId!==le||He.position!==Re)&&await t.onCardMove?.(He.id,le,Re);},[e.cards,e.columns,F,t,D]),ce=react.useCallback(V=>{w(V),a?.(V),k?.(V.id);},[a,k]),pe=react.useCallback(V=>{t.onCardUpdate?.(V.id,V),w(V);},[t]);return m?jsxRuntime.jsx("div",{className:f("asakaa-board",se,n),style:d,children:jsxRuntime.jsx(cf,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:f("asakaa-board",se,n),style:d,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(pd,{themeName:U,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:Ae,collisionDetection:core$1.closestCorners,onDragStart:S,onDragOver:_,onDragEnd:J,children:[jsxRuntime.jsxs("div",{ref:N,className:f("asakaa-board",se,n),style:{...d,cursor:L?"grabbing":void 0},"data-theme":U,children:[e.columns.sort((V,ue)=>V.position-ue.position).map(V=>{let ue=F.get(V.id)||[],K=!Ce.includes(V.id);return jsxRuntime.jsx(bo,{column:V,cards:ue,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:ce,onCardUpdate:ee,onColumnRename:ie,onColumnDelete:ve,isDeletable:K,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},V.id)}),c]}),jsxRuntime.jsx(core$1.DragOverlay,{children:x.draggedCardId?jsxRuntime.jsx(cr,{card:e.cards.find(V=>V.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(mr,{task:T,isOpen:!!T,onClose:()=>w(null),onCardUpdate:pe,theme:j?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:p,attachments:T?b?.get(T.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:C,availableTasks:R,comments:g,onAddComment:v,currentUser:h,mentionableUsers:u})]})}function cf({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var ff={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},bf={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},hf={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},yf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function vf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let i=c=>{d.current&&!d.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,c)=>i.position-c.position).map((i,c)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function xf({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[d,m]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let b=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(b=>b.handler),p=async(b,y)=>{if(y){m(b);try{await y();}catch(C){console.error(`Export ${b} failed:`,C);}finally{m(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((b,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(b.id,b.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===b.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):b.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function kf({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function Xs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:d,onExportExcel:m,translations:i}){let c=r==="dark"?ff:bf,l={...o==="es"?hf:yf,...i},p=n||d||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xf,{theme:c,t:l,onExportCSV:n,onExportJSON:d,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsxRuntime.jsx(vf,{columns:e,onSelect:t,theme:c,t:l,createTaskLabel:a}):jsxRuntime.jsx(kf,{onClick:()=>t(),label:a||l.newTask}))]})})}function Zs({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(""),i=react.useCallback(()=>{let p=d.trim();p&&(e(p),m(""),n(false));},[d,e]),c=react.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(m(""),n(false));},[i]),l=react.useCallback(()=>{setTimeout(()=>{d.trim()||n(false);},150);},[d]);return s?jsxRuntime.jsx("div",{className:f("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:d,onChange:p=>m(p.target.value),onKeyDown:c,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!d.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:f("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Qs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:d="dark",locale:m="es"}){let[i,c]=react.useState(false),[l,p]=react.useState(false),[b,y]=react.useState(""),[C,g]=react.useState([]),[v,h]=react.useState(""),[u,k]=react.useState(""),[x,D]=react.useState(""),[T,w]=react.useState(false),[L,B]=react.useState(false),[N,$]=react.useState(false),U=react.useRef(null),j=react.useRef(null),se={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},ee=react.useCallback(()=>{y(""),g([]),h(""),k(""),D(""),w(false),B(false),$(false),c(false);},[]);react.useEffect(()=>{i&&U.current&&U.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let F=R=>{j.current&&!j.current.contains(R.target)&&(b.trim()||ee());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[i,b,ee]);let ie=react.useCallback(async()=>{let F=b.trim();if(!(!F||l)){p(true);try{await t({name:F,columnId:e,assigneeIds:C.length>0?C:void 0,startDate:v?new Date(v):void 0,endDate:u?new Date(u):void 0,priority:x||void 0}),y(""),g([]),h(""),k(""),D(""),w(!1),B(!1),$(!1),U.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{p(false);}}},[b,e,C,v,u,x,t,l]),ve=react.useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),ie()):F.key==="Escape"&&ee();},[ie,ee]),Ce=react.useCallback(F=>{g(R=>R.includes(F)?R.filter(S=>S!==F):[...R,F]);},[]),Ae=d==="dark";return i?jsxRuntime.jsxs("div",{ref:j,className:f("rounded-lg overflow-hidden shadow-lg",Ae?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:U,type:"text",value:b,onChange:F=>y(F.target.value),onKeyDown:ve,placeholder:se.placeholder,disabled:l,className:f("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ae?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>w(!T),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||C.length>0?"bg-emerald-500/20 text-emerald-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:se.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),C.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:C.length})]}),jsxRuntime.jsx("button",{onClick:()=>B(!L),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||v||u?"bg-blue-500/20 text-blue-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:se.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>$(!N),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||x?x==="urgent"?"bg-red-500/20 text-red-400":x==="high"?"bg-orange-500/20 text-orange-400":x==="medium"?"bg-yellow-500/20 text-yellow-400":x==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:se.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:ie,disabled:!b.trim()||l,className:f("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):se.save})]})]}),T&&a.length>0&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxRuntime.jsxs("button",{onClick:()=>Ce(F.id),className:f("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",C.includes(F.id)?"bg-emerald-500 text-white":Ae?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsxRuntime.jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",C.includes(F.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:F.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:F.name.split(" ")[0]})]},F.id))})}),L&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:se.startDate}),jsxRuntime.jsx("input",{type:"date",value:v,onChange:F=>h(F.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:se.endDate}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:F=>k(F.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),N&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsxRuntime.jsx("button",{onClick:()=>D(x===F?"":F),className:f("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",x===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:Ae?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:se[F]},F))})})]}):jsxRuntime.jsxs("button",{onClick:()=>c(true),disabled:n,className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ae?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:se.buttonLabel})]})}var _o=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(Er,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
5
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function oc(e={}){return new _o(e)}var yo=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function ei(e,t){let a=r=>jsxRuntime.jsx(yo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ai({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:d,onOpenAIUsage:m,shortcut:i="k",className:c=""}){let[l,p]=react.useState(false),[b,y]=react.useState(""),[C,g]=react.useState("home"),[v,h]=react.useState(""),[u,k]=react.useState("");react.useEffect(()=>{let w=L=>{(L.metaKey||L.ctrlKey)&&L.key===i&&(L.preventDefault(),p(B=>!B)),L.key==="Escape"&&(p(false),g("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{l||(g("home"),y(""),h(""),k(""));},[l]);let x=react.useCallback(()=>{p(false);},[]),D=react.useCallback(w=>{let[L,B]=w.split(":");switch(L){case "create-card":g("create-card");break;case "create-card-in":h(B||"");break;case "navigate":B?(a?.(B),x()):g("navigate");break;case "search":r?.(b),x();break;case "priority":g("priority");break;case "set-priority":u&&B&&(o?.(u,B),x());break;case "assign":g("assign");break;case "assign-user":u&&B&&(s?.(u,B),x());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),x();break;case "ai-predict-risks":d?.(),x();break;case "ai-usage":m?.(),x();break;case "back":g("home");break;}},[b,u,t,a,r,o,s,n,d,m,x]),T=react.useCallback(()=>{v&&b.trim()&&(t?.(v,b.trim()),x());},[v,b,t,x]);return l?jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:x,children:jsxRuntime.jsx("div",{className:`command-palette ${c}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:b,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:C==="create-card"&&v?"Type card title and press Enter...":C==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&C==="create-card"&&v&&T();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),C==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},w.id))})]}),C==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),C==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let L=e.columns.find(B=>B.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:L?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},w.id)})})]}),C==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function ic(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
6
6
|
position: fixed !important;
|
|
7
7
|
inset: 0 !important;
|
|
8
8
|
z-index: 2147483647 !important;
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
border: none !important;
|
|
69
69
|
cursor: pointer !important;
|
|
70
70
|
opacity: 0.5 !important;
|
|
71
|
-
`,b.onmouseenter=()=>{b.style.opacity="1";},b.onmouseleave=()=>{b.style.opacity="0.5";},b.onclick=y=>{y.stopPropagation();let C=r<a.length-1?r+1:0;i(),o(C);},n.appendChild(l),n.appendChild(p),n.appendChild(b);}n.appendChild(d),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Nf(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function Df(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function oi(e){return e.startsWith("image/")}function nr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=react.useState(false),[m,i]=react.useState(false),[c,l]=react.useState(null),p=react.useRef(null),b=react.useRef(e);b.current=e;let y=react.useCallback((w,L)=>{L.preventDefault(),L.stopPropagation();let B=b.current.filter($=>oi($.type)),N=B.findIndex($=>$.id===w.id),W=$=>{let j=b.current.filter(Q=>oi(Q.type)),de=j[$];de&&nc(de.url,de.name,j,$,W);};nc(w.url,w.name,B,N,W);},[]),C=react.useCallback(w=>{let L=[],B=[];return e.length+w.length>s?(B.push(`Maximum ${s} files allowed`),{valid:L,errors:B}):(w.forEach(N=>{if(N.size/1048576>r){B.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>N.type.match($))){B.push(`${N.name} has invalid file type`);return}L.push(N);}),{valid:L,errors:B})},[e.length,s,r,o]),g=react.useCallback(async w=>{let{valid:L,errors:B}=C(w);if(B.length>0){l(B.join(", ")),setTimeout(()=>l(null),5e3);return}if(L.length!==0){i(true),l(null);try{await t?.(L);}catch(N){l(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[C,t]),v=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),d(true);},[]),h=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),d(false);},[]),u=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),k=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),d(false);let L=Array.from(w.dataTransfer.files);g(L);},[g]),x=react.useCallback(w=>{let L=w.target.files?Array.from(w.target.files):[];g(L),p.current&&(p.current.value="");},[g]),D=react.useCallback(()=>{p.current?.click();},[]),T=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:v,onDragLeave:h,onDragOver:u,onDrop:k,onClick:D,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:x,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),c&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:oi(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>y(w,L),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:w.thumbnailUrl||w.url,alt:w.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Df(w.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Nf(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>T(w.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},w.id))})]})}function ni({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:l,onUploadAttachments:p,onDeleteAttachment:b,onSuggestAssignee:y,onGenerateSubtasks:C,onEstimateEffort:g,currentUserId:v="user-1"}){let[h,u]=react.useState("details"),[k,x]=react.useState(false),[D,T]=react.useState({}),[w,L]=react.useState(""),[B,N]=react.useState(false),[W,$]=react.useState({});if(!t||!e)return null;let j=react.useCallback(()=>{x(false),T({}),u("details"),L(""),$({}),a();},[a]),de=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),T({}),x(false));},[e.id,D,r]),Q=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),j());},[e.id,o,j]),ne=react.useCallback(()=>{c&&w.trim()&&(c(e.id,w.trim()),L(""));},[e.id,w,c]),he=react.useCallback(async()=>{if(y){N(true);try{let S=await y(e);$(R=>({...R,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{N(false);}}},[e,y]),ke=react.useCallback(async()=>{if(C){N(true);try{let S=await C(e);$(R=>({...R,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{N(false);}}},[e,C]),Ae=react.useCallback(async()=>{if(g){N(true);try{let S=await g(e);$(R=>({...R,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{N(false);}}},[e,g]),F={...e,...D},O=s.filter(S=>F.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:j,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:D.title??F.title,onChange:S=>T({...D,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:de,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{x(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>x(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:Q,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:j,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>u("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>u("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),k?jsxRuntime.jsx("textarea",{value:D.description??F.description??"",onChange:S=>T({...D,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??F.assignedUserIds??[],onChange:S=>{let R=Array.from(S.target.selectedOptions,V=>V.value);T({...D,assignedUserIds:R});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:O.length>0?O.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),k?jsxRuntime.jsxs("select",{value:D.priority??F.priority??"",onChange:S=>T({...D,priority:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:F.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:F.labels&&F.labels.length>0?F.labels.map(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:S=>T({...D,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:S=>T({...D,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??F.estimatedTime??"",onChange:S=>T({...D,estimatedTime:S.target.value?parseFloat(S.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:F.dependencies&&F.dependencies.length>0?F.dependencies.map(S=>{let R=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",R.slice(-4)]},R)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:F.createdAt?new Date(F.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:S=>L(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ne,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(S=>{let R=s.find(V=>V.id===S.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[R&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:R.color},children:R.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:R?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(S.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:S.content})]},S.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:d.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:d.map(S=>{let R=s.find(V=>V.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:R?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(nr,{cardId:e.id,attachments:i,onUpload:p?S=>p(e.id,S):void 0,onDelete:b,currentUserId:v,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:he,disabled:B||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:ke,disabled:B||!C,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:Ae,disabled:B||!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"]})]}),W.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((S,R)=>{let V=s.find(ee=>ee.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[V&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:V.color},children:V.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:V?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},R)})]}),W.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((S,R)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},R))]}),W.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:[W.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function jo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,m]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),p=window.innerHeight,b=window.innerWidth,y=4,C=l.left;C+o>b-10&&(C=b-o-10),C<10&&(C=10);let g=p-l.bottom,v=l.top,h;return g>=s+y?h=l.bottom+y:v>=s+y?h=l.top-s-y:g>=v?h=l.bottom+y:h=Math.max(10,l.top-s-y),{top:h,left:C}},[e,o,s]);return react.useEffect(()=>{t&&m(c());},[t,c]),react.useEffect(()=>{if(!t)return;let l=b=>{let y=b.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Ye={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#57534E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var If=["LOW","MEDIUM","HIGH","URGENT"],Bf=["todo","in-progress","review","done"];function li({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:l,onAICreateSubtasks:p,onAIFindSimilar:b,availableColumns:y=[],availableLabels:C=[],availableTags:g=[],onCreateTag:v,onUploadCoverImage:h,unsplashAccessKey:u,theme:k,onSubtasksChange:x,attachments:D=[],onUploadAttachments:T,onDeleteAttachment:w}){let L=uo(),B=k||L?.themeName||"dark",[N,W]=react.useState(e),[$,j]=react.useState(false),[de,Q]=react.useState(e?.subtasks||[]),[ne,he]=react.useState(false),[ke,Ae]=react.useState(""),[F,O]=react.useState(""),[S,R]=react.useState("all"),[V,ee]=react.useState(false),[se,le]=react.useState(false),[Pe,Z]=react.useState(false),[_e,we]=react.useState(false),[je,yt]=react.useState(false),[It,at]=react.useState(false),kt=react.useRef(null),mt=react.useRef(null),Ot=react.useRef(null),me=react.useRef(null),I=react.useRef(null),ae=react.useRef(null),xe=react.useRef(null),Be=react.useRef(null),X=react.useRef(null),Me=react.useRef(null),_=react.useRef(null),Y=react.useRef(null);react.useEffect(()=>{e&&!N?(W({...e}),Q(e.subtasks||[])):e&&N&&e.id!==N.id&&(W({...e}),Q(e.subtasks||[]));},[e,N]),react.useEffect(()=>{let U=te=>{let Fe=te.target;me.current&&!me.current.contains(Fe)&&ee(false),I.current&&!I.current.contains(Fe)&&le(false),ae.current&&!ae.current.contains(Fe)&&Z(false),xe.current&&!xe.current.contains(Fe)&&we(false);};if(V||se||Pe||_e)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[V,se,Pe,_e]),react.useEffect(()=>{if(!t)return;let U=te=>{let Fe=te.target,Ze=Fe.tagName==="INPUT"||Fe.tagName==="TEXTAREA"||Fe.isContentEditable;if(te.key==="Escape"){te.preventDefault(),V||se||Pe||_e||je||It?(ee(false),le(false),Z(false),we(false),yt(false),at(false)):Ze||a();return}if(Ze&&te.key!=="Escape")return;let rt=te.metaKey||te.ctrlKey;switch(te.key.toLowerCase()){case "s":te.preventDefault(),ee(true);break;case "a":te.preventDefault(),Z(true);break;case "p":te.preventDefault(),le(true);break;case "l":te.preventDefault(),we(true);break;case "d":rt||(te.preventDefault(),yt(true),setTimeout(()=>Be.current?.focus(),0));break;case "e":rt||(te.preventDefault(),at(true));break;case "i":te.preventDefault(),j(true),setTimeout(()=>mt.current?.focus(),0);break;case "t":te.preventDefault(),he(true);break;case "c":te.preventDefault(),Ot.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,V,se,Pe,_e,je,It]);let Ue=react.useCallback(U=>{let te=U.currentTarget.textContent?.trim()||"";if(N&&te!==N.title){let Fe={...N,title:te};W(Fe),r?.(N.id,{title:te});}},[N,r]),Re=react.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=N?.title||"",U.currentTarget.blur());},[N]),Ve=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),j(false);},[N,e,r]),He=react.useCallback(U=>{if(N){let te={...N,columnId:U};W(te),r?.(N.id,{columnId:U}),ee(false);}},[N,r]),ce=react.useCallback(U=>{if(N){let te={...N,priority:U};W(te),r?.(N.id,{priority:U}),le(false);}},[N,r]),Ie=react.useCallback(U=>{if(N){let te=N.assignedUserIds||[],Fe=te.includes(U)?te.filter(rt=>rt!==U):[...te,U],Ze={...N,assignedUserIds:Fe};W(Ze),r?.(N.id,{assignedUserIds:Fe});}},[N,r]),J=react.useCallback(U=>{if(N){let te=N.labels||[],Fe=te.includes(U)?te.filter(rt=>rt!==U):[...te,U],Ze={...N,labels:Fe};W(Ze),r?.(N.id,{labels:Fe});}},[N,r]),We=react.useCallback(U=>{if(N){let te={...N,tags:U};W(te),r?.(N.id,{tags:U});}},[N,r]),Na=react.useCallback(U=>{if(N){let te=U.target.value,Fe={...N,endDate:te};W(Fe),r?.(N.id,{endDate:te}),yt(false);}},[N,r]),pe=react.useCallback(U=>{if(N){let te={...N,estimatedTime:parseFloat(U)||0};W(te),r?.(N.id,{estimatedTime:parseFloat(U)||0});}},[N,r]),Ge=react.useCallback(()=>{if(ke.trim()&&N){let U={id:`subtask-${Date.now()}`,title:ke.trim(),completed:false,createdAt:new Date},te=[...de,U];Q(te),Ae(""),he(false),x?.(N.id,te);}},[ke,de,N,x]),Oe=react.useCallback(U=>{let te=de.map(Fe=>Fe.id===U?{...Fe,completed:!Fe.completed,updatedAt:new Date}:Fe);Q(te),N&&x?.(N.id,te);},[de,N,x]),Ke=react.useCallback(U=>{let te=de.filter(Fe=>Fe.id!==U);Q(te),N&&x?.(N.id,te);},[de,N,x]),Je=react.useCallback(()=>{F.trim()&&N&&m&&(m(N.id,F.trim()),O(""));},[F,N,m]),P=react.useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),Je());},[Je]),A=U=>jsxRuntime.jsx(Ff__default.default,{remarkPlugins:[Af__default.default],rehypePlugins:[Lf__default.default],components:{a:({node:te,...Fe})=>jsxRuntime.jsx("a",{...Fe,target:"_blank",rel:"noopener noreferrer"})},children:U}),z=d.filter(U=>S==="comments"?U.type.includes("COMMENT"):S==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let re=N||e,Le=s.filter(U=>re.assignedUserIds?.includes(U.id)),Ne=de.filter(U=>U.completed).length;return jsxRuntime.jsx(lt,{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":B,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:kt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ue,onKeyDown:Re,children:re.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:me,children:[jsxRuntime.jsxs("button",{ref:X,className:"modal-v2-field",onClick:()=>ee(!V),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:re.columnId||"No status"})]}),jsxRuntime.jsx(jo,{triggerRef:X,isOpen:V,onClose:()=>ee(false),width:250,estimatedHeight:200,children:(y.length>0?y:Bf.map(U=>({id:U,title:U}))).map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${re.columnId===U.id?"active":""}`,onClick:()=>He(U.id),children:U.title},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ae,children:[jsxRuntime.jsxs("button",{ref:Me,className:"modal-v2-field",onClick:()=>Z(!Pe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Le.map(U=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jo,{triggerRef:Me,isOpen:Pe,onClose:()=>Z(false),width:280,estimatedHeight:300,children:s.map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${re.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>Ie(U.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,re.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:I,children:[jsxRuntime.jsxs("button",{ref:_,className:"modal-v2-field",onClick:()=>le(!se),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:re.priority||"None"})]}),jsxRuntime.jsxs(jo,{triggerRef:_,isOpen:se,onClose:()=>le(false),width:180,estimatedHeight:220,children:[If.map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${re.priority===U?"active":""}`,onClick:()=>ce(U),children:U},U)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>ce(""),children:"None"})]})]}),g.length>0||v?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Nr,{selectedTags:re.tags||[],availableTags:g,onChange:We,onCreateTag:v,theme:Ye[B]||Ye.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:xe,children:[jsxRuntime.jsxs("button",{ref:Y,className:"modal-v2-field",onClick:()=>we(!_e),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:re.labels&&re.labels.length>0?jsxRuntime.jsx("span",{children:re.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jo,{triggerRef:Y,isOpen:_e,onClose:()=>we(false),width:220,estimatedHeight:200,children:(C.length>0?C:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${re.labels?.includes(U)?"active":""}`,onClick:()=>J(U),children:[U,re.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:()=>{yt(!je),setTimeout(()=>Be.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:re.endDate?new Date(re.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Be,type:"date",value:typeof re.endDate=="string"?re.endDate.split("T")[0]:re.endDate?(()=>{let U=new Date(re.endDate),te=U.getUTCFullYear(),Fe=String(U.getUTCMonth()+1).padStart(2,"0"),Ze=String(U.getUTCDate()).padStart(2,"0");return `${te}-${Fe}-${Ze}`})():"",onChange:Na,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>at(!It),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:re.estimatedTime?`${re.estimatedTime}h`:"Not set"})]}),It&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:re.estimatedTime||"",onChange:U=>pe(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>at(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),$?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:re.description||"",onChange:U=>{if(N){let te={...N,description:U.target.value};W(te);}},onBlur:Ve,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>j(true),children:re.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:A(re.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"}),de.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Ne,"/",de.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>he(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:[de.map(U=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Oe(U.id),children:U.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:U.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ke(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)),ne&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:ke,onChange:U=>Ae(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Ge(),U.key==="Escape"&&(he(false),Ae(""));},onBlur:Ge,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||D.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(nr,{cardId:re.id,attachments:D,onUpload:T?U=>T(re.id,U):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="all"?"active":""}`,onClick:()=>R("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>R("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>R("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Ot,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:U=>O(U.target.value),onKeyDown:P,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:Je,disabled:!F.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[z.map(U=>{let te=s.find(Ze=>Ze.id===U.userId);if(U.type.includes("COMMENT")){let Ze=n.find(rt=>rt.id===U.metadata?.commentId);return Ze?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[te&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:te.color},children:te.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:te?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ze.content})]})]},U.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:te?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),z.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function _f({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function ci({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((d,m)=>d+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(_f,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,d)=>n+d.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,d)=>n+d.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,d)=>n+(d.planned||0),0)})]})]})]})}function Qf({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function mi({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,d=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=d;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Qf,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var lb={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},gc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function db({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:d,y:m,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function fc({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function pi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||lb[m.name]||gc[e.indexOf(m)%gc.length]})),d=n.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?db:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(fc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,l=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(fc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,i)=>i.value>m.value?i:m).name})]})]})]})}var Mn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=react.useState(false),[m,i]=react.useState(false),[c,l]=react.useState(false),[p,b]=react.useState(false);if(e.length===0)return null;let y=e.map(k=>k.id),C=k=>{r.onBulkUpdate?.(y,{priority:k}),d(false);},g=k=>{r.onBulkMove?.(y,k),i(false),a();},v=k=>{r.onBulkUpdate?.(y,{assignedUserIds:k}),l(false);},h=k=>{let x=new Set;e.forEach(T=>{T.labels?.forEach(w=>x.add(w));});let D=Array.from(new Set([...x,...k]));r.onBulkUpdate?.(y,{labels:D}),b(false);},u=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>C(k),children:[jsxRuntime.jsx("span",{className:f("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>b(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:u,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Mn.displayName="BulkOperationsToolbar";function gb(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(b=>{let y=a?.find(C=>C.id===b);n=`assignee-${b}`,d=y?.name||`User ${b}`,m=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:b,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];d=p.title,m=p.color,r.has(n)||r.set(n,{id:n,title:d,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(b=>{n=`label-${b}`,d=b,m="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:b,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ui({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),d=react.useMemo(()=>gb(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(i=>{n(c=>{let l=new Set(c);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||d.length===0?jsxRuntime.jsx(Er,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:f("asakaa-swimlane-view",o),children:[d.map(i=>{let c=s.has(i.id),l=e.cards.filter(b=>i.cardIds.includes(b.id)),p={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Er,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),d.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var gi=[{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 fi({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),d=gi.find(i=>i.value===e)||gi[0];react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:d.icon}),jsxRuntime.jsx("span",{children:d.label}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:gi.map(i=>jsxRuntime.jsxs("button",{onClick:()=>m(i.value),className:f("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Ko=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function hb(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,d=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&d&&m}function xc(e={}){let{shortcuts:t=Ko,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(m=>{o.current=[...o.current,m];},[]),d=react.useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return react.useEffect(()=>{function m(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(hb(i,l)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function vb(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function xb(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function kb(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=xb(e),r=t?vb(t):"";return a?`${a} + ${r}`:r}function wb(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function bi({shortcuts:e=Ko,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function d(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=wb(e);return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([d,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),d]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:kb(i)})]},i.action))})]},d))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var hi=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
71
|
+
`,b.onmouseenter=()=>{b.style.opacity="1";},b.onmouseleave=()=>{b.style.opacity="0.5";},b.onclick=y=>{y.stopPropagation();let C=r<a.length-1?r+1:0;i(),o(C);},n.appendChild(l),n.appendChild(p),n.appendChild(b);}n.appendChild(d),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Sf(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 Ef(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 oi(e){return e.startsWith("image/")}function nr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=react.useState(false),[m,i]=react.useState(false),[c,l]=react.useState(null),p=react.useRef(null),b=react.useRef(e);b.current=e;let y=react.useCallback((w,L)=>{L.preventDefault(),L.stopPropagation();let B=b.current.filter(U=>oi(U.type)),N=B.findIndex(U=>U.id===w.id),$=U=>{let j=b.current.filter(ee=>oi(ee.type)),se=j[U];se&&ic(se.url,se.name,j,U,$);};ic(w.url,w.name,B,N,$);},[]),C=react.useCallback(w=>{let L=[],B=[];return e.length+w.length>s?(B.push(`Maximum ${s} files allowed`),{valid:L,errors:B}):(w.forEach(N=>{if(N.size/1048576>r){B.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some(U=>N.type.match(U))){B.push(`${N.name} has invalid file type`);return}L.push(N);}),{valid:L,errors:B})},[e.length,s,r,o]),g=react.useCallback(async w=>{let{valid:L,errors:B}=C(w);if(B.length>0){l(B.join(", ")),setTimeout(()=>l(null),5e3);return}if(L.length!==0){i(true),l(null);try{await t?.(L);}catch(N){l(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[C,t]),v=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),d(true);},[]),h=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),d(false);},[]),u=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),k=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),d(false);let L=Array.from(w.dataTransfer.files);g(L);},[g]),x=react.useCallback(w=>{let L=w.target.files?Array.from(w.target.files):[];g(L),p.current&&(p.current.value="");},[g]),D=react.useCallback(()=>{p.current?.click();},[]),T=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:v,onDragLeave:h,onDragOver:u,onDrop:k,onClick:D,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:x,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),c&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:oi(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>y(w,L),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:w.thumbnailUrl||w.url,alt:w.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Ef(w.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Sf(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>T(w.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},w.id))})]})}function ni({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:l,onUploadAttachments:p,onDeleteAttachment:b,onSuggestAssignee:y,onGenerateSubtasks:C,onEstimateEffort:g,currentUserId:v="user-1"}){let[h,u]=react.useState("details"),[k,x]=react.useState(false),[D,T]=react.useState({}),[w,L]=react.useState(""),[B,N]=react.useState(false),[$,U]=react.useState({});if(!t||!e)return null;let j=react.useCallback(()=>{x(false),T({}),u("details"),L(""),U({}),a();},[a]),se=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),T({}),x(false));},[e.id,D,r]),ee=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),j());},[e.id,o,j]),ie=react.useCallback(()=>{c&&w.trim()&&(c(e.id,w.trim()),L(""));},[e.id,w,c]),ve=react.useCallback(async()=>{if(y){N(true);try{let S=await y(e);U(_=>({..._,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{N(false);}}},[e,y]),Ce=react.useCallback(async()=>{if(C){N(true);try{let S=await C(e);U(_=>({..._,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{N(false);}}},[e,C]),Ae=react.useCallback(async()=>{if(g){N(true);try{let S=await g(e);U(_=>({..._,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{N(false);}}},[e,g]),F={...e,...D},R=s.filter(S=>F.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:j,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:D.title??F.title,onChange:S=>T({...D,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:se,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{x(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>x(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:ee,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:j,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>u("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>u("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),k?jsxRuntime.jsx("textarea",{value:D.description??F.description??"",onChange:S=>T({...D,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??F.assignedUserIds??[],onChange:S=>{let _=Array.from(S.target.selectedOptions,J=>J.value);T({...D,assignedUserIds:_});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:R.length>0?R.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),k?jsxRuntime.jsxs("select",{value:D.priority??F.priority??"",onChange:S=>T({...D,priority:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:F.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:F.labels&&F.labels.length>0?F.labels.map(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:S=>T({...D,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:S=>T({...D,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??F.estimatedTime??"",onChange:S=>T({...D,estimatedTime:S.target.value?parseFloat(S.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:F.dependencies&&F.dependencies.length>0?F.dependencies.map(S=>{let _=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",_.slice(-4)]},_)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:F.createdAt?new Date(F.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:S=>L(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ie,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(S=>{let _=s.find(J=>J.id===S.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[_&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:_.color},children:_.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:_?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(S.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:S.content})]},S.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:d.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:d.map(S=>{let _=s.find(J=>J.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:_?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(nr,{cardId:e.id,attachments:i,onUpload:p?S=>p(e.id,S):void 0,onDelete:b,currentUserId:v,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:ve,disabled:B||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:Ce,disabled:B||!C,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:Ae,disabled:B||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),$.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),$.assignees.map((S,_)=>{let J=s.find(ce=>ce.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},_)})]}),$.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),$.subtasks.map((S,_)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},_))]}),$.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[$.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",($.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!$.assignees&&!$.subtasks&&!$.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function jo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,m]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),p=window.innerHeight,b=window.innerWidth,y=4,C=l.left;C+o>b-10&&(C=b-o-10),C<10&&(C=10);let g=p-l.bottom,v=l.top,h;return g>=s+y?h=l.bottom+y:v>=s+y?h=l.top-s-y:g>=v?h=l.bottom+y:h=Math.max(10,l.top-s-y),{top:h,left:C}},[e,o,s]);return react.useEffect(()=>{t&&m(c());},[t,c]),react.useEffect(()=>{if(!t)return;let l=b=>{let y=b.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var qe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#57534E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Rf=["LOW","MEDIUM","HIGH","URGENT"],Of=["todo","in-progress","review","done"];function li({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:l,onAICreateSubtasks:p,onAIFindSimilar:b,availableColumns:y=[],availableLabels:C=[],availableTags:g=[],onCreateTag:v,onUploadCoverImage:h,unsplashAccessKey:u,theme:k,onSubtasksChange:x,attachments:D=[],onUploadAttachments:T,onDeleteAttachment:w}){let L=uo(),B=k||L?.themeName||"dark",[N,$]=react.useState(e),[U,j]=react.useState(false),[se,ee]=react.useState(e?.subtasks||[]),[ie,ve]=react.useState(false),[Ce,Ae]=react.useState(""),[F,R]=react.useState(""),[S,_]=react.useState("all"),[J,ce]=react.useState(false),[pe,V]=react.useState(false),[ue,K]=react.useState(false),[He,le]=react.useState(false),[Re,rt]=react.useState(false),[ot,Ke]=react.useState(false),yt=react.useRef(null),lt=react.useRef(null),Ot=react.useRef(null),me=react.useRef(null),I=react.useRef(null),ae=react.useRef(null),we=react.useRef(null),Be=react.useRef(null),Z=react.useRef(null),Me=react.useRef(null),G=react.useRef(null),q=react.useRef(null);react.useEffect(()=>{e&&!N?($({...e}),ee(e.subtasks||[])):e&&N&&e.id!==N.id&&($({...e}),ee(e.subtasks||[]));},[e,N]),react.useEffect(()=>{let z=te=>{let Fe=te.target;me.current&&!me.current.contains(Fe)&&ce(false),I.current&&!I.current.contains(Fe)&&V(false),ae.current&&!ae.current.contains(Fe)&&K(false),we.current&&!we.current.contains(Fe)&&le(false);};if(J||pe||ue||He)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[J,pe,ue,He]),react.useEffect(()=>{if(!t)return;let z=te=>{let Fe=te.target,Qe=Fe.tagName==="INPUT"||Fe.tagName==="TEXTAREA"||Fe.isContentEditable;if(te.key==="Escape"){te.preventDefault(),J||pe||ue||He||Re||ot?(ce(false),V(false),K(false),le(false),rt(false),Ke(false)):Qe||a();return}if(Qe&&te.key!=="Escape")return;let nt=te.metaKey||te.ctrlKey;switch(te.key.toLowerCase()){case "s":te.preventDefault(),ce(true);break;case "a":te.preventDefault(),K(true);break;case "p":te.preventDefault(),V(true);break;case "l":te.preventDefault(),le(true);break;case "d":nt||(te.preventDefault(),rt(true),setTimeout(()=>Be.current?.focus(),0));break;case "e":nt||(te.preventDefault(),Ke(true));break;case "i":te.preventDefault(),j(true),setTimeout(()=>lt.current?.focus(),0);break;case "t":te.preventDefault(),ve(true);break;case "c":te.preventDefault(),Ot.current?.focus();break}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[t,a,J,pe,ue,He,Re,ot]);let $e=react.useCallback(z=>{let te=z.currentTarget.textContent?.trim()||"";if(N&&te!==N.title){let Fe={...N,title:te};$(Fe),r?.(N.id,{title:te});}},[N,r]),Oe=react.useCallback(z=>{z.key==="Enter"&&(z.preventDefault(),z.currentTarget.blur()),z.key==="Escape"&&(z.preventDefault(),z.currentTarget.textContent=N?.title||"",z.currentTarget.blur());},[N]),je=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),j(false);},[N,e,r]),We=react.useCallback(z=>{if(N){let te={...N,columnId:z};$(te),r?.(N.id,{columnId:z}),ce(false);}},[N,r]),de=react.useCallback(z=>{if(N){let te={...N,priority:z};$(te),r?.(N.id,{priority:z}),V(false);}},[N,r]),Ie=react.useCallback(z=>{if(N){let te=N.assignedUserIds||[],Fe=te.includes(z)?te.filter(nt=>nt!==z):[...te,z],Qe={...N,assignedUserIds:Fe};$(Qe),r?.(N.id,{assignedUserIds:Fe});}},[N,r]),Q=react.useCallback(z=>{if(N){let te=N.labels||[],Fe=te.includes(z)?te.filter(nt=>nt!==z):[...te,z],Qe={...N,labels:Fe};$(Qe),r?.(N.id,{labels:Fe});}},[N,r]),_e=react.useCallback(z=>{if(N){let te={...N,tags:z};$(te),r?.(N.id,{tags:z});}},[N,r]),Na=react.useCallback(z=>{if(N){let te=z.target.value,Fe={...N,endDate:te};$(Fe),r?.(N.id,{endDate:te}),rt(false);}},[N,r]),ge=react.useCallback(z=>{if(N){let te={...N,estimatedTime:parseFloat(z)||0};$(te),r?.(N.id,{estimatedTime:parseFloat(z)||0});}},[N,r]),Ve=react.useCallback(()=>{if(Ce.trim()&&N){let z={id:`subtask-${Date.now()}`,title:Ce.trim(),completed:false,createdAt:new Date},te=[...se,z];ee(te),Ae(""),ve(false),x?.(N.id,te);}},[Ce,se,N,x]),ze=react.useCallback(z=>{let te=se.map(Fe=>Fe.id===z?{...Fe,completed:!Fe.completed,updatedAt:new Date}:Fe);ee(te),N&&x?.(N.id,te);},[se,N,x]),Ye=react.useCallback(z=>{let te=se.filter(Fe=>Fe.id!==z);ee(te),N&&x?.(N.id,te);},[se,N,x]),Ze=react.useCallback(()=>{F.trim()&&N&&m&&(m(N.id,F.trim()),R(""));},[F,N,m]),P=react.useCallback(z=>{(z.metaKey||z.ctrlKey)&&z.key==="Enter"&&(z.preventDefault(),Ze());},[Ze]),A=z=>jsxRuntime.jsx(Lf__default.default,{remarkPlugins:[If__default.default],rehypePlugins:[Bf__default.default],components:{a:({node:te,...Fe})=>jsxRuntime.jsx("a",{...Fe,target:"_blank",rel:"noopener noreferrer"})},children:z}),O=d.filter(z=>S==="comments"?z.type.includes("COMMENT"):S==="history"?!z.type.includes("COMMENT"):true);if(!t||!e)return null;let re=N||e,Le=s.filter(z=>re.assignedUserIds?.includes(z.id)),De=se.filter(z=>z.completed).length;return jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:z=>z.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":B,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:yt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:$e,onKeyDown:Oe,children:re.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:me,children:[jsxRuntime.jsxs("button",{ref:Z,className:"modal-v2-field",onClick:()=>ce(!J),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:re.columnId||"No status"})]}),jsxRuntime.jsx(jo,{triggerRef:Z,isOpen:J,onClose:()=>ce(false),width:250,estimatedHeight:200,children:(y.length>0?y:Of.map(z=>({id:z,title:z}))).map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${re.columnId===z.id?"active":""}`,onClick:()=>We(z.id),children:z.title},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ae,children:[jsxRuntime.jsxs("button",{ref:Me,className:"modal-v2-field",onClick:()=>K(!ue),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Le.map(z=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:z.color},title:z.name,children:z.initials},z.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jo,{triggerRef:Me,isOpen:ue,onClose:()=>K(false),width:280,estimatedHeight:300,children:s.map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${re.assignedUserIds?.includes(z.id)?"active":""}`,onClick:()=>Ie(z.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:z.color},children:z.initials}),z.name,re.assignedUserIds?.includes(z.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:I,children:[jsxRuntime.jsxs("button",{ref:G,className:"modal-v2-field",onClick:()=>V(!pe),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:re.priority||"None"})]}),jsxRuntime.jsxs(jo,{triggerRef:G,isOpen:pe,onClose:()=>V(false),width:180,estimatedHeight:220,children:[Rf.map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${z.toLowerCase()} ${re.priority===z?"active":""}`,onClick:()=>de(z),children:z},z)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>de(""),children:"None"})]})]}),g.length>0||v?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Nr,{selectedTags:re.tags||[],availableTags:g,onChange:_e,onCreateTag:v,theme:qe[B]||qe.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:we,children:[jsxRuntime.jsxs("button",{ref:q,className:"modal-v2-field",onClick:()=>le(!He),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:re.labels&&re.labels.length>0?jsxRuntime.jsx("span",{children:re.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jo,{triggerRef:q,isOpen:He,onClose:()=>le(false),width:220,estimatedHeight:200,children:(C.length>0?C:["Bug","Feature","Enhancement","Documentation"]).map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${re.labels?.includes(z)?"active":""}`,onClick:()=>Q(z),children:[z,re.labels?.includes(z)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},z))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{rt(!Re),setTimeout(()=>Be.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:re.endDate?new Date(re.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Be,type:"date",value:typeof re.endDate=="string"?re.endDate.split("T")[0]:re.endDate?(()=>{let z=new Date(re.endDate),te=z.getUTCFullYear(),Fe=String(z.getUTCMonth()+1).padStart(2,"0"),Qe=String(z.getUTCDate()).padStart(2,"0");return `${te}-${Fe}-${Qe}`})():"",onChange:Na,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ke(!ot),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:re.estimatedTime?`${re.estimatedTime}h`:"Not set"})]}),ot&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:re.estimatedTime||"",onChange:z=>ge(z.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ke(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"})]}),U?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:re.description||"",onChange:z=>{if(N){let te={...N,description:z.target.value};$(te);}},onBlur:je,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>j(true),children:re.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:A(re.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"}),se.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[De,"/",se.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>ve(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:[se.map(z=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${z.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ze(z.id),children:z.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:z.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ye(z.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},z.id)),ie&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Ce,onChange:z=>Ae(z.target.value),onKeyDown:z=>{z.key==="Enter"&&Ve(),z.key==="Escape"&&(ve(false),Ae(""));},onBlur:Ve,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||D.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(nr,{cardId:re.id,attachments:D,onUpload:T?z=>T(re.id,z):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="all"?"active":""}`,onClick:()=>_("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>_("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>_("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Ot,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:z=>R(z.target.value),onKeyDown:P,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:Ze,disabled:!F.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[O.map(z=>{let te=s.find(Qe=>Qe.id===z.userId);if(z.type.includes("COMMENT")){let Qe=n.find(nt=>nt.id===z.metadata?.commentId);return Qe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[te&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:te.color},children:te.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:te?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Qe.content})]})]},z.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:te?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:z.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)}),O.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 jf({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 ci({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((d,m)=>d+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(jf,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,d)=>n+d.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,d)=>n+d.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,d)=>n+(d.planned||0),0)})]})]})]})}function tb({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 mi({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,d=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=d;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(tb,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var cb={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},bc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function mb({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:d,y:m,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function hc({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 pi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||cb[m.name]||bc[e.indexOf(m)%bc.length]})),d=n.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?mb:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(hc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,l=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(hc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,i)=>i.value>m.value?i:m).name})]})]})]})}var Mn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=react.useState(false),[m,i]=react.useState(false),[c,l]=react.useState(false),[p,b]=react.useState(false);if(e.length===0)return null;let y=e.map(k=>k.id),C=k=>{r.onBulkUpdate?.(y,{priority:k}),d(false);},g=k=>{r.onBulkMove?.(y,k),i(false),a();},v=k=>{r.onBulkUpdate?.(y,{assignedUserIds:k}),l(false);},h=k=>{let x=new Set;e.forEach(T=>{T.labels?.forEach(w=>x.add(w));});let D=Array.from(new Set([...x,...k]));r.onBulkUpdate?.(y,{labels:D}),b(false);},u=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>C(k),children:[jsxRuntime.jsx("span",{className:f("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>b(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:u,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Mn.displayName="BulkOperationsToolbar";function bb(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(b=>{let y=a?.find(C=>C.id===b);n=`assignee-${b}`,d=y?.name||`User ${b}`,m=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:b,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];d=p.title,m=p.color,r.has(n)||r.set(n,{id:n,title:d,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(b=>{n=`label-${b}`,d=b,m="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:b,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ui({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),d=react.useMemo(()=>bb(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(i=>{n(c=>{let l=new Set(c);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||d.length===0?jsxRuntime.jsx(Er,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:f("asakaa-swimlane-view",o),children:[d.map(i=>{let c=s.has(i.id),l=e.cards.filter(b=>i.cardIds.includes(b.id)),p={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Er,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),d.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var gi=[{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 fi({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),d=gi.find(i=>i.value===e)||gi[0];react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:d.icon}),jsxRuntime.jsx("span",{children:d.label}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:gi.map(i=>jsxRuntime.jsxs("button",{onClick:()=>m(i.value),className:f("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Ko=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function vb(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,d=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&d&&m}function wc(e={}){let{shortcuts:t=Ko,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(m=>{o.current=[...o.current,m];},[]),d=react.useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return react.useEffect(()=>{function m(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(vb(i,l)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function kb(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function wb(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 Cb(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=wb(e),r=t?kb(t):"";return a?`${a} + ${r}`:r}function Tb(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 bi({shortcuts:e=Ko,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function d(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=Tb(e);return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([d,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),d]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Cb(i)})]},i.action))})]},d))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var hi=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
72
72
|
1.
|
|
73
73
|
|
|
74
74
|
**Expected behavior:**
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
1.
|
|
109
109
|
|
|
110
110
|
**Action items:**
|
|
111
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function yi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let l=c.category||"Other";return i[l]||(i[l]=[]),i[l].push(c),i},{});return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([i,c])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:c.map(l=>jsxRuntime.jsxs("button",{onClick:()=>d(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function xi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=react.useState("export"),[m,i]=react.useState("json"),[c,l]=react.useState(null),p=react.useRef(null);if(!t)return null;let b=async()=>{let C=o?.current||void 0,g=await nd(e,m,C);sd(g,m);},y=async C=>{let g=C.target.files?.[0];if(g){try{let v=await dd(g),h=g.name.endsWith(".json")?"json":"csv",u=ld(v,h);l(u),u.success&&r&&r(u,v);}catch(v){l({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>d("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>d("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(C=>jsxRuntime.jsxs("button",{onClick:()=>i(C),className:f("p-4 rounded-lg border-2 transition-all text-center",m===C?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[C==="json"&&"\u{1F4C4}",C==="csv"&&"\u{1F4CA}",C==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:C})]},C))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:b,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),c&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:f("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((C,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",C]},g))})]})]})]})]})]})}var Sb=["URGENT","HIGH","MEDIUM","LOW"],Eb=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Pb=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ki({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:l=true,compact:p=false,groupBy:b="none",onGroupByChange:y}){let[C,g]=react.useState(true),v=react.useCallback(D=>{a({search:D.target.value});},[a]),h=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),u=react.useCallback(D=>{r({by:D.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),x=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${C?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!C),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:C?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:C?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),x&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!C&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:v,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let T=D.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Sb.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let T=D.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let T=D.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:u,className:"filter-bar__select filter-bar__select--sm",children:Eb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:b,onChange:D=>y(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Pb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),x&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function wi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:m}){let[i,c]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let b=y=>{l.current&&!l.current.contains(y.target)&&c(false);};return i&&document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b);}},[i]);let p=b=>{b(),c(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",b.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",b.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>p(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Ci={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"}},Ti={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"}},Ni={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},eo={dark:Ci,light:Ti,neutral:Ni},An="dark";var Ln=react.createContext(void 0),Ub="asakaa-theme";function Cc({children:e,defaultTheme:t=An,storageKey:a=Ub}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=react.useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,m=eo[r];Object.entries(m.colors).forEach(([c,l])=>{l&&d.style.setProperty(`--theme-${Hb(c)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([c,l])=>{let p=m.colors[c];p&&d.style.setProperty(l,p);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:eo};return jsxRuntime.jsx(Ln.Provider,{value:n,children:e})}function wo(){let e=react.useContext(Ln);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Hb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Di({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=wo();return e?jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(eo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Tc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ye[e]||Ye.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Ye[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ye[e].bgSecondary),bgGrid:r("--theme-bg-card",Ye[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ye[e].bgWeekend),border:r("--theme-border-primary",Ye[e].border),borderLight:r("--theme-border-subtle",Ye[e].borderLight),textPrimary:r("--theme-text-primary",Ye[e].textPrimary),textSecondary:r("--theme-text-secondary",Ye[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ye[e].textTertiary),accent:r("--theme-accent-primary",Ye[e].accent),accentHover:r("--theme-accent-hover",Ye[e].accentHover),accentLight:r("--theme-accent-primary",Ye[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ye[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ye[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ye[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ye[e].dependency),dependencyHover:r("--theme-border-secondary",Ye[e].dependencyHover),criticalPath:r("--theme-error",Ye[e].criticalPath),criticalPathLight:r("--theme-error",Ye[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ye[e].today):e==="neutral"?r("--theme-text-primary",Ye[e].today):r("--theme-error",Ye[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ye[e].todayLight):e==="neutral"?r("--theme-text-primary",Ye[e].todayLight):r("--theme-error",Ye[e].todayLight),milestone:r("--theme-warning",Ye[e].milestone),milestoneLight:r("--theme-warning",Ye[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ye[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ye[e].statusInProgress),statusCompleted:r("--theme-success",Ye[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ye[e].hoverBg),focusRing:r("--theme-accent-primary",Ye[e].focusRing)}}var In={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Nc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Si={en:In,es:Nc};function Dc(e){return Si[e]||Si.en}function Ei(e,t){let a=Dc(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var To=react.createContext(In);function Lr(){return react.useContext(To)}function ih({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[d,m]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null),p=Lr();if(react.useEffect(()=>{let g=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return d&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[d]),!(t||a||r||o||s||n))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(g=>g.handler),C=async(g,v)=>{if(v){c(g);try{await v();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!d),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:d?e.accent:e.bgSecondary,border:`1px solid ${d?e.accent:e.borderLight}`,color:d?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:y.map((g,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>C(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function lh({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function dh({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function ch({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Lr();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=d.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((i,c)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:c<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function mh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),d=react.useRef(null),m=Lr();react.useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let b=C=>{d.current&&!d.current.contains(C.target)&&n(false);},y=C=>{C.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(p),d._cleanup&&d._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,l=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p=>{p.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?l?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?l?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:l?"#0F1117":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:l?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(p=>{let b=t===p.value&&!r,y=()=>p.value==="all"?b?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:b?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?p.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:p.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]},p.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?l?"#3B82F6":"#2563EB":l?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]})})]})})]})}function Rn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:l,onCreateTask:p,taskFilter:b="all",onTaskFilterChange:y,hideCompleted:C=false,onHideCompletedChange:g,onExportPNG:v,onExportPDF:h,onExportExcel:u,onExportCSV:k,onExportJSON:x,onExportMSProject:D}){let T=Lr(),w=v||h||u||k||x||D,L=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],B=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(dh,{options:L,value:t,onChange:N=>a(N),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(ch,{theme:e,value:d,onChange:m}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(mh,{theme:e,value:b,onChange:y,hideCompleted:C,onHideCompletedChange:g})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||T.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ih,{theme:e,onExportPNG:v,onExportPDF:h,onExportExcel:u,onExportCSV:k,onExportJSON:x,onExportMSProject:D}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(lh,{options:B,value:s,onChange:N=>n(N),theme:e})]})]})}function On({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),d=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function No({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[d,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,l=r.length*36+8,p=8,b=window.innerWidth,y=window.innerHeight,C=t,g=a;t+c+p>b&&(C=t-c,C<p&&(C=p)),a+l+p>y&&(g=y-l-p,g<p&&(g=p)),m({x:C,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},l=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:l=>{c.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var At={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Bc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:l,enableKeyboard:p=true}){let b=react.useRef(false),y=react.useCallback(u=>{b.current=u;},[]),C=react.useCallback(u=>{let k=[],x=D=>{for(let T of D)k.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&x(T.subtasks);};return x(u),k},[]),g=react.useCallback(()=>{let u=C(e);for(let k of u)if(t.has(k.id))return k;return null},[e,t,C]),v=react.useCallback((u,k)=>{let x=C(e);if(x.length===0)return;let D=g();if(!D){a(x[0].id,false);return}let T=x.findIndex(B=>B.id===D.id);if(T===-1)return;let w=u==="up"?T-1:T+1;if(w<0||w>=x.length)return;let L=x[w];a(L.id,k);},[e,g,C,a]),h=react.useCallback(u=>{if(!p)return;let k=u.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||b.current){u.key==="Escape"&&(k.blur(),b.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?u.metaKey:u.ctrlKey,w=Array.from(t),L=g();if(u.key==="ArrowUp"){u.preventDefault(),v("up",u.shiftKey);return}if(u.key==="ArrowDown"){u.preventDefault(),v("down",u.shiftKey);return}if(L&&(u.key==="ArrowRight"||u.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(u.preventDefault(),(u.key==="ArrowRight"&&!L.isExpanded||u.key==="ArrowLeft"&&L.isExpanded)&&c(L.id));return}if(u.altKey&&(u.key==="ArrowUp"||u.key==="ArrowDown")){w.length>0&&(u.preventDefault(),n(w,u.key==="ArrowUp"?"up":"down"));return}if(u.key==="Tab"&&!u.shiftKey){w.length>0&&(u.preventDefault(),d(w));return}if(u.key==="Tab"&&u.shiftKey){w.length>0&&(u.preventDefault(),m(w));return}if(u.key==="Enter"&&!u.shiftKey&&!T){L&&(u.preventDefault(),r(L.id,"below"));return}if(u.key==="Enter"&&u.shiftKey&&!T){L&&(u.preventDefault(),r(L.id,"above"));return}if(u.key==="Enter"&&T){L&&(u.preventDefault(),l(L.id));return}if(u.key==="F2"){L&&(u.preventDefault(),i(L.id));return}if(u.key==="Delete"||u.key==="Backspace"&&T){w.length>0&&(u.preventDefault(),o(w));return}if(u.key==="d"&&T&&!u.shiftKey){w.length>0&&(u.preventDefault(),s(w));return}},[p,t,g,v,r,o,s,n,d,m,i,c,l]);return react.useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:y}}function Oc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(p=>{let b=new Set(p);return b.has(l)?b.delete(l):b.add(l),b}),r(l);},[]),n=react.useCallback((l,p)=>{if(!a){o(l);return}let b=p.indexOf(a),y=p.indexOf(l);if(b===-1||y===-1){o(l);return}let C=Math.min(b,y),g=Math.max(b,y),v=p.slice(C,g+1);t(new Set(v)),r(l);},[a,o]),d=react.useCallback((l,p,b,y)=>{y?n(l,p):b?s(l):o(l);},[o,s,n]),m=react.useCallback((l,p)=>{p?t(b=>{let y=new Set(b);return y.add(l),y}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Do(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let d={...r[n],parentId:o,level:s,position:n};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function zc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=zc(a.subtasks,t);if(r)return r}}return null}function Bi(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Bi(a.subtasks,t);if(r)return r}return null}function Ri(e,t){if(t.length===0)return e;let a=Do(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],n=(l,p)=>{let b=[];return {tasks:l.filter(C=>{if(p.has(C.id))return b.push(C),false;if(C.subtasks){let g=n(C.subtasks,p);C.subtasks=g.tasks,b.push(...g.removed);}return true}),removed:b}},d=(l,p,b)=>l.map(y=>y.id===p?{...y,subtasks:[...y.subtasks||[],...b],isExpanded:true}:y.subtasks?{...y,subtasks:d(y.subtasks,p,b)}:y),m=new Set(t),{tasks:i,removed:c}=n(e,m);return d(i,s.id,c)}function Oi(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Bi(a,r);if(!o)continue;let s=Bi(a,o.id),n=(i,c,l)=>{for(let p=0;p<i.length;p++){let b=i[p];if(b.id===c&&b.subtasks){let y=b.subtasks.findIndex(C=>C.id===l);if(y!==-1){let[C]=b.subtasks.splice(y,1);return C}}if(b.subtasks){let y=n(b.subtasks,c,l);if(y)return y}}return null},d=(i,c,l)=>{let p=i.findIndex(b=>b.id===c);if(p!==-1)return i.splice(p+1,0,l),i;for(let b of i)b.subtasks&&d(b.subtasks,c,l);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?d(s.subtasks,o.id,m):d(a,o.id,m));}return a}function zi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,m)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function Ui(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 Hi(e,t){let a=[...e];for(let r of t){let o=n=>{let d=n.findIndex(c=>c.id===r);if(d===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[d],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(d+1,0,i),true},s=n=>n.map(d=>({...d,id:`${d.id}-copy-${Date.now()}`,subtasks:d.subtasks?s(d.subtasks):void 0}));o(a);}return a}function Uc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},d=m=>{let i=m.findIndex(l=>l.id===t);if(i===-1){for(let l of m)if(l.subtasks&&d(l.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return d(r),{tasks:r,newTask:n}}function $i(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:$i(r.subtasks,t,a)}:r)}function Wi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Wi(a.subtasks,t)}:a)}function Gi(e,t){let a=c=>{for(let l of c){if(l.id===t)return l;if(l.subtasks){let p=a(l.subtasks);if(p)return p}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#3B82F6"},i=c=>c.map(l=>{if(l.id===t){let p=l.subtasks||[];return {...l,subtasks:[...p,m],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:m}}function Hc(e,t,a,r){if(t===a)return e;let o=zc(e,t);if(!o)return e;if(a){let d=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||d(c,i))return true;return false};if(d(o,a))return e}let s=d=>d.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0});}else {let d=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],l=r!==void 0?r:c.length,p=[...c];return p.splice(l,0,{...o,parentId:a}),{...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function Hn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:l,onColumnResize:p,onTaskUpdate:b,onTaskIndent:y,onTaskOutdent:C,onTaskMove:g,onMultiTaskDelete:v,onTaskDuplicate:h,onTaskCreate:u,onTaskRename:k,onCreateSubtask:x,onOpenTaskModal:D,onDeleteRequest:T,onTaskReparent:w}){let L=react.useContext(To),[B,N]=react.useState(null),[W,$]=react.useState(null),[j,de]=react.useState(""),Q=react.useRef(null),[ne,he]=react.useState(null),[ke,Ae]=react.useState(0),[F,O]=react.useState(0),[S,R]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[V,ee]=react.useState(null),[se,le]=react.useState(null),[Pe,Z]=react.useState(null),_e=react.useRef(0),we=5,je=react.useRef(false),[yt,It]=react.useState(null),[at,kt]=react.useState(false),[mt,Ot]=react.useState(null),[me,I]=react.useState(false),ae=react.useRef(null);react.useEffect(()=>{function A(z){ae.current&&!ae.current.contains(z.target)&&I(false);}if(me)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[me]),react.useEffect(()=>{W&&Q.current&&(Q.current.focus(),Q.current.select());},[W]),react.useEffect(()=>{if(!ne)return;let A=re=>{let Le=re.clientX-ke,Ne=F+Le;p?.(ne,Ne);},z=()=>{he(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",A),document.addEventListener("mouseup",z),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",z),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,ke,F,p]);let{selectedTaskIds:xe,handleTaskClick:Be,isTaskSelected:X}=Oc(),{setIsEditing:Me}=Bc({tasks:e,selectedTaskIds:xe,onTaskSelect:(A,z)=>{let Le=Do(e).map(Ne=>Ne.id);Be(A,Le,z||false,false);},onTaskCreate:u||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:C||(()=>{}),onTaskRename:A=>{let z=Do(e).find(re=>re.id===A);z&&He(z);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:A=>{let z=Do(e).find(re=>re.id===A);z&&D&&D(z);},enableKeyboard:true}),_=(A,z=0)=>{let re=[];for(let Le of A)re.push({task:Le,level:z}),Le.subtasks&&Le.subtasks.length>0&&Le.isExpanded&&re.push(..._(Le.subtasks,z+1));return re},Y=_(e),Ue=48,Re=Math.max(Y.length*a,600-Ue),Ve=A=>!A.startDate||!A.endDate?"-":`${Math.ceil((A.endDate.getTime()-A.startDate.getTime())/(1e3*60*60*24))}d`,He=A=>{$(A.id),de(A.name),Me(true);},ce=A=>{j.trim()&&j!==e.find(z=>z.id===A)?.name&&k?.(A,j.trim()),$(null),de(""),Me(false);},Ie=()=>{$(null),de(""),Me(false);},J=(A,z)=>{z.stopPropagation(),x?.(A.id);},We=(A,z)=>{z.preventDefault(),_e.current=z.clientY,ee(A),je.current=false,kt(false),It({x:z.clientX,y:z.clientY});},Na=A=>{if(!V||(Math.abs(A.clientY-_e.current)>we&&!je.current&&(je.current=true,kt(true)),It({x:A.clientX,y:A.clientY}),!je.current))return;let re=document.querySelectorAll("[data-task-row]"),Le=null,Ne=null;re.forEach(U=>{let te=U.getBoundingClientRect(),Fe=U.getAttribute("data-task-row");if(Fe&&Fe!==V&&A.clientY>=te.top&&A.clientY<=te.bottom){Le=Fe;let Ze=A.clientY-te.top,rt=te.height;Ze<rt*.25?Ne="above":Ze>rt*.75?Ne="below":Ne="child";}}),le(Le),Z(Ne);},pe=()=>{if(je.current&&V&&se&&Pe){if(Pe==="child")w?.(V,se);else if(Pe==="above"||Pe==="below"){let A=(Le,Ne,U=null)=>{for(let te of Le){if(te.id===Ne)return U;if(te.subtasks){let Fe=A(te.subtasks,Ne,te.id);if(Fe!==void 0)return Fe}}},z=A(e,se,null),re=(Le,Ne)=>{let U=Le.findIndex(te=>te.id===Ne);return Pe==="below"?U+1:U};if(z===null){let Le=re(e,se);w?.(V,null,Le);}else {let Le=Y.find(Ne=>Ne.task.id===z)?.task;if(Le?.subtasks){let Ne=re(Le.subtasks,se);w?.(V,z,Ne);}}}}ee(null),le(null),Z(null),It(null),je.current=false,kt(false);};react.useEffect(()=>{if(V)return document.addEventListener("mousemove",Na),document.addEventListener("mouseup",pe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Na),document.removeEventListener("mouseup",pe),document.body.style.cursor="",document.body.style.userSelect="";}},[V,se,Pe]);let Ge=(A,z,re)=>{switch(A.id){case "name":let Le=W===z.id,Ne=B===z.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${re*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:Ne?1:.3},onMouseDown:fe=>We(z.id,fe),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),z.subtasks&&z.subtasks.length>0?jsxRuntime.jsx("button",{onClick:fe=>{fe.stopPropagation(),m?.(z.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:z.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:z.color||"#3B82F6",opacity:z.parentId?.6:1,borderColor:z.isMilestone?t.accent:"transparent",borderWidth:z.isMilestone?"2px":"0px"},title:z.isMilestone?"Milestone":z.parentId?"Subtask":"Task"})}),Le?jsxRuntime.jsx("input",{ref:Q,type:"text",value:j,onChange:fe=>de(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"?ce(z.id):fe.key==="Escape"&&Ie();},onBlur:()=>ce(z.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:fe=>fe.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:z.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:z.parentId?"13px":"14px",fontWeight:z.isMilestone?600:z.parentId?400:600,letterSpacing:z.parentId?"0":"-0.01em"},title:z.name,children:z.name}),Ne&&!Le&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:fe=>fe.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:fe=>J(z,fe),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:fe=>{fe.stopPropagation(),He(z);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let te=A.id==="startDate"?"startDate":"endDate",Fe=z[te],Ze=mt?.taskId===z.id&&mt?.field===te,rt=fe=>fe?(typeof fe=="string"?new Date(fe):fe).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:fe=>fe.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:fe=>{if(Ze)Ot(null);else {let wt=fe.currentTarget.getBoundingClientRect();Ot({taskId:z.id,field:te,month:Fe?typeof Fe=="string"?new Date(Fe):Fe:new Date,position:{top:wt.bottom+4,left:wt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:rt(Fe)})]}),Ze&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ot(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:mt?.position.top,left:mt?.position.left},onClick:fe=>fe.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let fe=new Date,wt=new Date(fe);wt.setDate(fe.getDate()+1);let tt=new Date(fe);tt.setDate(fe.getDate()+7);let co=new Date(fe);return co.setDate(fe.getDate()+14),[{label:"Hoy",date:fe},{label:"Ma\xF1ana",date:wt},{label:"Pr\xF3xima semana",date:tt},{label:"2 semanas",date:co}].map((vr,Qa)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:er=>er.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:er=>er.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(z.id,{[te]:vr.date}),Ot(null);},children:vr.label},Qa))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:fe=>fe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(z.id,{[te]:void 0}),Ot(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:()=>Ot(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.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:mt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ot(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.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((fe,wt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:fe},wt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let fe=mt?.month||new Date,wt=fe.getFullYear(),tt=fe.getMonth(),co=new Date(wt,tt,1).getDay(),Lo=new Date(wt,tt+1,0).getDate(),vr=new Date,Qa=[];for(let _t=co-1;_t>=0;_t--)Qa.push({day:new Date(wt,tt,-_t).getDate(),date:new Date(wt,tt-1,new Date(wt,tt,-_t).getDate()),isCurrentMonth:false});for(let _t=1;_t<=Lo;_t++)Qa.push({day:_t,date:new Date(wt,tt,_t),isCurrentMonth:true});let er=42-Qa.length;for(let _t=1;_t<=er;_t++)Qa.push({day:_t,date:new Date(wt,tt+1,_t),isCurrentMonth:false});return Qa.map((_t,xs)=>{let ks=_t.date.toDateString()===vr.toDateString(),Io=(Fe?typeof Fe=="string"?new Date(Fe):Fe:null)?.toDateString()===_t.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:_t.isCurrentMonth?Io?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Io?"#3B82F6":"transparent",boxShadow:ks&&!Io?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{b?.(z.id,{[te]:_t.date}),Ot(null);},children:_t.day},xs)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Ve(z)})});case "assignees":let $r=r.filter(fe=>z.assignees?.some(wt=>wt.name===fe.name||wt.initials===fe.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(Yr,{assignedUsers:$r,availableUsers:r,onChange:fe=>{let wt=fe.map(tt=>({id:tt.id,name:tt.name,initials:tt.initials,color:tt.color}));b?.(z.id,{assignees:wt.length>0?wt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(Ed,{status:z.status||"todo",onChange:fe=>{b?.(z.id,{status:fe,progress:fe==="completed"?100:z.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:`${z.progress}%`,backgroundColor:z.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:[z.progress,"%"]})]});case "priority":let hr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},yr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},La=hr[z.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(jr,{priority:La,onChange:fe=>{fe&&b?.(z.id,{priority:yr[fe]||"medium"});}})});default:return null}},Oe=A=>[{id:"hide",label:"Hide Column",icon:At.Hide,onClick:()=>l(A),disabled:A==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:At.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:At.SortDesc,onClick:()=>{}}],Ke=A=>A.subtasks&&A.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:At.Add,onClick:()=>{x?.(A.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:At.Delete,onClick:()=>{T?T(A.id,A.name):v?.([A.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:At.Pencil,onClick:()=>{n?.(A);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:At.Add,onClick:()=>{x?.(A.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:At.MarkIncomplete,onClick:()=>{b?.(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:At.SetInProgress,onClick:()=>{b?.(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:At.MarkComplete,onClick:()=>{b?.(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:At.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:At.Delete,onClick:()=>{T?T(A.id,A.name):v?.([A.id]);}}],Je=c.filter(A=>A.visible),P=Je.reduce((A,z)=>A+z.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:P},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Ue}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Je.map((A,z)=>{let re=z===Je.length-1,Le=A.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Le?"":"justify-center"}`,style:{width:`${A.width}px`,minWidth:`${A.minWidth??(Le?200:60)}px`,maxWidth:`${A.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:re?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ne=>{Ne.preventDefault(),R({isOpen:true,x:Ne.clientX,y:Ne.clientY,type:"header",columnId:A.id});},onMouseEnter:Ne=>{Ne.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ne=>{Ne.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:A.label,children:A.label}),A.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ne===A.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ne=>{Ne.preventDefault(),Ne.stopPropagation(),he(A.id),Ae(Ne.clientX),O(A.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"}})})]},A.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(On,{columns:c,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>I(!me),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),me&&jsxRuntime.jsxs("div",{ref: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:A=>A.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>I(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Re},children:Y.map(({task:A,level:z},re)=>{let Le=X(A.id),Ne=se===A.id,U=Ne&&Pe==="above",te=Ne&&Pe==="below",Fe=Ne&&Pe==="child",Ze={};return Fe&&(Ze.backgroundColor=`${t.accent}15`,Ze.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":A.id,className:`flex items-center cursor-pointer group ${V===A.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Le?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Le?t.accentLight:Fe?`${t.accent}15`:re%2===0?t.bgPrimary:t.bgGrid,...Ze},onMouseEnter:()=>N(A.id),onMouseLeave:()=>N(null),onClick:rt=>{let hr=Do(e).map(fe=>fe.id),La=navigator.platform.toUpperCase().indexOf("MAC")>=0?rt.metaKey:rt.ctrlKey;Be(A.id,hr,La,rt.shiftKey),s?.(A);},onDoubleClick:rt=>{rt.stopPropagation(),n?.(A);},onContextMenu:rt=>{rt.preventDefault(),R({isOpen:true,x:rt.clientX,y:rt.clientY,type:"task",task:A}),d?.(A,rt);},whileHover:{backgroundColor:Le?t.accentLight:t.hoverBg},children:[U&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),te&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Je.map((rt,$r)=>{let hr=$r===Je.length-1,yr=rt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${yr?"justify-start":"justify-center"}`,style:{width:`${rt.width}px`,minWidth:`${rt.minWidth??(yr?200:60)}px`,maxWidth:`${rt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:hr?"none":`1px solid ${B===A.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ge(rt,A,yr?z:0)},`${A.id}-${rt.id}`)})]},A.id)})}),jsxRuntime.jsx(No,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?Oe(S.columnId):S.type==="task"&&S.task?Ke(S.task):[],onClose:()=>R({...S,isOpen:false}),theme:t}),at&&yt&&V&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:yt.x+12,top:yt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let A=Y.find(z=>z.task.id===V)?.task;return A?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:A.name})}):null})()}),document.body)]})}function Vc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,d]=react.useState(e),[m,i]=react.useState(t),[c,l]=react.useState(null),[p,b]=react.useState(null),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,u]=react.useState(0),[k,x]=react.useState(0),[D,T]=react.useState(null),[w,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:l,hoveredTaskId:p,setHoveredTaskId:b,activeZone:y,setActiveZone:C,draggedSegmentIndex:g,setDraggedSegmentIndex:v,draggedSegmentStartX:h,setDraggedSegmentStartX:u,segmentDragOffsetX:k,setSegmentDragOffsetX:x,hoveredSegmentIndex:D,setHoveredSegmentIndex:T,isHovered:w,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(j,de)=>{r("none"),l(null),b(null),d(j),i(de),x(0),v(null),u(0);}}}function Wn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:l,onDependencyCreate:p,allTaskPositions:b=[],onDragMove:y,onHoverChange:C}){let g=Vc(t,r),v=react.useRef(null),h=react.useRef(null),u=react.useRef(null),{dragMode:k,setDragMode:x,dragOffset:D,setDragOffset:T,ghostX:w,setGhostX:L,ghostWidth:B,setGhostWidth:N,connectionLine:W,setConnectionLine:$,hoveredTaskId:j,setHoveredTaskId:de,activeZone:Q,setActiveZone:ne,draggedSegmentIndex:he,setDraggedSegmentIndex:ke,draggedSegmentStartX:Ae,setDraggedSegmentStartX:F,segmentDragOffsetX:O,setSegmentDragOffsetX:S,hoveredSegmentIndex:R,setHoveredSegmentIndex:V,isHovered:ee,setIsHovered:se,isDragging:le,isResizing:Pe,isConnecting:Z,resetDragState:_e}=g,we=32,je=8,yt=e.endDate&&e.endDate<new Date&&e.progress<100,It=e.isCriticalPath,at=o.name==="neutral"||o.today==="#1C1917",kt=e.status==="completed"||e.progress===100,mt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},me=e.isCriticalPath||yt?"#DC2626":e.color?e.color:e.priority&&mt[e.priority]?mt[e.priority]:o.taskBarPrimary,ae=(pe=>pe>=80?20:pe>=60?15:pe>=50?12:10)(r),xe=r<50,Be=r<40;react.useEffect(()=>{if(C)if(ee&&!le&&!e.segments){let pe=a<100;C({task:e,x:t,y:a,width:r,height:we,showBelow:pe});}else C(null);},[ee,le,e,t,a,r,we,C]);let X=pe=>pe.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Me=()=>{let pe=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${pe} day${pe!==1?"s":""}`},_=pe=>Math.round(pe/s)*s,Y=pe=>{let Ge=Math.round(pe/s),Oe=new Date(n);return Oe.setDate(Oe.getDate()+Ge),Oe},Ue=(pe,Ge)=>{for(let Oe of b){if(Oe.id===e.id)continue;let Ke=5;if(pe>=Oe.x-Ke&&pe<=Oe.x+Oe.width+Ke&&Ge>=Oe.y-Ke&&Ge<=Oe.y+Oe.height+Ke)return Oe.id}return null},Re=react.useCallback((pe,Ge,Oe)=>{pe.preventDefault(),pe.stopPropagation();let Ke=v.current?.ownerSVGElement;if(!Ke)return;let Je=Ke.createSVGPoint();Je.x=pe.clientX,Je.y=pe.clientY;let P=Je.matrixTransform(Ke.getScreenCTM()?.inverse()),A=Oe!==void 0?Oe:t,z=Ge;if(!z){let re=P.x-A;pe.shiftKey?(z="connect",$({x:t+r,y:a+we/2})):pe.ctrlKey||pe.metaKey?z="move":pe.altKey?z=re<r/2?"resize-start":"resize-end":Be?re<r/2?z="move":z="resize-end":xe?re<=ae/2?z="resize-start":re>=r-ae/2?z="resize-end":z="move":re<=ae?z="resize-start":re>=r-ae?z="resize-end":z="move";}x(z),se(false),ne(null),z==="move"?T(P.x-A):z==="connect"?$({x:t+r,y:a+we/2}):T(0),L(A),N(r);},[t,r,a,we]),Ve=react.useCallback(pe=>{let Ge=v.current?.ownerSVGElement;if(!Ge)return;let Oe=Ge.closest(".gantt-timeline-scroll");if(!Oe)return;let Ke=Oe.getBoundingClientRect(),Je=60,P=15,A=0;if(pe.clientX<Ke.left+Je){let z=Ke.left+Je-pe.clientX;A=-Math.min(P,z/2);}else if(pe.clientX>Ke.right-Je){let z=pe.clientX-(Ke.right-Je);A=Math.min(P,z/2);}return A!==0&&(Oe.scrollLeft+=A),A!==0},[]),He=react.useCallback(pe=>{if(k==="none")return;u.current=pe;let Ge=v.current?.ownerSVGElement;if(!Ge)return;if(k==="move"||k==="resize-start"||k==="resize-end"){let Je=Ve(pe);Je&&!h.current?h.current=window.setInterval(()=>{u.current&&(Ve(u.current),He(u.current));},16):!Je&&h.current&&(window.clearInterval(h.current),h.current=null);}let Oe=Ge.createSVGPoint();Oe.x=pe.clientX,Oe.y=pe.clientY;let Ke=Oe.matrixTransform(Ge.getScreenCTM()?.inverse());if(k==="connect"){$({x:Ke.x,y:Ke.y});let Je=Ue(Ke.x,Ke.y);de(Je);}else if(k==="move"){let Je=Ke.x-D,P=_(Je);L(P),N(r);let A=Math.round((P-t)/s);if(y?.(e.id,A,true),e.segments&&e.segments.length>0&&he!==null){let z=P-Ae;S(z);}}else if(k==="resize-start"){let Je=Ke.x,P=_(Je),A=t+r-P;A>=s&&(L(P),N(A));}else if(k==="resize-end"){let Je=Ke.x,A=_(Je)-t;A>=s&&N(A);}},[k,t,r,s,D,e,_,he,Ae,Ue,de,$,L,N,S,y,Ve]),ce=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),u.current=null,k!=="none"){if(k==="connect")j&&p&&p(e,j),$(null),de(null);else {let pe=e.endDate.getTime()-e.startDate.getTime(),Ge,Oe,Ke=true;if(k==="move"){if(Ge=Y(w),Oe=new Date(Ge.getTime()+pe),e.segments&&e.segments.length>0&&he!==null){let Je=Math.round(O/s),P=e.segments.map((Le,Ne)=>{if(Ne===he){let U=new Date(Le.startDate),te=new Date(Le.endDate);return U.setDate(U.getDate()+Je),te.setDate(te.getDate()+Je),{startDate:U,endDate:te}}return Le}),A=P.flatMap(Le=>[Le.startDate,Le.endDate]),z=new Date(Math.min(...A.map(Le=>Le.getTime()))),re=new Date(Math.max(...A.map(Le=>Le.getTime())));l?.({...e,segments:P},z,re),_e(t,r);return}}else k==="resize-start"?(Ge=Y(w),Oe=e.endDate,Ge>Oe&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ke=false)):k==="resize-end"?(Ge=e.startDate,Oe=Y(w+B),Oe<Ge&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ke=false)):Ke=false;Ke&&Ge&&Oe&&(Oe.getTime()<Ge.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,Ge,Oe));}y?.(e.id,0,false),_e(t,r);}},[k,w,B,e,l,j,p,t,r,s,Y,O,he,_e,y]);react.useEffect(()=>{if(k==="none")return;let pe=Oe=>{He(Oe);},Ge=()=>{ce();};return window.addEventListener("mousemove",pe),window.addEventListener("mouseup",Ge),()=>{window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",Ge),h.current&&(window.clearInterval(h.current),h.current=null);}},[k,He,ce]);let Ie=le&&!Z?w:t,J=le&&!Z?B:r,We=d.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,"data-task-bar":"true",onClick:()=>!le&&m?.(e),onDoubleClick:pe=>{le||(pe.stopPropagation(),i?.(e));},onContextMenu:pe=>{pe.preventDefault(),c?.(e,pe);},onMouseEnter:()=>!le&&se(true),onMouseLeave:()=>{le||(se(false),ne(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:we,fill:"transparent",style:{pointerEvents:"all"}}),ee&&!le&&!xe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ae,height:we,fill:Q==="resize-start"?o.accent:"transparent",opacity:Q==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-start"),onMouseDown:pe=>Re(pe,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ae,y:a,width:r-ae*2,height:we,fill:Q==="move"?o.accent:"transparent",opacity:Q==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:pe=>Re(pe,"move")}),jsxRuntime.jsx("rect",{x:t+r-ae,y:a,width:ae,height:we,fill:Q==="resize-end"?o.accent:"transparent",opacity:Q==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:pe=>Re(pe,"resize-end")})]}),ee&&!le&&Be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:we,fill:Q==="move"?o.accent:"transparent",opacity:Q==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:pe=>Re(pe,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:we,fill:Q==="resize-end"?o.accent:"transparent",opacity:Q==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:pe=>Re(pe,"resize-end")}),ee&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+we-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),le&&!Z&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:a,width:B,height:we,rx:je,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie,y:a,width:J,height:we,rx:je,fill:me,"data-task-class":We,initial:{opacity:0,scale:.95},animate:{opacity:le&&!Z?.15:e.parentId?.6:ee?.9:.8,scale:ee&&!le?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>Re(pe),style:{cursor:le?Z?"crosshair":Pe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:J*(e.progress/100),height:we,rx:je,fill:me,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((pe,Ge)=>{let Oe=(pe.startDate.getTime()-n.getTime())/864e5*s,Je=(pe.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Oe+s,P=le&&k==="move"&&he===Ge,A=R===Ge,z=P?Oe+O:Oe;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!le&&V(Ge),onMouseLeave:()=>!le&&V(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:z,y:a,width:Je,height:we,rx:je,fill:me,initial:{opacity:0,scale:.95},animate:{opacity:P||e.parentId?.6:A?.9:.8,scale:A&&!le?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:re=>{re.stopPropagation(),ke(Ge),F(Oe),Re(re,void 0,Oe);},style:{cursor:le?Z?"crosshair":Pe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:z,y:a,width:Je*(e.progress/100),height:we,rx:je,fill:me,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ge}`)}),at&&(yt||It)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[It&&!yt&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:J,height:we,rx:je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),yt&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:J,height:we,rx:je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),J>60&&!e.segments&&(()=>{let pe=d.taskLabel(e),Ge=typeof pe=="string"?pe:e.name,Oe=Ge.length>Math.floor(J/8)?`${Ge.substring(0,Math.floor(J/8))}...`:Ge;return jsxRuntime.jsx("text",{x:Ie+12,y:a+we/2,dominantBaseline:"middle",fill:kt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:kt?"line-through":"none"},children:Oe})})(),J>100&&e.progress>0&&e.progress<100&&!le&&!e.segments&&jsxRuntime.jsxs("text",{x:Ie+J-12,y:a+we/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&&J>80&&!le&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ie+J-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ie+J-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ee||Pe)&&!Z&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ie-2,y:a,width:16,height:we,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-start"),onMouseLeave:()=>ne(null),onMouseDown:pe=>{pe.stopPropagation(),Re(pe,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie+4,y:a+8,width:3,height:we-16,rx:1.5,fill:Q==="resize-start"||k==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ie+J-14,y:a,width:16,height:we,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-end"),onMouseLeave:()=>ne(null),onMouseDown:pe=>{pe.stopPropagation(),Re(pe,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie+J-7,y:a+8,width:3,height:we-16,rx:1.5,fill:Q==="resize-end"||k==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee&&!le&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+we/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ne("connect"),onMouseLeave:()=>ne(null),onMouseDown:pe=>{pe.stopPropagation(),Re(pe,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+we/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Q==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Z&&W&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+we/2,x2:W.x,y2:W.y,stroke:j?o.statusCompleted:o.accent,strokeWidth:j?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:j?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:W.x,cy:W.y,r:j?8:6,fill:j?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),j&&jsxRuntime.jsx(framerMotion.motion.text,{x:W.x+15,y:W.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:W.x+10},animate:{opacity:1,x:W.x+15},transition:{duration:.2},children:"Connect"})]}),(ee||le)&&!Z&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie-2,y:a-2,width:J+4,height:we+4,rx:je+2,fill:"none",stroke:le?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:le?.6:.4,initial:{opacity:0},animate:{opacity:le?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Pe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+B,y1:0,x2:w+B,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee&&!le&&!e.segments&&!C&&(()=>{let Oe=a<100,Ke=Oe?a+we+13:a-82-13,Je=Oe?`M ${Ie+J/2-6} ${a+we+3} L ${Ie+J/2} ${a+we+13} L ${Ie+J/2+6} ${a+we+3}`:`M ${Ie+J/2-6} ${a-13} L ${Ie+J/2} ${a-3} L ${Ie+J/2+6} ${a-13}`,P=Ke+22,A=Ke+40,z=Ke+55,re=Ke+70,Le=Oe?Ke+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Oe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Oe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Je,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ie+J/2-120,y:Ke,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Ie+J/2,y:P,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Ie+J/2-110,y:A,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ie+J/2-70,y:A,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:X(e.startDate)}),jsxRuntime.jsx("text",{x:Ie+J/2-110,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ie+J/2-70,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:X(e.endDate)}),jsxRuntime.jsx("text",{x:Ie+J/2+10,y:A,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ie+J/2+65,y:A,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Me()}),jsxRuntime.jsx("text",{x:Ie+J/2+10,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ie+J/2+65,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Ie+J/2-110,y:re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ie+J/2-50,y:re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ne=>Ne.name).join(", ").substring(0,30),e.assignees.map(Ne=>Ne.name).join(", ").length>30?"...":""]})]}),!Oe&&jsxRuntime.jsx("text",{x:Ie+J/2,y:Le,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Be?"Left: move \u2022 Right: resize":xe?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Yc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:d}=e,m=82,i=13,c=d?o+n+i:o-m-i,l=d?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,p=c+22,b=c+40,y=c+55,C=c+70,g=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:d?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:d?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:c,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:p,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false}){let[m,i]=react.useState(false),[c,l]=react.useState(null),p=r-t,b=p>0,y=Math.abs(p)<5,C=20,g=!y&&a<=e,v,h,u=a-e,k=e+u/2;if(h=k,n==="squared")if(y)v=`M ${e} ${t} L ${a} ${r}`;else if(g){let ne=e+15,he=a-C,ke=b?t+20:t-20;h=he,v=`M ${e} ${t} L ${ne} ${t} L ${ne} ${ke} L ${he} ${ke} L ${he} ${r} L ${a} ${r}`;}else h=a-C,v=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else v=`M ${e} ${t} C ${k} ${t}, ${k} ${r}, ${a} ${r}`;let x=5,D=`M ${a} ${r} L ${a-x} ${r-x*.5} M ${a} ${r} L ${a-x} ${r+x*.5}`,T=o.dependency,w=o.dependencyHover||T,L="#f87171",B="rgba(248, 113, 113, 0.15)",N=h,W=(t+r)/2;if(c)if(y)N=Math.max(e+10,Math.min(a-10,c.x)),W=t;else if(g){let Q=e+15,ne=a-C,he=b?t+20:t-20,ke=[[e,t,Q,t],[Q,t,Q,he],[Q,he,ne,he],[ne,he,ne,r],[ne,r,a,r]],Ae=1/0,F={x:N,y:W};for(let O of ke){let S=$(c.x,c.y,O[0],O[1],O[2],O[3]),R=Math.hypot(c.x-S.x,c.y-S.y);R<Ae&&(Ae=R,F=S);}N=F.x,W=F.y;}else {let Q=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],ne=1/0,he={x:N,y:W};for(let ke of Q){let Ae=$(c.x,c.y,ke[0],ke[1],ke[2],ke[3]),F=Math.hypot(c.x-Ae.x,c.y-Ae.y);F<ne&&(ne=F,he=Ae);}N=he.x,W=he.y;}function $(Q,ne,he,ke,Ae,F){let O=Ae-he,S=F-ke,R=O*O+S*S;if(R===0)return {x:he,y:ke};let V=((Q-he)*O+(ne-ke)*S)/R;return V=Math.max(0,Math.min(1,V)),{x:he+V*O,y:ke+V*S}}let j=Q=>{let ne=Q.currentTarget.ownerSVGElement;if(!ne)return;let he=ne.getBoundingClientRect();l({x:Q.clientX-he.left,y:Q.clientY-he.top});},de=()=>{i(false),l(null);};return d?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:de,onMouseMove:j,children:[jsxRuntime.jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:v,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:v,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:w,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Q=>{Q.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:W,r:9,fill:B,stroke:L,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:W-3,x2:N+3,y2:W+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:W-3,x2:N-3,y2:W+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:de,onMouseMove:j,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:v,fill:"none",stroke:m?w:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:D,fill:"none",stroke:m?w:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?w:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:Q=>{Q.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:W,r:9,fill:B,stroke:L,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:W-3,x2:N+3,y2:W+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:W-3,x2:N-3,y2:W+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Kn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),d=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var be={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,m=i=>{if(!n.has(i)){n.add(i),d.add(i);let c=r.get(i)||[];for(let l of c){if(!n.has(l)&&m(l))return true;if(d.has(l))return true}}return d.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=be.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=be.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=be.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=be.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
112
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=
|
|
111
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function yi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let l=c.category||"Other";return i[l]||(i[l]=[]),i[l].push(c),i},{});return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([i,c])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:c.map(l=>jsxRuntime.jsxs("button",{onClick:()=>d(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function xi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=react.useState("export"),[m,i]=react.useState("json"),[c,l]=react.useState(null),p=react.useRef(null);if(!t)return null;let b=async()=>{let C=o?.current||void 0,g=await nd(e,m,C);sd(g,m);},y=async C=>{let g=C.target.files?.[0];if(g){try{let v=await dd(g),h=g.name.endsWith(".json")?"json":"csv",u=ld(v,h);l(u),u.success&&r&&r(u,v);}catch(v){l({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>d("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>d("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(C=>jsxRuntime.jsxs("button",{onClick:()=>i(C),className:f("p-4 rounded-lg border-2 transition-all text-center",m===C?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[C==="json"&&"\u{1F4C4}",C==="csv"&&"\u{1F4CA}",C==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:C})]},C))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:b,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),c&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:f("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((C,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",C]},g))})]})]})]})]})]})}var Pb=["URGENT","HIGH","MEDIUM","LOW"],Mb=[{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"}],Fb=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ki({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:l=true,compact:p=false,groupBy:b="none",onGroupByChange:y}){let[C,g]=react.useState(true),v=react.useCallback(D=>{a({search:D.target.value});},[a]),h=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),u=react.useCallback(D=>{r({by:D.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),x=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${C?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!C),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:C?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:C?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),x&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!C&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:v,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let T=D.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Pb.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let T=D.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let T=D.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:u,className:"filter-bar__select filter-bar__select--sm",children:Mb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:b,onChange:D=>y(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Fb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),x&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function wi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:m}){let[i,c]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let b=y=>{l.current&&!l.current.contains(y.target)&&c(false);};return i&&document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b);}},[i]);let p=b=>{b(),c(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",b.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",b.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>p(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Ci={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"}},Ti={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"}},Ni={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},eo={dark:Ci,light:Ti,neutral:Ni},An="dark";var Ln=react.createContext(void 0),$b="asakaa-theme";function Nc({children:e,defaultTheme:t=An,storageKey:a=$b}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=react.useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,m=eo[r];Object.entries(m.colors).forEach(([c,l])=>{l&&d.style.setProperty(`--theme-${Wb(c)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([c,l])=>{let p=m.colors[c];p&&d.style.setProperty(l,p);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:eo};return jsxRuntime.jsx(Ln.Provider,{value:n,children:e})}function wo(){let e=react.useContext(Ln);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Wb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Di({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=wo();return e?jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(eo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Dc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return qe[e]||qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",qe[e].bgSecondary),bgGrid:r("--theme-bg-card",qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",qe[e].bgWeekend),border:r("--theme-border-primary",qe[e].border),borderLight:r("--theme-border-subtle",qe[e].borderLight),textPrimary:r("--theme-text-primary",qe[e].textPrimary),textSecondary:r("--theme-text-secondary",qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",qe[e].textTertiary),accent:r("--theme-accent-primary",qe[e].accent),accentHover:r("--theme-accent-hover",qe[e].accentHover),accentLight:r("--theme-accent-primary",qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",qe[e].dependency),dependencyHover:r("--theme-border-secondary",qe[e].dependencyHover),criticalPath:r("--theme-error",qe[e].criticalPath),criticalPathLight:r("--theme-error",qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",qe[e].today):e==="neutral"?r("--theme-text-primary",qe[e].today):r("--theme-error",qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",qe[e].todayLight):e==="neutral"?r("--theme-text-primary",qe[e].todayLight):r("--theme-error",qe[e].todayLight),milestone:r("--theme-warning",qe[e].milestone),milestoneLight:r("--theme-warning",qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",qe[e].statusInProgress),statusCompleted:r("--theme-success",qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",qe[e].hoverBg),focusRing:r("--theme-accent-primary",qe[e].focusRing)}}var In={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Sc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Si={en:In,es:Sc};function Ec(e){return Si[e]||Si.en}function Ei(e,t){let a=Ec(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var To=react.createContext(In);function Lr(){return react.useContext(To)}function dh({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[d,m]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null),p=Lr();if(react.useEffect(()=>{let g=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return d&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[d]),!(t||a||r||o||s||n))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(g=>g.handler),C=async(g,v)=>{if(v){c(g);try{await v();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!d),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:d?e.accent:e.bgSecondary,border:`1px solid ${d?e.accent:e.borderLight}`,color:d?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:y.map((g,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>C(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function ch({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function mh({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 ph({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Lr();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=d.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((i,c)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:c<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function uh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),d=react.useRef(null),m=Lr();react.useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let b=C=>{d.current&&!d.current.contains(C.target)&&n(false);},y=C=>{C.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(p),d._cleanup&&d._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,l=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p=>{p.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?l?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?l?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:l?"#0F1117":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:l?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(p=>{let b=t===p.value&&!r,y=()=>p.value==="all"?b?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:b?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?p.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:p.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]},p.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?l?"#3B82F6":"#2563EB":l?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]})})]})})]})}function Rn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:l,onCreateTask:p,taskFilter:b="all",onTaskFilterChange:y,hideCompleted:C=false,onHideCompletedChange:g,onExportPNG:v,onExportPDF:h,onExportExcel:u,onExportCSV:k,onExportJSON:x,onExportMSProject:D}){let T=Lr(),w=v||h||u||k||x||D,L=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],B=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(mh,{options:L,value:t,onChange:N=>a(N),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(ph,{theme:e,value:d,onChange:m}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(uh,{theme:e,value:b,onChange:y,hideCompleted:C,onHideCompletedChange:g})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||T.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(dh,{theme:e,onExportPNG:v,onExportPDF:h,onExportExcel:u,onExportCSV:k,onExportJSON:x,onExportMSProject:D}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(ch,{options:B,value:s,onChange:N=>n(N),theme:e})]})]})}function On({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),d=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function No({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[d,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,l=r.length*36+8,p=8,b=window.innerWidth,y=window.innerHeight,C=t,g=a;t+c+p>b&&(C=t-c,C<p&&(C=p)),a+l+p>y&&(g=y-l-p,g<p&&(g=p)),m({x:C,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},l=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:l=>{c.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Lt={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 Oc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:l,enableKeyboard:p=true}){let b=react.useRef(false),y=react.useCallback(u=>{b.current=u;},[]),C=react.useCallback(u=>{let k=[],x=D=>{for(let T of D)k.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&x(T.subtasks);};return x(u),k},[]),g=react.useCallback(()=>{let u=C(e);for(let k of u)if(t.has(k.id))return k;return null},[e,t,C]),v=react.useCallback((u,k)=>{let x=C(e);if(x.length===0)return;let D=g();if(!D){a(x[0].id,false);return}let T=x.findIndex(B=>B.id===D.id);if(T===-1)return;let w=u==="up"?T-1:T+1;if(w<0||w>=x.length)return;let L=x[w];a(L.id,k);},[e,g,C,a]),h=react.useCallback(u=>{if(!p)return;let k=u.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||b.current){u.key==="Escape"&&(k.blur(),b.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?u.metaKey:u.ctrlKey,w=Array.from(t),L=g();if(u.key==="ArrowUp"){u.preventDefault(),v("up",u.shiftKey);return}if(u.key==="ArrowDown"){u.preventDefault(),v("down",u.shiftKey);return}if(L&&(u.key==="ArrowRight"||u.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(u.preventDefault(),(u.key==="ArrowRight"&&!L.isExpanded||u.key==="ArrowLeft"&&L.isExpanded)&&c(L.id));return}if(u.altKey&&(u.key==="ArrowUp"||u.key==="ArrowDown")){w.length>0&&(u.preventDefault(),n(w,u.key==="ArrowUp"?"up":"down"));return}if(u.key==="Tab"&&!u.shiftKey){w.length>0&&(u.preventDefault(),d(w));return}if(u.key==="Tab"&&u.shiftKey){w.length>0&&(u.preventDefault(),m(w));return}if(u.key==="Enter"&&!u.shiftKey&&!T){L&&(u.preventDefault(),r(L.id,"below"));return}if(u.key==="Enter"&&u.shiftKey&&!T){L&&(u.preventDefault(),r(L.id,"above"));return}if(u.key==="Enter"&&T){L&&(u.preventDefault(),l(L.id));return}if(u.key==="F2"){L&&(u.preventDefault(),i(L.id));return}if(u.key==="Delete"||u.key==="Backspace"&&T){w.length>0&&(u.preventDefault(),o(w));return}if(u.key==="d"&&T&&!u.shiftKey){w.length>0&&(u.preventDefault(),s(w));return}},[p,t,g,v,r,o,s,n,d,m,i,c,l]);return react.useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:y}}function Uc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(p=>{let b=new Set(p);return b.has(l)?b.delete(l):b.add(l),b}),r(l);},[]),n=react.useCallback((l,p)=>{if(!a){o(l);return}let b=p.indexOf(a),y=p.indexOf(l);if(b===-1||y===-1){o(l);return}let C=Math.min(b,y),g=Math.max(b,y),v=p.slice(C,g+1);t(new Set(v)),r(l);},[a,o]),d=react.useCallback((l,p,b,y)=>{y?n(l,p):b?s(l):o(l);},[o,s,n]),m=react.useCallback((l,p)=>{p?t(b=>{let y=new Set(b);return y.add(l),y}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Do(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let d={...r[n],parentId:o,level:s,position:n};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function Hc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Hc(a.subtasks,t);if(r)return r}}return null}function Bi(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Bi(a.subtasks,t);if(r)return r}return null}function Ri(e,t){if(t.length===0)return e;let a=Do(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],n=(l,p)=>{let b=[];return {tasks:l.filter(C=>{if(p.has(C.id))return b.push(C),false;if(C.subtasks){let g=n(C.subtasks,p);C.subtasks=g.tasks,b.push(...g.removed);}return true}),removed:b}},d=(l,p,b)=>l.map(y=>y.id===p?{...y,subtasks:[...y.subtasks||[],...b],isExpanded:true}:y.subtasks?{...y,subtasks:d(y.subtasks,p,b)}:y),m=new Set(t),{tasks:i,removed:c}=n(e,m);return d(i,s.id,c)}function Oi(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Bi(a,r);if(!o)continue;let s=Bi(a,o.id),n=(i,c,l)=>{for(let p=0;p<i.length;p++){let b=i[p];if(b.id===c&&b.subtasks){let y=b.subtasks.findIndex(C=>C.id===l);if(y!==-1){let[C]=b.subtasks.splice(y,1);return C}}if(b.subtasks){let y=n(b.subtasks,c,l);if(y)return y}}return null},d=(i,c,l)=>{let p=i.findIndex(b=>b.id===c);if(p!==-1)return i.splice(p+1,0,l),i;for(let b of i)b.subtasks&&d(b.subtasks,c,l);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?d(s.subtasks,o.id,m):d(a,o.id,m));}return a}function zi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,m)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function Ui(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 Hi(e,t){let a=[...e];for(let r of t){let o=n=>{let d=n.findIndex(c=>c.id===r);if(d===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[d],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(d+1,0,i),true},s=n=>n.map(d=>({...d,id:`${d.id}-copy-${Date.now()}`,subtasks:d.subtasks?s(d.subtasks):void 0}));o(a);}return a}function $c(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},d=m=>{let i=m.findIndex(l=>l.id===t);if(i===-1){for(let l of m)if(l.subtasks&&d(l.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return d(r),{tasks:r,newTask:n}}function $i(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:$i(r.subtasks,t,a)}:r)}function Wi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Wi(a.subtasks,t)}:a)}function Gi(e,t){let a=c=>{for(let l of c){if(l.id===t)return l;if(l.subtasks){let p=a(l.subtasks);if(p)return p}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#3B82F6"},i=c=>c.map(l=>{if(l.id===t){let p=l.subtasks||[];return {...l,subtasks:[...p,m],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:m}}function Wc(e,t,a,r){if(t===a)return e;let o=Hc(e,t);if(!o)return e;if(a){let d=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||d(c,i))return true;return false};if(d(o,a))return e}let s=d=>d.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0});}else {let d=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],l=r!==void 0?r:c.length,p=[...c];return p.splice(l,0,{...o,parentId:a}),{...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function Hn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:l,onColumnResize:p,onTaskUpdate:b,onTaskIndent:y,onTaskOutdent:C,onTaskMove:g,onMultiTaskDelete:v,onTaskDuplicate:h,onTaskCreate:u,onTaskRename:k,onCreateSubtask:x,onOpenTaskModal:D,onDeleteRequest:T,onTaskReparent:w}){let L=react.useContext(To),[B,N]=react.useState(null),[$,U]=react.useState(null),[j,se]=react.useState(""),ee=react.useRef(null),[ie,ve]=react.useState(null),[Ce,Ae]=react.useState(0),[F,R]=react.useState(0),[S,_]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[J,ce]=react.useState(null),[pe,V]=react.useState(null),[ue,K]=react.useState(null),He=react.useRef(0),le=5,Re=react.useRef(false),[rt,ot]=react.useState(null),[Ke,yt]=react.useState(false),[lt,Ot]=react.useState(null),[me,I]=react.useState(false),ae=react.useRef(null);react.useEffect(()=>{function A(O){ae.current&&!ae.current.contains(O.target)&&I(false);}if(me)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[me]),react.useEffect(()=>{$&&ee.current&&(ee.current.focus(),ee.current.select());},[$]),react.useEffect(()=>{if(!ie)return;let A=re=>{let Le=re.clientX-Ce,De=F+Le;p?.(ie,De);},O=()=>{ve(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",A),document.addEventListener("mouseup",O),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",O),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,Ce,F,p]);let{selectedTaskIds:we,handleTaskClick:Be,isTaskSelected:Z}=Uc(),{setIsEditing:Me}=Oc({tasks:e,selectedTaskIds:we,onTaskSelect:(A,O)=>{let Le=Do(e).map(De=>De.id);Be(A,Le,O||false,false);},onTaskCreate:u||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:C||(()=>{}),onTaskRename:A=>{let O=Do(e).find(re=>re.id===A);O&&We(O);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:A=>{let O=Do(e).find(re=>re.id===A);O&&D&&D(O);},enableKeyboard:true}),G=(A,O=0)=>{let re=[];for(let Le of A)re.push({task:Le,level:O}),Le.subtasks&&Le.subtasks.length>0&&Le.isExpanded&&re.push(...G(Le.subtasks,O+1));return re},q=G(e),$e=48,Oe=Math.max(q.length*a,600-$e),je=A=>!A.startDate||!A.endDate?"-":`${Math.ceil((A.endDate.getTime()-A.startDate.getTime())/(1e3*60*60*24))}d`,We=A=>{U(A.id),se(A.name),Me(true);},de=A=>{j.trim()&&j!==e.find(O=>O.id===A)?.name&&k?.(A,j.trim()),U(null),se(""),Me(false);},Ie=()=>{U(null),se(""),Me(false);},Q=(A,O)=>{O.stopPropagation(),x?.(A.id);},_e=(A,O)=>{O.preventDefault(),He.current=O.clientY,ce(A),Re.current=false,yt(false),ot({x:O.clientX,y:O.clientY});},Na=A=>{if(!J||(Math.abs(A.clientY-He.current)>le&&!Re.current&&(Re.current=true,yt(true)),ot({x:A.clientX,y:A.clientY}),!Re.current))return;let re=document.querySelectorAll("[data-task-row]"),Le=null,De=null;re.forEach(z=>{let te=z.getBoundingClientRect(),Fe=z.getAttribute("data-task-row");if(Fe&&Fe!==J&&A.clientY>=te.top&&A.clientY<=te.bottom){Le=Fe;let Qe=A.clientY-te.top,nt=te.height;Qe<nt*.25?De="above":Qe>nt*.75?De="below":De="child";}}),V(Le),K(De);},ge=()=>{if(Re.current&&J&&pe&&ue){if(ue==="child")w?.(J,pe);else if(ue==="above"||ue==="below"){let A=(Le,De,z=null)=>{for(let te of Le){if(te.id===De)return z;if(te.subtasks){let Fe=A(te.subtasks,De,te.id);if(Fe!==void 0)return Fe}}},O=A(e,pe,null),re=(Le,De)=>{let z=Le.findIndex(te=>te.id===De);return ue==="below"?z+1:z};if(O===null){let Le=re(e,pe);w?.(J,null,Le);}else {let Le=q.find(De=>De.task.id===O)?.task;if(Le?.subtasks){let De=re(Le.subtasks,pe);w?.(J,O,De);}}}}ce(null),V(null),K(null),ot(null),Re.current=false,yt(false);};react.useEffect(()=>{if(J)return document.addEventListener("mousemove",Na),document.addEventListener("mouseup",ge),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Na),document.removeEventListener("mouseup",ge),document.body.style.cursor="",document.body.style.userSelect="";}},[J,pe,ue]);let Ve=(A,O,re)=>{switch(A.id){case "name":let Le=$===O.id,De=B===O.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${re*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:De?1:.3},onMouseDown:he=>_e(O.id,he),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),O.subtasks&&O.subtasks.length>0?jsxRuntime.jsx("button",{onClick:he=>{he.stopPropagation(),m?.(O.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:O.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:O.color||"#3B82F6",opacity:O.parentId?.6:1,borderColor:O.isMilestone?t.accent:"transparent",borderWidth:O.isMilestone?"2px":"0px"},title:O.isMilestone?"Milestone":O.parentId?"Subtask":"Task"})}),Le?jsxRuntime.jsx("input",{ref:ee,type:"text",value:j,onChange:he=>se(he.target.value),onKeyDown:he=>{he.key==="Enter"?de(O.id):he.key==="Escape"&&Ie();},onBlur:()=>de(O.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:he=>he.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:O.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:O.parentId?"13px":"14px",fontWeight:O.isMilestone?600:O.parentId?400:600,letterSpacing:O.parentId?"0":"-0.01em"},title:O.name,children:O.name}),De&&!Le&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:he=>he.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:he=>Q(O,he),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:he=>{he.stopPropagation(),We(O);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let te=A.id==="startDate"?"startDate":"endDate",Fe=O[te],Qe=lt?.taskId===O.id&<?.field===te,nt=he=>he?(typeof he=="string"?new Date(he):he).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:he=>he.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:he=>{if(Qe)Ot(null);else {let Ct=he.currentTarget.getBoundingClientRect();Ot({taskId:O.id,field:te,month:Fe?typeof Fe=="string"?new Date(Fe):Fe:new Date,position:{top:Ct.bottom+4,left:Ct.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:nt(Fe)})]}),Qe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ot(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:lt?.position.top,left:lt?.position.left},onClick:he=>he.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let he=new Date,Ct=new Date(he);Ct.setDate(he.getDate()+1);let at=new Date(he);at.setDate(he.getDate()+7);let co=new Date(he);return co.setDate(he.getDate()+14),[{label:"Hoy",date:he},{label:"Ma\xF1ana",date:Ct},{label:"Pr\xF3xima semana",date:at},{label:"2 semanas",date:co}].map((vr,Qa)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:er=>er.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:er=>er.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(O.id,{[te]:vr.date}),Ot(null);},children:vr.label},Qa))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:he=>he.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:he=>he.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(O.id,{[te]:void 0}),Ot(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:()=>Ot(he=>he?{...he,month:new Date(he.month.getFullYear(),he.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:lt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ot(he=>he?{...he,month:new Date(he.month.getFullYear(),he.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((he,Ct)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:he},Ct))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let he=lt?.month||new Date,Ct=he.getFullYear(),at=he.getMonth(),co=new Date(Ct,at,1).getDay(),Lo=new Date(Ct,at+1,0).getDate(),vr=new Date,Qa=[];for(let _t=co-1;_t>=0;_t--)Qa.push({day:new Date(Ct,at,-_t).getDate(),date:new Date(Ct,at-1,new Date(Ct,at,-_t).getDate()),isCurrentMonth:false});for(let _t=1;_t<=Lo;_t++)Qa.push({day:_t,date:new Date(Ct,at,_t),isCurrentMonth:true});let er=42-Qa.length;for(let _t=1;_t<=er;_t++)Qa.push({day:_t,date:new Date(Ct,at+1,_t),isCurrentMonth:false});return Qa.map((_t,xs)=>{let ks=_t.date.toDateString()===vr.toDateString(),Io=(Fe?typeof Fe=="string"?new Date(Fe):Fe:null)?.toDateString()===_t.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:_t.isCurrentMonth?Io?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Io?"#3B82F6":"transparent",boxShadow:ks&&!Io?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{b?.(O.id,{[te]:_t.date}),Ot(null);},children:_t.day},xs)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:je(O)})});case "assignees":let $r=r.filter(he=>O.assignees?.some(Ct=>Ct.name===he.name||Ct.initials===he.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:he=>he.stopPropagation(),children:jsxRuntime.jsx(Yr,{assignedUsers:$r,availableUsers:r,onChange:he=>{let Ct=he.map(at=>({id:at.id,name:at.name,initials:at.initials,color:at.color}));b?.(O.id,{assignees:Ct.length>0?Ct:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:he=>he.stopPropagation(),children:jsxRuntime.jsx(Ed,{status:O.status||"todo",onChange:he=>{b?.(O.id,{status:he,progress:he==="completed"?100:O.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:`${O.progress}%`,backgroundColor:O.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:[O.progress,"%"]})]});case "priority":let hr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},yr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},La=hr[O.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:he=>he.stopPropagation(),children:jsxRuntime.jsx(jr,{priority:La,onChange:he=>{he&&b?.(O.id,{priority:yr[he]||"medium"});}})});default:return null}},ze=A=>[{id:"hide",label:"Hide Column",icon:Lt.Hide,onClick:()=>l(A),disabled:A==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Lt.SortDesc,onClick:()=>{}}],Ye=A=>A.subtasks&&A.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{x?.(A.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{T?T(A.id,A.name):v?.([A.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{n?.(A);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{x?.(A.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{b?.(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{b?.(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{b?.(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{T?T(A.id,A.name):v?.([A.id]);}}],Ze=c.filter(A=>A.visible),P=Ze.reduce((A,O)=>A+O.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:P},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${$e}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Ze.map((A,O)=>{let re=O===Ze.length-1,Le=A.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Le?"":"justify-center"}`,style:{width:`${A.width}px`,minWidth:`${A.minWidth??(Le?200:60)}px`,maxWidth:`${A.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:re?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:De=>{De.preventDefault(),_({isOpen:true,x:De.clientX,y:De.clientY,type:"header",columnId:A.id});},onMouseEnter:De=>{De.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:De=>{De.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:A.label,children:A.label}),A.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ie===A.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:De=>{De.preventDefault(),De.stopPropagation(),ve(A.id),Ae(De.clientX),R(A.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"}})})]},A.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(On,{columns:c,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>I(!me),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),me&&jsxRuntime.jsxs("div",{ref: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:A=>A.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>I(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Oe},children:q.map(({task:A,level:O},re)=>{let Le=Z(A.id),De=pe===A.id,z=De&&ue==="above",te=De&&ue==="below",Fe=De&&ue==="child",Qe={};return Fe&&(Qe.backgroundColor=`${t.accent}15`,Qe.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":A.id,className:`flex items-center cursor-pointer group ${J===A.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Le?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Le?t.accentLight:Fe?`${t.accent}15`:re%2===0?t.bgPrimary:t.bgGrid,...Qe},onMouseEnter:()=>N(A.id),onMouseLeave:()=>N(null),onClick:nt=>{let hr=Do(e).map(he=>he.id),La=navigator.platform.toUpperCase().indexOf("MAC")>=0?nt.metaKey:nt.ctrlKey;Be(A.id,hr,La,nt.shiftKey),s?.(A);},onDoubleClick:nt=>{nt.stopPropagation(),n?.(A);},onContextMenu:nt=>{nt.preventDefault(),_({isOpen:true,x:nt.clientX,y:nt.clientY,type:"task",task:A}),d?.(A,nt);},whileHover:{backgroundColor:Le?t.accentLight:t.hoverBg},children:[z&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),te&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ze.map((nt,$r)=>{let hr=$r===Ze.length-1,yr=nt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${yr?"justify-start":"justify-center"}`,style:{width:`${nt.width}px`,minWidth:`${nt.minWidth??(yr?200:60)}px`,maxWidth:`${nt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:hr?"none":`1px solid ${B===A.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ve(nt,A,yr?O:0)},`${A.id}-${nt.id}`)})]},A.id)})}),jsxRuntime.jsx(No,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?ze(S.columnId):S.type==="task"&&S.task?Ye(S.task):[],onClose:()=>_({...S,isOpen:false}),theme:t}),Ke&&rt&&J&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:rt.x+12,top:rt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let A=q.find(O=>O.task.id===J)?.task;return A?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:A.name})}):null})()}),document.body)]})}function Kc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,d]=react.useState(e),[m,i]=react.useState(t),[c,l]=react.useState(null),[p,b]=react.useState(null),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,u]=react.useState(0),[k,x]=react.useState(0),[D,T]=react.useState(null),[w,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:l,hoveredTaskId:p,setHoveredTaskId:b,activeZone:y,setActiveZone:C,draggedSegmentIndex:g,setDraggedSegmentIndex:v,draggedSegmentStartX:h,setDraggedSegmentStartX:u,segmentDragOffsetX:k,setSegmentDragOffsetX:x,hoveredSegmentIndex:D,setHoveredSegmentIndex:T,isHovered:w,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(j,se)=>{r("none"),l(null),b(null),d(j),i(se),x(0),v(null),u(0);}}}function Wn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:l,onDependencyCreate:p,allTaskPositions:b=[],onDragMove:y,onHoverChange:C}){let g=Kc(t,r),v=react.useRef(null),h=react.useRef(null),u=react.useRef(null),{dragMode:k,setDragMode:x,dragOffset:D,setDragOffset:T,ghostX:w,setGhostX:L,ghostWidth:B,setGhostWidth:N,connectionLine:$,setConnectionLine:U,hoveredTaskId:j,setHoveredTaskId:se,activeZone:ee,setActiveZone:ie,draggedSegmentIndex:ve,setDraggedSegmentIndex:Ce,draggedSegmentStartX:Ae,setDraggedSegmentStartX:F,segmentDragOffsetX:R,setSegmentDragOffsetX:S,hoveredSegmentIndex:_,setHoveredSegmentIndex:J,isHovered:ce,setIsHovered:pe,isDragging:V,isResizing:ue,isConnecting:K,resetDragState:He}=g,le=32,Re=8,rt=e.endDate&&e.endDate<new Date&&e.progress<100,ot=e.isCriticalPath,Ke=o.name==="neutral"||o.today==="#1C1917",yt=e.status==="completed"||e.progress===100,lt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},me=e.isCriticalPath||rt?"#DC2626":e.color?e.color:e.priority&<[e.priority]?lt[e.priority]:o.taskBarPrimary,ae=(ge=>ge>=80?20:ge>=60?15:ge>=50?12:10)(r),we=r<50,Be=r<40;react.useEffect(()=>{if(C)if(ce&&!V&&!e.segments){let ge=a<100;C({task:e,x:t,y:a,width:r,height:le,showBelow:ge});}else C(null);},[ce,V,e,t,a,r,le,C]);let Z=ge=>ge.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Me=()=>{let ge=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ge} day${ge!==1?"s":""}`},G=ge=>Math.round(ge/s)*s,q=ge=>{let Ve=Math.round(ge/s),ze=new Date(n);return ze.setDate(ze.getDate()+Ve),ze},$e=(ge,Ve)=>{for(let ze of b){if(ze.id===e.id)continue;let Ye=5;if(ge>=ze.x-Ye&&ge<=ze.x+ze.width+Ye&&Ve>=ze.y-Ye&&Ve<=ze.y+ze.height+Ye)return ze.id}return null},Oe=react.useCallback((ge,Ve,ze)=>{ge.preventDefault(),ge.stopPropagation();let Ye=v.current?.ownerSVGElement;if(!Ye)return;let Ze=Ye.createSVGPoint();Ze.x=ge.clientX,Ze.y=ge.clientY;let P=Ze.matrixTransform(Ye.getScreenCTM()?.inverse()),A=ze!==void 0?ze:t,O=Ve;if(!O){let re=P.x-A;ge.shiftKey?(O="connect",U({x:t+r,y:a+le/2})):ge.ctrlKey||ge.metaKey?O="move":ge.altKey?O=re<r/2?"resize-start":"resize-end":Be?re<r/2?O="move":O="resize-end":we?re<=ae/2?O="resize-start":re>=r-ae/2?O="resize-end":O="move":re<=ae?O="resize-start":re>=r-ae?O="resize-end":O="move";}x(O),pe(false),ie(null),O==="move"?T(P.x-A):O==="connect"?U({x:t+r,y:a+le/2}):T(0),L(A),N(r);},[t,r,a,le]),je=react.useCallback(ge=>{let Ve=v.current?.ownerSVGElement;if(!Ve)return;let ze=Ve.closest(".gantt-timeline-scroll");if(!ze)return;let Ye=ze.getBoundingClientRect(),Ze=60,P=15,A=0;if(ge.clientX<Ye.left+Ze){let O=Ye.left+Ze-ge.clientX;A=-Math.min(P,O/2);}else if(ge.clientX>Ye.right-Ze){let O=ge.clientX-(Ye.right-Ze);A=Math.min(P,O/2);}return A!==0&&(ze.scrollLeft+=A),A!==0},[]),We=react.useCallback(ge=>{if(k==="none")return;u.current=ge;let Ve=v.current?.ownerSVGElement;if(!Ve)return;if(k==="move"||k==="resize-start"||k==="resize-end"){let Ze=je(ge);Ze&&!h.current?h.current=window.setInterval(()=>{u.current&&(je(u.current),We(u.current));},16):!Ze&&h.current&&(window.clearInterval(h.current),h.current=null);}let ze=Ve.createSVGPoint();ze.x=ge.clientX,ze.y=ge.clientY;let Ye=ze.matrixTransform(Ve.getScreenCTM()?.inverse());if(k==="connect"){U({x:Ye.x,y:Ye.y});let Ze=$e(Ye.x,Ye.y);se(Ze);}else if(k==="move"){let Ze=Ye.x-D,P=G(Ze);L(P),N(r);let A=Math.round((P-t)/s);if(y?.(e.id,A,true),e.segments&&e.segments.length>0&&ve!==null){let O=P-Ae;S(O);}}else if(k==="resize-start"){let Ze=Ye.x,P=G(Ze),A=t+r-P;A>=s&&(L(P),N(A));}else if(k==="resize-end"){let Ze=Ye.x,A=G(Ze)-t;A>=s&&N(A);}},[k,t,r,s,D,e,G,ve,Ae,$e,se,U,L,N,S,y,je]),de=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),u.current=null,k!=="none"){if(k==="connect")j&&p&&p(e,j),U(null),se(null);else {let ge=e.endDate.getTime()-e.startDate.getTime(),Ve,ze,Ye=true;if(k==="move"){if(Ve=q(w),ze=new Date(Ve.getTime()+ge),e.segments&&e.segments.length>0&&ve!==null){let Ze=Math.round(R/s),P=e.segments.map((Le,De)=>{if(De===ve){let z=new Date(Le.startDate),te=new Date(Le.endDate);return z.setDate(z.getDate()+Ze),te.setDate(te.getDate()+Ze),{startDate:z,endDate:te}}return Le}),A=P.flatMap(Le=>[Le.startDate,Le.endDate]),O=new Date(Math.min(...A.map(Le=>Le.getTime()))),re=new Date(Math.max(...A.map(Le=>Le.getTime())));l?.({...e,segments:P},O,re),He(t,r);return}}else k==="resize-start"?(Ve=q(w),ze=e.endDate,Ve>ze&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ye=false)):k==="resize-end"?(Ve=e.startDate,ze=q(w+B),ze<Ve&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ye=false)):Ye=false;Ye&&Ve&&ze&&(ze.getTime()<Ve.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,Ve,ze));}y?.(e.id,0,false),He(t,r);}},[k,w,B,e,l,j,p,t,r,s,q,R,ve,He,y]);react.useEffect(()=>{if(k==="none")return;let ge=ze=>{We(ze);},Ve=()=>{de();};return window.addEventListener("mousemove",ge),window.addEventListener("mouseup",Ve),()=>{window.removeEventListener("mousemove",ge),window.removeEventListener("mouseup",Ve),h.current&&(window.clearInterval(h.current),h.current=null);}},[k,We,de]);let Ie=V&&!K?w:t,Q=V&&!K?B:r,_e=d.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,"data-task-bar":"true",onClick:()=>!V&&m?.(e),onDoubleClick:ge=>{V||(ge.stopPropagation(),i?.(e));},onContextMenu:ge=>{ge.preventDefault(),c?.(e,ge);},onMouseEnter:()=>!V&&pe(true),onMouseLeave:()=>{V||(pe(false),ie(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:le,fill:"transparent",style:{pointerEvents:"all"}}),ce&&!V&&!we&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ae,height:le,fill:ee==="resize-start"?o.accent:"transparent",opacity:ee==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-start"),onMouseDown:ge=>Oe(ge,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ae,y:a,width:r-ae*2,height:le,fill:ee==="move"?o.accent:"transparent",opacity:ee==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:ge=>Oe(ge,"move")}),jsxRuntime.jsx("rect",{x:t+r-ae,y:a,width:ae,height:le,fill:ee==="resize-end"?o.accent:"transparent",opacity:ee==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:ge=>Oe(ge,"resize-end")})]}),ce&&!V&&Be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:le,fill:ee==="move"?o.accent:"transparent",opacity:ee==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:ge=>Oe(ge,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:le,fill:ee==="resize-end"?o.accent:"transparent",opacity:ee==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:ge=>Oe(ge,"resize-end")}),ce&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+le-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),V&&!K&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:a,width:B,height:le,rx:Re,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie,y:a,width:Q,height:le,rx:Re,fill:me,"data-task-class":_e,initial:{opacity:0,scale:.95},animate:{opacity:V&&!K?.15:e.parentId?.6:ce?.9:.8,scale:ce&&!V?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ge=>Oe(ge),style:{cursor:V?K?"crosshair":ue?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:Q*(e.progress/100),height:le,rx:Re,fill:me,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ge,Ve)=>{let ze=(ge.startDate.getTime()-n.getTime())/864e5*s,Ze=(ge.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-ze+s,P=V&&k==="move"&&ve===Ve,A=_===Ve,O=P?ze+R:ze;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!V&&J(Ve),onMouseLeave:()=>!V&&J(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:O,y:a,width:Ze,height:le,rx:Re,fill:me,initial:{opacity:0,scale:.95},animate:{opacity:P||e.parentId?.6:A?.9:.8,scale:A&&!V?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:re=>{re.stopPropagation(),Ce(Ve),F(ze),Oe(re,void 0,ze);},style:{cursor:V?K?"crosshair":ue?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:O,y:a,width:Ze*(e.progress/100),height:le,rx:Re,fill:me,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ve}`)}),Ke&&(rt||ot)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ot&&!rt&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:Q,height:le,rx:Re,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),rt&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:Q,height:le,rx:Re,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Q>60&&!e.segments&&(()=>{let ge=d.taskLabel(e),Ve=typeof ge=="string"?ge:e.name,ze=Ve.length>Math.floor(Q/8)?`${Ve.substring(0,Math.floor(Q/8))}...`:Ve;return jsxRuntime.jsx("text",{x:Ie+12,y:a+le/2,dominantBaseline:"middle",fill:yt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:yt?"line-through":"none"},children:ze})})(),Q>100&&e.progress>0&&e.progress<100&&!V&&!e.segments&&jsxRuntime.jsxs("text",{x:Ie+Q-12,y:a+le/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&&Q>80&&!V&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ie+Q-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ie+Q-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ce||ue)&&!K&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ie-2,y:a,width:16,height:le,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-start"),onMouseLeave:()=>ie(null),onMouseDown:ge=>{ge.stopPropagation(),Oe(ge,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie+4,y:a+8,width:3,height:le-16,rx:1.5,fill:ee==="resize-start"||k==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ie+Q-14,y:a,width:16,height:le,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-end"),onMouseLeave:()=>ie(null),onMouseDown:ge=>{ge.stopPropagation(),Oe(ge,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie+Q-7,y:a+8,width:3,height:le-16,rx:1.5,fill:ee==="resize-end"||k==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce&&!V&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+le/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ie("connect"),onMouseLeave:()=>ie(null),onMouseDown:ge=>{ge.stopPropagation(),Oe(ge,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+le/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ee==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),K&&$&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+le/2,x2:$.x,y2:$.y,stroke:j?o.statusCompleted:o.accent,strokeWidth:j?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:j?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:$.x,cy:$.y,r:j?8:6,fill:j?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),j&&jsxRuntime.jsx(framerMotion.motion.text,{x:$.x+15,y:$.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:$.x+10},animate:{opacity:1,x:$.x+15},transition:{duration:.2},children:"Connect"})]}),(ce||V)&&!K&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie-2,y:a-2,width:Q+4,height:le+4,rx:Re+2,fill:"none",stroke:V?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:V?.6:.4,initial:{opacity:0},animate:{opacity:V?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+B,y1:0,x2:w+B,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce&&!V&&!e.segments&&!C&&(()=>{let ze=a<100,Ye=ze?a+le+13:a-82-13,Ze=ze?`M ${Ie+Q/2-6} ${a+le+3} L ${Ie+Q/2} ${a+le+13} L ${Ie+Q/2+6} ${a+le+3}`:`M ${Ie+Q/2-6} ${a-13} L ${Ie+Q/2} ${a-3} L ${Ie+Q/2+6} ${a-13}`,P=Ye+22,A=Ye+40,O=Ye+55,re=Ye+70,Le=ze?Ye+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ze?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ze?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ze,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ie+Q/2-120,y:Ye,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Ie+Q/2,y:P,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Ie+Q/2-110,y:A,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ie+Q/2-70,y:A,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Z(e.startDate)}),jsxRuntime.jsx("text",{x:Ie+Q/2-110,y:O,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ie+Q/2-70,y:O,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Z(e.endDate)}),jsxRuntime.jsx("text",{x:Ie+Q/2+10,y:A,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ie+Q/2+65,y:A,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Me()}),jsxRuntime.jsx("text",{x:Ie+Q/2+10,y:O,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ie+Q/2+65,y:O,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Ie+Q/2-110,y:re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ie+Q/2-50,y:re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(De=>De.name).join(", ").substring(0,30),e.assignees.map(De=>De.name).join(", ").length>30?"...":""]})]}),!ze&&jsxRuntime.jsx("text",{x:Ie+Q/2,y:Le,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Be?"Left: move \u2022 Right: resize":we?"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 Xc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:d}=e,m=82,i=13,c=d?o+n+i:o-m-i,l=d?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,p=c+22,b=c+40,y=c+55,C=c+70,g=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:d?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:d?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:c,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:p,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false}){let[m,i]=react.useState(false),[c,l]=react.useState(null),p=r-t,b=p>0,y=Math.abs(p)<5,C=20,g=!y&&a<=e,v,h,u=a-e,k=e+u/2;if(h=k,n==="squared")if(y)v=`M ${e} ${t} L ${a} ${r}`;else if(g){let ie=e+15,ve=a-C,Ce=b?t+20:t-20;h=ve,v=`M ${e} ${t} L ${ie} ${t} L ${ie} ${Ce} L ${ve} ${Ce} L ${ve} ${r} L ${a} ${r}`;}else h=a-C,v=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else v=`M ${e} ${t} C ${k} ${t}, ${k} ${r}, ${a} ${r}`;let x=5,D=`M ${a} ${r} L ${a-x} ${r-x*.5} M ${a} ${r} L ${a-x} ${r+x*.5}`,T=o.dependency,w=o.dependencyHover||T,L="#f87171",B="rgba(248, 113, 113, 0.15)",N=h,$=(t+r)/2;if(c)if(y)N=Math.max(e+10,Math.min(a-10,c.x)),$=t;else if(g){let ee=e+15,ie=a-C,ve=b?t+20:t-20,Ce=[[e,t,ee,t],[ee,t,ee,ve],[ee,ve,ie,ve],[ie,ve,ie,r],[ie,r,a,r]],Ae=1/0,F={x:N,y:$};for(let R of Ce){let S=U(c.x,c.y,R[0],R[1],R[2],R[3]),_=Math.hypot(c.x-S.x,c.y-S.y);_<Ae&&(Ae=_,F=S);}N=F.x,$=F.y;}else {let ee=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],ie=1/0,ve={x:N,y:$};for(let Ce of ee){let Ae=U(c.x,c.y,Ce[0],Ce[1],Ce[2],Ce[3]),F=Math.hypot(c.x-Ae.x,c.y-Ae.y);F<ie&&(ie=F,ve=Ae);}N=ve.x,$=ve.y;}function U(ee,ie,ve,Ce,Ae,F){let R=Ae-ve,S=F-Ce,_=R*R+S*S;if(_===0)return {x:ve,y:Ce};let J=((ee-ve)*R+(ie-Ce)*S)/_;return J=Math.max(0,Math.min(1,J)),{x:ve+J*R,y:Ce+J*S}}let j=ee=>{let ie=ee.currentTarget.ownerSVGElement;if(!ie)return;let ve=ie.getBoundingClientRect();l({x:ee.clientX-ve.left,y:ee.clientY-ve.top});},se=()=>{i(false),l(null);};return d?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:se,onMouseMove:j,children:[jsxRuntime.jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:v,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:v,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:w,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ee=>{ee.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:$,r:9,fill:B,stroke:L,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:$-3,x2:N+3,y2:$+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:$-3,x2:N-3,y2:$+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:se,onMouseMove:j,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:v,fill:"none",stroke:m?w:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:D,fill:"none",stroke:m?w:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?w:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ee=>{ee.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:$,r:9,fill:B,stroke:L,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:$-3,x2:N+3,y2:$+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:$-3,x2:N-3,y2:$+3,stroke:L,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Kn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),d=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var ye={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,m=i=>{if(!n.has(i)){n.add(i),d.add(i);let c=r.get(i)||[];for(let l of c){if(!n.has(l)&&m(l))return true;if(d.has(l))return true}}return d.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ye.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ye.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ye.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=ye.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
112
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=ye.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=ye.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)=>ye.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ye.findTaskById(e,t);return !a||!a.dependencies?[]:ye.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ye.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ye.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=ye.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=>ye.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=ye.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],d=s.map(m=>{let i=m.startDate&&m.endDate?ye.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?ye.formatDate(m.startDate):"N/A",m.endDate?ye.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:d,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ye.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?ye.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?ye.formatDate(m.startDate):"","End Date":m.endDate?ye.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(c=>c.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let d=a.utils.book_new();a.utils.book_append_sheet(d,s,"Gantt Tasks"),a.writeFile(d,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ye.flattenTasks(e),o=new Map;r.forEach((p,b)=>{o.set(p.id,b+1);});let s=p=>p.toISOString().replace("Z",""),n=ye.getEarliestStartDate(e)||new Date,d=ye.getLatestEndDate(e)||new Date,m=r.map((p,b)=>{let y=o.get(p.id),C=p.startDate&&p.endDate?ye.calculateDuration(p.startDate,p.endDate):0,g=(p.dependencies||[]).filter(v=>o.has(v)).map(v=>`
|
|
113
113
|
<PredecessorLink>
|
|
114
114
|
<PredecessorUID>${o.get(v)}</PredecessorUID>
|
|
115
115
|
<Type>1</Type>
|
|
@@ -339,9 +339,9 @@
|
|
|
339
339
|
</Calendars>
|
|
340
340
|
<Tasks>${m}
|
|
341
341
|
</Tasks>
|
|
342
|
-
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(c),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=be.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?be.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let b of i.dependencies){let y=t.find(C=>C.id===b);if(y){o(y);let C=r.get(b)?.ef||0;l=Math.max(l,C);}}let p=l+c;r.set(i.id,{es:l,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,d=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?be.calculateDuration(i.startDate,i.endDate):0,l=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),p=s;if(l.length>0)for(let y of l){d(y);let C=n.get(y.id)?.ls||0;p=Math.min(p,C);}let b=p-c;n.set(i.id,{ls:b,lf:p});};a.forEach(d);let m=[];for(let i of a){let c=r.get(i.id),l=n.get(i.id);if(c&&l){let p=l.ls-c.es;Math.abs(p)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=be.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(be.calculateCriticalPath(e).includes(t))return 0;let o=be.getDependentTasks(e,t);if(o.length===0){let d=be.getLatestEndDate(e);if(!d)return null;let m=be.calculateDuration(a.endDate,d);return Math.max(0,m)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,m)=>d-m)[0];if(!s)return null;let n=be.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>be.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=be.findTaskById(e,t);if(!r||!r.endDate)return e;let o=be.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let d=be.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=be.calculateEndDate(m,d),c=l=>l.map(p=>p.id===n.id?{...p,startDate:m,endDate:i}:p.subtasks?{...p,subtasks:c(p.subtasks)}:p);s=c(s),s=be.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,l=be.findTaskById(e,t);if(!l||!l.endDate)return [];let p=(b,y,C=new Set)=>{if(C.has(b))return;C.add(b);let g=be.getDependentTasks(e,b);for(let v of g){if(!v.startDate||!v.endDate)continue;let h=r.findIndex(N=>N.id===v.id);if(h===-1)continue;let u=v.startDate.getTime(),x=(v.endDate.getTime()-u)/c,T=(u-i)/c*s,w=T+y*s,L=Math.max(x*s,s),B=d+h*n+12;m.push({taskId:v.id,taskName:v.name,originalX:T,previewX:w,width:L,y:B,rowIndex:h,daysDelta:y,color:v.color}),p(v.id,y,C);}};return p(t,a),m},splitTask:(e,t,a,r=3)=>{let o=be.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],i=c=>c.map(l=>l.id===o.id?{...l,endDate:d,segments:m}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function qn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:l,onTaskContextMenu:p,onTaskDateChange:b,onDependencyCreate:y,onDependencyDelete:C}){let v=Lr(),[h,u]=react.useState([]),[k,x]=react.useState(null),D=react.useCallback(F=>{x(F);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,L=T*w*n,B=F=>{let O=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate())),S=O.getUTCDay()||7;O.setUTCDate(O.getUTCDate()+4-S);let R=new Date(Date.UTC(O.getUTCFullYear(),0,1));return Math.ceil(((O.getTime()-R.getTime())/864e5+1)/7)},N=F=>{let O=F.getDay();return O===0||O===6},W=react.useCallback(F=>{let O=Math.round(F/(w*n)),S=new Date(o);return S.setDate(S.getDate()+O),S},[o,w,n]),$=react.useCallback((F,O)=>{if(O.startDate&&O.endDate)return;let S=F.currentTarget.ownerSVGElement;if(!S)return;let R=S.createSVGPoint();R.x=F.clientX,R.y=F.clientY;let V=R.matrixTransform(S.getScreenCTM()?.inverse()),ee=W(V.x),se=new Date(ee);se.setDate(se.getDate()+1),b?.(O,ee,se);},[W,b]),j=react.useMemo(()=>{let F=V=>V.map(ee=>{if(ee.subtasks&&ee.subtasks.length>0){let se=F(ee.subtasks),le=se.filter(Pe=>Pe.startDate&&Pe.endDate);if(le.length>0){let Pe=le.map(je=>je.startDate.getTime()),Z=le.map(je=>je.endDate.getTime()),_e=new Date(Math.min(...Pe)),we=new Date(Math.max(...Z));return {...ee,subtasks:se,startDate:_e,endDate:we}}return {...ee,subtasks:se}}return ee}),O=(V,ee=[])=>{for(let se of V)ee.push(se),se.subtasks&&se.subtasks.length>0&&(se.isExpanded===void 0||se.isExpanded)&&O(se.subtasks,ee);return ee},S=F(e);return O(S)},[e]),de=react.useCallback(F=>{if(!F.startDate||!F.endDate)return {x:0,width:0};let O=F.startDate.getTime(),S=F.endDate.getTime(),R=o.getTime(),V=(O-R)/(1e3*60*60*24),ee=(S-O)/(1e3*60*60*24),se=V*w*n,le=Math.max(w*n,40),Pe=Math.max(ee*w*n,le);return {x:se,width:Pe}},[o,w,n]),Q=react.useMemo(()=>j.filter(F=>F.startDate&&F.endDate).map(F=>{let{x:O,width:S}=de(F),V=j.findIndex(ee=>ee.id===F.id)*a+12;return {id:F.id,x:O,y:V,width:S,height:32}}),[j,de]),ne=react.useCallback((F,O,S)=>{if(!S||O===0){u([]);return}let R=be.calculateCascadePreview(e,F,O,j,o,w*n,a,48);u(R);},[e,j,o,w,n,a,48]),he=react.useMemo(()=>{let F=[],O=new Date(o);for(;O<=s;){let V=(O.getTime()-o.getTime())/864e5*w*n;if(r==="day")F.push({date:new Date(O),label:O.toLocaleDateString(d,{day:"numeric",month:"short"}),x:V}),O.setDate(O.getDate()+1);else if(r==="week"){let ee=B(O);F.push({date:new Date(O),label:`${v.labels.week} ${ee}`,x:V}),O.setDate(O.getDate()+7);}else F.push({date:new Date(O),label:O.toLocaleDateString(d,{month:"short",year:"numeric"}),x:V}),O.setMonth(O.getMonth()+1);}return F},[o,s,r,w,n,d,v.labels.week]),ke=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*n,[o,w,n]),Ae=Math.max(j.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(L,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:48,fill:t.bgGrid}),he.map((F,O)=>jsxRuntime.jsxs("g",{children:[O>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:F.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:F.label})]},`header-${O}`)),ke>=0&&ke<=L&&jsxRuntime.jsx("circle",{cx:ke,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(L,1e3),height:Ae,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:Ae,fill:t.bgPrimary}),he.map((F,O)=>{let S=he[O+1]?.x||L,R=N(F.date);return jsxRuntime.jsxs("g",{children:[R&&jsxRuntime.jsx("rect",{x:F.x,y:0,width:S-F.x,height:j.length*a,fill:t.bgWeekend,opacity:1}),O>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:j.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},O)}),j.map((F,O)=>{let S=F.startDate&&F.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:O*a,width:L,height:a,fill:O%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${F.id}`),!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:O*a,width:L,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:R=>$(R,F),onMouseEnter:R=>{R.currentTarget.setAttribute("fill",t.accentLight),R.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:R=>{R.currentTarget.setAttribute("fill","transparent"),R.currentTarget.setAttribute("opacity","1");}},`clickable-${F.id}`),jsxRuntime.jsx("text",{x:ke>0?ke:100,y:O*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:v.labels.clickToSetDates},`placeholder-${F.id}`)]})]},`row-group-${F.id}`)}),j.map((F,O)=>{if(!F.startDate||!F.endDate)return null;let{x:S,width:R}=de(F),V=O*a+12,ee=F.subtasks&&F.subtasks.length>0&&!F.isMilestone;return F.isMilestone?jsxRuntime.jsx(Kn,{task:F,x:S+R/2,y:V+16,theme:t,onClick:c},F.id):ee?jsxRuntime.jsxs("g",{onClick:()=>c?.(F),onContextMenu:se=>{se.preventDefault(),se.stopPropagation(),p?.(F,se);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:V,width:R,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:S,y1:V,x2:S+R,y2:V,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:V,x2:S,y2:V+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S+R,y1:V,x2:S+R,y2:V+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:V+32,x2:S+R,y2:V+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),R>60&&jsxRuntime.jsx("text",{x:S+12,y:V+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:F.name})]},F.id):jsxRuntime.jsx(Wn,{task:F,x:S,y:V,width:R,theme:t,dayWidth:w*n,startDate:o,templates:m,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:b,onDependencyCreate:y,allTaskPositions:Q,onDragMove:ne,onHoverChange:D},F.id)}),j.map((F,O)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(S=>{let R=j.find(we=>we.id===S);if(!R||!R.startDate||!R.endDate)return null;let V=j.findIndex(we=>we.id===S),ee=de(R),se=de(F),le=ee.x+ee.width,Pe=V*a+28,Z=se.x,_e=O*a+28;return jsxRuntime.jsx(Vn,{x1:le,y1:Pe,x2:Z,y2:_e,theme:t,lineStyle:i,onDelete:()=>C?.(F.id,S)},`dep-${S}-${F.id}`)})),h.map(F=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:F.previewX,y:F.y-48,width:F.width,height:32,rx:8,fill:F.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(F.daysDelta)>0&&jsxRuntime.jsx("text",{x:F.previewX+F.width/2,y:F.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:F.daysDelta>0?`+${F.daysDelta}d`:`${F.daysDelta}d`})]},`cascade-preview-${F.taskId}`)),ke>=0&&ke<=L&&jsxRuntime.jsx("line",{x1:ke,y1:0,x2:ke,y2:Ae,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),k&&jsxRuntime.jsx(Yc,{tooltipData:k,theme:t})]})]})}var e0=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],Zc=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),t0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),a0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),r0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),o0=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Xn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:m}){let[i,c]=react.useState(false),[l,p]=react.useState(false),[b,y]=react.useState([]),[C,g]=react.useState(""),[v,h]=react.useState(false),[u,k]=react.useState(true),x=react.useRef(null),D=react.useRef(null),T=react.useRef(null),{enabled:w=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:N,suggestions:W=e0,maxHistory:$=50,persistHistory:j}=a,de=j?.storageKey||"gantt-ai-history",Q=j?.maxMessages??5;react.useEffect(()=>{if(j?.enabled)try{let O=localStorage.getItem(de);if(O){let R=JSON.parse(O).map(V=>({...V,timestamp:new Date(V.timestamp)}));y(R.slice(-Q));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[j?.enabled,de,Q]),react.useEffect(()=>{if(j?.enabled&&b.length>0)try{let O=b.filter(S=>!S.isLoading).slice(-Q);localStorage.setItem(de,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[b,j?.enabled,de,Q]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[b]),react.useEffect(()=>{i&&!l&&x.current&&setTimeout(()=>x.current?.focus(),100);},[i,l]);let ne=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&o?.(O.taskId,O.updates);break;case "create_task":O.newTask&&s?.(O.newTask);break;case "delete_task":O.taskId&&n?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&d?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&m?.(O.taskId,O.dependencyFrom);break}},[o,s,n,d,m]),he=react.useCallback(async O=>{if(!O.trim()||v)return;let S={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};y(V=>[...V.slice(-($-1)),S]),g(""),k(false),h(true);let R={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(V=>[...V,R]);try{if(N){let V=await N(O,e);y(ee=>{let se=ee.filter(Pe=>!Pe.isLoading),le={id:`assistant-${Date.now()}`,role:"assistant",content:V.message,timestamp:new Date,command:V};return [...se,le]}),ne(V);}else y(V=>[...V.filter(se=>!se.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(V){y(ee=>[...ee.filter(le=>!le.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${V instanceof Error?V.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[v,$,N,e,ne]),ke=O=>{O.preventDefault(),he(C);},Ae=O=>{g(O),x.current?.focus();};if(react.useEffect(()=>{let O=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(R=>!R),i||p(false)),S.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i]),react.useEffect(()=>{if(!i)return;let O=R=>{let V=R.target;T.current&&!T.current.contains(V)&&c(false);},S=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",O);}},[i]),!w)return null;let F={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[B]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>c(true),children:[jsxRuntime.jsx(Zc,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${F[B]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(Zc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(O=>!O),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(r0,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(a0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[b.length===0&&u&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((O,S)=>jsxRuntime.jsx("button",{onClick:()=>Ae(O),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:O.length>30?O.slice(0,30)+"...":O},S))})]}),b.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:O.role==="user"?"white":t.textPrimary},children:[O.isLoading?jsxRuntime.jsx(o0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:O.command.success?"#10B981":"#EF4444"},children:[O.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:ke,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:x,type:"text",value:C,onChange:O=>g(O.target.value),placeholder:L,disabled:v,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!C.trim()||v,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:C.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:C.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(t0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Qc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(l=>{let p=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:p};if(!c)return {...l,present:p};let b=[...l.past,l.present];return b.length>t&&b.shift(),{past:b,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:c,future:[i.present,...i.future]}});},[]),d=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:l}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function em({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=d?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&m&&n.key==="y"){n.preventDefault(),t();return}if(d&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var l0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${be.formatDate(e.startDate)} - ${be.formatDate(e.endDate)}`);let a=be.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=>be.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function tm(e){return {...l0,...e}}var b0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},om=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:l,enableAutoCriticalPath:p=true,persistExpandedState:b,persistFilter:y,aiAssistant:C,locale:g="en",customTranslations:v,showCreateTaskButton:h=false,createTaskLabel:u,onCreateTask:k,taskFilter:x,onTaskFilterChange:D,onThemeChange:T,onTaskClick:w,onTaskDblClick:L,onTaskContextMenu:B,onTaskUpdate:N,onProgressChange:W,onTaskEdit:$,onTaskAddSubtask:j,onTaskMarkIncomplete:de,onTaskSetInProgress:Q,onDependencyCreate:ne,onDependencyDelete:he,onBeforeTaskAdd:ke,onAfterTaskAdd:Ae,onBeforeTaskUpdate:F,onAfterTaskUpdate:O,onBeforeTaskDelete:S,onAfterTaskDelete:R}=a,ee=react.useContext(Ln)?.theme,[se,le]=react.useState(ee||s||"dark"),[Pe,Z]=react.useState(n),[_e,we]=react.useState(d),[je,yt]=react.useState(1),It=react.useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[at,kt]=react.useState(()=>{if(!y)return "all";try{let E=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(E);if(M){let G=JSON.parse(M);if(G.taskFilter)return G.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),mt=x??at,Ot=D??kt,[me,I]=react.useState(()=>{if(!y)return false;try{let E=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(E);if(M){let G=JSON.parse(M);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=It();if(E)try{let M={taskFilter:mt,hideCompleted:me};localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[mt,me,It]);let[ae,xe]=react.useState(0),[Be,X]=react.useState(false),[Me,_]=react.useState(null),[Y,Ue]=react.useState({isOpen:false,x:0,y:0,task:null}),[Re,Ve]=react.useState(null),[He,ce]=react.useState(null);react.useEffect(()=>{ee&&ee!==se&&le(ee);},[ee]),react.useEffect(()=>{s&&s!==se&&le(s);},[s]);let Ie=react.useCallback(E=>{le(E),T?.(E);},[T]),{state:J,setState:We,undo:Na,redo:pe,canUndo:Ge,canRedo:Oe,clearHistory:Ke}=Qc(t,50),Je=react.useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),P=react.useRef(new Map),A=react.useRef(false);if(!A.current&&b){A.current=true;let E=typeof b=="string"?b:"gantt-expanded-tasks";try{let M=localStorage.getItem(E);if(M){let G=JSON.parse(M);Array.isArray(G)&&(P.current=new Map(G));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let z=react.useCallback(()=>{let E=Je();if(E)try{let M=Array.from(P.current.entries());localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[Je]);react.useEffect(()=>{let E=M=>M.map(G=>{let oe=P.current.get(G.id),ue=oe!==void 0?{...G,isExpanded:oe}:G;return ue.subtasks?.length?{...ue,subtasks:E(ue.subtasks)}:ue});P.current.size>0?We(E(t)):We(t);},[t,We]);let re=react.useRef(t),Le=react.useRef(true);react.useEffect(()=>{if(Le.current){Le.current=false,re.current=J;return}if(!r)return;let E=JSON.stringify(re.current),M=JSON.stringify(J);E!==M&&(re.current=J,r(J));},[J,r]);let Ne=react.useMemo(()=>Ei(g,v),[g,v]),U=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[te,Fe]=react.useState(()=>U(Ne));react.useEffect(()=>{Fe(E=>E.map(M=>({...M,label:Ne.columns[M.id==="name"?"taskName":M.id]||M.label})));},[Ne]);let Ze=react.useMemo(()=>te.filter(M=>M.visible).reduce((M,G)=>M+G.width,0),[te]),rt=react.useRef(te.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=te.filter(oe=>oe.visible),M=E.map(oe=>oe.id).join(","),G=rt.current;if(M!==G){let oe=E.some(De=>De.id!=="name"),ue=G.includes(",");oe?!ue&&oe&&_(null):_(null),rt.current=M;}},[te]);let $r=60,hr=.6,yr=react.useMemo(()=>{let M=Ze+$r,G=typeof window<"u"?window.innerWidth*hr:800,oe=Math.max(M,G);return Me!==null?Math.max(200,Math.min(Me,oe)):Math.max(200,M)},[Me,Ze]),La=react.useRef(null),fe=react.useRef(null),wt=react.useRef(null),tt=react.useMemo(()=>Tc(se),[se]),co=react.useMemo(()=>({theme:tt,themeName:se}),[tt,se]),Lo=react.useMemo(()=>tm(l),[l]),vr=react.useMemo(()=>{if(!p)return J;let E=be.calculateCriticalPath(J),M=G=>G.map(oe=>({...oe,isCriticalPath:E.includes(oe.id),subtasks:oe.subtasks?M(oe.subtasks):void 0}));return M(J)},[J,p]),Qa=react.useMemo(()=>{if(mt==="all"&&!me)return vr;let E=M=>{let G=[];for(let oe of M){let ue=oe.subtasks?.length?E(oe.subtasks):void 0,De=false;if(me)De=oe.progress<100;else switch(mt){case "all":De=true;break;case "incomplete":De=oe.progress<100;break;case "in_progress":De=oe.progress>0&&oe.progress<100;break;case "completed":De=oe.progress===100;break}(De||ue&&ue.length>0)&&G.push({...oe,subtasks:ue});}return G};return E(vr)},[vr,mt,me]),er=b0(_e);em({undo:Na,redo:pe,canUndo:Ge,canRedo:Oe,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>be.findTaskById(J,E),addTask:(E,M)=>{We(G=>{if(!M)return [...G,{...E,level:0}];let oe=ue=>ue.map(De=>De.id===M?{...De,subtasks:[...De.subtasks||[],{...E,parentId:M,level:(De.level||0)+1}],isExpanded:true}:De.subtasks?{...De,subtasks:oe(De.subtasks)}:De);return oe(G)});},updateTask:(E,M)=>{We(G=>{let oe=ue=>ue.map(De=>De.id===E?{...De,...M}:De.subtasks?{...De,subtasks:oe(De.subtasks)}:De);return oe(G)});},deleteTask:E=>{We(M=>{let G=oe=>oe.filter(ue=>ue.id===E?false:(ue.subtasks&&(ue.subtasks=G(ue.subtasks)),true));return G(M)});},deleteTasks:E=>{We(M=>Ui(M,E));},duplicateTask:E=>{We(M=>Hi(M,[E]));},splitTask:(E,M,G=3)=>{We(oe=>be.splitTask(oe,E,M,G));},calculateEndDate:be.calculateEndDate,calculateDuration:be.calculateDuration,validateDependency:(E,M)=>!be.validateDependencies(J,E,M),getAllTasks:()=>be.flattenTasks(J),getTasksByStatus:E=>be.flattenTasks(J).filter(M=>M.status===E),getTasksByParent:E=>E?be.findTaskById(J,E)?.subtasks||[]:J.filter(G=>!G.parentId),getCriticalPath:()=>be.flattenTasks(J).filter(E=>E.isCriticalPath),indentTask:E=>{We(M=>Ri(M,[E]));},outdentTask:E=>{We(M=>Oi(M,[E]));},moveTask:(E,M)=>{We(G=>zi(G,[E],M));},createSubtask:async E=>{let{tasks:M,newTask:G}=Gi(J,E);if(ke){let oe=ke({...G,parentId:E});if((oe instanceof Promise?await oe:oe)===false)return}We(M),Ae&&Ae({...G,parentId:E});},scrollToTask:E=>{let G=be.flattenTasks(J).findIndex(oe=>oe.id===E);if(G!==-1&&La.current){let oe=G*er;La.current.scrollTo({top:oe,behavior:"smooth"}),fe.current&&fe.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(E,M=2e3)=>{},expandTask:E=>{We(M=>{let G=oe=>oe.map(ue=>ue.id===E?{...ue,isExpanded:true}:ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue);return G(M)});},collapseTask:E=>{We(M=>{let G=oe=>oe.map(ue=>ue.id===E?{...ue,isExpanded:false}:ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue);return G(M)});},expandAll:()=>{We(E=>{let M=G=>G.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?M(oe.subtasks):void 0}));return M(E)});},collapseAll:()=>{We(E=>{let M=G=>G.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?M(oe.subtasks):void 0}));return M(E)});},undo:Na,redo:pe,canUndo:()=>Ge,canRedo:()=>Oe,clearHistory:Ke,exportToPNG:async()=>{if(!wt.current||!La.current||!fe.current)throw new Error("Gantt container not found");let E=wt.current,M=La.current.querySelector(".gantt-grid-scroll"),G=fe.current,oe=M?.scrollTop||0,ue=G.scrollTop,De=E.style.overflow,Nt=E.style.height;try{let st=M?.querySelector(".gantt-taskgrid-content"),zt=G.querySelector("svg"),ma=st?.scrollHeight||M?.scrollHeight||600,ua=zt?.getBoundingClientRect().height||G.scrollHeight,Gr=(E.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ma,ua)+20;M&&(M.scrollTop=0),G.scrollTop=0,E.style.overflow="visible",E.style.height=`${Gr}px`,await new Promise(kr=>setTimeout(kr,100));let tr=await rm__default.default(E,{backgroundColor:tt.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:kr=>{let po=window.getComputedStyle(kr),_r=parseInt(po.zIndex,10);return !isNaN(_r)&&_r>=50||po.position==="fixed"}});return new Promise((kr,po)=>{tr.toBlob(_r=>{_r?kr(_r):po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{E.style.overflow=De,E.style.height=Nt,M&&(M.scrollTop=oe),G.scrollTop=ue;}},exportToPDF:async E=>{await be.exportToPDF(J,E);},exportToExcel:async E=>{await be.exportToExcel(J,E);},exportToJSON:()=>be.exportToJSON(J),exportToCSV:()=>be.exportToCSV(J),importFromJSON:E=>{let M=be.importFromJSON(E);We(M);},getTasks:()=>J,refresh:()=>{We(E=>[...E]);},clearAll:()=>{We([]);}}),[J,Na,pe,Ge,Oe,Ke,tt,er]);let _t=react.useCallback(E=>{Fe(M=>M.map(G=>G.id===E?{...G,visible:!G.visible}:G));},[]),xs=react.useCallback((E,M)=>{Fe(G=>G.map(oe=>{if(oe.id!==E)return oe;let ue=oe.minWidth??100,De=oe.maxWidth??800,Nt=Math.max(ue,Math.min(De,M));return {...oe,width:Nt}}));},[]),ks=react.useCallback(E=>{We(M=>{let G=Wi(M,E),oe=ue=>{for(let De of ue){if(De.id===E){P.current.set(E,De.isExpanded??true);return}De.subtasks?.length&&oe(De.subtasks);}};return oe(G),z(),G}),a.onTaskToggleExpand?.(E);},[a,z]),Wr=react.useCallback((E,M)=>{if(F&&F(E,M)===false)return;let oe=be.findTaskById(J,E)?.progress,ue=Nt=>Nt.map(st=>st.id===E?{...st,...M}:st.subtasks?{...st,subtasks:ue(st.subtasks)}:st);We(ue(J));let De=be.findTaskById(ue(J),E);De&&(N?.(De),O?.(De),M.progress!==void 0&&oe!==void 0&&M.progress!==oe&&W?.(E,oe,M.progress));},[J,N,F,O,W]),Io=react.useCallback(E=>{E.length!==0&&(We(M=>Ri(M,E)),a.onTaskIndent?.(E[0]));},[a]),pu=react.useCallback(E=>{E.length!==0&&(We(M=>Oi(M,E)),a.onTaskOutdent?.(E[0]));},[a]),uu=react.useCallback((E,M,G)=>{We(oe=>Hc(oe,E,M,G)),a.onTaskReparent?.(E,M,G);},[a]),gu=react.useCallback((E,M)=>{E.length!==0&&(We(G=>zi(G,E,M)),a.onTaskMove?.(E[0],M));},[a]),ws=react.useCallback(async E=>{let M=[];for(let G of E)S&&await Promise.resolve(S(G))===false||M.push(G);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(We(G=>Ui(G,M)),M.forEach(G=>a.onTaskDelete?.(G))),R&&M.forEach(G=>R(G)));},[a,S,R]),fu=react.useCallback(E=>{We(M=>Hi(M,E)),E.forEach(M=>a.onTaskDuplicate?.(M));},[a]),bu=react.useCallback((E,M)=>{We(G=>{let{tasks:oe,newTask:ue}=Uc(G,E,M);return ke&&ke(ue)===false?G:(a.onTaskCreate?.(ue.parentId,ue.position||0),Ae?.(ue),oe)});},[a,ke,Ae]),hu=react.useCallback((E,M)=>{We(G=>$i(G,E,M)),a.onTaskRename?.(E,M);},[a]),Cs=react.useCallback(E=>{We(M=>{let{tasks:G}=Gi(M,E);return a.onTaskCreate?.(E,0),G});},[a]),yu=react.useCallback((E,M,G)=>{let oe=E.startDate?Math.round((M.getTime()-E.startDate.getTime())/864e5):0,ue=st=>st.map(zt=>zt.id===E.id?{...zt,startDate:M,endDate:G,...E.segments&&{segments:E.segments}}:zt.subtasks?{...zt,subtasks:ue(zt.subtasks)}:zt),De=ue(J);De=be.autoScheduleDependents(De,E.id,oe),We(De);let Nt={...E,startDate:M,endDate:G};N?.(Nt);},[J,N]),vu=react.useCallback((E,M)=>{B?.(E,M),Ue({isOpen:true,x:M.clientX,y:M.clientY,task:E});},[B]),xu=react.useCallback((E,M)=>{let G=be.splitTask(J,E.id,M);We(G),Ue({isOpen:false,x:0,y:0,task:null});},[J]),jl=react.useCallback(E=>{let M=be.findTaskById(J,E.id)||E;L?.(M),$||Ve(M);},[J,L,$]),Kl=react.useCallback((E,M,G)=>{let oe=new Map,ue=ma=>{ma.forEach(ua=>{ua.dependencies&&oe.set(ua.id,ua.dependencies),ua.subtasks&&ue(ua.subtasks);});};ue(G);let De=oe.get(M)||[];oe.set(M,[...De,E]);let Nt=new Set,st=new Set,zt=ma=>{if(!Nt.has(ma)){Nt.add(ma),st.add(ma);let ua=oe.get(ma)||[];for(let xr of ua){if(!Nt.has(xr)&&zt(xr))return true;if(st.has(xr))return true}}return st.delete(ma),false};return zt(M)},[]),Yl=react.useCallback((E,M)=>{if(Kl(E.id,M,J)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
342
|
+
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(c),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=ye.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?ye.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let b of i.dependencies){let y=t.find(C=>C.id===b);if(y){o(y);let C=r.get(b)?.ef||0;l=Math.max(l,C);}}let p=l+c;r.set(i.id,{es:l,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,d=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?ye.calculateDuration(i.startDate,i.endDate):0,l=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),p=s;if(l.length>0)for(let y of l){d(y);let C=n.get(y.id)?.ls||0;p=Math.min(p,C);}let b=p-c;n.set(i.id,{ls:b,lf:p});};a.forEach(d);let m=[];for(let i of a){let c=r.get(i.id),l=n.get(i.id);if(c&&l){let p=l.ls-c.es;Math.abs(p)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=ye.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ye.calculateCriticalPath(e).includes(t))return 0;let o=ye.getDependentTasks(e,t);if(o.length===0){let d=ye.getLatestEndDate(e);if(!d)return null;let m=ye.calculateDuration(a.endDate,d);return Math.max(0,m)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,m)=>d-m)[0];if(!s)return null;let n=ye.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ye.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ye.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ye.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let d=ye.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=ye.calculateEndDate(m,d),c=l=>l.map(p=>p.id===n.id?{...p,startDate:m,endDate:i}:p.subtasks?{...p,subtasks:c(p.subtasks)}:p);s=c(s),s=ye.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,l=ye.findTaskById(e,t);if(!l||!l.endDate)return [];let p=(b,y,C=new Set)=>{if(C.has(b))return;C.add(b);let g=ye.getDependentTasks(e,b);for(let v of g){if(!v.startDate||!v.endDate)continue;let h=r.findIndex(N=>N.id===v.id);if(h===-1)continue;let u=v.startDate.getTime(),x=(v.endDate.getTime()-u)/c,T=(u-i)/c*s,w=T+y*s,L=Math.max(x*s,s),B=d+h*n+12;m.push({taskId:v.id,taskName:v.name,originalX:T,previewX:w,width:L,y:B,rowIndex:h,daysDelta:y,color:v.color}),p(v.id,y,C);}};return p(t,a),m},splitTask:(e,t,a,r=3)=>{let o=ye.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],i=c=>c.map(l=>l.id===o.id?{...l,endDate:d,segments:m}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function qn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:l,onTaskContextMenu:p,onTaskDateChange:b,onDependencyCreate:y,onDependencyDelete:C}){let v=Lr(),[h,u]=react.useState([]),[k,x]=react.useState(null),D=react.useCallback(F=>{x(F);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,L=T*w*n,B=F=>{let R=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate())),S=R.getUTCDay()||7;R.setUTCDate(R.getUTCDate()+4-S);let _=new Date(Date.UTC(R.getUTCFullYear(),0,1));return Math.ceil(((R.getTime()-_.getTime())/864e5+1)/7)},N=F=>{let R=F.getDay();return R===0||R===6},$=react.useCallback(F=>{let R=Math.round(F/(w*n)),S=new Date(o);return S.setDate(S.getDate()+R),S},[o,w,n]),U=react.useCallback((F,R)=>{if(R.startDate&&R.endDate)return;let S=F.currentTarget.ownerSVGElement;if(!S)return;let _=S.createSVGPoint();_.x=F.clientX,_.y=F.clientY;let J=_.matrixTransform(S.getScreenCTM()?.inverse()),ce=$(J.x),pe=new Date(ce);pe.setDate(pe.getDate()+1),b?.(R,ce,pe);},[$,b]),j=react.useMemo(()=>{let F=J=>J.map(ce=>{if(ce.subtasks&&ce.subtasks.length>0){let pe=F(ce.subtasks),V=pe.filter(ue=>ue.startDate&&ue.endDate);if(V.length>0){let ue=V.map(Re=>Re.startDate.getTime()),K=V.map(Re=>Re.endDate.getTime()),He=new Date(Math.min(...ue)),le=new Date(Math.max(...K));return {...ce,subtasks:pe,startDate:He,endDate:le}}return {...ce,subtasks:pe}}return ce}),R=(J,ce=[])=>{for(let pe of J)ce.push(pe),pe.subtasks&&pe.subtasks.length>0&&(pe.isExpanded===void 0||pe.isExpanded)&&R(pe.subtasks,ce);return ce},S=F(e);return R(S)},[e]),se=react.useCallback(F=>{if(!F.startDate||!F.endDate)return {x:0,width:0};let R=F.startDate.getTime(),S=F.endDate.getTime(),_=o.getTime(),J=(R-_)/(1e3*60*60*24),ce=(S-R)/(1e3*60*60*24),pe=J*w*n,V=Math.max(w*n,40),ue=Math.max(ce*w*n,V);return {x:pe,width:ue}},[o,w,n]),ee=react.useMemo(()=>j.filter(F=>F.startDate&&F.endDate).map(F=>{let{x:R,width:S}=se(F),J=j.findIndex(ce=>ce.id===F.id)*a+12;return {id:F.id,x:R,y:J,width:S,height:32}}),[j,se]),ie=react.useCallback((F,R,S)=>{if(!S||R===0){u([]);return}let _=ye.calculateCascadePreview(e,F,R,j,o,w*n,a,48);u(_);},[e,j,o,w,n,a,48]),ve=react.useMemo(()=>{let F=[],R=new Date(o);for(;R<=s;){let J=(R.getTime()-o.getTime())/864e5*w*n;if(r==="day")F.push({date:new Date(R),label:R.toLocaleDateString(d,{day:"numeric",month:"short"}),x:J}),R.setDate(R.getDate()+1);else if(r==="week"){let ce=B(R);F.push({date:new Date(R),label:`${v.labels.week} ${ce}`,x:J}),R.setDate(R.getDate()+7);}else F.push({date:new Date(R),label:R.toLocaleDateString(d,{month:"short",year:"numeric"}),x:J}),R.setMonth(R.getMonth()+1);}return F},[o,s,r,w,n,d,v.labels.week]),Ce=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*n,[o,w,n]),Ae=Math.max(j.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(L,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:48,fill:t.bgGrid}),ve.map((F,R)=>jsxRuntime.jsxs("g",{children:[R>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:F.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:F.label})]},`header-${R}`)),Ce>=0&&Ce<=L&&jsxRuntime.jsx("circle",{cx:Ce,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(L,1e3),height:Ae,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:Ae,fill:t.bgPrimary}),ve.map((F,R)=>{let S=ve[R+1]?.x||L,_=N(F.date);return jsxRuntime.jsxs("g",{children:[_&&jsxRuntime.jsx("rect",{x:F.x,y:0,width:S-F.x,height:j.length*a,fill:t.bgWeekend,opacity:1}),R>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:j.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},R)}),j.map((F,R)=>{let S=F.startDate&&F.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:L,height:a,fill:R%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${F.id}`),!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:L,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:_=>U(_,F),onMouseEnter:_=>{_.currentTarget.setAttribute("fill",t.accentLight),_.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:_=>{_.currentTarget.setAttribute("fill","transparent"),_.currentTarget.setAttribute("opacity","1");}},`clickable-${F.id}`),jsxRuntime.jsx("text",{x:Ce>0?Ce:100,y:R*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:v.labels.clickToSetDates},`placeholder-${F.id}`)]})]},`row-group-${F.id}`)}),j.map((F,R)=>{if(!F.startDate||!F.endDate)return null;let{x:S,width:_}=se(F),J=R*a+12,ce=F.subtasks&&F.subtasks.length>0&&!F.isMilestone;return F.isMilestone?jsxRuntime.jsx(Kn,{task:F,x:S+_/2,y:J+16,theme:t,onClick:c},F.id):ce?jsxRuntime.jsxs("g",{onClick:()=>c?.(F),onContextMenu:pe=>{pe.preventDefault(),pe.stopPropagation(),p?.(F,pe);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:J,width:_,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:S,y1:J,x2:S+_,y2:J,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:J,x2:S,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S+_,y1:J,x2:S+_,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:J+32,x2:S+_,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),_>60&&jsxRuntime.jsx("text",{x:S+12,y:J+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:F.name})]},F.id):jsxRuntime.jsx(Wn,{task:F,x:S,y:J,width:_,theme:t,dayWidth:w*n,startDate:o,templates:m,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:b,onDependencyCreate:y,allTaskPositions:ee,onDragMove:ie,onHoverChange:D},F.id)}),j.map((F,R)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(S=>{let _=j.find(le=>le.id===S);if(!_||!_.startDate||!_.endDate)return null;let J=j.findIndex(le=>le.id===S),ce=se(_),pe=se(F),V=ce.x+ce.width,ue=J*a+28,K=pe.x,He=R*a+28;return jsxRuntime.jsx(Vn,{x1:V,y1:ue,x2:K,y2:He,theme:t,lineStyle:i,onDelete:()=>C?.(F.id,S)},`dep-${S}-${F.id}`)})),h.map(F=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:F.previewX,y:F.y-48,width:F.width,height:32,rx:8,fill:F.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(F.daysDelta)>0&&jsxRuntime.jsx("text",{x:F.previewX+F.width/2,y:F.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:F.daysDelta>0?`+${F.daysDelta}d`:`${F.daysDelta}d`})]},`cascade-preview-${F.taskId}`)),Ce>=0&&Ce<=L&&jsxRuntime.jsx("line",{x1:Ce,y1:0,x2:Ce,y2:Ae,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),k&&jsxRuntime.jsx(Xc,{tooltipData:k,theme:t})]})]})}var a0=['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"'],em=()=>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"})]}),r0=()=>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"})}),o0=()=>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"})}),n0=()=>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"})}),s0=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Xn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:m}){let[i,c]=react.useState(false),[l,p]=react.useState(false),[b,y]=react.useState([]),[C,g]=react.useState(""),[v,h]=react.useState(false),[u,k]=react.useState(true),x=react.useRef(null),D=react.useRef(null),T=react.useRef(null),{enabled:w=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:N,suggestions:$=a0,maxHistory:U=50,persistHistory:j}=a,se=j?.storageKey||"gantt-ai-history",ee=j?.maxMessages??5;react.useEffect(()=>{if(j?.enabled)try{let R=localStorage.getItem(se);if(R){let _=JSON.parse(R).map(J=>({...J,timestamp:new Date(J.timestamp)}));y(_.slice(-ee));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[j?.enabled,se,ee]),react.useEffect(()=>{if(j?.enabled&&b.length>0)try{let R=b.filter(S=>!S.isLoading).slice(-ee);localStorage.setItem(se,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[b,j?.enabled,se,ee]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[b]),react.useEffect(()=>{i&&!l&&x.current&&setTimeout(()=>x.current?.focus(),100);},[i,l]);let ie=react.useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&n?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&d?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&m?.(R.taskId,R.dependencyFrom);break}},[o,s,n,d,m]),ve=react.useCallback(async R=>{if(!R.trim()||v)return;let S={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};y(J=>[...J.slice(-(U-1)),S]),g(""),k(false),h(true);let _={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(J=>[...J,_]);try{if(N){let J=await N(R,e);y(ce=>{let pe=ce.filter(ue=>!ue.isLoading),V={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...pe,V]}),ie(J);}else y(J=>[...J.filter(pe=>!pe.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(J){y(ce=>[...ce.filter(V=>!V.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[v,U,N,e,ie]),Ce=R=>{R.preventDefault(),ve(C);},Ae=R=>{g(R),x.current?.focus();};if(react.useEffect(()=>{let R=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(_=>!_),i||p(false)),S.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),react.useEffect(()=>{if(!i)return;let R=_=>{let J=_.target;T.current&&!T.current.contains(J)&&c(false);},S=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",R);}},[i]),!w)return null;let F={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[B]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>c(true),children:[jsxRuntime.jsx(em,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${F[B]} 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(em,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(n0,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(o0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[b.length===0&&u&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:$.slice(0,4).map((R,S)=>jsxRuntime.jsx("button",{onClick:()=>Ae(R),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:R.length>30?R.slice(0,30)+"...":R},S))})]}),b.map(R=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsxRuntime.jsx(s0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:Ce,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:x,type:"text",value:C,onChange:R=>g(R.target.value),placeholder:L,disabled:v,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!C.trim()||v,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:C.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:C.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(r0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function tm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(l=>{let p=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:p};if(!c)return {...l,present:p};let b=[...l.past,l.present];return b.length>t&&b.shift(),{past:b,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:c,future:[i.present,...i.future]}});},[]),d=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:l}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function am({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=d?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&m&&n.key==="y"){n.preventDefault(),t();return}if(d&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var c0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ye.formatDate(e.startDate)} - ${ye.formatDate(e.endDate)}`);let a=ye.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=>ye.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function rm(e){return {...c0,...e}}var y0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},sm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:l,enableAutoCriticalPath:p=true,persistExpandedState:b,persistFilter:y,aiAssistant:C,locale:g="en",customTranslations:v,showCreateTaskButton:h=false,createTaskLabel:u,onCreateTask:k,taskFilter:x,onTaskFilterChange:D,onThemeChange:T,onTaskClick:w,onTaskDblClick:L,onTaskContextMenu:B,onTaskUpdate:N,onProgressChange:$,onTaskEdit:U,onTaskAddSubtask:j,onTaskMarkIncomplete:se,onTaskSetInProgress:ee,onDependencyCreate:ie,onDependencyDelete:ve,onBeforeTaskAdd:Ce,onAfterTaskAdd:Ae,onBeforeTaskUpdate:F,onAfterTaskUpdate:R,onBeforeTaskDelete:S,onAfterTaskDelete:_}=a,ce=react.useContext(Ln)?.theme,[pe,V]=react.useState(ce||s||"dark"),[ue,K]=react.useState(n),[He,le]=react.useState(d),[Re,rt]=react.useState(1),ot=react.useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[Ke,yt]=react.useState(()=>{if(!y)return "all";try{let E=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(E);if(M){let W=JSON.parse(M);if(W.taskFilter)return W.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),lt=x??Ke,Ot=D??yt,[me,I]=react.useState(()=>{if(!y)return false;try{let E=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(E);if(M){let W=JSON.parse(M);if(typeof W.hideCompleted=="boolean")return W.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=ot();if(E)try{let M={taskFilter:lt,hideCompleted:me};localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[lt,me,ot]);let[ae,we]=react.useState(0),[Be,Z]=react.useState(false),[Me,G]=react.useState(null),[q,$e]=react.useState({isOpen:false,x:0,y:0,task:null}),[Oe,je]=react.useState(null),[We,de]=react.useState(null);react.useEffect(()=>{ce&&ce!==pe&&V(ce);},[ce]),react.useEffect(()=>{s&&s!==pe&&V(s);},[s]);let Ie=react.useCallback(E=>{V(E),T?.(E);},[T]),{state:Q,setState:_e,undo:Na,redo:ge,canUndo:Ve,canRedo:ze,clearHistory:Ye}=tm(t,50),Ze=react.useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),P=react.useRef(new Map),A=react.useRef(false);if(!A.current&&b){A.current=true;let E=typeof b=="string"?b:"gantt-expanded-tasks";try{let M=localStorage.getItem(E);if(M){let W=JSON.parse(M);Array.isArray(W)&&(P.current=new Map(W));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let O=react.useCallback(()=>{let E=Ze();if(E)try{let M=Array.from(P.current.entries());localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[Ze]);react.useEffect(()=>{let E=M=>M.map(W=>{let oe=P.current.get(W.id),fe=oe!==void 0?{...W,isExpanded:oe}:W;return fe.subtasks?.length?{...fe,subtasks:E(fe.subtasks)}:fe});P.current.size>0?_e(E(t)):_e(t);},[t,_e]);let re=react.useRef(t),Le=react.useRef(true);react.useEffect(()=>{if(Le.current){Le.current=false,re.current=Q;return}if(!r)return;let E=JSON.stringify(re.current),M=JSON.stringify(Q);E!==M&&(re.current=Q,r(Q));},[Q,r]);let De=react.useMemo(()=>Ei(g,v),[g,v]),z=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[te,Fe]=react.useState(()=>z(De));react.useEffect(()=>{Fe(E=>E.map(M=>({...M,label:De.columns[M.id==="name"?"taskName":M.id]||M.label})));},[De]);let Qe=react.useMemo(()=>te.filter(M=>M.visible).reduce((M,W)=>M+W.width,0),[te]),nt=react.useRef(te.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=te.filter(oe=>oe.visible),M=E.map(oe=>oe.id).join(","),W=nt.current;if(M!==W){let oe=E.some(Se=>Se.id!=="name"),fe=W.includes(",");oe?!fe&&oe&&G(null):G(null),nt.current=M;}},[te]);let $r=60,hr=.6,yr=react.useMemo(()=>{let M=Qe+$r,W=typeof window<"u"?window.innerWidth*hr:800,oe=Math.max(M,W);return Me!==null?Math.max(200,Math.min(Me,oe)):Math.max(200,M)},[Me,Qe]),La=react.useRef(null),he=react.useRef(null),Ct=react.useRef(null),at=react.useMemo(()=>Dc(pe),[pe]),co=react.useMemo(()=>({theme:at,themeName:pe}),[at,pe]),Lo=react.useMemo(()=>rm(l),[l]),vr=react.useMemo(()=>{if(!p)return Q;let E=ye.calculateCriticalPath(Q),M=W=>W.map(oe=>({...oe,isCriticalPath:E.includes(oe.id),subtasks:oe.subtasks?M(oe.subtasks):void 0}));return M(Q)},[Q,p]),Qa=react.useMemo(()=>{if(lt==="all"&&!me)return vr;let E=M=>{let W=[];for(let oe of M){let fe=oe.subtasks?.length?E(oe.subtasks):void 0,Se=false;if(me)Se=oe.progress<100;else switch(lt){case "all":Se=true;break;case "incomplete":Se=oe.progress<100;break;case "in_progress":Se=oe.progress>0&&oe.progress<100;break;case "completed":Se=oe.progress===100;break}(Se||fe&&fe.length>0)&&W.push({...oe,subtasks:fe});}return W};return E(vr)},[vr,lt,me]),er=y0(He);am({undo:Na,redo:ge,canUndo:Ve,canRedo:ze,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>ye.findTaskById(Q,E),addTask:(E,M)=>{_e(W=>{if(!M)return [...W,{...E,level:0}];let oe=fe=>fe.map(Se=>Se.id===M?{...Se,subtasks:[...Se.subtasks||[],{...E,parentId:M,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:oe(Se.subtasks)}:Se);return oe(W)});},updateTask:(E,M)=>{_e(W=>{let oe=fe=>fe.map(Se=>Se.id===E?{...Se,...M}:Se.subtasks?{...Se,subtasks:oe(Se.subtasks)}:Se);return oe(W)});},deleteTask:E=>{_e(M=>{let W=oe=>oe.filter(fe=>fe.id===E?false:(fe.subtasks&&(fe.subtasks=W(fe.subtasks)),true));return W(M)});},deleteTasks:E=>{_e(M=>Ui(M,E));},duplicateTask:E=>{_e(M=>Hi(M,[E]));},splitTask:(E,M,W=3)=>{_e(oe=>ye.splitTask(oe,E,M,W));},calculateEndDate:ye.calculateEndDate,calculateDuration:ye.calculateDuration,validateDependency:(E,M)=>!ye.validateDependencies(Q,E,M),getAllTasks:()=>ye.flattenTasks(Q),getTasksByStatus:E=>ye.flattenTasks(Q).filter(M=>M.status===E),getTasksByParent:E=>E?ye.findTaskById(Q,E)?.subtasks||[]:Q.filter(W=>!W.parentId),getCriticalPath:()=>ye.flattenTasks(Q).filter(E=>E.isCriticalPath),indentTask:E=>{_e(M=>Ri(M,[E]));},outdentTask:E=>{_e(M=>Oi(M,[E]));},moveTask:(E,M)=>{_e(W=>zi(W,[E],M));},createSubtask:async E=>{let{tasks:M,newTask:W}=Gi(Q,E);if(Ce){let oe=Ce({...W,parentId:E});if((oe instanceof Promise?await oe:oe)===false)return}_e(M),Ae&&Ae({...W,parentId:E});},scrollToTask:E=>{let W=ye.flattenTasks(Q).findIndex(oe=>oe.id===E);if(W!==-1&&La.current){let oe=W*er;La.current.scrollTo({top:oe,behavior:"smooth"}),he.current&&he.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(E,M=2e3)=>{},expandTask:E=>{_e(M=>{let W=oe=>oe.map(fe=>fe.id===E?{...fe,isExpanded:true}:fe.subtasks?{...fe,subtasks:W(fe.subtasks)}:fe);return W(M)});},collapseTask:E=>{_e(M=>{let W=oe=>oe.map(fe=>fe.id===E?{...fe,isExpanded:false}:fe.subtasks?{...fe,subtasks:W(fe.subtasks)}:fe);return W(M)});},expandAll:()=>{_e(E=>{let M=W=>W.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?M(oe.subtasks):void 0}));return M(E)});},collapseAll:()=>{_e(E=>{let M=W=>W.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?M(oe.subtasks):void 0}));return M(E)});},undo:Na,redo:ge,canUndo:()=>Ve,canRedo:()=>ze,clearHistory:Ye,exportToPNG:async()=>{if(!Ct.current||!La.current||!he.current)throw new Error("Gantt container not found");let E=Ct.current,M=La.current.querySelector(".gantt-grid-scroll"),W=he.current,oe=M?.scrollTop||0,fe=W.scrollTop,Se=E.style.overflow,Dt=E.style.height;try{let dt=M?.querySelector(".gantt-taskgrid-content"),zt=W.querySelector("svg"),ma=dt?.scrollHeight||M?.scrollHeight||600,ua=zt?.getBoundingClientRect().height||W.scrollHeight,Gr=(E.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ma,ua)+20;M&&(M.scrollTop=0),W.scrollTop=0,E.style.overflow="visible",E.style.height=`${Gr}px`,await new Promise(kr=>setTimeout(kr,100));let tr=await nm__default.default(E,{backgroundColor:at.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:kr=>{let po=window.getComputedStyle(kr),_r=parseInt(po.zIndex,10);return !isNaN(_r)&&_r>=50||po.position==="fixed"}});return new Promise((kr,po)=>{tr.toBlob(_r=>{_r?kr(_r):po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{E.style.overflow=Se,E.style.height=Dt,M&&(M.scrollTop=oe),W.scrollTop=fe;}},exportToPDF:async E=>{await ye.exportToPDF(Q,E);},exportToExcel:async E=>{await ye.exportToExcel(Q,E);},exportToJSON:()=>ye.exportToJSON(Q),exportToCSV:()=>ye.exportToCSV(Q),importFromJSON:E=>{let M=ye.importFromJSON(E);_e(M);},getTasks:()=>Q,refresh:()=>{_e(E=>[...E]);},clearAll:()=>{_e([]);}}),[Q,Na,ge,Ve,ze,Ye,at,er]);let _t=react.useCallback(E=>{Fe(M=>M.map(W=>W.id===E?{...W,visible:!W.visible}:W));},[]),xs=react.useCallback((E,M)=>{Fe(W=>W.map(oe=>{if(oe.id!==E)return oe;let fe=oe.minWidth??100,Se=oe.maxWidth??800,Dt=Math.max(fe,Math.min(Se,M));return {...oe,width:Dt}}));},[]),ks=react.useCallback(E=>{_e(M=>{let W=Wi(M,E),oe=fe=>{for(let Se of fe){if(Se.id===E){P.current.set(E,Se.isExpanded??true);return}Se.subtasks?.length&&oe(Se.subtasks);}};return oe(W),O(),W}),a.onTaskToggleExpand?.(E);},[a,O]),Wr=react.useCallback((E,M)=>{if(F&&F(E,M)===false)return;let oe=ye.findTaskById(Q,E)?.progress,fe=Dt=>Dt.map(dt=>dt.id===E?{...dt,...M}:dt.subtasks?{...dt,subtasks:fe(dt.subtasks)}:dt);_e(fe(Q));let Se=ye.findTaskById(fe(Q),E);Se&&(N?.(Se),R?.(Se),M.progress!==void 0&&oe!==void 0&&M.progress!==oe&&$?.(E,oe,M.progress));},[Q,N,F,R,$]),Io=react.useCallback(E=>{E.length!==0&&(_e(M=>Ri(M,E)),a.onTaskIndent?.(E[0]));},[a]),gu=react.useCallback(E=>{E.length!==0&&(_e(M=>Oi(M,E)),a.onTaskOutdent?.(E[0]));},[a]),fu=react.useCallback((E,M,W)=>{_e(oe=>Wc(oe,E,M,W)),a.onTaskReparent?.(E,M,W);},[a]),bu=react.useCallback((E,M)=>{E.length!==0&&(_e(W=>zi(W,E,M)),a.onTaskMove?.(E[0],M));},[a]),ws=react.useCallback(async E=>{let M=[];for(let W of E)S&&await Promise.resolve(S(W))===false||M.push(W);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(_e(W=>Ui(W,M)),M.forEach(W=>a.onTaskDelete?.(W))),_&&M.forEach(W=>_(W)));},[a,S,_]),hu=react.useCallback(E=>{_e(M=>Hi(M,E)),E.forEach(M=>a.onTaskDuplicate?.(M));},[a]),yu=react.useCallback((E,M)=>{_e(W=>{let{tasks:oe,newTask:fe}=$c(W,E,M);return Ce&&Ce(fe)===false?W:(a.onTaskCreate?.(fe.parentId,fe.position||0),Ae?.(fe),oe)});},[a,Ce,Ae]),vu=react.useCallback((E,M)=>{_e(W=>$i(W,E,M)),a.onTaskRename?.(E,M);},[a]),Cs=react.useCallback(E=>{_e(M=>{let{tasks:W}=Gi(M,E);return a.onTaskCreate?.(E,0),W});},[a]),xu=react.useCallback((E,M,W)=>{let oe=E.startDate?Math.round((M.getTime()-E.startDate.getTime())/864e5):0,fe=dt=>dt.map(zt=>zt.id===E.id?{...zt,startDate:M,endDate:W,...E.segments&&{segments:E.segments}}:zt.subtasks?{...zt,subtasks:fe(zt.subtasks)}:zt),Se=fe(Q);Se=ye.autoScheduleDependents(Se,E.id,oe),_e(Se);let Dt={...E,startDate:M,endDate:W};N?.(Dt);},[Q,N]),ku=react.useCallback((E,M)=>{B?.(E,M),$e({isOpen:true,x:M.clientX,y:M.clientY,task:E});},[B]),wu=react.useCallback((E,M)=>{let W=ye.splitTask(Q,E.id,M);_e(W),$e({isOpen:false,x:0,y:0,task:null});},[Q]),jl=react.useCallback(E=>{let M=ye.findTaskById(Q,E.id)||E;L?.(M),U||je(M);},[Q,L,U]),Kl=react.useCallback((E,M,W)=>{let oe=new Map,fe=ma=>{ma.forEach(ua=>{ua.dependencies&&oe.set(ua.id,ua.dependencies),ua.subtasks&&fe(ua.subtasks);});};fe(W);let Se=oe.get(M)||[];oe.set(M,[...Se,E]);let Dt=new Set,dt=new Set,zt=ma=>{if(!Dt.has(ma)){Dt.add(ma),dt.add(ma);let ua=oe.get(ma)||[];for(let xr of ua){if(!Dt.has(xr)&&zt(xr))return true;if(dt.has(xr))return true}}return dt.delete(ma),false};return zt(M)},[]),Yl=react.useCallback((E,M)=>{if(Kl(E.id,M,Q)){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 G=oe=>oe.map(ue=>{if(ue.id===M){let De=ue.dependencies||[];if(!De.includes(E.id))return {...ue,dependencies:[...De,E.id]}}return ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue});We(G(J)),ne?.(E.id,M);},[J,ne,Kl]),ql=react.useCallback((E,M)=>{let G=oe=>oe.map(ue=>{if(ue.id===E&&ue.dependencies){let De=ue.dependencies.filter(Nt=>Nt!==M);return {...ue,dependencies:De}}return ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue});We(G(J)),he?.(E,M);},[J,he]),{startDate:mn,endDate:ku}=react.useMemo(()=>{let E=J.filter(De=>De.startDate&&De.endDate);if(E.length===0){let De=new Date,Nt=new Date(De);Nt.setDate(Nt.getDate()-30);let st=new Date(De);return st.setDate(st.getDate()+60),{startDate:Nt,endDate:st}}let M=E.flatMap(De=>[De.startDate,De.endDate]).filter(De=>De!==void 0),G=new Date(Math.min(...M.map(De=>De.getTime()))),oe=new Date(Math.max(...M.map(De=>De.getTime()))),ue=Pe==="day"?7:Pe==="week"?14:30;return G.setDate(G.getDate()-ue),oe.setDate(oe.getDate()+ue),{startDate:G,endDate:oe}},[J,Pe]),wu=react.useCallback(async()=>{if(!wt.current||!La.current||!fe.current)return;await new Promise(Gr=>setTimeout(Gr,200));let E=wt.current,M=La.current.querySelector(".gantt-grid-scroll"),G=fe.current,oe=M?.scrollTop||0,ue=M?.scrollLeft||0,De=G.scrollTop,Nt=G.scrollLeft,st=E.style.overflow,zt=E.style.height,ma=M?.style.overflow||"",ua=G.style.overflow,xr=E.style.width,pn=G.style.width;try{let Gr=M?.querySelector(".gantt-taskgrid-content"),tr=G.querySelector("svg"),kr=tr?.getAttribute("height")?parseInt(tr.getAttribute("height"),10):tr?.getBoundingClientRect().height||0,po=Gr?.scrollHeight||M?.scrollHeight||600,_r=Math.max(kr,G.scrollHeight),Zl=tr?.getAttribute("width")?parseInt(tr.getAttribute("width"),10):tr?.getBoundingClientRect().width||G.scrollWidth,Mu=E.querySelector('[class*="h-12"]')?.offsetHeight||48,Ns=Math.max(po,_r,kr),Ds=Mu+Ns+50,Ss=(M?.offsetWidth||300)+Zl+10;M&&(M.scrollTop=0,M.scrollLeft=0),G.scrollTop=0,G.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Ds}px`,E.style.width=`${Ss}px`,M&&(M.style.overflow="visible",M.style.height=`${Ns+50}px`),G.style.overflow="visible",G.style.height=`${Ns+50}px`,G.style.width=`${Zl+10}px`,await new Promise(Ps=>setTimeout(Ps,150));let Fu=await rm__default.default(E,{backgroundColor:tt.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Ss,height:Ds,windowWidth:Ss+100,windowHeight:Ds+100,scrollX:0,scrollY:0,ignoreElements:Ps=>{let Ql=window.getComputedStyle(Ps),ed=parseInt(Ql.zIndex,10);return !isNaN(ed)&&ed>=50||Ql.position==="fixed"}}),Es=document.createElement("a");Es.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Es.href=Fu.toDataURL("image/png"),Es.click();}finally{E.style.overflow=st,E.style.height=zt,E.style.width=xr,M&&(M.style.overflow=ma,M.style.height="",M.scrollTop=oe,M.scrollLeft=ue),G.style.overflow=ua,G.style.height="",G.style.width=pn,G.scrollTop=De,G.scrollLeft=Nt;}},[tt]),Cu=react.useCallback(async()=>{await be.exportToPDF(J);},[J]),Tu=react.useCallback(async()=>{await be.exportToExcel(J);},[J]),Nu=react.useCallback(()=>{let E=be.exportToCSV(J),M=new Blob([E],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(M),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href);},[J]),Du=react.useCallback(()=>{let E=be.exportToJSON(J),M=new Blob([E],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(M),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href);},[J]),Su=react.useCallback(()=>{be.exportToMSProject(J,"Gantt Project","project.xml");},[J]),Eu=E=>{E.preventDefault(),X(true);},mo=react.useRef(false),[Ts,Xl]=react.useState(false),Bo=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=fe.current,M=La.current?.querySelector(".gantt-grid-scroll");if(!E||!M)return;let G=()=>{if(mo.current)return;mo.current=true;let st=E.scrollTop;xe(st),M.scrollTop=st,requestAnimationFrame(()=>{mo.current=false;});},oe=()=>{if(mo.current)return;mo.current=true;let st=M.scrollTop;xe(st),E.scrollTop=st,requestAnimationFrame(()=>{mo.current=false;});},ue=st=>{if(Be&&M){let ma=M.parentElement?.getBoundingClientRect()?.left||0,ua=st.clientX-ma,xr=200,pn=Ze+$r,Gr=window.innerWidth*hr,tr=Math.max(pn,Gr);ua>=xr&&ua<=tr&&_(ua);}if(Ts&&E){let zt=st.clientX-Bo.current.x,ma=st.clientY-Bo.current.y;E.scrollLeft=Bo.current.scrollLeft-zt,E.scrollTop=Bo.current.scrollTop-ma;}},De=()=>{X(false),Xl(false);},Nt=st=>{if(st.button!==0)return;let zt=st.target;zt.closest("[data-task-bar]")||zt.closest("[data-dependency-line]")||zt.closest("button")||zt.closest('[role="button"]')||zt.tagName==="rect"&&zt.getAttribute("data-clickable")==="true"||(Xl(true),Bo.current={x:st.clientX,y:st.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},st.preventDefault());};return E.addEventListener("scroll",G),M.addEventListener("scroll",oe),E.addEventListener("mousedown",Nt),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",De),()=>{E.removeEventListener("scroll",G),M.removeEventListener("scroll",oe),E.removeEventListener("mousedown",Nt),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",De);}},[Be,Ts,Ze]);let Jl=react.useRef(false),Pu=react.useRef(null);return react.useLayoutEffect(()=>{if(Jl.current||J.length===0||!fe.current)return;Jl.current=true,Pu.current=mn;let E=fe.current,M=new Date,G=Pe==="day"?60:Pe==="week"?20:8,oe=(M.getTime()-mn.getTime())/(1e3*60*60*24),ue=E.clientWidth,Nt=oe*G*je-ue/2;oe>=0&&ue>0&&(E.scrollLeft=Math.max(0,Nt));},[J.length,mn,Pe,je]),jsxRuntime.jsx(To.Provider,{value:Ne,children:jsxRuntime.jsx(Is.Provider,{value:co,children:jsxRuntime.jsxs("div",{ref:wt,className:"flex flex-col h-full w-full",style:{backgroundColor:tt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Rn,{theme:tt,timeScale:Pe,onTimeScaleChange:Z,zoom:je,onZoomChange:yt,currentTheme:se,onThemeChange:Ie,rowDensity:_e,onRowDensityChange:we,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:u,onCreateTask:k,taskFilter:mt,onTaskFilterChange:Ot,hideCompleted:me,onHideCompletedChange:I,onExportPNG:i?wu:void 0,onExportPDF:i?Cu:void 0,onExportExcel:i?Tu:void 0,onExportCSV:i?Nu:void 0,onExportJSON:i?Du:void 0,onExportMSProject:i?Su:void 0}),jsxRuntime.jsxs("div",{ref:La,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:yr,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Hn,{tasks:Qa,theme:tt,rowHeight:er,availableUsers:c,templates:Lo,onTaskClick:w,onTaskDblClick:jl,onTaskContextMenu:B,onTaskToggle:ks,scrollTop:ae,columns:te,onToggleColumn:_t,onColumnResize:xs,onTaskUpdate:Wr,onTaskIndent:Io,onTaskOutdent:pu,onTaskMove:gu,onMultiTaskDelete:ws,onTaskDuplicate:fu,onTaskCreate:bu,onTaskRename:hu,onCreateSubtask:Cs,onOpenTaskModal:w?E=>w(E):void 0,onDeleteRequest:(E,M)=>ce({taskId:E,taskName:M}),onTaskReparent:uu})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:tt.border,zIndex:15},onMouseDown:Eu}),jsxRuntime.jsx("div",{ref:fe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ts?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(qn,{tasks:Qa,theme:tt,rowHeight:er,timeScale:Pe,startDate:mn,endDate:ku,zoom:je,locale:g,templates:Lo,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:w,onTaskDblClick:jl,onTaskContextMenu:vu,onTaskDateChange:yu,onDependencyCreate:Yl,onDependencyDelete:ql})})]}),Y.task&&jsxRuntime.jsx(No,{isOpen:Y.isOpen,x:Y.x,y:Y.y,theme:tt,onClose:()=>Ue({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Y.task;if(!E)return [];let M=be.findTaskById(J,E.id)||E;return M.subtasks&&M.subtasks.length>0?[{id:"addSubtask",label:Ne.contextMenu?.addSubtask||"Add Subtask",icon:At.Add,onClick:()=>{j?j(M):Cs(M.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Ne.contextMenu?.deleteTask||"Delete Task",icon:At.Delete,onClick:()=>{ce({taskId:M.id,taskName:M.name});}}]:[{id:"edit",label:Ne.contextMenu?.editTask||"Edit Task",icon:At.Pencil,onClick:()=>{$?$(M):Ve(M);}},{id:"addSubtask",label:Ne.contextMenu?.addSubtask||"Add Subtask",icon:At.Add,onClick:()=>{j?j(M):Cs(M.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Ne.contextMenu?.markIncomplete||"Mark Incomplete",icon:At.MarkIncomplete,onClick:()=>{de?de(M):Wr(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"},{id:"setInProgress",label:Ne.contextMenu?.setInProgress||"Set In Progress",icon:At.SetInProgress,onClick:()=>{Q?Q(M):Wr(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"},{id:"markComplete",label:Ne.contextMenu?.markComplete||"Mark Complete",icon:At.MarkComplete,onClick:()=>{Wr(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Ne.contextMenu?.splitTask||"Split Task",icon:At.Split,onClick:()=>{if(!M.startDate||!M.endDate){console.warn("Cannot split task without dates");return}let oe=M.startDate.getTime(),ue=M.endDate.getTime(),De=oe+(ue-oe)/2,Nt=new Date(De);xu(M,Nt);},disabled:!M.startDate||!M.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Ne.contextMenu?.deleteTask||"Delete Task",icon:At.Delete,onClick:()=>{ce({taskId:M.id,taskName:M.name});}}]})()}),jsxRuntime.jsx(mr,{task:Re,isOpen:!!Re,onClose:()=>Ve(null),onTaskUpdate:E=>{Re&&(Wr(Re.id,E),Ve(null));},theme:se==="light"?"light":"dark",locale:g==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:He&&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:()=>ce(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:tt.bgSecondary,border:`1px solid ${tt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${tt.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:tt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ne.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:tt.textSecondary,fontFamily:"Inter, sans-serif"},children:g==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:tt.textSecondary,fontFamily:"Inter, sans-serif"},children:[g==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:tt.textPrimary},children:['"',He.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:tt.bgPrimary,borderTop:`1px solid ${tt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ce(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:tt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=tt.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:g==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ws([He.taskId]),ce(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),g==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(Xn,{tasks:J,theme:tt,config:C,onTasksUpdate:We,onTaskUpdate:Wr,onTaskCreate:E=>{We(M=>[...M,E]);},onTaskDelete:E=>{ws([E]);},onDependencyCreate:(E,M)=>{let G=be.findTaskById(J,E);G&&Yl(G,M);},onDependencyDelete:ql})]})})})});var Yi=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],qi=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function lm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:b,onDeleteAttachment:y}){let C=[...Yi,...i.filter(I=>!Yi.some(ae=>ae.id===I.id))],g=Ye[m]||Ye.dark,[v,h]=react.useState(false),[u,k]=react.useState(false),[x,D]=react.useState(false),[T,w]=react.useState(false),[L,B]=react.useState({top:0,left:0}),[N,W]=react.useState(null),[$,j]=react.useState(new Date),[de,Q]=react.useState({top:0,left:0}),[ne,he]=react.useState(false),[ke,Ae]=react.useState([]),[F,O]=react.useState(false),[S,R]=react.useState(""),V=react.useRef(null),ee=react.useRef(null),se=react.useRef(null),le=react.useRef(null),Pe=react.useRef(null),[Z,_e]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[we,je]=react.useState({});react.useEffect(()=>{a?(_e({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)&&he(true)):(_e({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),he(false),Ae([]));},[a,e]),react.useEffect(()=>{let I=ae=>{V.current&&!V.current.contains(ae.target)&&h(false),ee.current&&!ee.current.contains(ae.target)&&k(false),se.current&&!se.current.contains(ae.target)&&D(false),le.current&&!le.current.contains(ae.target)&&w(false);};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);let yt=()=>{let I={};return Z.name.trim()||(I.name="El nombre es requerido"),Z.startDate&&Z.endDate&&Z.startDate>Z.endDate&&(I.endDate="La fecha de fin debe ser posterior a la de inicio"),je(I),Object.keys(I).length===0},It=async I=>{if(I.preventDefault(),!!yt())try{let ae=d==="create"&&ke.length>0?{...Z,pendingFiles:ke}:Z;await s(ae),Ae([]),t();}catch(ae){console.error("Error submitting task:",ae);}},at=(I,ae)=>{_e(xe=>{let Be={...xe,[I]:ae};if(I==="status"){let X=ae;X==="todo"?Be.progress=0:X==="in-progress"?(xe.progress===0||xe.progress===100)&&(Be.progress=50):X==="completed"||X==="closed"?Be.progress=100:(X==="in-review"||X==="review")&&(Be.progress=75);}if(I==="progress"){let X=typeof ae=="number"?ae:parseInt(ae,10);X===100&&xe.status!=="completed"?Be.status="completed":X>0&&X<100&&xe.status==="todo"?Be.status="in-progress":X===0&&xe.status!=="todo"&&(Be.status="todo");}return Be}),we[I]&&je(xe=>{let Be={...xe};return delete Be[I],Be});},kt=C.find(I=>I.id===Z.status)??Yi[0],mt=qi.find(I=>I.id===Z.priority)??qi[1],Ot=Xr.find(I=>I.value===Z.color)??Xr[0],me={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:kt.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:I=>{I.currentTarget.style.backgroundColor=g.hoverBg,I.currentTarget.style.color=g.textPrimary;},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="transparent",I.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:It,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:Z.name,onChange:I=>at("name",I.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),we.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"}),we.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:Z.description||"",onChange:I=>at("description",I.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:V,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&h(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...me,borderColor:kt.color,backgroundColor:`${kt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:kt.color}}),jsxRuntime.jsx("span",{style:{color:kt.color},children:kt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:kt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:C.map(I=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{at("status",I.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:I.color}}),I.title,Z.status===I.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),jsxRuntime.jsxs("div",{ref:ee,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!u),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:me,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:mt.color}}),jsxRuntime.jsx("span",{children:mt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:qi.map(I=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{at("priority",I.id),k(false);},children:[jsxRuntime.jsx("span",{children:I.icon}),I.label,Z.priority===I.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:se,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:me,disabled:n,children:[Z.assignees&&Z.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:Z.assignees.slice(0,3).map((I,ae)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:I.color||g.accent,borderColor:g.bgSecondary},children:I.initials},ae))}),Z.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",Z.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(I=>{let ae=Z.assignees?.some(xe=>xe.name===I.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let xe=ae?(Z.assignees||[]).filter(Be=>Be.name!==I.name):[...Z.assignees||[],{name:I.name,avatar:I.avatar,initials:I.name.split(" ").map(Be=>Be[0]).join("").toUpperCase().slice(0,2),color:g.accent}];at("assignees",xe);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:I.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:I.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},I.id)})})})]}),jsxRuntime.jsxs("div",{ref:le,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)w(false);else {if(le.current){let I=le.current.getBoundingClientRect(),ae=window.innerHeight,xe=120,X=ae-I.bottom<xe?I.top-xe-8:I.bottom+8;B({top:X,left:I.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:me,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Z.color}}),jsxRuntime.jsx("span",{children:Ot.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${L.top}px`,left:`${L.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Xr.slice(0,18).map(I=>{let ae=Z.color===I.value;return jsxRuntime.jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),at("color",I.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:I.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:I.value,outline:ae?`2px solid ${I.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},I.value)})})})})]})})]}),c.length>0||l?jsxRuntime.jsx(Nr,{selectedTags:Z.tags||[],availableTags:c,onChange:I=>at("tags",I),onCreateTag:l,theme:g,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:Pe,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(N==="start")W(null);else {if(Pe.current){let I=Pe.current.getBoundingClientRect(),ae=window.innerHeight,xe=320,X=ae-I.bottom<xe?I.top-xe-8:I.bottom+8;Q({top:X,left:I.left});}W("start"),j(Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...me,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:n||Z.isMilestone,children:Z.startDate?Z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(N==="end")W(null);else {if(Pe.current){let I=Pe.current.getBoundingClientRect(),ae=window.innerHeight,xe=320,X=ae-I.bottom<xe?I.top-xe-8:I.bottom+8;Q({top:X,left:I.left});}W("end"),j(Z.endDate||Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...me,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:n||Z.isMilestone,children:Z.endDate?Z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>W(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:`${de.top}px`,left:`${de.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let I=new Date,ae=new Date(I);ae.setDate(I.getDate()+1);let xe=new Date(I);xe.setDate(I.getDate()+7);let Be=new Date(I);return Be.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:ae},{label:"Pr\xF3xima semana",date:xe},{label:"2 semanas",date:Be}].map((Me,_)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(at("startDate",Me.date),(!Z.endDate||Me.date>Z.endDate)&&at("endDate",Me.date),W("end")):(at("endDate",Me.date),(!Z.startDate||Me.date<Z.startDate)&&at("startDate",Me.date),W(null));},children:Me.label},_))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{at("startDate",void 0),at("endDate",void 0),W(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>j(new Date($.getFullYear(),$.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>j(new Date($.getFullYear(),$.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((I,ae)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:I},ae))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let I=$.getFullYear(),ae=$.getMonth(),xe=new Date(I,ae,1).getDay(),Be=new Date(I,ae+1,0).getDate(),X=new Date,Me=[];for(let Y=xe-1;Y>=0;Y--)Me.push({day:new Date(I,ae,-Y).getDate(),date:new Date(I,ae-1,new Date(I,ae,-Y).getDate()),isCurrentMonth:false});for(let Y=1;Y<=Be;Y++)Me.push({day:Y,date:new Date(I,ae,Y),isCurrentMonth:true});let _=42-Me.length;for(let Y=1;Y<=_;Y++)Me.push({day:Y,date:new Date(I,ae+1,Y),isCurrentMonth:false});return Me.map((Y,Ue)=>{let Re=Y.date.toDateString()===X.toDateString(),Ve=Z.startDate?.toDateString()===Y.date.toDateString(),He=Z.endDate?.toDateString()===Y.date.toDateString(),ce=Z.startDate&&Z.endDate&&Y.date>=Z.startDate&&Y.date<=Z.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Y.isCurrentMonth?Ve||He?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:Ve?"#3B82F6":He?"#7C3AED":ce?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Re&&!Ve&&!He?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(at("startDate",Y.date),Z.endDate&&Y.date>Z.endDate&&at("endDate",Y.date),W("end")):(at("endDate",Y.date),Z.startDate&&Y.date<Z.startDate&&at("startDate",Y.date),W(null));},children:Y.day},Ue)})})()})]})]})]})})]}),we.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:we.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:Z.progress,onChange:I=>at("progress",parseInt(I.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"}20`,color:Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"},children:[Z.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>he(!ne),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 ${ne?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ne&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(b||p.length>0||d==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",d==="create"?ke.length>0&&`(${ke.length})`:p.length>0&&`(${p.length})`]})]}),d==="create"?jsxRuntime.jsx(nr,{cardId:"pending",attachments:ke.map((I,ae)=>({id:`pending-${ae}`,cardId:"pending",name:I.name,size:I.size,type:I.type,url:URL.createObjectURL(I),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:I=>Ae(ae=>[...ae,...I]),onDelete:I=>{let ae=parseInt(I.replace("pending-",""),10);Ae(xe=>xe.filter((Be,X)=>X!==ae));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(nr,{cardId:a?.id||"new",attachments:p,onUpload:b&&a?.id?I=>b(a.id,I):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),d==="create"&&ke.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[ke.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:Z.isMilestone,onChange:I=>at("isMilestone",I.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),Z.dependencies&&Z.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Z.dependencies.map(I=>{let ae=r.find(xe=>xe.id===I);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[ae?.name||I.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let xe=(Z.dependencies||[]).filter(Be=>Be!==I);at("dependencies",xe);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},I)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{O(!F),R("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(false),R("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:I=>R(I.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(I=>I.id!==a?.id).filter(I=>S===""||I.name.toLowerCase().includes(S.toLowerCase())).map(I=>{let ae=Z.dependencies?.includes(I.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let xe=Z.dependencies||[],Be;ae?Be=xe.filter(X=>X!==I.id):Be=[...xe,I.id],at("dependencies",Be);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:ae?`${g.accent}10`:"transparent"},onMouseEnter:xe=>{ae||(xe.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:xe=>{xe.currentTarget.style.backgroundColor=ae?`${g.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:ae?g.accent:"transparent",borderColor:ae?g.accent:g.borderLight},children:ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:g.textPrimary},children:I.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:I.id.slice(0,8)})]})]},I.id)}),r.filter(I=>I.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:I=>!n&&(I.currentTarget.style.opacity="0.9"),onMouseLeave:I=>!n&&(I.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var dm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
344
|
+
Task dependencies must flow in one direction only.`);return}let W=oe=>oe.map(fe=>{if(fe.id===M){let Se=fe.dependencies||[];if(!Se.includes(E.id))return {...fe,dependencies:[...Se,E.id]}}return fe.subtasks?{...fe,subtasks:W(fe.subtasks)}:fe});_e(W(Q)),ie?.(E.id,M);},[Q,ie,Kl]),ql=react.useCallback((E,M)=>{let W=oe=>oe.map(fe=>{if(fe.id===E&&fe.dependencies){let Se=fe.dependencies.filter(Dt=>Dt!==M);return {...fe,dependencies:Se}}return fe.subtasks?{...fe,subtasks:W(fe.subtasks)}:fe});_e(W(Q)),ve?.(E,M);},[Q,ve]),{startDate:mn,endDate:Cu}=react.useMemo(()=>{let E=Q.filter(Se=>Se.startDate&&Se.endDate);if(E.length===0){let Se=new Date,Dt=new Date(Se);Dt.setDate(Dt.getDate()-30);let dt=new Date(Se);return dt.setDate(dt.getDate()+60),{startDate:Dt,endDate:dt}}let M=E.flatMap(Se=>[Se.startDate,Se.endDate]).filter(Se=>Se!==void 0),W=new Date(Math.min(...M.map(Se=>Se.getTime()))),oe=new Date(Math.max(...M.map(Se=>Se.getTime()))),fe=ue==="day"?7:ue==="week"?14:30;return W.setDate(W.getDate()-fe),oe.setDate(oe.getDate()+fe),{startDate:W,endDate:oe}},[Q,ue]),Tu=react.useCallback(async()=>{if(!Ct.current||!La.current||!he.current)return;await new Promise(Gr=>setTimeout(Gr,200));let E=Ct.current,M=La.current.querySelector(".gantt-grid-scroll"),W=he.current,oe=M?.scrollTop||0,fe=M?.scrollLeft||0,Se=W.scrollTop,Dt=W.scrollLeft,dt=E.style.overflow,zt=E.style.height,ma=M?.style.overflow||"",ua=W.style.overflow,xr=E.style.width,pn=W.style.width;try{let Gr=M?.querySelector(".gantt-taskgrid-content"),tr=W.querySelector("svg"),kr=tr?.getAttribute("height")?parseInt(tr.getAttribute("height"),10):tr?.getBoundingClientRect().height||0,po=Gr?.scrollHeight||M?.scrollHeight||600,_r=Math.max(kr,W.scrollHeight),Zl=tr?.getAttribute("width")?parseInt(tr.getAttribute("width"),10):tr?.getBoundingClientRect().width||W.scrollWidth,Au=E.querySelector('[class*="h-12"]')?.offsetHeight||48,Ns=Math.max(po,_r,kr),Ds=Au+Ns+50,Ss=(M?.offsetWidth||300)+Zl+10;M&&(M.scrollTop=0,M.scrollLeft=0),W.scrollTop=0,W.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Ds}px`,E.style.width=`${Ss}px`,M&&(M.style.overflow="visible",M.style.height=`${Ns+50}px`),W.style.overflow="visible",W.style.height=`${Ns+50}px`,W.style.width=`${Zl+10}px`,await new Promise(Ps=>setTimeout(Ps,150));let Lu=await nm__default.default(E,{backgroundColor:at.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Ss,height:Ds,windowWidth:Ss+100,windowHeight:Ds+100,scrollX:0,scrollY:0,ignoreElements:Ps=>{let Ql=window.getComputedStyle(Ps),ed=parseInt(Ql.zIndex,10);return !isNaN(ed)&&ed>=50||Ql.position==="fixed"}}),Es=document.createElement("a");Es.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Es.href=Lu.toDataURL("image/png"),Es.click();}finally{E.style.overflow=dt,E.style.height=zt,E.style.width=xr,M&&(M.style.overflow=ma,M.style.height="",M.scrollTop=oe,M.scrollLeft=fe),W.style.overflow=ua,W.style.height="",W.style.width=pn,W.scrollTop=Se,W.scrollLeft=Dt;}},[at]),Nu=react.useCallback(async()=>{await ye.exportToPDF(Q);},[Q]),Du=react.useCallback(async()=>{await ye.exportToExcel(Q);},[Q]),Su=react.useCallback(()=>{let E=ye.exportToCSV(Q),M=new Blob([E],{type:"text/csv;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(M),W.download="gantt-chart.csv",W.click(),URL.revokeObjectURL(W.href);},[Q]),Eu=react.useCallback(()=>{let E=ye.exportToJSON(Q),M=new Blob([E],{type:"application/json;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(M),W.download="gantt-chart.json",W.click(),URL.revokeObjectURL(W.href);},[Q]),Pu=react.useCallback(()=>{ye.exportToMSProject(Q,"Gantt Project","project.xml");},[Q]),Mu=E=>{E.preventDefault(),Z(true);},mo=react.useRef(false),[Ts,Xl]=react.useState(false),Bo=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=he.current,M=La.current?.querySelector(".gantt-grid-scroll");if(!E||!M)return;let W=()=>{if(mo.current)return;mo.current=true;let dt=E.scrollTop;we(dt),M.scrollTop=dt,requestAnimationFrame(()=>{mo.current=false;});},oe=()=>{if(mo.current)return;mo.current=true;let dt=M.scrollTop;we(dt),E.scrollTop=dt,requestAnimationFrame(()=>{mo.current=false;});},fe=dt=>{if(Be&&M){let ma=M.parentElement?.getBoundingClientRect()?.left||0,ua=dt.clientX-ma,xr=200,pn=Qe+$r,Gr=window.innerWidth*hr,tr=Math.max(pn,Gr);ua>=xr&&ua<=tr&&G(ua);}if(Ts&&E){let zt=dt.clientX-Bo.current.x,ma=dt.clientY-Bo.current.y;E.scrollLeft=Bo.current.scrollLeft-zt,E.scrollTop=Bo.current.scrollTop-ma;}},Se=()=>{Z(false),Xl(false);},Dt=dt=>{if(dt.button!==0)return;let zt=dt.target;zt.closest("[data-task-bar]")||zt.closest("[data-dependency-line]")||zt.closest("button")||zt.closest('[role="button"]')||zt.tagName==="rect"&&zt.getAttribute("data-clickable")==="true"||(Xl(true),Bo.current={x:dt.clientX,y:dt.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},dt.preventDefault());};return E.addEventListener("scroll",W),M.addEventListener("scroll",oe),E.addEventListener("mousedown",Dt),document.addEventListener("mousemove",fe),document.addEventListener("mouseup",Se),()=>{E.removeEventListener("scroll",W),M.removeEventListener("scroll",oe),E.removeEventListener("mousedown",Dt),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",Se);}},[Be,Ts,Qe]);let Jl=react.useRef(false),Fu=react.useRef(null);return react.useLayoutEffect(()=>{if(Jl.current||Q.length===0||!he.current)return;Jl.current=true,Fu.current=mn;let E=he.current,M=new Date,W=ue==="day"?60:ue==="week"?20:8,oe=(M.getTime()-mn.getTime())/(1e3*60*60*24),fe=E.clientWidth,Dt=oe*W*Re-fe/2;oe>=0&&fe>0&&(E.scrollLeft=Math.max(0,Dt));},[Q.length,mn,ue,Re]),jsxRuntime.jsx(To.Provider,{value:De,children:jsxRuntime.jsx(Is.Provider,{value:co,children:jsxRuntime.jsxs("div",{ref:Ct,className:"flex flex-col h-full w-full",style:{backgroundColor:at.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Rn,{theme:at,timeScale:ue,onTimeScaleChange:K,zoom:Re,onZoomChange:rt,currentTheme:pe,onThemeChange:Ie,rowDensity:He,onRowDensityChange:le,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:u,onCreateTask:k,taskFilter:lt,onTaskFilterChange:Ot,hideCompleted:me,onHideCompletedChange:I,onExportPNG:i?Tu:void 0,onExportPDF:i?Nu:void 0,onExportExcel:i?Du:void 0,onExportCSV:i?Su:void 0,onExportJSON:i?Eu:void 0,onExportMSProject:i?Pu:void 0}),jsxRuntime.jsxs("div",{ref:La,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:yr,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Hn,{tasks:Qa,theme:at,rowHeight:er,availableUsers:c,templates:Lo,onTaskClick:w,onTaskDblClick:jl,onTaskContextMenu:B,onTaskToggle:ks,scrollTop:ae,columns:te,onToggleColumn:_t,onColumnResize:xs,onTaskUpdate:Wr,onTaskIndent:Io,onTaskOutdent:gu,onTaskMove:bu,onMultiTaskDelete:ws,onTaskDuplicate:hu,onTaskCreate:yu,onTaskRename:vu,onCreateSubtask:Cs,onOpenTaskModal:w?E=>w(E):void 0,onDeleteRequest:(E,M)=>de({taskId:E,taskName:M}),onTaskReparent:fu})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:at.border,zIndex:15},onMouseDown:Mu}),jsxRuntime.jsx("div",{ref:he,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ts?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(qn,{tasks:Qa,theme:at,rowHeight:er,timeScale:ue,startDate:mn,endDate:Cu,zoom:Re,locale:g,templates:Lo,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:w,onTaskDblClick:jl,onTaskContextMenu:ku,onTaskDateChange:xu,onDependencyCreate:Yl,onDependencyDelete:ql})})]}),q.task&&jsxRuntime.jsx(No,{isOpen:q.isOpen,x:q.x,y:q.y,theme:at,onClose:()=>$e({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=q.task;if(!E)return [];let M=ye.findTaskById(Q,E.id)||E;return M.subtasks&&M.subtasks.length>0?[{id:"addSubtask",label:De.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{j?j(M):Cs(M.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:De.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{de({taskId:M.id,taskName:M.name});}}]:[{id:"edit",label:De.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{U?U(M):je(M);}},{id:"addSubtask",label:De.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{j?j(M):Cs(M.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:De.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{se?se(M):Wr(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"},{id:"setInProgress",label:De.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{ee?ee(M):Wr(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"},{id:"markComplete",label:De.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{Wr(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:De.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{if(!M.startDate||!M.endDate){console.warn("Cannot split task without dates");return}let oe=M.startDate.getTime(),fe=M.endDate.getTime(),Se=oe+(fe-oe)/2,Dt=new Date(Se);wu(M,Dt);},disabled:!M.startDate||!M.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:De.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{de({taskId:M.id,taskName:M.name});}}]})()}),jsxRuntime.jsx(mr,{task:Oe,isOpen:!!Oe,onClose:()=>je(null),onTaskUpdate:E=>{Oe&&(Wr(Oe.id,E),je(null));},theme:pe==="light"?"light":"dark",locale:g==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:We&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>de(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:at.bgSecondary,border:`1px solid ${at.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${at.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:at.textPrimary,fontFamily:"Inter, sans-serif"},children:[De.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:at.textSecondary,fontFamily:"Inter, sans-serif"},children:g==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:at.textSecondary,fontFamily:"Inter, sans-serif"},children:[g==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:at.textPrimary},children:['"',We.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:at.bgPrimary,borderTop:`1px solid ${at.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>de(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:at.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=at.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:g==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ws([We.taskId]),de(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),g==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(Xn,{tasks:Q,theme:at,config:C,onTasksUpdate:_e,onTaskUpdate:Wr,onTaskCreate:E=>{_e(M=>[...M,E]);},onTaskDelete:E=>{ws([E]);},onDependencyCreate:(E,M)=>{let W=ye.findTaskById(Q,E);W&&Yl(W,M);},onDependencyDelete:ql})]})})})});var Yi=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],qi=[{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 cm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:b,onDeleteAttachment:y}){let C=[...Yi,...i.filter(I=>!Yi.some(ae=>ae.id===I.id))],g=qe[m]||qe.dark,[v,h]=react.useState(false),[u,k]=react.useState(false),[x,D]=react.useState(false),[T,w]=react.useState(false),[L,B]=react.useState({top:0,left:0}),[N,$]=react.useState(null),[U,j]=react.useState(new Date),[se,ee]=react.useState({top:0,left:0}),[ie,ve]=react.useState(false),[Ce,Ae]=react.useState([]),[F,R]=react.useState(false),[S,_]=react.useState(""),J=react.useRef(null),ce=react.useRef(null),pe=react.useRef(null),V=react.useRef(null),ue=react.useRef(null),[K,He]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[le,Re]=react.useState({});react.useEffect(()=>{a?(He({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)&&ve(true)):(He({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ve(false),Ae([]));},[a,e]),react.useEffect(()=>{let I=ae=>{J.current&&!J.current.contains(ae.target)&&h(false),ce.current&&!ce.current.contains(ae.target)&&k(false),pe.current&&!pe.current.contains(ae.target)&&D(false),V.current&&!V.current.contains(ae.target)&&w(false);};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);let rt=()=>{let I={};return K.name.trim()||(I.name="El nombre es requerido"),K.startDate&&K.endDate&&K.startDate>K.endDate&&(I.endDate="La fecha de fin debe ser posterior a la de inicio"),Re(I),Object.keys(I).length===0},ot=async I=>{if(I.preventDefault(),!!rt())try{let ae=d==="create"&&Ce.length>0?{...K,pendingFiles:Ce}:K;await s(ae),Ae([]),t();}catch(ae){console.error("Error submitting task:",ae);}},Ke=(I,ae)=>{He(we=>{let Be={...we,[I]:ae};if(I==="status"){let Z=ae;Z==="todo"?Be.progress=0:Z==="in-progress"?(we.progress===0||we.progress===100)&&(Be.progress=50):Z==="completed"||Z==="closed"?Be.progress=100:(Z==="in-review"||Z==="review")&&(Be.progress=75);}if(I==="progress"){let Z=typeof ae=="number"?ae:parseInt(ae,10);Z===100&&we.status!=="completed"?Be.status="completed":Z>0&&Z<100&&we.status==="todo"?Be.status="in-progress":Z===0&&we.status!=="todo"&&(Be.status="todo");}return Be}),le[I]&&Re(we=>{let Be={...we};return delete Be[I],Be});},yt=C.find(I=>I.id===K.status)??Yi[0],lt=qi.find(I=>I.id===K.priority)??qi[1],Ot=Xr.find(I=>I.value===K.color)??Xr[0],me={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:yt.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:I=>{I.currentTarget.style.backgroundColor=g.hoverBg,I.currentTarget.style.color=g.textPrimary;},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="transparent",I.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:ot,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:K.name,onChange:I=>Ke("name",I.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),le.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"}),le.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:K.description||"",onChange:I=>Ke("description",I.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:J,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&h(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...me,borderColor:yt.color,backgroundColor:`${yt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:yt.color}}),jsxRuntime.jsx("span",{style:{color:yt.color},children:yt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:yt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:C.map(I=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ke("status",I.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:I.color}}),I.title,K.status===I.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),jsxRuntime.jsxs("div",{ref:ce,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!u),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:me,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:lt.color}}),jsxRuntime.jsx("span",{children:lt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:qi.map(I=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ke("priority",I.id),k(false);},children:[jsxRuntime.jsx("span",{children:I.icon}),I.label,K.priority===I.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:pe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:me,disabled:n,children:[K.assignees&&K.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:K.assignees.slice(0,3).map((I,ae)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:I.color||g.accent,borderColor:g.bgSecondary},children:I.initials},ae))}),K.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",K.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(I=>{let ae=K.assignees?.some(we=>we.name===I.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:we=>we.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:we=>we.currentTarget.style.backgroundColor="transparent",onClick:()=>{let we=ae?(K.assignees||[]).filter(Be=>Be.name!==I.name):[...K.assignees||[],{name:I.name,avatar:I.avatar,initials:I.name.split(" ").map(Be=>Be[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Ke("assignees",we);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:I.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:I.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},I.id)})})})]}),jsxRuntime.jsxs("div",{ref:V,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)w(false);else {if(V.current){let I=V.current.getBoundingClientRect(),ae=window.innerHeight,we=120,Z=ae-I.bottom<we?I.top-we-8:I.bottom+8;B({top:Z,left:I.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:me,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:K.color}}),jsxRuntime.jsx("span",{children:Ot.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${L.top}px`,left:`${L.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Xr.slice(0,18).map(I=>{let ae=K.color===I.value;return jsxRuntime.jsx("button",{type:"button",onClick:we=>{we.preventDefault(),we.stopPropagation(),Ke("color",I.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:I.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:I.value,outline:ae?`2px solid ${I.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},I.value)})})})})]})})]}),c.length>0||l?jsxRuntime.jsx(Nr,{selectedTags:K.tags||[],availableTags:c,onChange:I=>Ke("tags",I),onCreateTag:l,theme:g,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:ue,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!K.isMilestone)if(N==="start")$(null);else {if(ue.current){let I=ue.current.getBoundingClientRect(),ae=window.innerHeight,we=320,Z=ae-I.bottom<we?I.top-we-8:I.bottom+8;ee({top:Z,left:I.left});}$("start"),j(K.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...me,opacity:K.isMilestone?.5:1,cursor:K.isMilestone?"not-allowed":"pointer"},disabled:n||K.isMilestone,children:K.startDate?K.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!K.isMilestone)if(N==="end")$(null);else {if(ue.current){let I=ue.current.getBoundingClientRect(),ae=window.innerHeight,we=320,Z=ae-I.bottom<we?I.top-we-8:I.bottom+8;ee({top:Z,left:I.left});}$("end"),j(K.endDate||K.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...me,opacity:K.isMilestone?.5:1,cursor:K.isMilestone?"not-allowed":"pointer"},disabled:n||K.isMilestone,children:K.endDate?K.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${se.top}px`,left:`${se.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let I=new Date,ae=new Date(I);ae.setDate(I.getDate()+1);let we=new Date(I);we.setDate(I.getDate()+7);let Be=new Date(I);return Be.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:ae},{label:"Pr\xF3xima semana",date:we},{label:"2 semanas",date:Be}].map((Me,G)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(Ke("startDate",Me.date),(!K.endDate||Me.date>K.endDate)&&Ke("endDate",Me.date),$("end")):(Ke("endDate",Me.date),(!K.startDate||Me.date<K.startDate)&&Ke("startDate",Me.date),$(null));},children:Me.label},G))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ke("startDate",void 0),Ke("endDate",void 0),$(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>j(new Date(U.getFullYear(),U.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:U.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>j(new Date(U.getFullYear(),U.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((I,ae)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:I},ae))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let I=U.getFullYear(),ae=U.getMonth(),we=new Date(I,ae,1).getDay(),Be=new Date(I,ae+1,0).getDate(),Z=new Date,Me=[];for(let q=we-1;q>=0;q--)Me.push({day:new Date(I,ae,-q).getDate(),date:new Date(I,ae-1,new Date(I,ae,-q).getDate()),isCurrentMonth:false});for(let q=1;q<=Be;q++)Me.push({day:q,date:new Date(I,ae,q),isCurrentMonth:true});let G=42-Me.length;for(let q=1;q<=G;q++)Me.push({day:q,date:new Date(I,ae+1,q),isCurrentMonth:false});return Me.map((q,$e)=>{let Oe=q.date.toDateString()===Z.toDateString(),je=K.startDate?.toDateString()===q.date.toDateString(),We=K.endDate?.toDateString()===q.date.toDateString(),de=K.startDate&&K.endDate&&q.date>=K.startDate&&q.date<=K.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:q.isCurrentMonth?je||We?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:je?"#3B82F6":We?"#7C3AED":de?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Oe&&!je&&!We?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(Ke("startDate",q.date),K.endDate&&q.date>K.endDate&&Ke("endDate",q.date),$("end")):(Ke("endDate",q.date),K.startDate&&q.date<K.startDate&&Ke("startDate",q.date),$(null));},children:q.day},$e)})})()})]})]})]})})]}),le.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:le.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:K.progress,onChange:I=>Ke("progress",parseInt(I.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:K.progress<30?"#EF4444":K.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${K.progress<30?"#EF4444":K.progress<70?"#F59E0B":"#10B981"}20`,color:K.progress<30?"#EF4444":K.progress<70?"#F59E0B":"#10B981"},children:[K.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>ve(!ie),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 ${ie?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ie&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(b||p.length>0||d==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",d==="create"?Ce.length>0&&`(${Ce.length})`:p.length>0&&`(${p.length})`]})]}),d==="create"?jsxRuntime.jsx(nr,{cardId:"pending",attachments:Ce.map((I,ae)=>({id:`pending-${ae}`,cardId:"pending",name:I.name,size:I.size,type:I.type,url:URL.createObjectURL(I),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:I=>Ae(ae=>[...ae,...I]),onDelete:I=>{let ae=parseInt(I.replace("pending-",""),10);Ae(we=>we.filter((Be,Z)=>Z!==ae));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(nr,{cardId:a?.id||"new",attachments:p,onUpload:b&&a?.id?I=>b(a.id,I):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),d==="create"&&Ce.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Ce.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:K.isMilestone,onChange:I=>Ke("isMilestone",I.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),K.dependencies&&K.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:K.dependencies.map(I=>{let ae=r.find(we=>we.id===I);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[ae?.name||I.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let we=(K.dependencies||[]).filter(Be=>Be!==I);Ke("dependencies",we);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},I)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{R(!F),_("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{R(false),_("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:I=>_(I.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(I=>I.id!==a?.id).filter(I=>S===""||I.name.toLowerCase().includes(S.toLowerCase())).map(I=>{let ae=K.dependencies?.includes(I.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let we=K.dependencies||[],Be;ae?Be=we.filter(Z=>Z!==I.id):Be=[...we,I.id],Ke("dependencies",Be);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:ae?`${g.accent}10`:"transparent"},onMouseEnter:we=>{ae||(we.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:we=>{we.currentTarget.style.backgroundColor=ae?`${g.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:ae?g.accent:"transparent",borderColor:ae?g.accent:g.borderLight},children:ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:g.textPrimary},children:I.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:I.id.slice(0,8)})]})]},I.id)}),r.filter(I=>I.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:I=>!n&&(I.currentTarget.style.opacity="0.9"),onMouseLeave:I=>!n&&(I.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var mm=`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
|
|
@@ -382,11 +382,11 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
382
382
|
|
|
383
383
|
Always try to match task names case-insensitively and handle partial matches.
|
|
384
384
|
If you can't find a task by name, search through the provided task list.
|
|
385
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
386
|
-
${
|
|
385
|
+
If ambiguous, ask for clarification in the message field.`;function pm(e){return `CURRENT TASKS:
|
|
386
|
+
${um(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
|
|
387
387
|
`)}
|
|
388
388
|
|
|
389
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function mm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function br(e,t){let a=mm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let m=d.name.toLowerCase();return n.every(i=>m.includes(i))})}function Xi(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let b={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(b!==void 0){let y=new Date(r),C=y.getDay(),g=b-C;return g<=0&&(g+=7),y.setDate(y.getDate()+g),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),b=s[2].toLowerCase(),y=new Date(r);return b==="day"||b==="d\xEDa"||b==="dias"?y.setDate(y.getDate()+p):b==="week"||b==="semana"||b==="semanas"?y.setDate(y.getDate()+p*7):(b==="month"||b==="mes"||b==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let p=parseInt(d[1],10),b=parseInt(d[2],10)-1,y=parseInt(d[3],10);return new Date(y,b,p)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),b=m[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(b!==void 0)return new Date(y,b,p)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=c[l[1].toLowerCase()],b=parseInt(l[2],10),y=l[3]?parseInt(l[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,b)}return null}function Ji(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 Zi(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function pm(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function um(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),c=r[2].trim(),l=br(t,i),p=Xi(c);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let b=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+b),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:p,endDate:y},message:`Moved "${l.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),l=br(t,i),p=Ji(c);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let b=new Date(l.endDate);return b.setDate(b.getDate()+p),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:b},message:`Extended "${l.name}" by ${p} days. New end date: ${b.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),l=br(t,i),p=Zi(c);return l?p===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:p},message:`Set "${l.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),l=br(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:c},message:`Renamed "${l.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),c=d[2].trim(),l=br(t,i),p=br(t,c);return l?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:l.id,dependencyTo:p.id,message:`Linked "${l.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),c=br(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function gm(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function S0(e){if(e)switch(e.toUpperCase()){case "TODO":case "BLOCKED":return "todo";case "IN_PROGRESS":case "REVIEW":return "in-progress";case "DONE":return "completed";default:return "todo"}}function E0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Qn(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let l=a.find(p=>p.id===c);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Qn(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},d=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||d&&m&&Math.abs(m.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:m,progress:e.progress||0,status:S0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function fm(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:E0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function bm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Qn(r,e,t))}var Qi={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"}},el={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},es={en:Qi,es:el};function tl(e){return es[e]||es.en}function ts(e,t){let a=tl(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var al=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function hm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let p=b=>{d.current&&!d.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let m=al[0],i=al.find(p=>p.value===e)??m,c=i.icon,l=p=>{switch(p){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:al.map(p=>{let b=p.icon;return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),t(p.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===p.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(b,{className:f("w-4 h-4",p.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:l(p.value)})]},p.value)})})]})}var rl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function vm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let c=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=rl.find(c=>c.value===e)??rl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:rl.map(c=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(c.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-2 h-2 rounded-full",c.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function os(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ns(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function km({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=react.useState(false),[m,i]=react.useState(""),c=react.useRef(null);react.useEffect(()=>{let y=C=>{c.current&&!c.current.contains(C.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]);let l=t.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())||y.email?.toLowerCase().includes(m.toLowerCase())),p=y=>e.some(C=>C.name===y),b=y=>{if(a)if(p(y.name))a(e.filter(C=>C.name!==y.name));else {let C={name:y.name,initials:os(y.name),color:y.color||ns(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl};a([...e,C]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((y,C)=>jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${C}`)),e.length>3&&jsxRuntime.jsxs("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),d(!n);},className:f("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((y,C)=>jsxRuntime.jsx("div",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${C}`)),e.length>2&&jsxRuntime.jsxs("span",{className:f("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:f("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:y=>y.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):l.map(y=>jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),b(y);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!y.avatarUrl&&ns(y.name)),children:y.avatarUrl?jsxRuntime.jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):os(y.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:y.name}),y.email&&jsxRuntime.jsx("div",{className:f("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:y.email})]}),p(y.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},y.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((y,C)=>jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[y.name,jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),a(e.filter(v=>v.name!==y.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${y.name}-${C}`))})]})]})}var Z0={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},Q0={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function ss({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(()=>{if(e){let g=e instanceof Date?e:new Date(e);return new Date(g.getFullYear(),g.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),c=e?e instanceof Date?e:new Date(e):null,l=r==="es"?"es":"en";react.useEffect(()=>{let g=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let p=g=>g?g.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",b=(g,v)=>new Date(g,v+1,0).getDate(),y=(g,v)=>new Date(g,v,1).getDay(),C=()=>{let g=d.getFullYear(),v=d.getMonth(),h=b(g,v),u=y(g,v),k=new Date,x=[];for(let D=0;D<u;D++)x.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${D}`));for(let D=1;D<=h;D++){let T=new Date(g,v,D),w=c&&c.getDate()===D&&c.getMonth()===v&&c.getFullYear()===g,L=k.getDate()===D&&k.getMonth()===v&&k.getFullYear()===g;x.push(jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),t?.(T),n(false);},className:f("w-8 h-8 rounded-full text-sm transition-colors",w?"bg-[#3B82F6] text-white":L?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:D},D));}return x};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:p(c)}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:f("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:p(c)})]}),s&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()-1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium",a?"text-white":"text-gray-900"),children:[Z0[l][d.getMonth()]," ",d.getFullYear()]}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()+1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Q0[l].map(g=>jsxRuntime.jsx("div",{className:f("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:g},g))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:C()}),jsxRuntime.jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),t?.(new Date),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation();let v=new Date;v.setDate(v.getDate()+1),t?.(v),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Nm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),d=s.clientX-n.left,m=Math.round(d/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:f("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:f("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Em({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{m(e);},[e]);let c=()=>{d!==e&&t?.(d),n(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(m(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:d,onChange:p=>m(p.target.value),onBlur:c,onKeyDown:l,onClick:p=>p.stopPropagation(),className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:f("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Fm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[d,m]=react.useState(false),[i,c]=react.useState(e?.toString()||""),l=react.useRef(null);react.useEffect(()=>{d&&l.current&&(l.current.focus(),l.current.select());},[d]),react.useEffect(()=>{c(e?.toString()||"");},[e]);let p=()=>{let y=parseFloat(i);if(!isNaN(y)){let C=y;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&t?.(C);}m(false);},b=y=>{y.key==="Enter"?p():y.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):d?jsxRuntime.jsx("input",{ref:l,type:"number",value:i,onChange:y=>c(y.target.value),onBlur:p,onKeyDown:b,onClick:y=>y.stopPropagation(),min:o,max:s,className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),m(true);},className:f("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function Am({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=react.useState(false),m=react.useRef(null);return react.useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:f("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),d(false);},className:f("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Im({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:f("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function Om({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:f("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:f("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function ky(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wy(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function $m({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let l=react.useRef(null),p=r==="es"?Um.es:Um.en;if(react.useEffect(()=>{let v=u=>{l.current&&!l.current.contains(u.target)&&t();},h=u=>{u.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let b=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:p.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),d&&(v.push({id:"status",label:p.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:p.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:p.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let u=e.task.assignees||[],x=u.some(D=>D.name===h.name)?u.filter(D=>D.name!==h.name):[...u,{name:h.name,initials:ky(h.name),color:h.color||wy(h.name),avatar:h.avatarUrl}];d({...e.task,assignees:x}),t();}}))})),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:p.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:p.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},y=()=>{if(!e.columnId)return [];let v=[];return i&&(v.push({id:"sort-asc",label:p.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:p.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:p.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),v},C=e.type==="task"?b():y(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:l,style:g,className:f("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:C.map(v=>v.separator?jsxRuntime.jsx("div",{className:f("my-1 h-px",a?"bg-white/10":"bg-gray-200")},v.id):v.submenu?jsxRuntime.jsx(Cy,{item:v,isDark:a},v.id):jsxRuntime.jsxs("button",{onClick:v.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:f(v.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function Cy({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:f("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxRuntime.jsxs("button",{onClick:d.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var Um={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var _m={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},Uy=["name","status","priority","assignees","startDate","endDate","progress","tags"];function jm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[m,i]=react.useState(""),c=react.useRef(null),l=d==="es"?Vm.es:Vm.en;if(react.useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let h=k=>{c.current&&!c.current.contains(k.target)&&t();},u=k=>{k.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",u),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",u);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let p=v=>l.columns[v]||v,b=v=>{if(v==="name")return;let h=a.map(u=>u.id===v?{...u,visible:!u.visible}:u);o(h);},y=(v,h)=>{let u=a.find(x=>x.type===v&&(!h||x.customFieldId===h));if(u){b(u.id);return}let k={id:h||v,type:v,label:h?r.find(x=>x.id===h)?.name||v:p(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,k]);},C=Uy.filter(v=>p(v).toLowerCase().includes(m.toLowerCase())),g=r.filter(v=>v.name.toLowerCase().includes(m.toLowerCase()));return jsxRuntime.jsxs("div",{ref:c,className:f("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("font-medium",n?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:m,onChange:v=>i(v.target.value),placeholder:l.searchPlaceholder,className:f("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:C.map(v=>{let h=a.find(x=>x.type===v&&!x.customFieldId),u=h?.visible??false,k=v==="name";return jsxRuntime.jsxs("button",{onClick:()=>{k||(h?b(h.id):y(v));},disabled:k,className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",k&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",u?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:u&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_m[v]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:p(v)})]},v)})})]}),g.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:g.map(v=>{let u=a.find(k=>k.customFieldId===v.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>y(v.type,v.id),className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",u?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:u&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_m[v.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:v.name})]},v.id)})})]}),s&&jsxRuntime.jsx("div",{className:f("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:f("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.createField]})})]})}var Vm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Yy=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function qm({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[d,m]=react.useState("text"),[i,c]=react.useState([""]),l=o==="es"?Ym.es:Ym.en;react.useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let p=()=>{if(!s.trim())return;let g={name:s.trim(),type:d};d==="dropdown"&&(g.options=i.filter(v=>v.trim())),a(g),t();},b=()=>{c([...i,""]);},y=(g,v)=>{let h=[...i];h[g]=v,c(h);},C=g=>{i.length>1&&c(i.filter((v,h)=>h!==g));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:f("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:f("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:l.fieldNamePlaceholder,className:f("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Yy.map(g=>jsxRuntime.jsxs("button",{onClick:()=>m(g.type),className:f("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsxRuntime.jsx("span",{className:f("text-xs",d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[g.type]})]},g.type))})]}),d==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((g,v)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:g,onChange:h=>y(v,h.target.value),placeholder:`${l.option} ${v+1}`,className:f("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>C(v),className:f("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},v)),jsxRuntime.jsxs("button",{onClick:b,className:f("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:f("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsxRuntime.jsx("button",{onClick:p,disabled:!s.trim(),className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var Ym={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Zm={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function Qm({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=react.useState(false),m=react.useRef(null),i=react.useRef(0),c=s==="es"?Zm.es:Zm.en;react.useEffect(()=>{if(!n)return;let b=C=>{Date.now()-i.current<100||m.current&&!m.current.contains(C.target)&&d(false);},y=C=>{C.key==="Escape"&&d(false);};return document.addEventListener("mousedown",b),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);}},[n]);let l=[{value:"all",label:c.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),n||(i.current=Date.now()),d(y=>!y);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),c.filters,p&&jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:f("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:f("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:l.map(b=>{let y=e===b.value&&!t,C=()=>b.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):b.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(b.value),r(false),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f(y?b.color:"text-gray-400","flex-shrink-0"),children:C()}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:b.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},b.value)})}),jsxRuntime.jsx("div",{className:f("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let b=!t;r(b),b&&a("all"),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:f("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var mv=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function op(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...op(r.subtasks,t+1));return a}function pv({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function np({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:l,showSearch:p=true,showHierarchy:b=true,tableColumns:y,allowColumnCustomization:C=true,allowColumnResize:g=true,enableContextMenu:v=true,showCreateTaskButton:h=false,onCreateTask:u}=t,k=ts(c,l),x=i==="dark",[D,T]=react.useState("startDate"),[w,L]=react.useState("asc"),[B,N]=react.useState(""),[W,$]=react.useState("all"),[j,de]=react.useState(false),[Q,ne]=react.useState(y||mv),[he,ke]=react.useState(false),[Ae,F]=react.useState(false),[O,S]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[R,V]=react.useState(null),[ee,se]=react.useState(0),[le,Pe]=react.useState(0),Z=react.useRef(null);react.useEffect(()=>{y&&ne(y);},[y]);let _e=react.useMemo(()=>{let _=new Set;function Y(Ue){for(let Re of Ue)Re.subtasks?.length&&(Re.isExpanded!==false&&_.add(Re.id),Y(Re.subtasks));}return Y(e),_},[e]),we=react.useMemo(()=>Q.filter(_=>_.visible),[Q]),je=react.useCallback(_=>{a.onTaskToggleExpand?.(_);},[a]),yt=react.useCallback(_=>{D===_?L(Y=>Y==="asc"?"desc":"asc"):(T(_),L("asc")),a.onSortChange?.({column:_,direction:w==="asc"?"desc":"asc"});},[D,w,a]),It=react.useCallback(_=>{ne(_),a.onColumnsChange?.(_);},[a]),at=react.useCallback(_=>{let Y=Q.map(Ue=>Ue.id===_?{...Ue,visible:false}:Ue);It(Y);},[Q,It]),kt=react.useCallback((_,Y)=>{T(_),L(Y);},[]),mt=react.useCallback((_,Y,Ue)=>{v&&(_.preventDefault(),S({isOpen:true,x:_.clientX,y:_.clientY,type:Y?"task":"header",task:Y,columnId:Ue}));},[v]),Ot=react.useCallback(()=>{S(_=>({..._,isOpen:false}));},[]),me=react.useCallback((_,Y)=>{if(!g)return;_.preventDefault(),_.stopPropagation();let Ue=Q.find(Re=>Re.id===Y);Ue&&(V(Y),se(_.clientX),Pe(Ue.width));},[Q,g]);react.useEffect(()=>{if(!R)return;let _=Ue=>{let Re=Ue.clientX-ee,Ve=Math.max(50,le+Re),He=Q.map(ce=>ce.id===R?{...ce,width:Ve}:ce);ne(He);},Y=()=>{R&&a.onColumnsChange?.(Q),V(null);};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",Y);}},[R,ee,le,Q,a]);let I=react.useCallback(async _=>{if(a.onCreateCustomField){let Y={..._,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}F(false);},[a]),ae=react.useCallback(_=>_.progress===100||_.status==="completed"?"completed":_.progress&&_.progress>0||_.status==="in-progress"?"in-progress":"todo",[]),xe=react.useMemo(()=>{let _=op(e);if(B.trim()){let Y=B.toLowerCase();_=_.filter(Ue=>Ue.name.toLowerCase().includes(Y));}return W!=="all"&&(_=_.filter(Y=>ae(Y)===W)),j&&(_=_.filter(Y=>ae(Y)!=="completed")),_.sort((Y,Ue)=>{let Re,Ve;switch(D){case "name":Re=Y.name.toLowerCase(),Ve=Ue.name.toLowerCase();break;case "startDate":Re=Y.startDate?.getTime()||0,Ve=Ue.startDate?.getTime()||0;break;case "endDate":Re=Y.endDate?.getTime()||0,Ve=Ue.endDate?.getTime()||0;break;case "progress":Re=Y.progress||0,Ve=Ue.progress||0;break;case "status":Re=Y.status||"todo",Ve=Ue.status||"todo";break;case "priority":let He={urgent:0,high:1,medium:2,low:3,none:4};Re=He[Y.priority]??4,Ve=He[Ue.priority]??4;break;default:return 0}return Re<Ve?w==="asc"?-1:1:Re>Ve?w==="asc"?1:-1:0}),_},[e,B,W,j,D,w,ae]),Be=react.useCallback((_,Y)=>{let Ue=He=>{a.onTaskUpdate?.({..._,...He});},Re=He=>He?_.customFields?.find(Ie=>Ie.fieldId===He)?.value:void 0,Ve=(He,ce)=>{if(!He)return;let J=[..._.customFields||[]],We=J.findIndex(Na=>Na.fieldId===He);We>=0?J[We]={fieldId:He,value:ce}:J.push({fieldId:He,value:ce}),Ue({customFields:J});};switch(Y.type){case "name":return null;case "status":return jsxRuntime.jsx(hm,{value:_.status||(_.progress===100?"completed":_.progress&&_.progress>0?"in-progress":"todo"),onChange:ce=>{Ue({status:ce,progress:ce==="completed"?100:ce==="in-progress"?50:0});},isDark:x,locale:c,translations:k.status});case "priority":return jsxRuntime.jsx(vm,{value:_.priority,onChange:ce=>Ue({priority:ce}),isDark:x,locale:c});case "assignees":return jsxRuntime.jsx(km,{value:_.assignees||[],availableUsers:d,onChange:ce=>Ue({assignees:ce}),isDark:x,locale:c});case "startDate":return jsxRuntime.jsx(ss,{value:_.startDate,onChange:ce=>Ue({startDate:ce}),isDark:x,locale:c});case "endDate":return jsxRuntime.jsx(ss,{value:_.endDate,onChange:ce=>Ue({endDate:ce}),isDark:x,locale:c});case "progress":return jsxRuntime.jsx(Nm,{value:_.progress||0,onChange:ce=>{let Ie=ce===100?"completed":ce>0?"in-progress":"todo";Ue({progress:ce,status:Ie});},isDark:x});case "tags":return jsxRuntime.jsx(Om,{value:_.tags||[],isDark:x});case "text":return jsxRuntime.jsx(Em,{value:Re(Y.customFieldId)||"",onChange:ce=>Ve(Y.customFieldId,ce),isDark:x});case "number":return jsxRuntime.jsx(Fm,{value:Re(Y.customFieldId)||0,onChange:ce=>Ve(Y.customFieldId,ce),isDark:x});case "date":let He=Re(Y.customFieldId);return jsxRuntime.jsx(ss,{value:He?new Date(He):void 0,onChange:ce=>Ve(Y.customFieldId,ce),isDark:x,locale:c});case "dropdown":return jsxRuntime.jsx(Am,{value:Re(Y.customFieldId)||"",options:Y.options||[],onChange:ce=>Ve(Y.customFieldId,ce),isDark:x});case "checkbox":return jsxRuntime.jsx(Im,{value:Re(Y.customFieldId)||false,onChange:ce=>Ve(Y.customFieldId,ce),isDark:x});default:return jsxRuntime.jsx("span",{className:f("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,c,d,k]),X=react.useCallback(_=>({name:k.columns.name,status:k.columns.status,priority:k.columns.priority,assignees:k.columns.assignees,startDate:k.columns.startDate,endDate:k.columns.endDate,progress:k.columns.progress})[_.type]||_.label,[k]),Me=react.useMemo(()=>we.reduce((_,Y)=>_+Y.width,0)+(C?48:0),[we,C]);return r?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:k.empty.noTasks}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Z,className:f("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",R&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(Qm,{value:W,hideCompleted:j,onChange:$,onHideCompletedChange:de,isDark:x,locale:c}),jsxRuntime.jsxs("div",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[xe.length," ",k.pagination.tasks]}),p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:B,onChange:_=>N(_.target.value),placeholder:k.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),h&&u&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:k.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:Me},children:[jsxRuntime.jsxs("div",{className:f("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[we.map(_=>jsxRuntime.jsxs("div",{className:f("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:_.width,minWidth:_.minWidth},onContextMenu:Y=>mt(Y,void 0,_.id),children:[_.sortable?jsxRuntime.jsxs("button",{onClick:()=>yt(_.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[X(_),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:f("w-3 h-3",D===_.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:X(_)}),g&&_.resizable&&jsxRuntime.jsx("div",{className:f("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",R===_.id&&"bg-[#3B82F6]"),onMouseDown:Y=>me(Y,_.id)})]},_.id)),C&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),ke(Y=>!Y);},className:f("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",he&&(x?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(jm,{isOpen:he,onClose:()=>ke(false),columns:Q,customFields:m,onColumnsChange:It,onCreateCustomField:()=>{ke(false),F(true);},isDark:x,locale:c})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xe.map((_,Y)=>{let Ue=_e.has(_.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:Y*.02},className:f("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(_),onDoubleClick:()=>a.onTaskDoubleClick?.(_),onContextMenu:Re=>mt(Re,_),children:[we.map(Re=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Re.width,minWidth:Re.minWidth},children:Re.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&_.level>0&&jsxRuntime.jsx("div",{style:{width:`${_.level*24}px`},className:"flex-shrink-0"}),b&&_.hasChildren&&jsxRuntime.jsx("button",{onClick:Ve=>{Ve.stopPropagation(),je(_.id);},className:f("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:Ue?jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),b&&!_.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:Ve=>{Ve.stopPropagation(),a.onTaskUpdate?.({..._,progress:_.progress===100?0:100,status:_.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(pv,{status:_.status,progress:_.progress})}),jsxRuntime.jsx("span",{className:f("truncate font-medium",x?"text-white":"text-gray-900",_.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:_.name})]}):Be(_,Re)},Re.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},_.id)})}),xe.length===0&&B&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:f("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f(x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.noResults})]})})]})}),jsxRuntime.jsx($m,{state:O,onClose:Ot,isDark:x,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:at,onColumnSort:kt,availableUsers:d}),jsxRuntime.jsx(qm,{isOpen:Ae,onClose:()=>F(false),onSave:I,isDark:x,locale:c})]})}var sp=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],ip=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],lp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var dl={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"},cl={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"},ml={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},ds={dark:dl,light:cl,neutral:ml};function dp(e){return ds[e]||ds.dark}var pl={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"}},ul={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},cs={en:pl,es:ul};function tn(e){return cs[e]||cs.en}function ms(e,t){let a=tn(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function cp(e){let t=tn(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function mp(e,t=0,a=true){let r=tn(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function bp(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function fl(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function hp({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function vp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:l,onAddComment:p,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:C,onTaskOpen:g}){let{theme:v="dark",locale:h="en",customTranslations:u}=t,k=ms(h,u),x=v==="dark",[D,T]=react.useState(r||new Date),[w,L]=react.useState(null),[B,N]=react.useState(null),[W,$]=react.useState({}),j=4,de=3,[Q,ne]=react.useState(null),[he,ke]=react.useState(""),[Ae,F]=react.useState(void 0),[O,S]=react.useState(null),[R,V]=react.useState(false),[ee,se]=react.useState(false),[le,Pe]=react.useState(null),[Z,_e]=react.useState(false),[we,je]=react.useState(new Date),yt=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()-1,1));},[D]),It=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()+1,1));},[D]),at=react.useCallback(()=>{T(new Date);},[]),kt=react.useMemo(()=>{let me=D.getFullYear(),I=D.getMonth(),ae=new Date(me,I,1),xe=new Date(me,I+1,0),Be=ae.getDay(),X=xe.getDate(),Me=bp(e),_=new Date;_.setHours(0,0,0,0);let Y=[],Ue=Be,Re=new Date(me,I,0).getDate();for(let He=Ue-1;He>=0;He--){let ce=new Date(me,I-1,Re-He);Y.push({date:ce,isCurrentMonth:false,isToday:false,isWeekend:ce.getDay()===0||ce.getDay()===6,events:Me.filter(Ie=>fl(ce,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}for(let He=1;He<=X;He++){let ce=new Date(me,I,He),Ie=ce.getTime()===_.getTime();Y.push({date:ce,isCurrentMonth:true,isToday:Ie,isWeekend:ce.getDay()===0||ce.getDay()===6,events:Me.filter(J=>fl(ce,J)).map(J=>({id:J.id,title:J.name,start:J.startDate,end:J.endDate,task:J}))});}let Ve=42-Y.length;for(let He=1;He<=Ve;He++){let ce=new Date(me,I+1,He);Y.push({date:ce,isCurrentMonth:false,isToday:false,isWeekend:ce.getDay()===0||ce.getDay()===6,events:Me.filter(Ie=>fl(ce,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}return Y},[D,e]),mt=h==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ot=D.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:k.labels.noEvents}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:d,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:f("text-xl font-semibold capitalize",x?"text-white":"text-gray-900"),children:Ot}),jsxRuntime.jsx("button",{onClick:at,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",x?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:k.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:yt,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:It,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:mt.map(me=>jsxRuntime.jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:me},me))}),jsxRuntime.jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:kt.map((me,I)=>{let ae=me.date.getDay()===0||me.date.getDay()===6;return jsxRuntime.jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?ae?"bg-[#1C1F26]":me.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":ae?"bg-gray-100":me.isCurrentMonth?"bg-white":"bg-gray-50",me.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let xe=W[I]||j,Be=me.events.slice(0,xe),X=me.events.length-xe;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Be.map(Me=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{L(Me.task),a.onEventClick?.(Me),g?.(Me.task.id);},whileHover:{scale:1.02},className:f("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Me.task.progress===100?x?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":x?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(hp,{task:Me.task}),jsxRuntime.jsx("span",{className:"truncate",children:Me.title})]})},Me.id)),X>0&&jsxRuntime.jsxs("button",{onClick:Me=>{Me.stopPropagation(),$(_=>({..._,[I]:xe+de}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",h==="es"?"M\xC1S":"MORE"]}),xe>j&&me.events.length>j&&jsxRuntime.jsx("button",{onClick:Me=>{Me.stopPropagation(),$(_=>({..._,[I]:j}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:h==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let xe=I>=28,Be=I%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),Q===I?ne(null):(ne(I),ke(""),F(void 0),S(null),Pe(null),V(false),se(false),_e(false),je(me.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",Q===I?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",x?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3.5 h-3.5 transition-transform",Q===I&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q===I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ne(null),ke(""),F(void 0),S(null),Pe(null),V(false),se(false),_e(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:xe?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:xe?-5:5,scale:.95},transition:{duration:.12},className:f("absolute w-[320px] rounded-lg shadow-2xl z-50",xe?"bottom-full mb-1":"top-full mt-1",Be?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),V(false),se(false),_e(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:he,onChange:X=>ke(X.target.value),placeholder:h==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:f("w-full bg-transparent text-sm outline-none placeholder:opacity-40",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&he.trim()){let Me=t.availableUsers?.find(Y=>Y.id===O),_=le||me.date;a.onTaskCreate?.({name:he.trim(),startDate:_,endDate:_,priority:Ae,assignees:Me?[Me]:void 0}),ke(""),F(void 0),S(null),Pe(null),ne(null);}X.key==="Escape"&&(ne(null),ke(""),F(void 0),S(null),Pe(null));}})}),jsxRuntime.jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",x?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),V(!R),se(false);},className:f("p-1 rounded transition-colors",Ae?Ae==="urgent"||Ae==="high"?"text-red-400 bg-red-500/20":Ae==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:h==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:h==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:h==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:h==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:h==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{F(X.id),V(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",Ae===X.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),_e(!Z),V(false),se(false),je(le||me.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",le?"bg-[#7C3AED]/20 text-[#7C3AED]":x?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(le||me.date).toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:f("w-40 py-2 border-r",x?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Me=new Date(X);Me.setDate(X.getDate()+1);let _=new Date(X);_.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let Y=new Date(X);Y.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let Ue=new Date(X);Ue.setDate(X.getDate()+14);let Re=new Date(X);return Re.setDate(X.getDate()+28),[{label:h==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Ma\xF1ana":"Tomorrow",date:Me,display:Me.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Este fin de semana":"This weekend",date:_,display:h==="es"?"s\xE1b.":"sat."},{label:h==="es"?"Pr\xF3xima semana":"Next week",date:Y,display:h==="es"?"lun.":"mon."},{label:h==="es"?"2 semanas":"2 weeks",date:Ue,display:Ue.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:h==="es"?"4 semanas":"4 weeks",date:Re,display:Re.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((He,ce)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Pe(He.date),_e(false);},children:[jsxRuntime.jsx("span",{children:He.label}),jsxRuntime.jsx("span",{className:f("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:He.display})]},ce))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:f("text-xs font-medium",x?"text-white":"text-gray-900"),children:we.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>je(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:h==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>je(new Date(we.getFullYear(),we.getMonth()-1)),className:f("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>je(new Date(we.getFullYear(),we.getMonth()+1)),className:f("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(h==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=we.getFullYear(),Me=we.getMonth(),_=new Date(X,Me,1).getDay(),Y=new Date(X,Me+1,0).getDate(),Ue=new Date(X,Me,0).getDate(),Re=new Date,Ve=[];for(let ce=_-1;ce>=0;ce--)Ve.push({dayNum:Ue-ce,isCurrentMonth:false,date:new Date(X,Me-1,Ue-ce)});for(let ce=1;ce<=Y;ce++)Ve.push({dayNum:ce,isCurrentMonth:true,date:new Date(X,Me,ce)});let He=42-Ve.length;for(let ce=1;ce<=He;ce++)Ve.push({dayNum:ce,isCurrentMonth:false,date:new Date(X,Me+1,ce)});return Ve.map((ce,Ie)=>{let J=ce.date.toDateString()===Re.toDateString(),We=(le||me.date).toDateString()===ce.date.toDateString();return jsxRuntime.jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!ce.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),ce.isCurrentMonth&&(x?"text-white":"text-gray-900"),J&&"ring-1 ring-[#3B82F6]",We&&"bg-[#7C3AED] text-white",!We&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Pe(ce.date),_e(false);},children:ce.dayNum},Ie)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),se(!ee),V(false);},className:f("p-1 rounded transition-colors",O?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:O?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(X=>X.id===O)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===O)?.initials||t.availableUsers?.find(X=>X.id===O)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{S(null),se(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",!O&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:h==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxRuntime.jsxs("button",{onClick:()=>{S(X.id),se(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",O===X.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:f("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:h==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(he.trim()){let X=t.availableUsers?.find(_=>_.id===O),Me=le||me.date;a.onTaskCreate?.({name:he.trim(),startDate:Me,endDate:Me,priority:Ae,assignees:X?[X]:void 0}),ke(""),F(void 0),S(null),Pe(null),ne(null);}},disabled:!he.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",he.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:h==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:f("text-sm font-medium",me.isToday?"text-[#3B82F6]":me.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:me.date.getDate()})]})]},I)})})]})}),jsxRuntime.jsx(mr,{task:w,isOpen:!!w,onClose:()=>L(null),onTaskUpdate:me=>{a.onTaskUpdate?.(me),L(me);},theme:v==="dark"?"dark":"light",locale:h,availableUsers:t.availableUsers?.map(me=>({id:me.id,name:me.name,avatar:me.avatar,initials:me.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:w?c?.get(w.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:bp(e).filter(me=>me.id!==w?.id),comments:l?.filter(me=>me.taskId===w?.id).map(me=>({...me,createdAt:me.createdAt instanceof Date?me.createdAt:new Date(me.createdAt),updatedAt:me.updatedAt instanceof Date?me.updatedAt:me.updatedAt?new Date(me.updatedAt):void 0})),onAddComment:p,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:C}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:f("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",x?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:f("font-medium",x?"text-white":"text-gray-900"),children:B.date.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>N(null),className:f("p-1 rounded",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:B.events.map(me=>jsxRuntime.jsxs("button",{onClick:()=>{N(null),L(me.task),g?.(me.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(hp,{task:me.task}),jsxRuntime.jsx("span",{className:f("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:me.title}),me.task.priority==="high"||me.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},me.id))})]})]})})]})}var bl={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"},hl={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"},yl={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1"},ps={dark:bl,light:hl,neutral:yl};function xp(e){return ps[e]||ps.dark}function wv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[m,i]=react.useState(false),c=react.useMemo(()=>t.filter(b=>e.cardIds.includes(b.id)),[t,e.cardIds]),l=react.useMemo(()=>{let b=c.length,y=new Set(c.flatMap(v=>v.assignedUserIds||[])).size,C=c.map(v=>v.priority).filter(Boolean),g=new Set(c.flatMap(v=>v.labels||[])).size;return {totalCards:b,uniqueAssignees:y,priorities:C,labels:g}},[c]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:f("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:b=>{b.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:c.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:c.map(b=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(b),children:a(b)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(b),children:[jsxRuntime.jsx("h4",{children:b.title}),b.description&&jsxRuntime.jsxs("p",{children:[b.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,b.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},b.id))})})]})}var wp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function rn(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function on(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function Cp(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Tp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let m=react.useMemo(()=>({...wp,...n}),[n]),[i,c]=react.useState(new Set),l=react.useRef(null),p=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(u=>{let k=u.timestamp.toISOString().split("T")[0],x=h.get(k);x?x.push(u):h.set(k,[u]);}),Array.from(h.entries()).sort((u,k)=>k[0].localeCompare(u[0])).map(([u,k])=>({date:new Date(u),events:k.sort((x,D)=>D.timestamp.getTime()-x.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:b,uniqueTypes:y}=react.useMemo(()=>{let h=new Set,u=new Set;return e.forEach(k=>{h.add(k.userId),u.add(k.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(u)}},[e]),C=h=>{c(u=>{let k=new Set(u);return k.has(h)?k.delete(h):k.add(h),k});},g=h=>{let k=new Date().getTime()-h.getTime(),x=Math.floor(k/6e4),D=Math.floor(k/36e5),T=Math.floor(k/864e5);return x<1?"just now":x<60?`${x}m ago`:D<24?`${D}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},v=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:f("history-timeline-empty",d),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:f("history-timeline",m.compact&&"compact",d),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let u=h.target.value;a({...t,types:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(h=>jsxRuntime.jsxs("option",{value:h,children:[on(h)," ",h.replace("_"," ")]},h))]}),b.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let u=h.target.value;a({...t,users:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),b.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),v>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:p.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((u,k)=>{let x=i.has(u.id),D=s===u.id,T=Cp(u.type);return jsxRuntime.jsxs("div",{"data-event-id":u.id,className:f("history-timeline-event",x&&"expanded",D&&"selected"),onClick:()=>o?.(u),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:on(u.type)})}),k<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&u.userAvatar&&jsxRuntime.jsx("img",{src:u.userAvatar,alt:u.userName||u.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:u.userName||u.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:rn(u)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(u.timestamp):u.timestamp.toLocaleString()})]}),Object.keys(u.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),C(u.id);},children:[x?"\u25BC":"\u25B6"," Show changes"]}),x&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(u.changes).map(([w,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},w)),u.metadata&&Object.keys(u.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(u.metadata).map(([w,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},w))]})]})]})]},u.id)})})]},h.date?.toISOString()||"all"))})]})}function Dp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:f("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:f("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&on(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&rn(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:b=>d(parseInt(b.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((b,y)=>jsxRuntime.jsx("div",{className:f("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>d(y),title:rn(b)},b.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:c.map(b=>jsxRuntime.jsxs("button",{className:f("history-replay-speed-btn",e.speed===b&&"active"),onClick:()=>m(b),children:[b,"x"]},b))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(b=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:b},b))})]})]})]})]}):jsxRuntime.jsxs("div",{className:f("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function vl(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 xl(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function Sp(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function Ep(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ev(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),d=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let l=a/2,p=r/2;c.vx+=(l-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(b=>{if(c.id===b.id)return;let y=c.x-b.x,C=c.y-b.y,g=Math.sqrt(y*y+C*C)||1,v=o.chargeStrength*i/(g*g);c.vx+=y/g*v,c.vy+=C/g*v;});}),t.forEach(c=>{let l=d.get(typeof c.source=="string"?c.source:c.source.id),p=d.get(typeof c.target=="string"?c.target:c.target.id);if(!l||!p)return;let b=p.x-l.x,y=p.y-l.y,C=Math.sqrt(b*b+y*y)||1,g=(C-o.linkDistance)/C*o.forceStrength*i;l.vx+=b*g,l.vy+=y*g,p.vx-=b*g,p.vy-=y*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Pp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:m}){let i=react.useRef(null),[c,l]=react.useState([]),[p,b]=react.useState(null),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,u]=react.useState(1),[k,x]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=Ev(e,t,a.width,a.height,a,150);l($);},[e,t,a]);let D=react.useCallback(($,j)=>{a.enableDragging&&(j.stopPropagation(),b($));},[a.enableDragging]),T=react.useCallback($=>{if(!p||!i.current)return;let de=i.current.getBoundingClientRect(),Q=($.clientX-de.left-k.x)/h,ne=($.clientY-de.top-k.y)/h;l(he=>he.map(ke=>ke.id===p?{...ke,x:Q,y:ne,fx:Q,fy:ne}:ke));},[p,h,k]),w=react.useCallback(()=>{b(null);},[]),L=react.useCallback(($,j)=>{j.stopPropagation(),d?.({type:"node-click",node:$,position:{x:j.clientX,y:j.clientY}});},[d]),B=react.useCallback(($,j)=>{j.stopPropagation(),d?.({type:"edge-click",edge:$,position:{x:j.clientX,y:j.clientY}});},[d]),N=react.useCallback($=>{let j=c.find(de=>de.id===$);return j?{x:j.x,y:j.y}:{x:0,y:0}},[c]),W=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let j=$.card.priority;return j==="URGENT"?"#ef4444":j==="HIGH"?"#f59e0b":j==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:f("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:f("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>u($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>u($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{u(1),x({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:vl($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Sp($)," ",xl($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let j=N(typeof $.source=="string"?$.source:$.source.id),de=N(typeof $.target=="string"?$.target:$.target.id),Q=Ep($.type),ne=g===$.id,he=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-edge",ne&&"hovered",he&&"critical"),onMouseEnter:()=>v($.id),onMouseLeave:()=>v(null),onClick:ke=>B($,ke),children:[jsxRuntime.jsx("line",{x1:j.x,y1:j.y,x2:de.x,y2:de.y,stroke:vl($.type),strokeWidth:he?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ne?1:.6,markerEnd:Q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ne&&jsxRuntime.jsx("text",{x:(j.x+de.x)/2,y:(j.y+de.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:xl($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map($=>{let j=y===$.id,de=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-node",j&&"hovered",de&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:Q=>D($.id,Q),onMouseEnter:()=>C($.id),onMouseLeave:()=>C(null),onClick:Q=>L($,Q),children:[jsxRuntime.jsx("circle",{r:de?a.nodeSize*1.2:a.nodeSize,fill:W($),stroke:de?"#fbbf24":"#ffffff",strokeWidth:de?3:2,opacity:j?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Ap({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[d,m]=react.useState(false),[i,c]=react.useState(null),[l,p]=react.useState(null),b=react.useRef(null),y=d||o;react.useEffect(()=>{e&&b.current&&b.current.focus();},[e]),react.useEffect(()=>{let h=u=>{u.key==="Escape"&&!y&&C();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,y]);let C=()=>{y||(n(""),c(null),p(null),t());},g=async()=>{if(!(!s.trim()||y)){m(true),c(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},v=()=>{l&&(a(l),C());};return e?jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:C,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,u)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},u))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,u)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},u)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:b,value:s,onChange:h=>n(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,u)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},u))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:C,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var kl={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var Mv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Fv={generatePlan:{enabled:true,minPlanTier:"hobby",estimatedTokens:2e3},predictRisks:{enabled:true,minPlanTier:"pro",estimatedTokens:1500},suggestAssignee:{enabled:true,minPlanTier:"hobby",estimatedTokens:800},generateReport:{enabled:true,minPlanTier:"enterprise",estimatedTokens:3e3},generateSubtasks:{enabled:true,minPlanTier:"hobby",estimatedTokens:1e3}};function Av(e,t,a){let r=kl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function nn(e){return `$${e.toFixed(4)}`}var wl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Av(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,p)=>l+p.cost,0),s=a.reduce((l,p)=>l+p.inputTokens,0),n=a.reduce((l,p)=>l+p.outputTokens,0),d=a.filter(l=>l.success),m=a.reduce((l,p)=>l+p.duration,0),i={},c={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,c[l.feature]=(c[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:m,percentUsed:i,isExceeded:d>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},no=new wl;function Bp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(no.getStats()),[s,n]=react.useState(no.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(no.getStats()),n(no.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let d=no.getRecentOperations(5);return jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:nn(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,i])=>{let c=r.costsByFeature[m]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:nn(c)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:d.map(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:nn(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function zp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=react.useState(""),[m,i]=react.useState(""),[c,l]=react.useState(""),[p,b]=react.useState(false),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,u]=react.useState(null),k=react.useRef(null),x=p||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let B=N=>{N.key==="Escape"&&!x&&D();};if(e)return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[e,x]);let D=()=>{x||(d(""),i(""),l(""),C(null),v(null),u(null),t());},T=async()=>{if(!(!n.trim()||x)){b(true),C(null),v(null),u(null);try{let B=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});v(B.tasks.tasks),u({from_cache:B.from_cache,tokens_used:B.tokens_used,mock_mode:B.mock_mode,similarity:B.similarity,tokens_saved:B.tokens_saved});}catch(B){C(B instanceof Error?B.message:"Failed to generate tasks");}finally{b(false);}}},w=()=>{g&&(a(g),D());};if(!e)return null;let L=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:D,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% 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((B,N)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",N+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:B.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"})]}),B.start," \u2192 ",B.end]}),jsxRuntime.jsxs("span",{children:[B.duration," days"]}),B.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",B.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${B.priority==="high"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:B.priority})]})},B.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:k,value:n,onChange:B=>d(B.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:B=>i(B.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:x})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:B=>l(B.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:x})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((B,N)=>jsxRuntime.jsx("button",{onClick:()=>d(B),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:B},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:D,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:T,disabled:!n.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Tasks"})]})]})]})})]})}function fs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&bn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,h,u)=>{console.warn(`Retry attempt ${h} after ${u}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=react.useCallback(async(g,v,h)=>{r(u=>{let k=u.cards.find(B=>B.id===g);if(!k)return u;let x=k.columnId,D={...k,columnId:v,position:h},T=u.cards.map(B=>B.id===g?D:B),w=u.columns.map(B=>{if(B.id===x)return {...B,cardIds:B.cardIds.filter(N=>N!==g)};if(B.id===v){let N=T.filter(W=>W.columnId===v).sort((W,$)=>W.position-$.position);return {...B,cardIds:N.map(W=>W.id)}}return B}),L={...u,cards:T,columns:w};return o(L),L});},[o]),n=react.useCallback(async(g,v)=>{r(h=>{let u=h.cards.map(x=>x.id===g?{...x,...v}:x),k={...h,cards:u};return o(k),k});},[o]),d=react.useCallback(async g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let u={...g,id:v},k=h.columns.map(D=>D.id===g.columnId?{...D,cardIds:[...D.cardIds,v]}:D),x={...h,cards:[...h.cards,u],columns:k};return o(x),x});},[o]),m=react.useCallback(async g=>{r(v=>{let h=v.cards.find(D=>D.id===g);if(!h)return v;let u=v.cards.filter(D=>D.id!==g),k=v.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(T=>T!==g)}:D),x={...v,cards:u,columns:k};return o(x),x});},[o]),i=react.useCallback(async g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let u={...g,id:v,cardIds:[]},k={...h,columns:[...h.columns,u]};return o(k),k});},[o]),c=react.useCallback(async(g,v)=>{r(h=>{let u=h.columns.map(x=>x.id===g?{...x,...v}:x),k={...h,columns:u};return o(k),k});},[o]),l=react.useCallback(async g=>{r(v=>{let h=v.cards.filter(x=>x.columnId!==g),u=v.columns.filter(x=>x.id!==g),k={...v,cards:h,columns:u};return o(k),k});},[o]),p=react.useCallback(g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(g),v},[d]),b=react.useCallback(g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),v},[i]),y=react.useCallback(()=>{r(g=>{let v={...g,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:l},setBoard:r,helpers:{addCard:p,addColumn:b,deleteCard:m,deleteColumn:l,clearBoard:y}}}function Hp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=fs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:i??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var sn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Wp={by:"none",order:"asc"};function Gp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...sn,...e}),[s,n]=react.useState({...Wp,...t}),d=react.useCallback(C=>{o(g=>({...g,...C}));},[]),m=react.useCallback(C=>{n(g=>({...g,...C}));},[]),i=react.useCallback(()=>{o(sn),n(Wp);},[]),c=react.useCallback(()=>{a&&o({...sn,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...sn,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...sn,priorities:["HIGH","URGENT"]});},[]),b=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(C=>{let g=[...C];if(r.search){let v=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(v)||h.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,h=v.getFullYear(),u=String(v.getMonth()+1).padStart(2,"0"),k=String(v.getDate()).padStart(2,"0"),x=`${h}-${u}-${k}`;g=g.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let T=D.endDate||D.dueDate;if(!T)return false;let w;if(typeof T=="string")w=T.split("T")[0]||T;else {let L=T.getUTCFullYear(),B=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");w=`${L}-${B}-${N}`;}switch(r.dateFilter){case "overdue":return w<x;case "today":return w===x;case "this-week":let L=new Date(x+"T00:00:00"),B=new Date(w+"T00:00:00"),N=new Date(L);return N.setDate(N.getDate()+7),B>=L&&B<=N;case "custom":if(r.dateRange){let W=typeof T=="string"?new Date(T):T;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(g=g.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(u=>r.assignees.includes(u)))),r.labels.length>0&&(g=g.filter(v=>v.labels&&v.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&g.sort((v,h)=>{let u=0;switch(s.by){case "created":let k=v.createdAt?new Date(v.createdAt).getTime():0,x=h.createdAt?new Date(h.createdAt).getTime():0;u=k-x;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=D[v.priority||"LOW"],w=D[h.priority||"LOW"];u=T-w;break;case "dueDate":let L=v.endDate||v.dueDate,B=h.endDate||h.dueDate;if(!L)return 1;if(!B)return -1;let N=typeof L=="string"?new Date(L).getTime():L.getTime(),W=typeof B=="string"?new Date(B).getTime():B.getTime();u=N-W;break;case "title":u=v.title.localeCompare(h.title);break;case "estimate":let $=v.estimatedTime||0,j=h.estimatedTime||0;u=$-j;break;default:u=0;}return s.order==="asc"?u:-u}),g},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:l,filterHighPriority:p,applyFilters:y,hasActiveFilters:b}}var Vp,jp;if(typeof window<"u")try{let e=un("ai");Vp=e.generateObject,jp=e.generateText;}catch{}function Kp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Vp&&jp&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let b=p instanceof Error?p:new Error("Failed to generate plan");throw o(b),b}finally{a(false);}},[s]),d=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let b=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(b),b}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let b=p instanceof Error?p:new Error("Failed to predict risks");throw o(b),b}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(p){let b=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(b),b}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(p){let b=p instanceof Error?p:new Error("Failed to estimate effort");throw o(b),b}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function Tl(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function Yp(e){let{cards:t}=e,[a,r]=Tl(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,p)=>{if(!p){r({selectedCardIds:[l],lastSelectedCardId:l});return}let b=p.ctrlKey||p.metaKey,y=p.shiftKey;if(b)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(C=>C!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(y&&a.lastSelectedCardId){let C=t.find(v=>v.id===l),g=t.find(v=>v.id===a.lastSelectedCardId);if(C&&g&&C.columnId===g.columnId){let v=t.filter(w=>w.columnId===C.columnId).sort((w,L)=>w.position-L.position),h=v.findIndex(w=>w.id===a.lastSelectedCardId),u=v.findIndex(w=>w.id===l),[k,x]=h<u?[h,u]:[u,h],D=v.slice(k,x+1).map(w=>w.id),T=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:T,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),c=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:m,toggleCard:i,getSelectedCards:c}}var qp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Xp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...qp,...a}),[a]),[s,n]=react.useState([]),d=react.useCallback((C,g,v,h,u)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:C,cardIds:g,columnId:v,strategy:h,color:u,isExpanded:true,position:s.filter(x=>x.columnId===v).length,createdAt:new Date};n(x=>[...x,k]);},[o.minCardsPerStack,s]),m=react.useCallback(C=>{n(g=>g.filter(v=>v.id!==C));},[]),i=react.useCallback(C=>{n(g=>g.map(v=>v.id===C?{...v,isExpanded:!v.isExpanded}:v));},[]),c=react.useCallback((C,g)=>{n(v=>v.map(h=>h.id===C&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),l=react.useCallback((C,g)=>{n(v=>v.map(h=>{if(h.id===C){let u=h.cardIds.filter(k=>k!==g);return u.length<o.minCardsPerStack?null:{...h,cardIds:u}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=react.useCallback(C=>s.filter(g=>g.columnId===C).sort((g,v)=>g.position-v.position),[s]),b=react.useCallback(async C=>{let g=t.filter(x=>x.columnId===C);if(g.length<o.minCardsPerStack*2)return [];let v=[],h=new Map;g.forEach(x=>{x.labels&&x.labels.length>0&&x.labels.forEach(D=>{h.has(D)||h.set(D,[]),h.get(D).push(x);});}),h.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:x.map(T=>T.id),columnId:C,strategy:"labels",color:"#3b82f6"},reason:`${x.length} cards with label "${D}"`,confidence:.85});});let u=new Map;g.forEach(x=>{x.assignedUserIds&&x.assignedUserIds.length>0&&x.assignedUserIds.forEach(D=>{u.has(D)||u.set(D,[]),u.get(D).push(x);});}),u.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:x.map(T=>T.id),columnId:C,strategy:"assignee",color:"#8b5cf6"},reason:`${x.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(g.forEach(x=>{x.priority&&(k.has(x.priority)||k.set(x.priority,[]),k.get(x.priority).push(x));}),k.forEach((x,D)=>{if(x.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";v.push({stack:{title:`${T} ${D} Priority`,cardIds:x.map(w=>w.id),columnId:C,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${x.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let x of g){let T=(await r.findSimilar(x,g)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let w=[x.id,...T.map(B=>B.card.id)],L=T.reduce((B,N)=>B+N.similarity,0)/T.length;v.push({stack:{title:`\u2728 Similar to "${x.title.substring(0,30)}${x.title.length>30?"...":""}"`,cardIds:w,columnId:C,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:L});}}return v.filter(x=>x.confidence>=o.autoStackConfidenceThreshold).sort((x,D)=>D.confidence-x.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(C=>{d(C.stack.title,C.stack.cardIds,C.stack.columnId,C.stack.strategy,C.stack.color);},[d]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let v=await b(g),h=v[0];v.length>0&&h&&h.confidence>=.9&&y(h);});},[]),{stacks:s,createStack:d,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:l,getStacksForColumn:p,getSuggestions:b,applySuggestion:y,config:o}}var Jp=react.createContext(null);function Zp({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=un("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=un("@libxai/core");n.set(m.id,new i(m));});let d=null;if(t?.board){let{Board:m}=un("@libxai/core");d=new m(t.board);}r.current=new core.BoardStore({board:d,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Jp.Provider,{value:{store:o},children:e})}function bs(){let e=react.useContext(Jp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function dn(){let e=bs(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=react.useCallback(h=>{e.updateBoard(h);},[e]),m=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,u)=>{e.updateColumn(h,u);},[e]),c=react.useCallback(h=>{e.deleteColumn(h);},[e]),l=react.useCallback(h=>e.getColumn(h),[e]),p=react.useCallback(h=>{e.addCard(h);},[e]),b=react.useCallback((h,u)=>{e.updateCard(h,u);},[e]),y=react.useCallback(h=>{e.deleteCard(h);},[e]),C=react.useCallback((h,u,k)=>{e.moveCard(h,u,k);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),v=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:l,addCard:p,updateCard:b,deleteCard:y,moveCard:C,getCard:g,getCardsByColumn:v}}function eu(e){let{cards:t}=dn();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function tu(e="position",t="asc"){let{cards:a}=dn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?d[o.priority]:0,i=s.priority?d[s.priority]:0;n=m-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var hs=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=rd.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},qv=new hs;function ru({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:m}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=c.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},b=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:p,className:o,children:jsxRuntime.jsx("div",{style:b,children:l.map(y=>{let C=e[y.index];if(!C)return null;let g=m?m(C,y.index):y.index,v={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:v,"data-index":y.index,children:r(C,y.index)},g)})})})}function ou(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function su({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:m,horizontal:i=true}){let c=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:d}),p=l.getVirtualItems(),b={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:c,style:b,className:s,children:jsxRuntime.jsx("div",{style:y,children:p.map(C=>{let g=e[C.index];if(!g)return null;let v=m?m(g,C.index):C.index,h={position:"absolute",top:0,left:C.start,width:C.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":C.index,children:o(g,C.index)},v)})})})}function iu(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function lu(e,t=10){return e>t}var El={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Pl={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ml={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Fl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ll={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Il={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Bl={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)"},Rl={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)"},Ol={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},zl={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}},Ul={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},ys={spacing:El,borderRadius:Pl,fontSize:Ml,fontWeight:Fl,lineHeight:Al,zIndex:Ll,duration:Il,easing:Bl,shadows:Rl,opacity:Ol,kanban:zl,gantt:Ul};function du(e,t,a){return e[t]??a}function Hl(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)?Hl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Zv(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function $l(e="asakaa"){let t=Hl(ys),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Zv(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
389
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function um(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function br(e,t){let a=um(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let m=d.name.toLowerCase();return n.every(i=>m.includes(i))})}function Xi(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let b={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(b!==void 0){let y=new Date(r),C=y.getDay(),g=b-C;return g<=0&&(g+=7),y.setDate(y.getDate()+g),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),b=s[2].toLowerCase(),y=new Date(r);return b==="day"||b==="d\xEDa"||b==="dias"?y.setDate(y.getDate()+p):b==="week"||b==="semana"||b==="semanas"?y.setDate(y.getDate()+p*7):(b==="month"||b==="mes"||b==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let p=parseInt(d[1],10),b=parseInt(d[2],10)-1,y=parseInt(d[3],10);return new Date(y,b,p)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),b=m[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(b!==void 0)return new Date(y,b,p)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=c[l[1].toLowerCase()],b=parseInt(l[2],10),y=l[3]?parseInt(l[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,b)}return null}function Ji(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 Zi(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 gm(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 fm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),c=r[2].trim(),l=br(t,i),p=Xi(c);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let b=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+b),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:p,endDate:y},message:`Moved "${l.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),l=br(t,i),p=Ji(c);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let b=new Date(l.endDate);return b.setDate(b.getDate()+p),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:b},message:`Extended "${l.name}" by ${p} days. New end date: ${b.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),l=br(t,i),p=Zi(c);return l?p===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:p},message:`Set "${l.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),l=br(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:c},message:`Renamed "${l.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),c=d[2].trim(),l=br(t,i),p=br(t,c);return l?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:l.id,dependencyTo:p.id,message:`Linked "${l.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),c=br(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function bm(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 P0(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 M0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Qn(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let l=a.find(p=>p.id===c);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Qn(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},d=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||d&&m&&Math.abs(m.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:m,progress:e.progress||0,status:P0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function hm(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:M0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function ym(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Qn(r,e,t))}var Qi={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"}},el={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},es={en:Qi,es:el};function tl(e){return es[e]||es.en}function ts(e,t){let a=tl(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var al=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function vm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let p=b=>{d.current&&!d.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let m=al[0],i=al.find(p=>p.value===e)??m,c=i.icon,l=p=>{switch(p){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:al.map(p=>{let b=p.icon;return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),t(p.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===p.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(b,{className:f("w-4 h-4",p.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:l(p.value)})]},p.value)})})]})}var rl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function km({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let c=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=rl.find(c=>c.value===e)??rl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:rl.map(c=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(c.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-2 h-2 rounded-full",c.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function os(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ns(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Cm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=react.useState(false),[m,i]=react.useState(""),c=react.useRef(null);react.useEffect(()=>{let y=C=>{c.current&&!c.current.contains(C.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]);let l=t.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())||y.email?.toLowerCase().includes(m.toLowerCase())),p=y=>e.some(C=>C.name===y),b=y=>{if(a)if(p(y.name))a(e.filter(C=>C.name!==y.name));else {let C={name:y.name,initials:os(y.name),color:y.color||ns(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl};a([...e,C]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((y,C)=>jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${C}`)),e.length>3&&jsxRuntime.jsxs("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),d(!n);},className:f("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((y,C)=>jsxRuntime.jsx("div",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${C}`)),e.length>2&&jsxRuntime.jsxs("span",{className:f("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:f("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:y=>y.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):l.map(y=>jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),b(y);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!y.avatarUrl&&ns(y.name)),children:y.avatarUrl?jsxRuntime.jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):os(y.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:y.name}),y.email&&jsxRuntime.jsx("div",{className:f("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:y.email})]}),p(y.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},y.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((y,C)=>jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[y.name,jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),a(e.filter(v=>v.name!==y.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${y.name}-${C}`))})]})]})}var ey={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},ty={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function ss({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(()=>{if(e){let g=e instanceof Date?e:new Date(e);return new Date(g.getFullYear(),g.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),c=e?e instanceof Date?e:new Date(e):null,l=r==="es"?"es":"en";react.useEffect(()=>{let g=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let p=g=>g?g.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",b=(g,v)=>new Date(g,v+1,0).getDate(),y=(g,v)=>new Date(g,v,1).getDay(),C=()=>{let g=d.getFullYear(),v=d.getMonth(),h=b(g,v),u=y(g,v),k=new Date,x=[];for(let D=0;D<u;D++)x.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${D}`));for(let D=1;D<=h;D++){let T=new Date(g,v,D),w=c&&c.getDate()===D&&c.getMonth()===v&&c.getFullYear()===g,L=k.getDate()===D&&k.getMonth()===v&&k.getFullYear()===g;x.push(jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),t?.(T),n(false);},className:f("w-8 h-8 rounded-full text-sm transition-colors",w?"bg-[#3B82F6] text-white":L?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:D},D));}return x};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:p(c)}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:f("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:p(c)})]}),s&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()-1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium",a?"text-white":"text-gray-900"),children:[ey[l][d.getMonth()]," ",d.getFullYear()]}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()+1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:ty[l].map(g=>jsxRuntime.jsx("div",{className:f("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:g},g))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:C()}),jsxRuntime.jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),t?.(new Date),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation();let v=new Date;v.setDate(v.getDate()+1),t?.(v),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Sm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),d=s.clientX-n.left,m=Math.round(d/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:f("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:f("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Mm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{m(e);},[e]);let c=()=>{d!==e&&t?.(d),n(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(m(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:d,onChange:p=>m(p.target.value),onBlur:c,onKeyDown:l,onClick:p=>p.stopPropagation(),className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:f("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Lm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[d,m]=react.useState(false),[i,c]=react.useState(e?.toString()||""),l=react.useRef(null);react.useEffect(()=>{d&&l.current&&(l.current.focus(),l.current.select());},[d]),react.useEffect(()=>{c(e?.toString()||"");},[e]);let p=()=>{let y=parseFloat(i);if(!isNaN(y)){let C=y;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&t?.(C);}m(false);},b=y=>{y.key==="Enter"?p():y.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):d?jsxRuntime.jsx("input",{ref:l,type:"number",value:i,onChange:y=>c(y.target.value),onBlur:p,onKeyDown:b,onClick:y=>y.stopPropagation(),min:o,max:s,className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),m(true);},className:f("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function Im({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=react.useState(false),m=react.useRef(null);return react.useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:f("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),d(false);},className:f("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Rm({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:f("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function Um({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:f("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:f("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function Cy(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ty(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Gm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let l=react.useRef(null),p=r==="es"?$m.es:$m.en;if(react.useEffect(()=>{let v=u=>{l.current&&!l.current.contains(u.target)&&t();},h=u=>{u.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let b=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:p.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),d&&(v.push({id:"status",label:p.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:p.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:p.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let u=e.task.assignees||[],x=u.some(D=>D.name===h.name)?u.filter(D=>D.name!==h.name):[...u,{name:h.name,initials:Cy(h.name),color:h.color||Ty(h.name),avatar:h.avatarUrl}];d({...e.task,assignees:x}),t();}}))})),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:p.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:p.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},y=()=>{if(!e.columnId)return [];let v=[];return i&&(v.push({id:"sort-asc",label:p.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:p.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:p.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),v},C=e.type==="task"?b():y(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:l,style:g,className:f("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:C.map(v=>v.separator?jsxRuntime.jsx("div",{className:f("my-1 h-px",a?"bg-white/10":"bg-gray-200")},v.id):v.submenu?jsxRuntime.jsx(Ny,{item:v,isDark:a},v.id):jsxRuntime.jsxs("button",{onClick:v.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:f(v.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function Ny({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:f("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxRuntime.jsxs("button",{onClick:d.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var $m={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var jm={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},$y=["name","status","priority","assignees","startDate","endDate","progress","tags"];function Ym({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[m,i]=react.useState(""),c=react.useRef(null),l=d==="es"?Km.es:Km.en;if(react.useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let h=k=>{c.current&&!c.current.contains(k.target)&&t();},u=k=>{k.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",u),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",u);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let p=v=>l.columns[v]||v,b=v=>{if(v==="name")return;let h=a.map(u=>u.id===v?{...u,visible:!u.visible}:u);o(h);},y=(v,h)=>{let u=a.find(x=>x.type===v&&(!h||x.customFieldId===h));if(u){b(u.id);return}let k={id:h||v,type:v,label:h?r.find(x=>x.id===h)?.name||v:p(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,k]);},C=$y.filter(v=>p(v).toLowerCase().includes(m.toLowerCase())),g=r.filter(v=>v.name.toLowerCase().includes(m.toLowerCase()));return jsxRuntime.jsxs("div",{ref:c,className:f("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("font-medium",n?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:m,onChange:v=>i(v.target.value),placeholder:l.searchPlaceholder,className:f("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:C.map(v=>{let h=a.find(x=>x.type===v&&!x.customFieldId),u=h?.visible??false,k=v==="name";return jsxRuntime.jsxs("button",{onClick:()=>{k||(h?b(h.id):y(v));},disabled:k,className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",k&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",u?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:u&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:jm[v]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:p(v)})]},v)})})]}),g.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:g.map(v=>{let u=a.find(k=>k.customFieldId===v.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>y(v.type,v.id),className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",u?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:u&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:jm[v.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:v.name})]},v.id)})})]}),s&&jsxRuntime.jsx("div",{className:f("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:f("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.createField]})})]})}var Km={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Xy=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function Jm({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[d,m]=react.useState("text"),[i,c]=react.useState([""]),l=o==="es"?Xm.es:Xm.en;react.useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let p=()=>{if(!s.trim())return;let g={name:s.trim(),type:d};d==="dropdown"&&(g.options=i.filter(v=>v.trim())),a(g),t();},b=()=>{c([...i,""]);},y=(g,v)=>{let h=[...i];h[g]=v,c(h);},C=g=>{i.length>1&&c(i.filter((v,h)=>h!==g));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:f("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:f("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:l.fieldNamePlaceholder,className:f("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Xy.map(g=>jsxRuntime.jsxs("button",{onClick:()=>m(g.type),className:f("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsxRuntime.jsx("span",{className:f("text-xs",d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[g.type]})]},g.type))})]}),d==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((g,v)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:g,onChange:h=>y(v,h.target.value),placeholder:`${l.option} ${v+1}`,className:f("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>C(v),className:f("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},v)),jsxRuntime.jsxs("button",{onClick:b,className:f("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:f("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsxRuntime.jsx("button",{onClick:p,disabled:!s.trim(),className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var Xm={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var ep={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function tp({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=react.useState(false),m=react.useRef(null),i=react.useRef(0),c=s==="es"?ep.es:ep.en;react.useEffect(()=>{if(!n)return;let b=C=>{Date.now()-i.current<100||m.current&&!m.current.contains(C.target)&&d(false);},y=C=>{C.key==="Escape"&&d(false);};return document.addEventListener("mousedown",b),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);}},[n]);let l=[{value:"all",label:c.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),n||(i.current=Date.now()),d(y=>!y);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),c.filters,p&&jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:f("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:f("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:l.map(b=>{let y=e===b.value&&!t,C=()=>b.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):b.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(b.value),r(false),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f(y?b.color:"text-gray-400","flex-shrink-0"),children:C()}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:b.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},b.value)})}),jsxRuntime.jsx("div",{className:f("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let b=!t;r(b),b&&a("all"),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:f("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var uv=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function sp(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(...sp(r.subtasks,t+1));return a}function gv({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 ip({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:l,showSearch:p=true,showHierarchy:b=true,tableColumns:y,allowColumnCustomization:C=true,allowColumnResize:g=true,enableContextMenu:v=true,showCreateTaskButton:h=false,onCreateTask:u}=t,k=ts(c,l),x=i==="dark",[D,T]=react.useState("startDate"),[w,L]=react.useState("asc"),[B,N]=react.useState(""),[$,U]=react.useState("all"),[j,se]=react.useState(false),[ee,ie]=react.useState(y||uv),[ve,Ce]=react.useState(false),[Ae,F]=react.useState(false),[R,S]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[_,J]=react.useState(null),[ce,pe]=react.useState(0),[V,ue]=react.useState(0),K=react.useRef(null);react.useEffect(()=>{y&&ie(y);},[y]);let He=react.useMemo(()=>{let G=new Set;function q($e){for(let Oe of $e)Oe.subtasks?.length&&(Oe.isExpanded!==false&&G.add(Oe.id),q(Oe.subtasks));}return q(e),G},[e]),le=react.useMemo(()=>ee.filter(G=>G.visible),[ee]),Re=react.useCallback(G=>{a.onTaskToggleExpand?.(G);},[a]),rt=react.useCallback(G=>{D===G?L(q=>q==="asc"?"desc":"asc"):(T(G),L("asc")),a.onSortChange?.({column:G,direction:w==="asc"?"desc":"asc"});},[D,w,a]),ot=react.useCallback(G=>{ie(G),a.onColumnsChange?.(G);},[a]),Ke=react.useCallback(G=>{let q=ee.map($e=>$e.id===G?{...$e,visible:false}:$e);ot(q);},[ee,ot]),yt=react.useCallback((G,q)=>{T(G),L(q);},[]),lt=react.useCallback((G,q,$e)=>{v&&(G.preventDefault(),S({isOpen:true,x:G.clientX,y:G.clientY,type:q?"task":"header",task:q,columnId:$e}));},[v]),Ot=react.useCallback(()=>{S(G=>({...G,isOpen:false}));},[]),me=react.useCallback((G,q)=>{if(!g)return;G.preventDefault(),G.stopPropagation();let $e=ee.find(Oe=>Oe.id===q);$e&&(J(q),pe(G.clientX),ue($e.width));},[ee,g]);react.useEffect(()=>{if(!_)return;let G=$e=>{let Oe=$e.clientX-ce,je=Math.max(50,V+Oe),We=ee.map(de=>de.id===_?{...de,width:je}:de);ie(We);},q=()=>{_&&a.onColumnsChange?.(ee),J(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",q),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",q);}},[_,ce,V,ee,a]);let I=react.useCallback(async G=>{if(a.onCreateCustomField){let q={...G,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(q);}F(false);},[a]),ae=react.useCallback(G=>G.progress===100||G.status==="completed"?"completed":G.progress&&G.progress>0||G.status==="in-progress"?"in-progress":"todo",[]),we=react.useMemo(()=>{let G=sp(e);if(B.trim()){let q=B.toLowerCase();G=G.filter($e=>$e.name.toLowerCase().includes(q));}return $!=="all"&&(G=G.filter(q=>ae(q)===$)),j&&(G=G.filter(q=>ae(q)!=="completed")),G.sort((q,$e)=>{let Oe,je;switch(D){case "name":Oe=q.name.toLowerCase(),je=$e.name.toLowerCase();break;case "startDate":Oe=q.startDate?.getTime()||0,je=$e.startDate?.getTime()||0;break;case "endDate":Oe=q.endDate?.getTime()||0,je=$e.endDate?.getTime()||0;break;case "progress":Oe=q.progress||0,je=$e.progress||0;break;case "status":Oe=q.status||"todo",je=$e.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};Oe=We[q.priority]??4,je=We[$e.priority]??4;break;default:return 0}return Oe<je?w==="asc"?-1:1:Oe>je?w==="asc"?1:-1:0}),G},[e,B,$,j,D,w,ae]),Be=react.useCallback((G,q)=>{let $e=We=>{a.onTaskUpdate?.({...G,...We});},Oe=We=>We?G.customFields?.find(Ie=>Ie.fieldId===We)?.value:void 0,je=(We,de)=>{if(!We)return;let Q=[...G.customFields||[]],_e=Q.findIndex(Na=>Na.fieldId===We);_e>=0?Q[_e]={fieldId:We,value:de}:Q.push({fieldId:We,value:de}),$e({customFields:Q});};switch(q.type){case "name":return null;case "status":return jsxRuntime.jsx(vm,{value:G.status||(G.progress===100?"completed":G.progress&&G.progress>0?"in-progress":"todo"),onChange:de=>{$e({status:de,progress:de==="completed"?100:de==="in-progress"?50:0});},isDark:x,locale:c,translations:k.status});case "priority":return jsxRuntime.jsx(km,{value:G.priority,onChange:de=>$e({priority:de}),isDark:x,locale:c});case "assignees":return jsxRuntime.jsx(Cm,{value:G.assignees||[],availableUsers:d,onChange:de=>$e({assignees:de}),isDark:x,locale:c});case "startDate":return jsxRuntime.jsx(ss,{value:G.startDate,onChange:de=>$e({startDate:de}),isDark:x,locale:c});case "endDate":return jsxRuntime.jsx(ss,{value:G.endDate,onChange:de=>$e({endDate:de}),isDark:x,locale:c});case "progress":return jsxRuntime.jsx(Sm,{value:G.progress||0,onChange:de=>{let Ie=de===100?"completed":de>0?"in-progress":"todo";$e({progress:de,status:Ie});},isDark:x});case "tags":return jsxRuntime.jsx(Um,{value:G.tags||[],isDark:x});case "text":return jsxRuntime.jsx(Mm,{value:Oe(q.customFieldId)||"",onChange:de=>je(q.customFieldId,de),isDark:x});case "number":return jsxRuntime.jsx(Lm,{value:Oe(q.customFieldId)||0,onChange:de=>je(q.customFieldId,de),isDark:x});case "date":let We=Oe(q.customFieldId);return jsxRuntime.jsx(ss,{value:We?new Date(We):void 0,onChange:de=>je(q.customFieldId,de),isDark:x,locale:c});case "dropdown":return jsxRuntime.jsx(Im,{value:Oe(q.customFieldId)||"",options:q.options||[],onChange:de=>je(q.customFieldId,de),isDark:x});case "checkbox":return jsxRuntime.jsx(Rm,{value:Oe(q.customFieldId)||false,onChange:de=>je(q.customFieldId,de),isDark:x});default:return jsxRuntime.jsx("span",{className:f("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,c,d,k]),Z=react.useCallback(G=>({name:k.columns.name,status:k.columns.status,priority:k.columns.priority,assignees:k.columns.assignees,startDate:k.columns.startDate,endDate:k.columns.endDate,progress:k.columns.progress})[G.type]||G.label,[k]),Me=react.useMemo(()=>le.reduce((G,q)=>G+q.width,0)+(C?48:0),[le,C]);return r?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:k.empty.noTasks}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:K,className:f("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",_&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(tp,{value:$,hideCompleted:j,onChange:U,onHideCompletedChange:se,isDark:x,locale:c}),jsxRuntime.jsxs("div",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[we.length," ",k.pagination.tasks]}),p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:B,onChange:G=>N(G.target.value),placeholder:k.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),h&&u&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:k.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:Me},children:[jsxRuntime.jsxs("div",{className:f("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[le.map(G=>jsxRuntime.jsxs("div",{className:f("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:G.width,minWidth:G.minWidth},onContextMenu:q=>lt(q,void 0,G.id),children:[G.sortable?jsxRuntime.jsxs("button",{onClick:()=>rt(G.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Z(G),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:f("w-3 h-3",D===G.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:Z(G)}),g&&G.resizable&&jsxRuntime.jsx("div",{className:f("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",_===G.id&&"bg-[#3B82F6]"),onMouseDown:q=>me(q,G.id)})]},G.id)),C&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),Ce(q=>!q);},className:f("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ve&&(x?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(Ym,{isOpen:ve,onClose:()=>Ce(false),columns:ee,customFields:m,onColumnsChange:ot,onCreateCustomField:()=>{Ce(false),F(true);},isDark:x,locale:c})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we.map((G,q)=>{let $e=He.has(G.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:q*.02},className:f("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(G),onDoubleClick:()=>a.onTaskDoubleClick?.(G),onContextMenu:Oe=>lt(Oe,G),children:[le.map(Oe=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Oe.width,minWidth:Oe.minWidth},children:Oe.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&G.level>0&&jsxRuntime.jsx("div",{style:{width:`${G.level*24}px`},className:"flex-shrink-0"}),b&&G.hasChildren&&jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),Re(G.id);},className:f("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:$e?jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),b&&!G.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),a.onTaskUpdate?.({...G,progress:G.progress===100?0:100,status:G.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(gv,{status:G.status,progress:G.progress})}),jsxRuntime.jsx("span",{className:f("truncate font-medium",x?"text-white":"text-gray-900",G.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:G.name})]}):Be(G,Oe)},Oe.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},G.id)})}),we.length===0&&B&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:f("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f(x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.noResults})]})})]})}),jsxRuntime.jsx(Gm,{state:R,onClose:Ot,isDark:x,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ke,onColumnSort:yt,availableUsers:d}),jsxRuntime.jsx(Jm,{isOpen:Ae,onClose:()=>F(false),onSave:I,isDark:x,locale:c})]})}var lp=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],dp=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],cp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var dl={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"},cl={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"},ml={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},ds={dark:dl,light:cl,neutral:ml};function mp(e){return ds[e]||ds.dark}var pl={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"}},ul={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},cs={en:pl,es:ul};function tn(e){return cs[e]||cs.en}function ms(e,t){let a=tn(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function pp(e){let t=tn(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function up(e,t=0,a=true){let r=tn(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function yp(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 fl(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 vp({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 kp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:l,onAddComment:p,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:C,onTaskOpen:g}){let{theme:v="dark",locale:h="en",customTranslations:u}=t,k=ms(h,u),x=v==="dark",[D,T]=react.useState(r||new Date),[w,L]=react.useState(null),[B,N]=react.useState(null),[$,U]=react.useState({}),j=4,se=3,[ee,ie]=react.useState(null),[ve,Ce]=react.useState(""),[Ae,F]=react.useState(void 0),[R,S]=react.useState(null),[_,J]=react.useState(false),[ce,pe]=react.useState(false),[V,ue]=react.useState(null),[K,He]=react.useState(false),[le,Re]=react.useState(new Date),rt=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()-1,1));},[D]),ot=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()+1,1));},[D]),Ke=react.useCallback(()=>{T(new Date);},[]),yt=react.useMemo(()=>{let me=D.getFullYear(),I=D.getMonth(),ae=new Date(me,I,1),we=new Date(me,I+1,0),Be=ae.getDay(),Z=we.getDate(),Me=yp(e),G=new Date;G.setHours(0,0,0,0);let q=[],$e=Be,Oe=new Date(me,I,0).getDate();for(let We=$e-1;We>=0;We--){let de=new Date(me,I-1,Oe-We);q.push({date:de,isCurrentMonth:false,isToday:false,isWeekend:de.getDay()===0||de.getDay()===6,events:Me.filter(Ie=>fl(de,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}for(let We=1;We<=Z;We++){let de=new Date(me,I,We),Ie=de.getTime()===G.getTime();q.push({date:de,isCurrentMonth:true,isToday:Ie,isWeekend:de.getDay()===0||de.getDay()===6,events:Me.filter(Q=>fl(de,Q)).map(Q=>({id:Q.id,title:Q.name,start:Q.startDate,end:Q.endDate,task:Q}))});}let je=42-q.length;for(let We=1;We<=je;We++){let de=new Date(me,I+1,We);q.push({date:de,isCurrentMonth:false,isToday:false,isWeekend:de.getDay()===0||de.getDay()===6,events:Me.filter(Ie=>fl(de,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}return q},[D,e]),lt=h==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ot=D.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:k.labels.noEvents}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:d,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:f("text-xl font-semibold capitalize",x?"text-white":"text-gray-900"),children:Ot}),jsxRuntime.jsx("button",{onClick:Ke,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",x?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:k.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:rt,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:ot,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:lt.map(me=>jsxRuntime.jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:me},me))}),jsxRuntime.jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:yt.map((me,I)=>{let ae=me.date.getDay()===0||me.date.getDay()===6;return jsxRuntime.jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?ae?"bg-[#1C1F26]":me.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":ae?"bg-gray-100":me.isCurrentMonth?"bg-white":"bg-gray-50",me.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let we=$[I]||j,Be=me.events.slice(0,we),Z=me.events.length-we;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Be.map(Me=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{L(Me.task),a.onEventClick?.(Me),g?.(Me.task.id);},whileHover:{scale:1.02},className:f("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Me.task.progress===100?x?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":x?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(vp,{task:Me.task}),jsxRuntime.jsx("span",{className:"truncate",children:Me.title})]})},Me.id)),Z>0&&jsxRuntime.jsxs("button",{onClick:Me=>{Me.stopPropagation(),U(G=>({...G,[I]:we+se}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Z," ",h==="es"?"M\xC1S":"MORE"]}),we>j&&me.events.length>j&&jsxRuntime.jsx("button",{onClick:Me=>{Me.stopPropagation(),U(G=>({...G,[I]:j}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:h==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let we=I>=28,Be=I%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),ee===I?ie(null):(ie(I),Ce(""),F(void 0),S(null),ue(null),J(false),pe(false),He(false),Re(me.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",ee===I?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",x?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3.5 h-3.5 transition-transform",ee===I&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee===I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ie(null),Ce(""),F(void 0),S(null),ue(null),J(false),pe(false),He(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:f("absolute w-[320px] rounded-lg shadow-2xl z-50",we?"bottom-full mb-1":"top-full mt-1",Be?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>{Z.stopPropagation(),J(false),pe(false),He(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:ve,onChange:Z=>Ce(Z.target.value),placeholder:h==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:f("w-full bg-transparent text-sm outline-none placeholder:opacity-40",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Z=>{if(Z.key==="Enter"&&ve.trim()){let Me=t.availableUsers?.find(q=>q.id===R),G=V||me.date;a.onTaskCreate?.({name:ve.trim(),startDate:G,endDate:G,priority:Ae,assignees:Me?[Me]:void 0}),Ce(""),F(void 0),S(null),ue(null),ie(null);}Z.key==="Escape"&&(ie(null),Ce(""),F(void 0),S(null),ue(null));}})}),jsxRuntime.jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",x?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),J(!_),pe(false);},className:f("p-1 rounded transition-colors",Ae?Ae==="urgent"||Ae==="high"?"text-red-400 bg-red-500/20":Ae==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[{id:"urgent",label:h==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:h==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:h==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:h==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:h==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Z=>jsxRuntime.jsxs("button",{onClick:()=>{F(Z.id),J(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",Ae===Z.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",Z.color)}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:Z.label})]},Z.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:Z=>{Z.stopPropagation(),He(!K),J(false),pe(false),Re(V||me.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",V?"bg-[#7C3AED]/20 text-[#7C3AED]":x?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(V||me.date).toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxRuntime.jsx("div",{className:f("w-40 py-2 border-r",x?"border-white/10":"border-gray-200"),children:(()=>{let Z=new Date,Me=new Date(Z);Me.setDate(Z.getDate()+1);let G=new Date(Z);G.setDate(Z.getDate()+((6-Z.getDay()+7)%7||7));let q=new Date(Z);q.setDate(Z.getDate()+((1-Z.getDay()+7)%7||7));let $e=new Date(Z);$e.setDate(Z.getDate()+14);let Oe=new Date(Z);return Oe.setDate(Z.getDate()+28),[{label:h==="es"?"Hoy":"Today",date:Z,display:Z.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Ma\xF1ana":"Tomorrow",date:Me,display:Me.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Este fin de semana":"This weekend",date:G,display:h==="es"?"s\xE1b.":"sat."},{label:h==="es"?"Pr\xF3xima semana":"Next week",date:q,display:h==="es"?"lun.":"mon."},{label:h==="es"?"2 semanas":"2 weeks",date:$e,display:$e.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:h==="es"?"4 semanas":"4 weeks",date:Oe,display:Oe.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((We,de)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ue(We.date),He(false);},children:[jsxRuntime.jsx("span",{children:We.label}),jsxRuntime.jsx("span",{className:f("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:We.display})]},de))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:f("text-xs font-medium",x?"text-white":"text-gray-900"),children:le.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Re(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:h==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Re(new Date(le.getFullYear(),le.getMonth()-1)),className:f("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Re(new Date(le.getFullYear(),le.getMonth()+1)),className:f("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(h==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Z=>jsxRuntime.jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:Z},Z))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Z=le.getFullYear(),Me=le.getMonth(),G=new Date(Z,Me,1).getDay(),q=new Date(Z,Me+1,0).getDate(),$e=new Date(Z,Me,0).getDate(),Oe=new Date,je=[];for(let de=G-1;de>=0;de--)je.push({dayNum:$e-de,isCurrentMonth:false,date:new Date(Z,Me-1,$e-de)});for(let de=1;de<=q;de++)je.push({dayNum:de,isCurrentMonth:true,date:new Date(Z,Me,de)});let We=42-je.length;for(let de=1;de<=We;de++)je.push({dayNum:de,isCurrentMonth:false,date:new Date(Z,Me+1,de)});return je.map((de,Ie)=>{let Q=de.date.toDateString()===Oe.toDateString(),_e=(V||me.date).toDateString()===de.date.toDateString();return jsxRuntime.jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!de.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),de.isCurrentMonth&&(x?"text-white":"text-gray-900"),Q&&"ring-1 ring-[#3B82F6]",_e&&"bg-[#7C3AED] text-white",!_e&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ue(de.date),He(false);},children:de.dayNum},Ie)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),pe(!ce),J(false);},className:f("p-1 rounded transition-colors",R?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:R?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(Z=>Z.id===R)?.color||"#7C3AED"},children:t.availableUsers?.find(Z=>Z.id===R)?.initials||t.availableUsers?.find(Z=>Z.id===R)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{S(null),pe(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",!R&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:h==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Z=>jsxRuntime.jsxs("button",{onClick:()=>{S(Z.id),pe(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",R===Z.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:Z.color||"#7C3AED"},children:Z.initials||Z.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:Z.name})]},Z.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:f("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:h==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(ve.trim()){let Z=t.availableUsers?.find(G=>G.id===R),Me=V||me.date;a.onTaskCreate?.({name:ve.trim(),startDate:Me,endDate:Me,priority:Ae,assignees:Z?[Z]:void 0}),Ce(""),F(void 0),S(null),ue(null),ie(null);}},disabled:!ve.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",ve.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:h==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:f("text-sm font-medium",me.isToday?"text-[#3B82F6]":me.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:me.date.getDate()})]})]},I)})})]})}),jsxRuntime.jsx(mr,{task:w,isOpen:!!w,onClose:()=>L(null),onTaskUpdate:me=>{a.onTaskUpdate?.(me),L(me);},theme:v==="dark"?"dark":"light",locale:h,availableUsers:t.availableUsers?.map(me=>({id:me.id,name:me.name,avatar:me.avatar,initials:me.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:w?c?.get(w.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:yp(e).filter(me=>me.id!==w?.id),comments:l?.filter(me=>me.taskId===w?.id).map(me=>({...me,createdAt:me.createdAt instanceof Date?me.createdAt:new Date(me.createdAt),updatedAt:me.updatedAt instanceof Date?me.updatedAt:me.updatedAt?new Date(me.updatedAt):void 0})),onAddComment:p,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:C}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:f("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",x?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:f("font-medium",x?"text-white":"text-gray-900"),children:B.date.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>N(null),className:f("p-1 rounded",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:B.events.map(me=>jsxRuntime.jsxs("button",{onClick:()=>{N(null),L(me.task),g?.(me.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(vp,{task:me.task}),jsxRuntime.jsx("span",{className:f("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:me.title}),me.task.priority==="high"||me.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},me.id))})]})]})})]})}var bl={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"},hl={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"},yl={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1"},ps={dark:bl,light:hl,neutral:yl};function wp(e){return ps[e]||ps.dark}function Tv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[m,i]=react.useState(false),c=react.useMemo(()=>t.filter(b=>e.cardIds.includes(b.id)),[t,e.cardIds]),l=react.useMemo(()=>{let b=c.length,y=new Set(c.flatMap(v=>v.assignedUserIds||[])).size,C=c.map(v=>v.priority).filter(Boolean),g=new Set(c.flatMap(v=>v.labels||[])).size;return {totalCards:b,uniqueAssignees:y,priorities:C,labels:g}},[c]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:f("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:b=>{b.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:c.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:c.map(b=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(b),children:a(b)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(b),children:[jsxRuntime.jsx("h4",{children:b.title}),b.description&&jsxRuntime.jsxs("p",{children:[b.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,b.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},b.id))})})]})}var Tp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function rn(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function on(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function Np(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 Dp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let m=react.useMemo(()=>({...Tp,...n}),[n]),[i,c]=react.useState(new Set),l=react.useRef(null),p=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(u=>{let k=u.timestamp.toISOString().split("T")[0],x=h.get(k);x?x.push(u):h.set(k,[u]);}),Array.from(h.entries()).sort((u,k)=>k[0].localeCompare(u[0])).map(([u,k])=>({date:new Date(u),events:k.sort((x,D)=>D.timestamp.getTime()-x.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:b,uniqueTypes:y}=react.useMemo(()=>{let h=new Set,u=new Set;return e.forEach(k=>{h.add(k.userId),u.add(k.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(u)}},[e]),C=h=>{c(u=>{let k=new Set(u);return k.has(h)?k.delete(h):k.add(h),k});},g=h=>{let k=new Date().getTime()-h.getTime(),x=Math.floor(k/6e4),D=Math.floor(k/36e5),T=Math.floor(k/864e5);return x<1?"just now":x<60?`${x}m ago`:D<24?`${D}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},v=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:f("history-timeline-empty",d),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:f("history-timeline",m.compact&&"compact",d),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let u=h.target.value;a({...t,types:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(h=>jsxRuntime.jsxs("option",{value:h,children:[on(h)," ",h.replace("_"," ")]},h))]}),b.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let u=h.target.value;a({...t,users:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),b.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),v>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:p.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((u,k)=>{let x=i.has(u.id),D=s===u.id,T=Np(u.type);return jsxRuntime.jsxs("div",{"data-event-id":u.id,className:f("history-timeline-event",x&&"expanded",D&&"selected"),onClick:()=>o?.(u),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:on(u.type)})}),k<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&u.userAvatar&&jsxRuntime.jsx("img",{src:u.userAvatar,alt:u.userName||u.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:u.userName||u.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:rn(u)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(u.timestamp):u.timestamp.toLocaleString()})]}),Object.keys(u.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),C(u.id);},children:[x?"\u25BC":"\u25B6"," Show changes"]}),x&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(u.changes).map(([w,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},w)),u.metadata&&Object.keys(u.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(u.metadata).map(([w,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},w))]})]})]})]},u.id)})})]},h.date?.toISOString()||"all"))})]})}function Ep({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:f("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:f("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&on(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&rn(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:b=>d(parseInt(b.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((b,y)=>jsxRuntime.jsx("div",{className:f("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>d(y),title:rn(b)},b.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:c.map(b=>jsxRuntime.jsxs("button",{className:f("history-replay-speed-btn",e.speed===b&&"active"),onClick:()=>m(b),children:[b,"x"]},b))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(b=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:b},b))})]})]})]})]}):jsxRuntime.jsxs("div",{className:f("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function vl(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 xl(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 Pp(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 Mp(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Mv(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),d=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let l=a/2,p=r/2;c.vx+=(l-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(b=>{if(c.id===b.id)return;let y=c.x-b.x,C=c.y-b.y,g=Math.sqrt(y*y+C*C)||1,v=o.chargeStrength*i/(g*g);c.vx+=y/g*v,c.vy+=C/g*v;});}),t.forEach(c=>{let l=d.get(typeof c.source=="string"?c.source:c.source.id),p=d.get(typeof c.target=="string"?c.target:c.target.id);if(!l||!p)return;let b=p.x-l.x,y=p.y-l.y,C=Math.sqrt(b*b+y*y)||1,g=(C-o.linkDistance)/C*o.forceStrength*i;l.vx+=b*g,l.vy+=y*g,p.vx-=b*g,p.vy-=y*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Fp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:m}){let i=react.useRef(null),[c,l]=react.useState([]),[p,b]=react.useState(null),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,u]=react.useState(1),[k,x]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let U=Mv(e,t,a.width,a.height,a,150);l(U);},[e,t,a]);let D=react.useCallback((U,j)=>{a.enableDragging&&(j.stopPropagation(),b(U));},[a.enableDragging]),T=react.useCallback(U=>{if(!p||!i.current)return;let se=i.current.getBoundingClientRect(),ee=(U.clientX-se.left-k.x)/h,ie=(U.clientY-se.top-k.y)/h;l(ve=>ve.map(Ce=>Ce.id===p?{...Ce,x:ee,y:ie,fx:ee,fy:ie}:Ce));},[p,h,k]),w=react.useCallback(()=>{b(null);},[]),L=react.useCallback((U,j)=>{j.stopPropagation(),d?.({type:"node-click",node:U,position:{x:j.clientX,y:j.clientY}});},[d]),B=react.useCallback((U,j)=>{j.stopPropagation(),d?.({type:"edge-click",edge:U,position:{x:j.clientX,y:j.clientY}});},[d]),N=react.useCallback(U=>{let j=c.find(se=>se.id===U);return j?{x:j.x,y:j.y}:{x:0,y:0}},[c]),$=react.useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let j=U.card.priority;return j==="URGENT"?"#ef4444":j==="HIGH"?"#f59e0b":j==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:f("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:f("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>u(U=>Math.min(U+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>u(U=>Math.max(U-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{u(1),x({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(U=>U.type))).map(U=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:vl(U)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Pp(U)," ",xl(U)]})]},U))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let j=N(typeof U.source=="string"?U.source:U.source.id),se=N(typeof U.target=="string"?U.target:U.target.id),ee=Mp(U.type),ie=g===U.id,ve=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-edge",ie&&"hovered",ve&&"critical"),onMouseEnter:()=>v(U.id),onMouseLeave:()=>v(null),onClick:Ce=>B(U,Ce),children:[jsxRuntime.jsx("line",{x1:j.x,y1:j.y,x2:se.x,y2:se.y,stroke:vl(U.type),strokeWidth:ve?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ie?1:.6,markerEnd:ee?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ie&&jsxRuntime.jsx("text",{x:(j.x+se.x)/2,y:(j.y+se.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:xl(U.type)})]},U.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map(U=>{let j=y===U.id,se=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-node",j&&"hovered",se&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:ee=>D(U.id,ee),onMouseEnter:()=>C(U.id),onMouseLeave:()=>C(null),onClick:ee=>L(U,ee),children:[jsxRuntime.jsx("circle",{r:se?a.nodeSize*1.2:a.nodeSize,fill:$(U),stroke:se?"#fbbf24":"#ffffff",strokeWidth:se?3:2,opacity:j?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.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 Ip({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[d,m]=react.useState(false),[i,c]=react.useState(null),[l,p]=react.useState(null),b=react.useRef(null),y=d||o;react.useEffect(()=>{e&&b.current&&b.current.focus();},[e]),react.useEffect(()=>{let h=u=>{u.key==="Escape"&&!y&&C();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,y]);let C=()=>{y||(n(""),c(null),p(null),t());},g=async()=>{if(!(!s.trim()||y)){m(true),c(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},v=()=>{l&&(a(l),C());};return e?jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:C,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,u)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},u))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,u)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},u)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:b,value:s,onChange:h=>n(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,u)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},u))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:C,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var kl={"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 Av={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Lv={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 Iv(e,t,a){let r=kl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function nn(e){return `$${e.toFixed(4)}`}var wl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Iv(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,p)=>l+p.cost,0),s=a.reduce((l,p)=>l+p.inputTokens,0),n=a.reduce((l,p)=>l+p.outputTokens,0),d=a.filter(l=>l.success),m=a.reduce((l,p)=>l+p.duration,0),i={},c={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,c[l.feature]=(c[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:m,percentUsed:i,isExceeded:d>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},no=new wl;function Op({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(no.getStats()),[s,n]=react.useState(no.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(no.getStats()),n(no.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let d=no.getRecentOperations(5);return jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:nn(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,i])=>{let c=r.costsByFeature[m]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:nn(c)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:d.map(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:nn(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Hp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=react.useState(""),[m,i]=react.useState(""),[c,l]=react.useState(""),[p,b]=react.useState(false),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,u]=react.useState(null),k=react.useRef(null),x=p||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let B=N=>{N.key==="Escape"&&!x&&D();};if(e)return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[e,x]);let D=()=>{x||(d(""),i(""),l(""),C(null),v(null),u(null),t());},T=async()=>{if(!(!n.trim()||x)){b(true),C(null),v(null),u(null);try{let B=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});v(B.tasks.tasks),u({from_cache:B.from_cache,tokens_used:B.tokens_used,mock_mode:B.mock_mode,similarity:B.similarity,tokens_saved:B.tokens_saved});}catch(B){C(B instanceof Error?B.message:"Failed to generate tasks");}finally{b(false);}}},w=()=>{g&&(a(g),D());};if(!e)return null;let L=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:D,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% 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((B,N)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",N+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:B.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"})]}),B.start," \u2192 ",B.end]}),jsxRuntime.jsxs("span",{children:[B.duration," days"]}),B.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",B.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${B.priority==="high"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:B.priority})]})},B.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:k,value:n,onChange:B=>d(B.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:B=>i(B.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:x})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:B=>l(B.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:x})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((B,N)=>jsxRuntime.jsx("button",{onClick:()=>d(B),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:B},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:D,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:T,disabled:!n.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Tasks"})]})]})]})})]})}function fs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&bn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,h,u)=>{console.warn(`Retry attempt ${h} after ${u}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=react.useCallback(async(g,v,h)=>{r(u=>{let k=u.cards.find(B=>B.id===g);if(!k)return u;let x=k.columnId,D={...k,columnId:v,position:h},T=u.cards.map(B=>B.id===g?D:B),w=u.columns.map(B=>{if(B.id===x)return {...B,cardIds:B.cardIds.filter(N=>N!==g)};if(B.id===v){let N=T.filter($=>$.columnId===v).sort(($,U)=>$.position-U.position);return {...B,cardIds:N.map($=>$.id)}}return B}),L={...u,cards:T,columns:w};return o(L),L});},[o]),n=react.useCallback(async(g,v)=>{r(h=>{let u=h.cards.map(x=>x.id===g?{...x,...v}:x),k={...h,cards:u};return o(k),k});},[o]),d=react.useCallback(async g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let u={...g,id:v},k=h.columns.map(D=>D.id===g.columnId?{...D,cardIds:[...D.cardIds,v]}:D),x={...h,cards:[...h.cards,u],columns:k};return o(x),x});},[o]),m=react.useCallback(async g=>{r(v=>{let h=v.cards.find(D=>D.id===g);if(!h)return v;let u=v.cards.filter(D=>D.id!==g),k=v.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(T=>T!==g)}:D),x={...v,cards:u,columns:k};return o(x),x});},[o]),i=react.useCallback(async g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let u={...g,id:v,cardIds:[]},k={...h,columns:[...h.columns,u]};return o(k),k});},[o]),c=react.useCallback(async(g,v)=>{r(h=>{let u=h.columns.map(x=>x.id===g?{...x,...v}:x),k={...h,columns:u};return o(k),k});},[o]),l=react.useCallback(async g=>{r(v=>{let h=v.cards.filter(x=>x.columnId!==g),u=v.columns.filter(x=>x.id!==g),k={...v,cards:h,columns:u};return o(k),k});},[o]),p=react.useCallback(g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(g),v},[d]),b=react.useCallback(g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),v},[i]),y=react.useCallback(()=>{r(g=>{let v={...g,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:l},setBoard:r,helpers:{addCard:p,addColumn:b,deleteCard:m,deleteColumn:l,clearBoard:y}}}function Wp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=fs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:i??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var sn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},_p={by:"none",order:"asc"};function Vp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...sn,...e}),[s,n]=react.useState({..._p,...t}),d=react.useCallback(C=>{o(g=>({...g,...C}));},[]),m=react.useCallback(C=>{n(g=>({...g,...C}));},[]),i=react.useCallback(()=>{o(sn),n(_p);},[]),c=react.useCallback(()=>{a&&o({...sn,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...sn,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...sn,priorities:["HIGH","URGENT"]});},[]),b=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(C=>{let g=[...C];if(r.search){let v=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(v)||h.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,h=v.getFullYear(),u=String(v.getMonth()+1).padStart(2,"0"),k=String(v.getDate()).padStart(2,"0"),x=`${h}-${u}-${k}`;g=g.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let T=D.endDate||D.dueDate;if(!T)return false;let w;if(typeof T=="string")w=T.split("T")[0]||T;else {let L=T.getUTCFullYear(),B=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");w=`${L}-${B}-${N}`;}switch(r.dateFilter){case "overdue":return w<x;case "today":return w===x;case "this-week":let L=new Date(x+"T00:00:00"),B=new Date(w+"T00:00:00"),N=new Date(L);return N.setDate(N.getDate()+7),B>=L&&B<=N;case "custom":if(r.dateRange){let $=typeof T=="string"?new Date(T):T;return $>=r.dateRange.start&&$<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(g=g.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(u=>r.assignees.includes(u)))),r.labels.length>0&&(g=g.filter(v=>v.labels&&v.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&g.sort((v,h)=>{let u=0;switch(s.by){case "created":let k=v.createdAt?new Date(v.createdAt).getTime():0,x=h.createdAt?new Date(h.createdAt).getTime():0;u=k-x;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=D[v.priority||"LOW"],w=D[h.priority||"LOW"];u=T-w;break;case "dueDate":let L=v.endDate||v.dueDate,B=h.endDate||h.dueDate;if(!L)return 1;if(!B)return -1;let N=typeof L=="string"?new Date(L).getTime():L.getTime(),$=typeof B=="string"?new Date(B).getTime():B.getTime();u=N-$;break;case "title":u=v.title.localeCompare(h.title);break;case "estimate":let U=v.estimatedTime||0,j=h.estimatedTime||0;u=U-j;break;default:u=0;}return s.order==="asc"?u:-u}),g},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:l,filterHighPriority:p,applyFilters:y,hasActiveFilters:b}}var Kp,Yp;if(typeof window<"u")try{let e=un("ai");Kp=e.generateObject,Yp=e.generateText;}catch{}function qp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Kp&&Yp&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let b=p instanceof Error?p:new Error("Failed to generate plan");throw o(b),b}finally{a(false);}},[s]),d=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let b=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(b),b}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let b=p instanceof Error?p:new Error("Failed to predict risks");throw o(b),b}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(p){let b=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(b),b}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(p){let b=p instanceof Error?p:new Error("Failed to estimate effort");throw o(b),b}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function Tl(){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 Xp(e){let{cards:t}=e,[a,r]=Tl(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,p)=>{if(!p){r({selectedCardIds:[l],lastSelectedCardId:l});return}let b=p.ctrlKey||p.metaKey,y=p.shiftKey;if(b)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(C=>C!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(y&&a.lastSelectedCardId){let C=t.find(v=>v.id===l),g=t.find(v=>v.id===a.lastSelectedCardId);if(C&&g&&C.columnId===g.columnId){let v=t.filter(w=>w.columnId===C.columnId).sort((w,L)=>w.position-L.position),h=v.findIndex(w=>w.id===a.lastSelectedCardId),u=v.findIndex(w=>w.id===l),[k,x]=h<u?[h,u]:[u,h],D=v.slice(k,x+1).map(w=>w.id),T=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:T,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),c=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:m,toggleCard:i,getSelectedCards:c}}var Jp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Zp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Jp,...a}),[a]),[s,n]=react.useState([]),d=react.useCallback((C,g,v,h,u)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:C,cardIds:g,columnId:v,strategy:h,color:u,isExpanded:true,position:s.filter(x=>x.columnId===v).length,createdAt:new Date};n(x=>[...x,k]);},[o.minCardsPerStack,s]),m=react.useCallback(C=>{n(g=>g.filter(v=>v.id!==C));},[]),i=react.useCallback(C=>{n(g=>g.map(v=>v.id===C?{...v,isExpanded:!v.isExpanded}:v));},[]),c=react.useCallback((C,g)=>{n(v=>v.map(h=>h.id===C&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),l=react.useCallback((C,g)=>{n(v=>v.map(h=>{if(h.id===C){let u=h.cardIds.filter(k=>k!==g);return u.length<o.minCardsPerStack?null:{...h,cardIds:u}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=react.useCallback(C=>s.filter(g=>g.columnId===C).sort((g,v)=>g.position-v.position),[s]),b=react.useCallback(async C=>{let g=t.filter(x=>x.columnId===C);if(g.length<o.minCardsPerStack*2)return [];let v=[],h=new Map;g.forEach(x=>{x.labels&&x.labels.length>0&&x.labels.forEach(D=>{h.has(D)||h.set(D,[]),h.get(D).push(x);});}),h.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:x.map(T=>T.id),columnId:C,strategy:"labels",color:"#3b82f6"},reason:`${x.length} cards with label "${D}"`,confidence:.85});});let u=new Map;g.forEach(x=>{x.assignedUserIds&&x.assignedUserIds.length>0&&x.assignedUserIds.forEach(D=>{u.has(D)||u.set(D,[]),u.get(D).push(x);});}),u.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:x.map(T=>T.id),columnId:C,strategy:"assignee",color:"#8b5cf6"},reason:`${x.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(g.forEach(x=>{x.priority&&(k.has(x.priority)||k.set(x.priority,[]),k.get(x.priority).push(x));}),k.forEach((x,D)=>{if(x.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";v.push({stack:{title:`${T} ${D} Priority`,cardIds:x.map(w=>w.id),columnId:C,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${x.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let x of g){let T=(await r.findSimilar(x,g)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let w=[x.id,...T.map(B=>B.card.id)],L=T.reduce((B,N)=>B+N.similarity,0)/T.length;v.push({stack:{title:`\u2728 Similar to "${x.title.substring(0,30)}${x.title.length>30?"...":""}"`,cardIds:w,columnId:C,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:L});}}return v.filter(x=>x.confidence>=o.autoStackConfidenceThreshold).sort((x,D)=>D.confidence-x.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(C=>{d(C.stack.title,C.stack.cardIds,C.stack.columnId,C.stack.strategy,C.stack.color);},[d]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let v=await b(g),h=v[0];v.length>0&&h&&h.confidence>=.9&&y(h);});},[]),{stacks:s,createStack:d,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:l,getStacksForColumn:p,getSuggestions:b,applySuggestion:y,config:o}}var Qp=react.createContext(null);function eu({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=un("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=un("@libxai/core");n.set(m.id,new i(m));});let d=null;if(t?.board){let{Board:m}=un("@libxai/core");d=new m(t.board);}r.current=new core.BoardStore({board:d,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Qp.Provider,{value:{store:o},children:e})}function bs(){let e=react.useContext(Qp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function dn(){let e=bs(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=react.useCallback(h=>{e.updateBoard(h);},[e]),m=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,u)=>{e.updateColumn(h,u);},[e]),c=react.useCallback(h=>{e.deleteColumn(h);},[e]),l=react.useCallback(h=>e.getColumn(h),[e]),p=react.useCallback(h=>{e.addCard(h);},[e]),b=react.useCallback((h,u)=>{e.updateCard(h,u);},[e]),y=react.useCallback(h=>{e.deleteCard(h);},[e]),C=react.useCallback((h,u,k)=>{e.moveCard(h,u,k);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),v=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:l,addCard:p,updateCard:b,deleteCard:y,moveCard:C,getCard:g,getCardsByColumn:v}}function au(e){let{cards:t}=dn();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function ru(e="position",t="asc"){let{cards:a}=dn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?d[o.priority]:0,i=s.priority?d[s.priority]:0;n=m-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var hs=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=rd.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Jv=new hs;function nu({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:m}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=c.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},b=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:p,className:o,children:jsxRuntime.jsx("div",{style:b,children:l.map(y=>{let C=e[y.index];if(!C)return null;let g=m?m(C,y.index):y.index,v={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:v,"data-index":y.index,children:r(C,y.index)},g)})})})}function su(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 lu({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:m,horizontal:i=true}){let c=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:d}),p=l.getVirtualItems(),b={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:c,style:b,className:s,children:jsxRuntime.jsx("div",{style:y,children:p.map(C=>{let g=e[C.index];if(!g)return null;let v=m?m(g,C.index):C.index,h={position:"absolute",top:0,left:C.start,width:C.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":C.index,children:o(g,C.index)},v)})})})}function du(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 cu(e,t=10){return e>t}var El={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Pl={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ml={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Fl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ll={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Il={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Bl={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)"},Rl={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)"},Ol={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},zl={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}},Ul={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},ys={spacing:El,borderRadius:Pl,fontSize:Ml,fontWeight:Fl,lineHeight:Al,zIndex:Ll,duration:Il,easing:Bl,shadows:Rl,opacity:Ol,kanban:zl,gantt:Ul};function mu(e,t,a){return e[t]??a}function Hl(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)?Hl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function ex(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function $l(e="asakaa"){let t=Hl(ys),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=ex(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
390
390
|
${a.join(`
|
|
391
391
|
`)}
|
|
392
392
|
}`}function cn(e,t="asakaa"){let a=[],r=Hl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
@@ -394,7 +394,7 @@ ${a.join(`
|
|
|
394
394
|
`)}
|
|
395
395
|
}`}var vs={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Wl={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Gl={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function _l(e=vs,t="asakaa"){let a=$l(t),r=cn(e,t);return `${a}
|
|
396
396
|
|
|
397
|
-
${r}`}function
|
|
397
|
+
${r}`}function pu(){return `/**
|
|
398
398
|
* ASAKAA Design Tokens
|
|
399
399
|
* Auto-generated from design-tokens.ts
|
|
400
400
|
* Do not edit this file directly
|
|
@@ -415,6 +415,6 @@ ${cn(Gl,"asakaa").split(`
|
|
|
415
415
|
`).slice(1,-1).join(`
|
|
416
416
|
`)}
|
|
417
417
|
}
|
|
418
|
-
`}var
|
|
419
|
-
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=
|
|
418
|
+
`}var tx=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function uu({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=wo();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,d])=>{let m=n,i=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${d.displayName} theme`,"aria-pressed":i,title:d.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(tx,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:d.displayName})]},m)})})}
|
|
419
|
+
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=Op;exports.AI_FEATURES=Lv;exports.AI_MODELS=kl;exports.AddCardButton=Qs;exports.AddColumnButton=Zs;exports.AttachmentUploader=nr;exports.BoardProvider=eu;exports.BulkOperationsToolbar=Mn;exports.BurnDownChart=mi;exports.CUSTOM_FIELD_TYPES=cp;exports.CalendarBoard=kp;exports.Card=cr;exports.CardDetailModal=ni;exports.CardDetailModalV2=li;exports.CardHistoryReplay=Ep;exports.CardHistoryTimeline=Dp;exports.CardRelationshipsGraph=Fp;exports.CardStack=Tv;exports.CardTemplateSelector=yi;exports.CircuitBreaker=Fs;exports.Column=bo;exports.ColumnManager=On;exports.CommandPalette=ai;exports.ConfigMenu=wi;exports.ContextMenu=No;exports.DEFAULT_SHORTCUTS=Ko;exports.DEFAULT_TABLE_COLUMNS=lp;exports.DEFAULT_TEMPLATES=hi;exports.DateRangePicker=Ro;exports.DependenciesSelector=zo;exports.DependencyLine=Vn;exports.DistributionCharts=pi;exports.EditableColumnTitle=Us;exports.ErrorBoundary=yo;exports.ExportImportModal=xi;exports.FilterBar=ki;exports.GANTT_AI_SYSTEM_PROMPT=mm;exports.GanttAIAssistant=Xn;exports.GanttBoard=sm;exports.GanttI18nContext=To;exports.GanttMilestone=Kn;exports.GanttToolbar=Rn;exports.GenerateGanttTasksDialog=Hp;exports.GeneratePlanModal=Ip;exports.GroupBySelector=fi;exports.KanbanBoard=Er;exports.KanbanToolbar=Xs;exports.KanbanViewAdapter=_o;exports.KeyboardShortcutsHelp=bi;exports.ListView=ip;exports.MenuIcons=Lt;exports.PluginManager=hs;exports.PrioritySelector=jr;exports.RATE_LIMITS=Av;exports.STANDARD_FIELDS=dp;exports.SwimlaneBoardView=ui;exports.TagBadge=$s;exports.TagList=Ud;exports.TagPicker=Nr;exports.TaskBar=Wn;exports.TaskDetailModal=mr;exports.TaskFormModal=cm;exports.TaskGrid=Hn;exports.ThemeModal=Di;exports.ThemeProvider=Nc;exports.ThemeSwitcher=uu;exports.Timeline=qn;exports.UserAssignmentSelector=Yr;exports.VelocityChart=ci;exports.VirtualGrid=lu;exports.VirtualList=nu;exports.aiUsageTracker=no;exports.borderRadius=Pl;exports.calculatePosition=fn;exports.calendarDarkTheme=bl;exports.calendarEnTranslations=pl;exports.calendarEsTranslations=ul;exports.calendarLightTheme=hl;exports.calendarNeutralTheme=yl;exports.calendarThemes=ps;exports.calendarTranslations=cs;exports.cardToGanttTask=Qn;exports.cardsToGanttTasks=ym;exports.cn=f;exports.createKanbanView=oc;exports.createRetryWrapper=Hu;exports.darkTheme=Ci;exports.darkTokenTheme=vs;exports.defaultTheme=An;exports.designTokens=ys;exports.duration=Il;exports.easing=Bl;exports.exportTokensToCSS=pu;exports.findTaskByName=br;exports.fontSize=Ml;exports.fontWeight=Fl;exports.formatCost=nn;exports.ganttEnTranslations=In;exports.ganttEsTranslations=Sc;exports.ganttTaskToCardUpdate=hm;exports.ganttThemes=qe;exports.ganttTokens=Ul;exports.ganttTranslations=Si;exports.ganttUtils=ye;exports.generateCSSVariables=$l;exports.generateCompleteCSS=_l;exports.generateInitialPositions=Ru;exports.generateTasksContext=pm;exports.generateThemeVariables=cn;exports.getCalendarTheme=wp;exports.getCalendarTranslations=tn;exports.getListViewTheme=mp;exports.getListViewTranslations=tl;exports.getMonthNames=pp;exports.getToken=mu;exports.getTranslations=Ec;exports.getWeekdayNames=up;exports.kanbanTokens=zl;exports.lightTheme=Ti;exports.lightTokenTheme=Wl;exports.lineHeight=Al;exports.listViewDarkTheme=dl;exports.listViewEnTranslations=Qi;exports.listViewEsTranslations=el;exports.listViewLightTheme=cl;exports.listViewNeutralTheme=ml;exports.listViewThemes=ds;exports.listViewTranslations=es;exports.mergeCalendarTranslations=ms;exports.mergeListViewTranslations=ts;exports.mergeTranslations=Ei;exports.neutralTheme=Ni;exports.neutralTokenTheme=Gl;exports.opacity=Ol;exports.parseLocalCommand=fm;exports.parseNaturalDate=Xi;exports.parseNaturalDuration=Ji;exports.parseProgress=Zi;exports.parseStatus=gm;exports.pluginManager=Jv;exports.retrySyncOperation=Uu;exports.retryWithBackoff=bn;exports.shadows=Rl;exports.shouldVirtualizeGrid=cu;exports.spacing=El;exports.themes=eo;exports.useAI=qp;exports.useBoard=Wp;exports.useBoardCore=dn;exports.useBoardStore=bs;exports.useCardStacking=Zp;exports.useDragState=Ys;exports.useFilteredCards=au;exports.useFilters=Vp;exports.useGanttI18n=Lr;exports.useKanbanState=fs;exports.useKeyboardShortcuts=wc;exports.useMultiSelect=Xp;exports.useSelectionState=Tl;exports.useSortedCards=ru;exports.useTheme=wo;exports.useVirtualGrid=du;exports.useVirtualList=su;exports.validateAIResponse=bm;exports.withErrorBoundary=ei;exports.wouldCreateCircularDependency=yn;exports.zIndex=Ll;//# sourceMappingURL=index.cjs.map
|
|
420
420
|
//# sourceMappingURL=index.cjs.map
|