@libxai/board 1.3.0 → 1.4.0
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 +60 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +60 -60
- package/dist/index.js.map +1 -1
- package/dist/styles.css +135 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Ld(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=Ld(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,b)=>{i[g]=l[b]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.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),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.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 Ld(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 Id(e,t){switch(t){case "json":return Fg(e);case "csv":return Ag(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Bd(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 ai=createContext(null);function Rd(){return useContext(ai)}var Od=createContext(null);function $d({children:e,themeName:t}){return jsx(Od.Provider,{value:{themeName:t},children:e})}function Mo(){return useContext(Od)}function yt({children:e,container:t}){let[a,r]=useState(false),o=Rd(),s=Mo();if(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:l,themeName:m}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var Gd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Ug="#BDC3C7",Hg=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function co({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),l=useRef(null),m=useRef(null),i=()=>{if(!m.current)return;let g=m.current.getBoundingClientRect(),b=window.innerHeight,w=window.innerWidth,f=160,y=220,h=4,v=g.right-f;v<10&&(v=g.left),v+f>w-10&&(v=w-f-10);let T=b-g.bottom,D=g.top,N;T>=y+h?N=g.bottom+h:D>=y+h?N=g.top-y-h:N=T>=D?g.bottom+h:Math.max(10,g.top-y-h),n({top:N,left:v}),o(true);};useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&!m.current?.contains(b.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=b=>{b.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let c=g=>{t(g),o(false);},d=e?Gd[e]:null,p=d?.color||Ug;return jsxs("div",{className:`relative ${a||""}`,children:[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:d?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children: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&&jsx(yt,{children:jsxs("div",{ref:l,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:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsxs("div",{className:"py-1",children:[Object.entries(Gd).map(([g,b])=>jsxs("button",{onClick:()=>c(g),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:b.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx(Hg,{color:b.color}),jsx("span",{className:"font-semibold text-sm",children:b.label}),e===g&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Wg=[{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 Jo({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),p=(Mo()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),T=window.innerHeight,D=window.innerWidth,N=320,E=380,k=4,R=v.left;R+N>D-10&&(R=D-N-10),R<10&&(R=10);let I=T-v.bottom,C=v.top,W;I>=E+k?W=v.bottom+k:C>=E+k?W=v.top-E-k:W=I>=C?v.bottom+k:Math.max(10,v.top-E-k),l({top:W,left:R}),s(true);};useEffect(()=>{let v=T=>{m.current&&!m.current.contains(T.target)&&!i.current?.contains(T.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),useEffect(()=>{let v=T=>{T.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let b=v=>{let T=new Date,D=R=>{let I=R.getFullYear(),C=String(R.getMonth()+1).padStart(2,"0"),W=String(R.getDate()).padStart(2,"0");return `${I}-${C}-${W}`},N=D(T),E=new Date(T);E.setDate(E.getDate()+v);let k=D(E);a(N,k),s(false);},w=()=>{if(!e||!t)return "Set date";let v=E=>{if(E instanceof Date)return E;if(typeof E!="string"||!E.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=E.split("-").map(Number);if(k.length!==3||k.some(W=>isNaN(W)))return null;let R=k[0],I=k[1],C=k[2];return R===void 0||I===void 0||C===void 0?null:new Date(R,I-1,C)},T=v(e),D=v(t);if(!T||!D||isNaN(T.getTime())||isNaN(D.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[T.getMonth()]} ${T.getDate()} \u2013 ${N[D.getMonth()]} ${D.getDate()}`},f=e&&t,h=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,T=new Date;return T.setHours(0,0,0,0),v<T})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):g(),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:f?`${w()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:w()})]}),o&&jsx(yt,{children: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:[jsxs("div",{className:"p-4 border-b",style:{borderColor:p?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[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"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:Wg.map(v=>jsx("button",{onClick:()=>b(v.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:T=>{T.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",T.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",T.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.label))})]}),jsxs("div",{className:"p-4",children:[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"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:v=>a(v.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"}}),jsx("input",{type:"date",value:t||"",onChange:v=>a(e,v.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)&&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:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function uo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[l,m]=useState(""),[i,c]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),g=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),v=window.innerHeight,T=window.innerWidth,D=300,N=380,E=4,k=h.right-D;k<10&&(k=h.left),k+D>T-10&&(k=T-D-10);let R=v-h.bottom,I=h.top,C;R>=N+E?C=h.bottom+E:I>=N+E?C=h.top-N-E:C=R>=I?h.bottom+E:Math.max(10,h.top-N-E),c({top:C,left:k}),n(true);};useEffect(()=>{let h=v=>{d.current&&!d.current.contains(v.target)&&!p.current?.contains(v.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=v=>{v.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let b=h=>{let v=e.some(T=>T.id===h.id);a(v?e.filter(T=>T.id!==h.id):[...e,h]);},w=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),f=e.slice(0,o),y=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,onClick:()=>s?n(false):g(),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?jsxs("div",{className:"asakaa-avatar-group",children:[f.map(h=>jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),y>0&&jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):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:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[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"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(yt,{children:jsxs("div",{ref:d,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:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,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})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:w.length===0?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"}):w.map(h=>{let v=e.some(T=>T.id===h.id);return jsxs("button",{onClick:()=>b(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:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[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?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),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}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#3b82f6":"transparent"},children:v?"\u2713":""})]},h.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children: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 On(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 d=c;return d.taskId||d.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,l=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)&&l(c))return true;if(n.has(c))return true}}return n.delete(m),false};return l(a)}function Qo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,m]=useState(false),[i,c]=useState(""),[d,p]=useState(t.length>0),[g,b]=useState({top:0,left:0}),[w,f]=useState(null),y=useRef(null),h=useRef(null),v=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),R=window.innerHeight,I=window.innerWidth,C=300,W=d?380:120,H=4,x=k.right-C;x<10&&(x=k.left),x+C>I-10&&(x=I-C-10);let te=R-k.bottom,oe=k.top,ne;te>=W+H?ne=k.bottom+H:oe>=W+H?ne=k.top-W-H:ne=te>=oe?k.bottom+H:Math.max(10,k.top-W-H),b({top:ne,left:x}),m(true);};useEffect(()=>{if(!l||!h.current)return;let k=h.current.getBoundingClientRect(),R=window.innerHeight,I=window.innerWidth,C=300,W=d?380:120,H=4,x=k.right-C;x<10&&(x=k.left),x+C>I-10&&(x=I-C-10);let te=R-k.bottom,oe=k.top,ne;te>=W+H?ne=k.bottom+H:oe>=W+H?ne=k.top-W-H:ne=te>=oe?k.bottom+H:Math.max(10,k.top-W-H),b({top:ne,left:x});},[d,l]),useEffect(()=>{let k=R=>{y.current&&!y.current.contains(R.target)&&!h.current?.contains(R.target)&&(m(false),c(""));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{let k=R=>{R.key==="Escape"&&(m(false),c(""));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]);let T=k=>{let R=t.includes(k),I=a.find(C=>C.id===k);if(f(null),R){let C=t.filter(W=>W!==k);r(C),C.length===0&&p(false);}else {if(s&&On(a,k,e)){let W=`Cannot add "${I?.title||k}" as dependency - would create circular reference`;f(W),n?.(k,I?.title||k),setTimeout(()=>f(null),3e3);return}r([...t,k]),p(true);}},D=()=>{let k=!d;p(k),k||r([]);},N=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),E=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:h,onClick:()=>l?m(false):v(),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:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children: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:E,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:E},children:t.length})]}),l&&jsx(yt,{children:jsxs("div",{ref:y,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.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:[w&&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:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children: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"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:w})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children: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"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:k=>c(k.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})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:N.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):N.map(k=>{let R=t.includes(k.id);return jsxs("button",{onClick:()=>T(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.currentTarget.style.background="transparent";},children:[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:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children: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 Er=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:p,transition:g,isDragging:b}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),w={transform:Ln.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:d,style:w,...i,...c,onClick:()=>a?.(e),children:t(e)});let f=l.filter(T=>e.assignedUserIds?.includes(T.id)),y=e.progress===100,h=(e.attachments||[]).filter(T=>T.type.startsWith("image/")),v={...w,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:v,className:u("asakaa-card",b&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:T=>{T.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:T=>{T.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?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:T=>{T.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((T,D)=>jsxs("div",{className:"relative",children:[jsx("img",{src:T.url,alt:T.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:N=>{N.currentTarget.style.display="none";}}),D===3&&h.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},T.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:y?"line-through":"none",opacity:y?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:T=>T.stopPropagation(),className:"priority-selector",children:jsx(co,{priority:e.priority,onChange:T=>n?.(e.id,{priority:T})})}),jsx("div",{onClick:T=>T.stopPropagation(),className:"date-picker",children:jsx(Jo,{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:(T,D)=>n?.(e.id,{startDate:T,endDate:D})})}),l.length>0&&jsx("div",{onClick:T=>T.stopPropagation(),className:"user-selector",children:jsx(uo,{assignedUsers:f,availableUsers:l,onChange:T=>n?.(e.id,{assignedUserIds:T.map(D=>D.id)})})}),jsx("div",{onClick:T=>T.stopPropagation(),className:"dependencies-selector",children:jsx(Qo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(T=>typeof T=="string"?T:T.taskId):[],availableTasks:m,onChange:T=>n?.(e.id,{dependencies:T})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(T=>jsx("span",{className:"asakaa-label",children:T},T))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children: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)));Er.displayName="Card";var $n={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"}},Qd=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function ec({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),c=[...Object.entries($n).map(([f,y])=>({id:f,label:y.label,color:y.color,icon:y.icon})),...r.filter(f=>!Object.keys($n).includes(f.id)).map(f=>({id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let f=$n[e];if(f)return {...f,id:e};let y=r.find(h=>h.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{...$n.todo,id:"todo"}},p=()=>{if(!i.current)return;let f=i.current.getBoundingClientRect(),y=window.innerHeight,h=window.innerWidth,v=180,T=280,D=4,N=f.right-v;N<10&&(N=f.left),N+v>h-10&&(N=h-v-10);let E=y-f.bottom,k=f.top,R;E>=T+D?R=f.bottom+D:k>=T+D?R=f.top-T-D:R=E>=k?f.bottom+D:Math.max(10,f.top-T-D),l({top:R,left:N}),s(true);};useEffect(()=>{let f=y=>{m.current&&!m.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),useEffect(()=>{let f=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let g=f=>{t(f),s(false);},b=d(),w=b.color;return jsxs("div",{className:`relative ${a||""}`,children:[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:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:b.label,children:jsx(Qd,{icon:b.icon,color:w})}),o&&jsx(yt,{children: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:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsx("div",{className:"py-1",children:c.map(f=>jsxs("button",{onClick:()=>g(f.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:f.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsx(Qd,{icon:f.icon,color:f.color}),jsx("span",{className:"font-semibold",children:f.label}),e===f.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f.id))})]})})]})}function tc({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[l,m]=useState(false),[i,c]=useState(e),[d,p]=useState({top:0,left:0}),g=useRef(null),b=useRef(null),w=useRef(null);useEffect(()=>{if(s&&b.current){let v=b.current.getBoundingClientRect();p({top:v.bottom+window.scrollY+8,left:v.left+window.scrollX});}},[s]),useEffect(()=>{let v=T=>{g.current&&!g.current.contains(T.target)&&!b.current?.contains(T.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]),useEffect(()=>{let v=T=>{T.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s,e]),useEffect(()=>{l&&w.current&&(w.current.focus(),w.current.select());},[l]);let f=()=>{m(true),c(e);},y=()=>{let v=i.trim();v&&v!==e&&t(v),m(false),n(false),c(e);},h=v=>{v.key==="Enter"?y():v.key==="Escape"&&(m(false),c(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:b,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:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsx(yt,{children:jsx("div",{ref:g,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsx("input",{ref:w,type:"text",value:i,onChange:v=>c(v.target.value),onKeyDown:h,onBlur:y,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})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:f,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:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),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:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[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"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Lo=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:b,onColumnDelete:w,isDeletable:f=false,className:y})=>{let{setNodeRef:h,isOver:v}=useDroppable({id:e.id,data:{type:"column",column:e}}),T=useRef(null),D=c??Sd(t.length),N=useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>d,enabled:D});if(a)return jsx("div",{ref:h,className:y,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),R=k.state==="exceeded",I=()=>"asakaa-column-count";return jsxs("div",{ref:h,className:u("asakaa-column",v&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",y),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u(I()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),k.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),k.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),k.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(b||w)&&jsx(tc,{columnTitle:e.title,onRename:C=>b?.(e.id,C),onDelete:w?()=>w(e.id):void 0,isDeletable:f}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsx(SortableContext,{items:t.map(C=>C.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):D?jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(C=>{let W=t[C.index];return W?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsx(Er,{card:W,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i})},W.id):null})}):t.map(C=>jsx(Er,{card:C,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i},C.id))})})]})});Lo.displayName="Column";function ii({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.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?jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:m,onKeyDown:i,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function df(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 ic(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(l=>{let m=l.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function cf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function mf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var uf=["\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 lc({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:b,maxFileSizeMB:w=10}){let f=l==="dark",[y,h]=useState(false),[v,T]=useState([]),[D,N]=useState(0),[E,k]=useState(null),[R,I]=useState(false),C=useRef(null),W=useRef(null),H=useRef(null),x=useRef(null),te=useCallback((S,K)=>{let J=df(S,K);if(k(J),J){let ie=r.filter(ue=>ue.name.toLowerCase().includes(J.query)||ue.email&&ue.email.toLowerCase().includes(J.query)).slice(0,5);T(ie),h(ie.length>0),N(0);}else h(false),T([]);},[r]),oe=S=>{let K=S.target.value;if(t(K),te(K,S.target.selectionStart||0),C.current){C.current.style.height="24px";let J=C.current.scrollHeight,ie=280,ue=Math.min(J,ie);C.current.style.height=`${ue}px`,C.current.style.overflowY=J>ie?"auto":"hidden";}},ne=()=>{C.current&&te(e,C.current.selectionStart||0);},A=useCallback(S=>{if(!E||!C.current)return;let K=e.slice(0,E.start),J=e.slice(E.end),ie=`@${S.name.replace(/\s+/g,"")} `,ue=K+ie+J;t(ue),h(false),k(null),setTimeout(()=>{if(C.current){let ye=E.start+ie.length;C.current.selectionStart=ye,C.current.selectionEnd=ye,C.current.focus();}},0);},[E,e,t]),ke=S=>{if(y&&v.length>0)switch(S.key){case "ArrowDown":S.preventDefault(),N(K=>K<v.length-1?K+1:0);break;case "ArrowUp":S.preventDefault(),N(K=>K>0?K-1:v.length-1);break;case "Enter":{S.preventDefault();let K=v[D];K&&A(K);break}case "Tab":{S.preventDefault();let K=v[D];K&&A(K);break}case "Escape":S.preventDefault(),h(false);break}else S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),a());};useEffect(()=>{let S=K=>{W.current&&!W.current.contains(K.target)&&C.current&&!C.current.contains(K.target)&&h(false),x.current&&!x.current.contains(K.target)&&I(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let Ie=useCallback(S=>{if(!C.current)return;let K=C.current.selectionStart||e.length,J=e.slice(0,K)+S+e.slice(K);t(J),I(false),setTimeout(()=>{if(C.current){let ie=K+S.length;C.current.selectionStart=ie,C.current.selectionEnd=ie,C.current.focus();}},0);},[e,t]),L=useCallback(S=>{if(!g||!S.target.files)return;let K=Array.from(S.target.files),J=w*1024*1024,ie=K.filter(ue=>ue.size>J?(console.warn(`File ${ue.name} exceeds max size of ${w}MB`),false):true);ie.length>0&&g(ie),S.target.value="";},[g,w]),U=useCallback(S=>S.type.startsWith("image/")?Image:S.type.includes("pdf")||S.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(y&&W.current){let S=W.current.children[D];S&&S.scrollIntoView({block:"nearest"});}},[D,y]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(S=>{let K=U(S.file),J=S.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",f?"bg-white/10":"bg-gray-100"),children:[J&&S.preview?jsx("img",{src:S.preview,alt:S.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(K,{className:u("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:u("text-xs truncate",f?"text-white":"text-gray-900"),children:S.file.name}),jsx("p",{className:u("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:mf(S.file.size)})]}),b&&jsx("button",{onClick:()=>b(S.id),className:u("p-0.5 rounded-full transition-colors",f?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},S.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",f?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!R),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",f?"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:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:R&&jsx(motion.div,{ref:x,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:uf.map(S=>jsx("button",{type:"button",onClick:()=>Ie(S),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",f?"hover:bg-white/10":"hover:bg-gray-100"),children:S},S))})})})]}),d&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",f?"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:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:H,type:"file",multiple:true,onChange:L,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:C,value:e,onChange:oe,onSelect:ne,onKeyDown:ke,placeholder:o||(m==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",f?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&p.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":f?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:y&&v.length>0&&jsx(motion.div,{ref:W,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((S,K)=>jsxs("button",{type:"button",onClick:()=>A(S),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",K===D?f?"bg-white/10":"bg-gray-100":f?"hover:bg-white/5":"hover:bg-gray-50"),children:[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:cf(S.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",f?"text-white":"text-gray-900"),children:S.name}),S.email&&jsx("p",{className:u("text-xs truncate",f?"text-[#6B7280]":"text-gray-500"),children:S.email})]})]},S.id))})})]})]})]})}function dc({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)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,m)=>l.type==="mention"?jsx("span",{className:u("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:l.value},m):jsx("span",{children:l.value},m))})}var Gn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Gr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,m]=useState(false),[i,c]=useState(""),[d,p]=useState(false),[g,b]=useState(Gn[10]||"#3B82F6"),[w,f]=useState({top:0,left:0}),y=useRef(null),h=useRef(null),v=useRef(null),T=useRef(null),D=t.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())),N=t.some(C=>C.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&h.current){let C=h.current.getBoundingClientRect();f({top:C.bottom+6,left:C.left});}},[l]),useEffect(()=>{let C=W=>{let H=W.target,x=y.current?.contains(H),te=v.current?.contains(H);!x&&!te&&(m(false),c(""),p(false));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),useEffect(()=>{l&&T.current&&T.current.focus();},[l]);let E=C=>{let W=e.some(H=>H.id===C.id);a(W?e.filter(H=>H.id!==C.id):[...e,C]);},k=async()=>{if(!(!r||!i.trim())){p(true);try{let C=await r(i.trim(),g);C&&(a([...e,C]),c(""),b(Gn[Math.floor(Math.random()*Gn.length)]||"#3B82F6"));}finally{p(false);}}},R=(C,W)=>{W.stopPropagation(),a(e.filter(H=>H.id!==C));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:y,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&m(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(C=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:v,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:w.top,left:w.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:T,type:"text",value:i,onChange:C=>c(C.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:C=>{C.key==="Enter"&&i.trim()&&!N&&r&&k();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(C=>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:`${C.color}20`,color:C.color},onClick:W=>R(C.id,W),children:[C.name,jsx(X,{className:"w-3 h-3"})]},C.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(C=>{let W=e.some(H=>H.id===C.id);return jsxs("button",{type:"button",onClick:()=>E(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:W?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:H=>{W||(H.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:H=>{W||(H.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsx("span",{className:"flex-1 text-left",children:C.name}),W&&jsx(Check,{className:"w-4 h-4",style:{color:C.color}})]},C.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!N&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Gn.map(C=>jsx("button",{type:"button",onClick:()=>b(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:g===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxs("button",{type:"button",onClick:k,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function di({tag:e,onRemove:t,size:a="sm"}){return 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&&jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function mc({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 jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(di,{tag:s,size:a},s.id)),o>0&&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 go=[{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 uc(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function kf(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function wf({className:e}){return jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function ci({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=kf(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},m=uc(e.loggedMinutes),i=e.estimateMinutes?uc(e.estimateMinutes):null,c=a&&i?`${m} / ${i}`:m;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(wf,{className:l[t]}),jsx("span",{children:c})]})}function gc(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o)}function _n(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Nf(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Df({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Sf({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function fc({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Ef({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function mi({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:m,onDiscardTimer:i,onClose:c,className:d}){let[p,g]=useState(""),[b,w]=useState(t.estimateMinutes?_n(t.estimateMinutes):""),[f,y]=useState(""),[h,v]=useState(false),[T,D]=useState(false),N=useRef(null);useEffect(()=>{N.current?.focus();},[]);let E=async()=>{let I=gc(p);if(!(I<=0||!s)){v(true);try{await s({durationMinutes:I,note:f.trim()||void 0,source:"manual"}),g(""),y("");}finally{v(false);}}},k=async()=>{if(!n)return;let I=b.trim()?gc(b):null;await n(I),D(false);},R=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),E()),I.key==="Escape"&&c?.();};return jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:c,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(fc,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Nf(o)})]}),jsx("button",{onClick:m,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Sf,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(fc,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Df,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Ef,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:N,type:"text",value:p,onChange:I=>g(I.target.value),onKeyDown:R,placeholder:"2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:E,disabled:h||!p.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:f,onChange:I=>y(I.target.value),onKeyDown:R,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:_n(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),T?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:b,onChange:I=>w(I.target.value),onKeyDown:I=>{I.key==="Enter"&&k(),I.key==="Escape"&&D(false);},onBlur:k,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>D(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?_n(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(I=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:I.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:_n(I.durationMinutes)})]},I.id))})]})]})}function Af(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o)}function Lf(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function fo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,m]=useState(Lf(r)),[i,c]=useState(""),[d,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let b=async()=>{p(true);let v=Af(l);await o(v&&v>0?v:null,i||void 0),p(false);},w=async()=>{p(true),await o(null),p(false);},f=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),b()),v.key==="Escape"&&s();},y={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},h={estimate:"1h 30m",quoted:"1h 30m",log:"1h 30m"};return jsxs("div",{className:u("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:v=>v.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-sm font-medium",a?"text-white":"text-gray-900"),children:y[e]}),jsx("button",{type:"button",onClick:s,className:u("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"mb-3",children:[jsx("input",{ref:g,type:"text",value:l,onChange:v=>m(v.target.value),onKeyDown:f,placeholder:h[e],className:u("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsx("p",{className:u("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 1h 30m, 45m, 2:30":"e.g. 1h 30m, 45m, 2:30"})]}),e==="log"&&jsx("div",{className:"mb-3",children:jsx("input",{type:"text",value:i,onChange:v=>c(v.target.value),onKeyDown:f,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:u("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsx("button",{type:"button",onClick:b,disabled:d||!l.trim(),className:u("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:d?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:w,disabled:d,className:u("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function If(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Bf(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function gi({summary:e,showLabel:t=false,size:a="md",className:r}){let o=If(e.health),s=Bf(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,m=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:u("flex items-center gap-2",r),children:[jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${m}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Io(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Of(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function $f(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function zf(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function Uf({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",m=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",Io(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:u("font-medium",m),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:u("font-medium",m),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:u("font-medium",m),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",m),children:Io(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",m),children:Io(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",m),children:e.totalTasksWithEstimate})]})]})]})]})}function Hf({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null&&e.varianceMinutes>0?"+":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:u("text-xs mt-1",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Io(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:Io(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,Io(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",$f(e.status,a),Of(e.status,a)),children:zf(e.status,t)})})]})}function fi({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#0F1117]":"bg-gray-50",m=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",c=n?"text-[#E5E7EB]":"text-gray-900",d=n?"text-[#9CA3AF]":"text-gray-500",p=n?"bg-[#0F1117]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((b,w)=>b.varianceMinutes===null?1:w.varianceMinutes===null?-1:w.varianceMinutes-b.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",l,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Uf,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",m,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:p,children:jsxs("tr",{children:[jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",i),children:g.map(b=>jsx(Hf,{task:b,locale:a,isDark:n,onClick:s},b.taskId))})]})})}),jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Jn(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function a0(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function Tc(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 r0(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:l=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:g=[],comments:b=[],onAddComment:w,currentUser:f,mentionableUsers:y=[],onUploadCommentAttachments:h,enableTimeTracking:v=false,timeTrackingSummary:T,timeEntries:D=[],isTimerRunning:N=false,timerElapsedSeconds:E=0,onTimeLog:k,onEstimateUpdate:R,onSoldEffortUpdate:I,onTimerStart:C,onTimerStop:W,onTimerDiscard:H}){let x=s==="dark",te={textTertiary:x?"#6B7280":"#9CA3AF",textSecondary:x?"#9CA3AF":"#6B7280",textPrimary:x?"#FFFFFF":"#111827",borderLight:x?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:x?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:x?"#1A1D25":"#FFFFFF",bgSecondary:x?"#0F1117":"#F9FAFB",hoverBg:x?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},oe=e&&"title"in e&&!("name"in e),ne=e,[A,ke]=useState(e?Tc(e,l):null),[Ie,L]=useState(false),[U,S]=useState(false),[K,J]=useState(false),[ie,ue]=useState(null),[ye,Oe]=useState(new Date),[Q,Je]=useState(false),[Pe,rt]=useState(false),[ut,It]=useState(""),[Xe,pt]=useState(false),[ce,Ge]=useState(false),[Be,B]=useState(false),[X$1,ge]=useState(false),[Ae,Ue]=useState(""),nt=useRef(null),Pt=useRef(null),[$e,O]=useState(""),ae=useRef(null),[Le,je]=useState(""),[qe,j]=useState(false),[$,Me]=useState([]),[ht,le]=useState(""),[He,De]=useState(false),Re=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let P=Tc(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),ke(P),Ue(P.description||""),O(P.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!Ae)return;let P=setTimeout(()=>{let re=Pt.current;re&&(re.style.height="auto",re.style.height=`${Math.max(100,re.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,Ae]),useEffect(()=>()=>{nt.current&&clearTimeout(nt.current),ae.current&&clearTimeout(ae.current);},[]),useEffect(()=>{t&&Re.current&&b.length>0&&setTimeout(()=>{Re.current&&(Re.current.scrollTop=Re.current.scrollHeight);},100);},[t,b.length]);let de=useCallback(P=>{ke(P),oe&&o&&ne?o(r0(P,ne)):r&&r(P);},[oe,ne,o,r]),Ve=useCallback(()=>{L(false),S(false),J(false),ue(null),rt(false),It(""),pt(false);},[]),V=useCallback((P,re)=>{if(!A)return;let ve={...A,[P]:re};de(ve);},[A,de]),q=useCallback(()=>{let P=Pt.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),Se=useCallback(P=>{Ue(P),setTimeout(q,0),nt.current&&clearTimeout(nt.current),nt.current=setTimeout(()=>{if(A){let re={...A,description:P};de(re);}},800);},[A,de,q]),Ye=useCallback(P=>{O(P),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{if(A&&P.trim()){let re={...A,name:P.trim()};de(re);}},800);},[A,de]),ze=useCallback(P=>{let re=P.map(ve=>{let Ze={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ve};return ve.type.startsWith("image/")&&(Ze.preview=URL.createObjectURL(ve)),Ze});Me(ve=>[...ve,...re]);},[]),G=useCallback(P=>{Me(re=>{let ve=re.find(Ze=>Ze.id===P);return ve?.preview&&URL.revokeObjectURL(ve.preview),re.filter(Ze=>Ze.id!==P)});},[]),me=useCallback(async()=>{if(!(!A||!Le.trim()&&$.length===0||!w)){j(true);try{let P=ic(Le,y),re=[];if($.length>0&&h){let ve=$.map(Ze=>Ze.file);re=await h(ve);}await w(A.id,Le.trim(),P.length>0?P:void 0,re.length>0?re:void 0),je(""),$.forEach(ve=>{ve.preview&&URL.revokeObjectURL(ve.preview);}),Me([]);}finally{j(false);}}},[A,Le,$,w,y,h]),_e=useCallback(()=>{if(!A||!ht.trim())return;let P={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:ht.trim(),progress:0,startDate:new Date,endDate:new Date},re=[...A.subtasks||[],P],ve={...A,subtasks:re};de(ve),le(""),De(false);},[A,ht,de]),Tt=useCallback(P=>{if(!A?.subtasks)return;let re=A.subtasks.map(Ze=>Ze.id===P?{...Ze,progress:Ze.progress===100?0:100}:Ze),ve={...A,subtasks:re};de(ve);},[A,de]),gt=useCallback(P=>{if(!A?.subtasks)return;let re=A.subtasks.filter(Ze=>Ze.id!==P),ve={...A,subtasks:re};de(ve);},[A,de]),Sr=useCallback(P=>{let re=typeof P=="string"?new Date(P):P,Ze=new Date().getTime()-re.getTime(),aa=Math.floor(Ze/6e4),ia=Math.floor(Ze/36e5),ra=Math.floor(Ze/864e5);return aa<1?n==="es"?"Ahora":"Just now":aa<60?n==="es"?`Hace ${aa} min`:`${aa}m ago`:ia<24?n==="es"?`Hace ${ia}h`:`${ia}h ago`:ra<7?n==="es"?`Hace ${ra}d`:`${ra}d ago`:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),fr=useCallback(P=>{if(!A)return;let re=A.progress||0;P==="completed"?re=100:P==="in-progress"&&re===0?re=10:P==="todo"&&(re=0);let ve={...A,status:P,progress:re};de(ve),L(false);},[A,de]),Ia=useCallback((P,re)=>{if(!A)return;let ve={...A,startDate:P,endDate:re};de(ve);},[A,de]),Ba=useCallback(()=>{let P=ye.getFullYear(),re=ye.getMonth(),ve=new Date(P,re,1),aa=new Date(P,re+1,0).getDate(),ia=ve.getDay(),ra=[],rr=new Date(P,re,0).getDate();for(let Sa=ia-1;Sa>=0;Sa--)ra.push({date:new Date(P,re-1,rr-Sa),isCurrentMonth:false});for(let Sa=1;Sa<=aa;Sa++)ra.push({date:new Date(P,re,Sa),isCurrentMonth:true});let Ta=42-ra.length;for(let Sa=1;Sa<=Ta;Sa++)ra.push({date:new Date(P,re+1,Sa),isCurrentMonth:false});return ra},[ye]),fe=useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),B(false),!A||!d)return;let re=Array.from(P.dataTransfer.files);if(re.length!==0){ge(true);try{await d(A.id,re);}finally{ge(false);}}},[A,d]),Nt=useCallback(async P=>{if(!A||!d||!P.target.files)return;let re=Array.from(P.target.files);if(re.length!==0){ge(true);try{await d(A.id,re);}finally{ge(false);}P.target.value="";}},[A,d]),ot=useCallback(P=>{P.preventDefault(),P.stopPropagation(),B(true);},[]),Or=useCallback(P=>{P.preventDefault(),P.stopPropagation(),B(false);},[]),oo=useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),br=useCallback(P=>P.startsWith("image/")?Image:P.includes("pdf")||P.includes("document")?FileText:File,[]);return !t||!A?null:jsx(AnimatePresence,{children:t&&A&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",x?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",x?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",x?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:u("text-xs font-mono",x?"text-[#6B7280]":"text-gray-400"),children:A.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let P=A.progress===100?0:100,ve={...A,progress:P,status:P===100?"completed":"todo"};de(ve);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",A.progress===100?"bg-green-500 border-green-500":x?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:A.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:$e,onChange:P=>Ye(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",A.progress===100?"line-through text-[#6B7280]":x?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Ve(),L(!Ie);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",A.progress===100||A.status==="completed"?"bg-green-500/20 text-green-400":A.progress&&A.progress>0||A.status==="in-progress"?"bg-blue-500/20 text-blue-400":x?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.progress===100||A.status==="completed"?n==="es"?"COMPLETADO":"DONE":A.progress&&A.progress>0||A.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:Ie&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",x?"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=>jsxs("button",{onClick:()=>fr(P.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",A.status===P.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:x?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Ve(),J(!K);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",x?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[A.assignees&&A.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[A.assignees.slice(0,3).map((P,re)=>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()},re)),A.assignees.length>3&&jsxs("span",{className:u("text-xs",x?"text-[#6B7280]":"text-gray-400"),children:["+",A.assignees.length-3]})]}):jsx("span",{className:u("text-sm",x?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",x?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:K&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>J(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(P=>{let re=A.assignees?.some(ve=>ve.name===P.name);return jsxs("button",{onClick:()=>{let ve=A.assignees||[],Ze;re?Ze=ve.filter(aa=>aa.name!==P.name):Ze=[...ve,P],V("assignees",Ze);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",re&&(x?"bg-white/5":"bg-gray-50")),children:[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()}),jsx("span",{className:u("flex-1",x?"text-white":"text-gray-900"),children:P.name}),re&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",x?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ue(ie?null:"start"),Oe(A.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",x?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[A.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",x?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),A.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:ie&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ue(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",x?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,re=new Date(P);re.setDate(P.getDate()+1);let ve=new Date(P);ve.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Ze=new Date(P);Ze.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let aa=new Date(P);aa.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let ia=new Date(P);ia.setDate(P.getDate()+14);let ra=new Date(P);return ra.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:re,display:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ze,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:aa,display:aa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ia,display:ia.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ra,display:ra.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ta,Sa)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ie==="start"){let no=A.endDate&&Ta.date>A.endDate?Ta.date:A.endDate;Ia(Ta.date,no),ue("end");}else {let no=A.startDate&&Ta.date<A.startDate?Ta.date:A.startDate;Ia(no,Ta.date),ue(null);}},children:[jsx("span",{children:Ta.label}),jsx("span",{className:u("text-xs",x?"text-[#6B7280]":"text-gray-400"),children:Ta.display})]},Sa))})(),jsx("div",{className:u("border-t mt-2 pt-2",x?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Ia(void 0,void 0),ue(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",x?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",x?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ie==="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"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",x?"text-white":"text-gray-900"),children:ye.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>Oe(new Date),className:u("p-1 rounded text-sm transition-colors",x?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Oe(new Date(ye.getFullYear(),ye.getMonth()-1)),className:u("p-1 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>Oe(new Date(ye.getFullYear(),ye.getMonth()+1)),className:u("p-1 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),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=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",x?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ba().map((P,re)=>{let ve=P.date.toDateString()===new Date().toDateString(),Ze=A.startDate?.toDateString()===P.date.toDateString(),aa=A.endDate?.toDateString()===P.date.toDateString(),ia=Ze||aa,ra=A.startDate&&A.endDate&&P.date>=A.startDate&&P.date<=A.endDate;return jsx("button",{onClick:()=>{let rr=new Date(P.date);if(ie==="start"){let Ta=A.endDate&&rr>A.endDate?rr:A.endDate;Ia(rr,Ta),ue("end");}else {let Ta=A.startDate&&rr<A.startDate?rr:A.startDate;Ia(Ta,rr),ue(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(x?"text-white":"text-gray-900"),ve&&"ring-2 ring-[#3B82F6]",Ze&&"bg-[#3B82F6] text-white",aa&&!Ze&&"bg-[#7C3AED] text-white",ra&&!ia&&(x?"bg-[#7C3AED]/20":"bg-purple-100"),!ia&&(x?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},re)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Ve(),S(!U);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",A.priority==="high"||A.priority==="urgent"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":A.priority==="low"?"bg-green-500/20 text-green-400":x?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.priority?A.priority==="high"||A.priority==="urgent"?n==="es"?"Alta":"High":A.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:U&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>S(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",x?"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=>jsxs("button",{onClick:()=>{V("priority",P.id),S(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",A.priority===P.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:x?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",x?"text-white":"text-gray-900"),children:A.startDate&&A.endDate?`${Math.ceil((A.endDate.getTime()-A.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:u("w-4 h-4 rounded-full border-2",x?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Q?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:A.progress||0,onChange:P=>{let re=parseInt(P.target.value),ve=A.status;re===100?ve="completed":re>0?ve="in-progress":ve="todo";let Ze={...A,progress:re,status:ve};de(Ze);},onBlur:()=>Je(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",x?"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}):jsx("button",{onClick:()=>Je(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",x?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",A.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${A.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",x?"text-white":"text-gray-900"),children:[A.progress||0,"%"]})]})]}),v&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:T?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Ge("estimate"),className:u("text-sm px-2 py-0.5 rounded",x?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Jn(T.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Ge("estimate"),className:u("text-sm",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ce==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"estimate",locale:n,isDark:x,currentValue:T?.estimateMinutes||null,onSave:async P=>{await R?.(A.id,P),Ge(false);},onClose:()=>Ge(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:A.quotedMinutes?jsx("button",{type:"button",onClick:()=>Ge("quoted"),className:u("text-sm px-2 py-0.5 rounded",x?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Jn(A.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Ge("quoted"),className:u("text-sm",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ce==="quoted"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"quoted",locale:n,isDark:x,currentValue:A.quotedMinutes||null,onSave:async P=>{I?(await I(A.id,P),ke(re=>re?{...re,quotedMinutes:P}:null)):V("quotedMinutes",P),Ge(false);},onClose:()=>Ge(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[N?jsxs("button",{type:"button",onClick:()=>W?.(A.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),a0(E||0)]}):jsx("button",{type:"button",onClick:()=>C?.(A.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",x?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),jsxs("button",{type:"button",onClick:()=>Ge("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",x?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),T&&T.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[jsxs("span",{className:u("text-sm font-medium",T.health==="over-budget"?"text-red-500":T.health==="at-risk"?"text-yellow-500":x?"text-white":"text-gray-900"),children:[Jn(T.loggedMinutes),T.estimateMinutes&&jsxs("span",{className:u("font-normal",x?"text-[#6B7280]":"text-gray-400"),children:[" / ",Jn(T.estimateMinutes)]})]}),T.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:u("h-full rounded-full transition-all",T.health==="over-budget"?"bg-red-500":T.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,T.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:ce==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"log",locale:n,isDark:x,currentValue:null,onSave:async(P,re)=>{P&&await k?.(A.id,{durationMinutes:P,note:re,source:"manual"}),Ge(false);},onClose:()=>Ge(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(Gr,{selectedTags:A.tags||[],availableTags:m,onChange:P=>{V("tags",P);},onCreateTag:i,theme:te})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[A.dependencies&&A.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:A.dependencies.map(P=>{let re=g.find(ve=>ve.id===P);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",x?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[re?.name||P.slice(0,8),jsx("button",{onClick:()=>{let ve=(A.dependencies||[]).filter(Ze=>Ze!==P);V("dependencies",ve);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},P)})}),jsxs("button",{onClick:()=>{Ve(),rt(!Pe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",x?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Pe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{rt(false),It("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",x?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ut,onChange:P=>It(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",x?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(P=>P.id!==A.id).filter(P=>ut===""||P.name.toLowerCase().includes(ut.toLowerCase())).map(P=>{let re=A.dependencies?.includes(P.id);return jsxs("button",{onClick:()=>{let ve=A.dependencies||[],Ze;re?Ze=ve.filter(aa=>aa!==P.id):Ze=[...ve,P.id],V("dependencies",Ze);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",re&&(x?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",re?"bg-blue-500 border-blue-500":x?"border-white/30":"border-gray-300"),children:re&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",x?"text-white":"text-gray-900"),children:P.name}),jsx("span",{className:u("text-xs",x?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",x?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Ve(),pt(!Xe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",x?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:A.color||"#6366F1"}}),jsx("span",{className:u("text-sm",x?"text-white":"text-gray-900"),children:go.find(P=>P.value===A.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",x?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>pt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:go.map(P=>{let re=A.color===P.value;return jsx("button",{onClick:()=>{V("color",P.value),pt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",re&&"ring-2 ring-offset-2",x?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:re?P.value:void 0},title:P.name,children:re&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:A.isMilestone||false,onChange:P=>V("isMilestone",P.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",A.isMilestone?"bg-purple-500 border-purple-500":x?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",x?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",x?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",x?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:Pt,value:Ae,onChange:P=>Se(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("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",x?"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")})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",x?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:u("text-sm font-semibold",x?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",A.subtasks&&A.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",x?"text-[#6B7280]":"text-gray-400"),children:["(",A.subtasks.filter(P=>P.progress===100).length,"/",A.subtasks.length,")"]})]})}),A.subtasks&&A.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:A.subtasks.map(P=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Tt(P.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":x?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":x?"text-white":"text-gray-900"),children:P.name}),jsx("button",{onClick:()=>gt(P.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",x?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},P.id))}),He?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:ht,onChange:P=>le(P.target.value),onKeyDown:P=>{P.key==="Enter"&&ht.trim()?_e():P.key==="Escape"&&(De(false),le(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",x?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:_e,disabled:!ht.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",ht.trim()?"bg-blue-500 hover:bg-blue-600 text-white":x?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{De(false),le("");},className:u("p-2 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>De(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",x?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",x?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",x?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",x?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let re=br(P.type),ve=P.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",x?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ve&&P.thumbnailUrl?jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsx(re,{className:u("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",x?"text-white":"text-gray-900"),children:P.name}),jsx("p",{className:u("text-xs",x?"text-[#6B7280]":"text-gray-400"),children:oo(P.size)})]}),p&&jsx("button",{onClick:()=>p(P.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",x?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxs("div",{onDragOver:ot,onDragLeave:Or,onDrop:fe,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Be?x?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":x?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",X$1&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Nt,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||X$1}),X$1?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",Be?"text-blue-500":x?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-500"),children:Be?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:u("text-xs mt-1",x?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:u("w-96 border-l flex flex-col",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",x?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",x?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",b.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",x?"text-[#6B7280]":"text-gray-400"),children:["(",b.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
1
|
+
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import _m from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,FileText,Timer,Clock,Tag,BarChart,CalendarCheck,Users,Flag,CircleDot,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Square,Play,Diamond,Upload,MessageSquare,Rows3,Filter,FileImage,FileSpreadsheet,FileJson,FolderKanban,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,AlertCircle,Milestone,List,Search,Loader2,Copy}from'lucide-react';import {Command}from'cmdk';import K0 from'react-markdown';import Y0 from'remark-gfm';import q0 from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';var Bn=(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 Rn=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 [Rn.Translate.toString(e),Rn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return twMerge(clsx(e))}function On(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 Fg(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function ai(e,t){return e.length===0?1e3:t===0?On(null,e[0].position):t>=e.length?On(e[e.length-1].position,null):On(e[t-1].position,e[t].position)}function Ld(e,t=100){return e>t}var Ag=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 Lg(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 $n(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Ag,onRetry:l}=t,m,i=0;for(let c=1;c<=a;c++){i=c;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(m=d,c===a||!n(m,c))return {error:m,attempts:i,success:false};let f=Lg(c,r,o,s);if(l)try{l(m,c,f);}catch(x){console.error("Error in retry callback:",x);}await new Promise(x=>setTimeout(x,f));}}return {error:m||new Error("Unknown error"),attempts:i,success:false}}function Ig(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 Bg(e,t={}){return async(...a)=>$n(()=>e(...a),t)}var ri=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 Id=(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))(Id||{}),lo=class lo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,m?n:"");break;case "INFO":console.info(l,o,m?n:"");break;case "WARN":console.warn(l,o,m?n:"");break;case "ERROR":console.error(l,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",...lo.globalOptions};}static configure(t){lo.globalOptions={...lo.globalOptions,...t};}child(t){return new lo({...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 zn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new zn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Id[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};lo.globalOptions={};var oi=lo,zn=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}},Bd=new oi;function Og(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 $g(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(l=>l.id===s.columnId);return [s.id,ni(s.title),ni(s.description||""),ni(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 zg(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 _m(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),m=297,i=210,c=n.width/n.height,d=m-20,g=d/c;g>i-20&&(g=i-20,d=g*c);let f=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});f.setFontSize(16),f.setTextColor(255,255,255),f.setFillColor(10,10,10),f.rect(0,0,m,15,"F"),f.text(e.title||"Kanban Board",10,10);let x=(m-d)/2;return f.addImage(l,"PNG",x,20,d,g),f}catch(n){console.error("Error capturing board:",n);}let o=new 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 l=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,l.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):l.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 ni(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Od(e,t,a,r){switch(t){case "json":return Og(e,r);case "csv":return $g(e);case "pdf":return await zg(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function $d(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"},l=new Blob([e],{type:n[t]}),m=URL.createObjectURL(l),i=document.createElement("a");i.href=m,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(m);}function Ug(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 Hg(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=zd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=zd(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((f,x)=>{i[f]=l[x]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),g={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.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(g),d.cardIds.push(g.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.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 zd(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 Ud(e,t){switch(t){case "json":return Ug(e);case "csv":return Hg(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Hd(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 si=createContext(null);function Wd(){return useContext(si)}var Gd=createContext(null);function Vd({children:e,themeName:t}){return jsx(Gd.Provider,{value:{themeName:t},children:e})}function Mo(){return useContext(Gd)}function yt({children:e,container:t}){let[a,r]=useState(false),o=Wd(),s=Mo();if(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:l,themeName:m}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var qd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},qg="#BDC3C7",Xg=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function co({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),l=useRef(null),m=useRef(null),i=()=>{if(!m.current)return;let f=m.current.getBoundingClientRect(),x=window.innerHeight,T=window.innerWidth,p=160,h=220,b=4,y=f.right-p;y<10&&(y=f.left),y+p>T-10&&(y=T-p-10);let w=x-f.bottom,D=f.top,N;w>=h+b?N=f.bottom+b:D>=h+b?N=f.top-h-b:N=w>=D?f.bottom+b:Math.max(10,f.top-h-b),n({top:N,left:y}),o(true);};useEffect(()=>{let f=x=>{l.current&&!l.current.contains(x.target)&&!m.current?.contains(x.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),useEffect(()=>{let f=x=>{x.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let c=f=>{t(f),o(false);},d=e?qd[e]:null,g=d?.color||qg;return jsxs("div",{className:`relative ${a||""}`,children:[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?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}30 inset`:"none"},title:d?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(yt,{children:jsxs("div",{ref:l,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:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsxs("div",{className:"py-1",children:[Object.entries(qd).map(([f,x])=>jsxs("button",{onClick:()=>c(f),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:x.color,background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsx(Xg,{color:x.color}),jsx("span",{className:"font-semibold text-sm",children:x.label}),e===f&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Jg=[{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 Zo({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),g=(Mo()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),w=window.innerHeight,D=window.innerWidth,N=320,E=380,k=4,R=y.left;R+N>D-10&&(R=D-N-10),R<10&&(R=10);let I=w-y.bottom,C=y.top,W;I>=E+k?W=y.bottom+k:C>=E+k?W=y.top-E-k:W=I>=C?y.bottom+k:Math.max(10,y.top-E-k),l({top:W,left:R}),s(true);};useEffect(()=>{let y=w=>{m.current&&!m.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),useEffect(()=>{let y=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let x=y=>{let w=new Date,D=R=>{let I=R.getFullYear(),C=String(R.getMonth()+1).padStart(2,"0"),W=String(R.getDate()).padStart(2,"0");return `${I}-${C}-${W}`},N=D(w),E=new Date(w);E.setDate(E.getDate()+y);let k=D(E);a(N,k),s(false);},T=()=>{if(!e||!t)return "Set date";let y=E=>{if(E instanceof Date)return E;if(typeof E!="string"||!E.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=E.split("-").map(Number);if(k.length!==3||k.some(W=>isNaN(W)))return null;let R=k[0],I=k[1],C=k[2];return R===void 0||I===void 0||C===void 0?null:new Date(R,I-1,C)},w=y(e),D=y(t);if(!w||!D||isNaN(w.getTime())||isNaN(D.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[w.getMonth()]} ${w.getDate()} \u2013 ${N[D.getMonth()]} ${D.getDate()}`},p=e&&t,b=(()=>{if(!t)return false;let y=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),y<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:p?`${T()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:T()})]}),o&&jsx(yt,{children: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:g?"#1A1D25":"#FFFFFF",border:`1px solid ${g?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:g?"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:[jsxs("div",{className:"p-4 border-b",style:{borderColor:g?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:Jg.map(y=>jsx("button",{onClick:()=>x(y.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:y.label},y.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:y=>a(y.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:y=>a(e,y.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}})]}),(e||t)&&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:y=>{y.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:y=>{y.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function uo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[l,m]=useState(""),[i,c]=useState({top:0,left:0}),d=useRef(null),g=useRef(null),f=()=>{if(!g.current)return;let b=g.current.getBoundingClientRect(),y=window.innerHeight,w=window.innerWidth,D=300,N=380,E=4,k=b.right-D;k<10&&(k=b.left),k+D>w-10&&(k=w-D-10);let R=y-b.bottom,I=b.top,C;R>=N+E?C=b.bottom+E:I>=N+E?C=b.top-N-E:C=R>=I?b.bottom+E:Math.max(10,b.top-N-E),c({top:C,left:k}),n(true);};useEffect(()=>{let b=y=>{d.current&&!d.current.contains(y.target)&&!g.current?.contains(y.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=y=>{y.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let x=b=>{let y=e.some(w=>w.id===b.id);a(y?e.filter(w=>w.id!==b.id):[...e,b]);},T=t.filter(b=>b.name.toLowerCase().includes(l.toLowerCase())),p=e.slice(0,o),h=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:g,onClick:()=>s?n(false):f(),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?jsxs("div",{className:"asakaa-avatar-group",children:[p.map(b=>jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),h>0&&jsxs("div",{className:"asakaa-avatar",children:["+",h]})]}):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:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[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"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(yt,{children:jsxs("div",{ref:d,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:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange:b=>m(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:T.length===0?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"}):T.map(b=>{let y=e.some(w=>w.id===b.id);return jsxs("button",{onClick:()=>x(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:b.color,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:y?"#3b82f6":"transparent"},children:y?"\u2713":""})]},b.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children: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 Un(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 d=c;return d.taskId||d.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,l=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)&&l(c))return true;if(n.has(c))return true}}return n.delete(m),false};return l(a)}function en({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,m]=useState(false),[i,c]=useState(""),[d,g]=useState(t.length>0),[f,x]=useState({top:0,left:0}),[T,p]=useState(null),h=useRef(null),b=useRef(null),y=()=>{if(!b.current)return;let k=b.current.getBoundingClientRect(),R=window.innerHeight,I=window.innerWidth,C=300,W=d?380:120,H=4,v=k.right-C;v<10&&(v=k.left),v+C>I-10&&(v=I-C-10);let te=R-k.bottom,oe=k.top,ne;te>=W+H?ne=k.bottom+H:oe>=W+H?ne=k.top-W-H:ne=te>=oe?k.bottom+H:Math.max(10,k.top-W-H),x({top:ne,left:v}),m(true);};useEffect(()=>{if(!l||!b.current)return;let k=b.current.getBoundingClientRect(),R=window.innerHeight,I=window.innerWidth,C=300,W=d?380:120,H=4,v=k.right-C;v<10&&(v=k.left),v+C>I-10&&(v=I-C-10);let te=R-k.bottom,oe=k.top,ne;te>=W+H?ne=k.bottom+H:oe>=W+H?ne=k.top-W-H:ne=te>=oe?k.bottom+H:Math.max(10,k.top-W-H),x({top:ne,left:v});},[d,l]),useEffect(()=>{let k=R=>{h.current&&!h.current.contains(R.target)&&!b.current?.contains(R.target)&&(m(false),c(""));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{let k=R=>{R.key==="Escape"&&(m(false),c(""));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]);let w=k=>{let R=t.includes(k),I=a.find(C=>C.id===k);if(p(null),R){let C=t.filter(W=>W!==k);r(C),C.length===0&&g(false);}else {if(s&&Un(a,k,e)){let W=`Cannot add "${I?.title||k}" as dependency - would create circular reference`;p(W),n?.(k,I?.title||k),setTimeout(()=>p(null),3e3);return}r([...t,k]),g(true);}},D=()=>{let k=!d;g(k),k||r([]);},N=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),E=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:b,onClick:()=>l?m(false):y(),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:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children: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:E,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:E},children:t.length})]}),l&&jsx(yt,{children:jsxs("div",{ref:h,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.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:[T&&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:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children: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"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:T})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children: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"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:k=>c(k.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})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:N.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):N.map(k=>{let R=t.includes(k.id);return jsxs("button",{onClick:()=>w(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.currentTarget.style.background="transparent";},children:[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:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),g(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 Er=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:g,transition:f,isDragging:x}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),T={transform:Rn.Transform.toString(g),transition:f};if(t)return jsx("div",{ref:d,style:T,...i,...c,onClick:()=>a?.(e),children:t(e)});let p=l.filter(w=>e.assignedUserIds?.includes(w.id)),h=e.progress===100,b=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),y={...T,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:y,className:u("asakaa-card",x&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsx("img",{src:b[0].url,alt:b[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:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((w,D)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:N=>{N.currentTarget.style.display="none";}}),D===3&&b.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",b.length-4]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:h?"line-through":"none",opacity:h?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(co,{priority:e.priority,onChange:w=>n?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Zo,{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:(w,D)=>n?.(e.id,{startDate:w,endDate:D})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(uo,{assignedUsers:p,availableUsers:l,onChange:w=>n?.(e.id,{assignedUserIds:w.map(D=>D.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(en,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:m,onChange:w=>n?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children: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)));Er.displayName="Card";var Hn={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"}},nc=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function sc({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),c=[...Object.entries(Hn).map(([p,h])=>({id:p,label:h.label,color:h.color,icon:h.icon})),...r.filter(p=>!Object.keys(Hn).includes(p.id)).map(p=>({id:p.id,label:p.title,color:p.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let p=Hn[e];if(p)return {...p,id:e};let h=r.find(b=>b.id===e);return h?{id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}:{...Hn.todo,id:"todo"}},g=()=>{if(!i.current)return;let p=i.current.getBoundingClientRect(),h=window.innerHeight,b=window.innerWidth,y=180,w=280,D=4,N=p.right-y;N<10&&(N=p.left),N+y>b-10&&(N=b-y-10);let E=h-p.bottom,k=p.top,R;E>=w+D?R=p.bottom+D:k>=w+D?R=p.top-w-D:R=E>=k?p.bottom+D:Math.max(10,p.top-w-D),l({top:R,left:N}),s(true);};useEffect(()=>{let p=h=>{m.current&&!m.current.contains(h.target)&&!i.current?.contains(h.target)&&s(false);};if(o)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]),useEffect(()=>{let p=h=>{h.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[o]);let f=p=>{t(p),s(false);},x=d(),T=x.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):g(),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:`${T}10`,boxShadow:`0 0 0 2px ${T}30 inset`},title:x.label,children:jsx(nc,{icon:x.icon,color:T})}),o&&jsx(yt,{children: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:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsx("div",{className:"py-1",children:c.map(p=>jsxs("button",{onClick:()=>f(p.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:p.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsx(nc,{icon:p.icon,color:p.color}),jsx("span",{className:"font-semibold",children:p.label}),e===p.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p.id))})]})})]})}function ic({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[l,m]=useState(false),[i,c]=useState(e),[d,g]=useState({top:0,left:0}),f=useRef(null),x=useRef(null),T=useRef(null);useEffect(()=>{if(s&&x.current){let y=x.current.getBoundingClientRect();g({top:y.bottom+window.scrollY+8,left:y.left+window.scrollX});}},[s]),useEffect(()=>{let y=w=>{f.current&&!f.current.contains(w.target)&&!x.current?.contains(w.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),useEffect(()=>{let y=w=>{w.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s,e]),useEffect(()=>{l&&T.current&&(T.current.focus(),T.current.select());},[l]);let p=()=>{m(true),c(e);},h=()=>{let y=i.trim();y&&y!==e&&t(y),m(false),n(false),c(e);},b=y=>{y.key==="Enter"?h():y.key==="Escape"&&(m(false),c(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:x,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:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsx(yt,{children:jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsx("input",{ref:T,type:"text",value:i,onChange:y=>c(y.target.value),onKeyDown:b,onBlur:h,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})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:p,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:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),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:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[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"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Lo=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:g,onToggleCollapse:f,onColumnRename:x,onColumnDelete:T,isDeletable:p=false,className:h})=>{let{setNodeRef:b,isOver:y}=useDroppable({id:e.id,data:{type:"column",column:e}}),w=useRef(null),D=c??Ld(t.length),N=useVirtualizer({count:t.length,getScrollElement:()=>w.current,estimateSize:()=>d,enabled:D});if(a)return jsx("div",{ref:b,className:h,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),R=k.state==="exceeded",I=()=>"asakaa-column-count";return jsxs("div",{ref:b,className:u("asakaa-column",y&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",h),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u(I()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),k.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),k.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),k.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(x||T)&&jsx(ic,{columnTitle:e.title,onRename:C=>x?.(e.id,C),onDelete:T?()=>T(e.id):void 0,isDeletable:p}),f&&jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":g?"Expand column":"Collapse column",children:g?"\u25B6":"\u25BC"})]})]}),!g&&jsx("div",{ref:w,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsx(SortableContext,{items:t.map(C=>C.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):D?jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(C=>{let W=t[C.index];return W?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsx(Er,{card:W,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i})},W.id):null})}):t.map(C=>jsx(Er,{card:C,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i},C.id))})})]})});Lo.displayName="Column";function mi({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.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?jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:m,onKeyDown:i,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function yf(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 pc(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(l=>{let m=l.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function vf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function xf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var kf=["\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 gc({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:g=[],onFilesSelect:f,onRemoveFile:x,maxFileSizeMB:T=10}){let p=l==="dark",[h,b]=useState(false),[y,w]=useState([]),[D,N]=useState(0),[E,k]=useState(null),[R,I]=useState(false),C=useRef(null),W=useRef(null),H=useRef(null),v=useRef(null),te=useCallback((S,K)=>{let J=yf(S,K);if(k(J),J){let ie=r.filter(ue=>ue.name.toLowerCase().includes(J.query)||ue.email&&ue.email.toLowerCase().includes(J.query)).slice(0,5);w(ie),b(ie.length>0),N(0);}else b(false),w([]);},[r]),oe=S=>{let K=S.target.value;if(t(K),te(K,S.target.selectionStart||0),C.current){C.current.style.height="24px";let J=C.current.scrollHeight,ie=280,ue=Math.min(J,ie);C.current.style.height=`${ue}px`,C.current.style.overflowY=J>ie?"auto":"hidden";}},ne=()=>{C.current&&te(e,C.current.selectionStart||0);},A=useCallback(S=>{if(!E||!C.current)return;let K=e.slice(0,E.start),J=e.slice(E.end),ie=`@${S.name.replace(/\s+/g,"")} `,ue=K+ie+J;t(ue),b(false),k(null),setTimeout(()=>{if(C.current){let ye=E.start+ie.length;C.current.selectionStart=ye,C.current.selectionEnd=ye,C.current.focus();}},0);},[E,e,t]),ke=S=>{if(h&&y.length>0)switch(S.key){case "ArrowDown":S.preventDefault(),N(K=>K<y.length-1?K+1:0);break;case "ArrowUp":S.preventDefault(),N(K=>K>0?K-1:y.length-1);break;case "Enter":{S.preventDefault();let K=y[D];K&&A(K);break}case "Tab":{S.preventDefault();let K=y[D];K&&A(K);break}case "Escape":S.preventDefault(),b(false);break}else S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),a());};useEffect(()=>{let S=K=>{W.current&&!W.current.contains(K.target)&&C.current&&!C.current.contains(K.target)&&b(false),v.current&&!v.current.contains(K.target)&&I(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let Ie=useCallback(S=>{if(!C.current)return;let K=C.current.selectionStart||e.length,J=e.slice(0,K)+S+e.slice(K);t(J),I(false),setTimeout(()=>{if(C.current){let ie=K+S.length;C.current.selectionStart=ie,C.current.selectionEnd=ie,C.current.focus();}},0);},[e,t]),L=useCallback(S=>{if(!f||!S.target.files)return;let K=Array.from(S.target.files),J=T*1024*1024,ie=K.filter(ue=>ue.size>J?(console.warn(`File ${ue.name} exceeds max size of ${T}MB`),false):true);ie.length>0&&f(ie),S.target.value="";},[f,T]),U=useCallback(S=>S.type.startsWith("image/")?Image:S.type.includes("pdf")||S.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(h&&W.current){let S=W.current.children[D];S&&S.scrollIntoView({block:"nearest"});}},[D,h]),jsxs("div",{className:"flex flex-col gap-2",children:[g.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:g.map(S=>{let K=U(S.file),J=S.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",p?"bg-white/10":"bg-gray-100"),children:[J&&S.preview?jsx("img",{src:S.preview,alt:S.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(K,{className:u("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:u("text-xs truncate",p?"text-white":"text-gray-900"),children:S.file.name}),jsx("p",{className:u("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:xf(S.file.size)})]}),x&&jsx("button",{onClick:()=>x(S.id),className:u("p-0.5 rounded-full transition-colors",p?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},S.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",p?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!R),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",p?"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:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:R&&jsx(motion.div,{ref:v,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:kf.map(S=>jsx("button",{type:"button",onClick:()=>Ie(S),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",p?"hover:bg-white/10":"hover:bg-gray-100"),children:S},S))})})})]}),d&&f&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",p?"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:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:H,type:"file",multiple:true,onChange:L,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:C,value:e,onChange:oe,onSelect:ne,onKeyDown:ke,placeholder:o||(m==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",p?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&g.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||g.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":p?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:h&&y.length>0&&jsx(motion.div,{ref:W,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:y.map((S,K)=>jsxs("button",{type:"button",onClick:()=>A(S),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",K===D?p?"bg-white/10":"bg-gray-100":p?"hover:bg-white/5":"hover:bg-gray-50"),children:[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:vf(S.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",p?"text-white":"text-gray-900"),children:S.name}),S.email&&jsx("p",{className:u("text-xs truncate",p?"text-[#6B7280]":"text-gray-500"),children:S.email})]})]},S.id))})})]})]})]})}function fc({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)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,m)=>l.type==="mention"?jsx("span",{className:u("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:l.value},m):jsx("span",{children:l.value},m))})}var jn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Gr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,m]=useState(false),[i,c]=useState(""),[d,g]=useState(false),[f,x]=useState(jn[10]||"#3B82F6"),[T,p]=useState({top:0,left:0}),h=useRef(null),b=useRef(null),y=useRef(null),w=useRef(null),D=t.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())),N=t.some(C=>C.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&b.current){let C=b.current.getBoundingClientRect();p({top:C.bottom+6,left:C.left});}},[l]),useEffect(()=>{let C=W=>{let H=W.target,v=h.current?.contains(H),te=y.current?.contains(H);!v&&!te&&(m(false),c(""),g(false));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let E=C=>{let W=e.some(H=>H.id===C.id);a(W?e.filter(H=>H.id!==C.id):[...e,C]);},k=async()=>{if(!(!r||!i.trim())){g(true);try{let C=await r(i.trim(),f);C&&(a([...e,C]),c(""),x(jn[Math.floor(Math.random()*jn.length)]||"#3B82F6"));}finally{g(false);}}},R=(C,W)=>{W.stopPropagation(),a(e.filter(H=>H.id!==C));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:h,className:"relative",children:[jsxs("button",{ref:b,type:"button",onClick:()=>!s&&m(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(C=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:y,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:T.top,left:T.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:C=>c(C.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:C=>{C.key==="Enter"&&i.trim()&&!N&&r&&k();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(C=>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:`${C.color}20`,color:C.color},onClick:W=>R(C.id,W),children:[C.name,jsx(X,{className:"w-3 h-3"})]},C.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(C=>{let W=e.some(H=>H.id===C.id);return jsxs("button",{type:"button",onClick:()=>E(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:W?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:H=>{W||(H.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:H=>{W||(H.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsx("span",{className:"flex-1 text-left",children:C.name}),W&&jsx(Check,{className:"w-4 h-4",style:{color:C.color}})]},C.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!N&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:jn.map(C=>jsx("button",{type:"button",onClick:()=>x(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:f===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxs("button",{type:"button",onClick:k,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function pi({tag:e,onRemove:t,size:a="sm"}){return 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&&jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function hc({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 jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(pi,{tag:s,size:a},s.id)),o>0&&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 go=[{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 yc(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Mf(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Ff({className:e}){return jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function gi({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Mf(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},m=yc(e.loggedMinutes),i=e.estimateMinutes?yc(e.estimateMinutes):null,c=a&&i?`${m} / ${i}`:m;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(Ff,{className:l[t]}),jsx("span",{children:c})]})}function xc(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o)}function Yn(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function If(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Bf({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Rf({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function kc({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Of({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function fi({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:m,onDiscardTimer:i,onClose:c,className:d}){let[g,f]=useState(""),[x,T]=useState(t.estimateMinutes?Yn(t.estimateMinutes):""),[p,h]=useState(""),[b,y]=useState(false),[w,D]=useState(false),N=useRef(null);useEffect(()=>{N.current?.focus();},[]);let E=async()=>{let I=xc(g);if(!(I<=0||!s)){y(true);try{await s({durationMinutes:I,note:p.trim()||void 0,source:"manual"}),f(""),h("");}finally{y(false);}}},k=async()=>{if(!n)return;let I=x.trim()?xc(x):null;await n(I),D(false);},R=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),E()),I.key==="Escape"&&c?.();};return jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:c,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(kc,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:If(o)})]}),jsx("button",{onClick:m,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Rf,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(kc,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Bf,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Of,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:N,type:"text",value:g,onChange:I=>f(I.target.value),onKeyDown:R,placeholder:"2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:E,disabled:b||!g.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:p,onChange:I=>h(I.target.value),onKeyDown:R,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Yn(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:x,onChange:I=>T(I.target.value),onKeyDown:I=>{I.key==="Enter"&&k(),I.key==="Escape"&&D(false);},onBlur:k,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>D(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Yn(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(I=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:I.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Yn(I.durationMinutes)})]},I.id))})]})]})}function Hf(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o)}function Wf(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function fo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,m]=useState(Wf(r)),[i,c]=useState(""),[d,g]=useState(false),f=useRef(null);useEffect(()=>{f.current?.focus();},[]);let x=async()=>{g(true);let y=Hf(l);await o(y&&y>0?y:null,i||void 0),g(false);},T=async()=>{g(true),await o(null),g(false);},p=y=>{y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),x()),y.key==="Escape"&&s();},h={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},b={estimate:"1h 30m",quoted:"1h 30m",log:"1h 30m"};return jsxs("div",{className:u("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:y=>y.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-sm font-medium",a?"text-white":"text-gray-900"),children:h[e]}),jsx("button",{type:"button",onClick:s,className:u("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"mb-3",children:[jsx("input",{ref:f,type:"text",value:l,onChange:y=>m(y.target.value),onKeyDown:p,placeholder:b[e],className:u("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsx("p",{className:u("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 1h 30m, 45m, 2:30":"e.g. 1h 30m, 45m, 2:30"})]}),e==="log"&&jsx("div",{className:"mb-3",children:jsx("input",{type:"text",value:i,onChange:y=>c(y.target.value),onKeyDown:p,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:u("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsx("button",{type:"button",onClick:x,disabled:d||!l.trim(),className:u("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:d?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:T,disabled:d,className:u("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function Gf(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Vf(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function yi({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Gf(e.health),s=Vf(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,m=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:u("flex items-center gap-2",r),children:[jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${m}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Io(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function jf(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Kf(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Yf(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function qf({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",m=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",Io(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:u("font-medium",m),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:u("font-medium",m),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:u("font-medium",m),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",m),children:Io(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",m),children:Io(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",m),children:e.totalTasksWithEstimate})]})]})]})]})}function Xf({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null&&e.varianceMinutes>0?"+":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:u("text-xs mt-1",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Io(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:Io(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,Io(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Kf(e.status,a),jf(e.status,a)),children:Yf(e.status,t)})})]})}function vi({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#0F1117]":"bg-gray-50",m=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",c=n?"text-[#E5E7EB]":"text-gray-900",d=n?"text-[#9CA3AF]":"text-gray-500",g=n?"bg-[#0F1117]/50":"bg-gray-50",f=useMemo(()=>e?[...e.tasks].sort((x,T)=>x.varianceMinutes===null?1:T.varianceMinutes===null?-1:T.varianceMinutes-x.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",l,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(qf,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",m,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:g,children:jsxs("tr",{children:[jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",i),children:f.map(x=>jsx(Xf,{task:x,locale:a,isDark:n,onClick:s},x.taskId))})]})})}),jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function es(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function m0(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function Mc(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 u0(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:l=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:g,availableTasks:f=[],comments:x=[],onAddComment:T,currentUser:p,mentionableUsers:h=[],onUploadCommentAttachments:b,enableTimeTracking:y=false,timeTrackingSummary:w,timeEntries:D=[],isTimerRunning:N=false,timerElapsedSeconds:E=0,onTimeLog:k,onEstimateUpdate:R,onSoldEffortUpdate:I,onTimerStart:C,onTimerStop:W,onTimerDiscard:H}){let v=s==="dark",te={textTertiary:v?"#6B7280":"#9CA3AF",textSecondary:v?"#9CA3AF":"#6B7280",textPrimary:v?"#FFFFFF":"#111827",borderLight:v?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:v?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:v?"#1A1D25":"#FFFFFF",bgSecondary:v?"#0F1117":"#F9FAFB",hoverBg:v?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},oe=e&&"title"in e&&!("name"in e),ne=e,[A,ke]=useState(e?Mc(e,l):null),[Ie,L]=useState(false),[U,S]=useState(false),[K,J]=useState(false),[ie,ue]=useState(null),[ye,Oe]=useState(new Date),[Q,Je]=useState(false),[Pe,rt]=useState(false),[ut,It]=useState(""),[Xe,pt]=useState(false),[ce,Ge]=useState(false),[Be,B]=useState(false),[X$1,ge]=useState(false),[Ae,Ue]=useState(""),nt=useRef(null),Pt=useRef(null),[$e,O]=useState(""),ae=useRef(null),[Le,je]=useState(""),[qe,j]=useState(false),[$,Me]=useState([]),[ht,le]=useState(""),[He,De]=useState(false),Re=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let P=Mc(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),ke(P),Ue(P.description||""),O(P.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!Ae)return;let P=setTimeout(()=>{let re=Pt.current;re&&(re.style.height="auto",re.style.height=`${Math.max(100,re.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,Ae]),useEffect(()=>()=>{nt.current&&clearTimeout(nt.current),ae.current&&clearTimeout(ae.current);},[]),useEffect(()=>{t&&Re.current&&x.length>0&&setTimeout(()=>{Re.current&&(Re.current.scrollTop=Re.current.scrollHeight);},100);},[t,x.length]);let de=useCallback(P=>{ke(P),oe&&o&&ne?o(u0(P,ne)):r&&r(P);},[oe,ne,o,r]),Ve=useCallback(()=>{L(false),S(false),J(false),ue(null),rt(false),It(""),pt(false);},[]),V=useCallback((P,re)=>{if(!A)return;let ve={...A,[P]:re};de(ve);},[A,de]),q=useCallback(()=>{let P=Pt.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),Se=useCallback(P=>{Ue(P),setTimeout(q,0),nt.current&&clearTimeout(nt.current),nt.current=setTimeout(()=>{if(A){let re={...A,description:P};de(re);}},800);},[A,de,q]),Ye=useCallback(P=>{O(P),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{if(A&&P.trim()){let re={...A,name:P.trim()};de(re);}},800);},[A,de]),ze=useCallback(P=>{let re=P.map(ve=>{let Ze={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ve};return ve.type.startsWith("image/")&&(Ze.preview=URL.createObjectURL(ve)),Ze});Me(ve=>[...ve,...re]);},[]),G=useCallback(P=>{Me(re=>{let ve=re.find(Ze=>Ze.id===P);return ve?.preview&&URL.revokeObjectURL(ve.preview),re.filter(Ze=>Ze.id!==P)});},[]),me=useCallback(async()=>{if(!(!A||!Le.trim()&&$.length===0||!T)){j(true);try{let P=pc(Le,h),re=[];if($.length>0&&b){let ve=$.map(Ze=>Ze.file);re=await b(ve);}await T(A.id,Le.trim(),P.length>0?P:void 0,re.length>0?re:void 0),je(""),$.forEach(ve=>{ve.preview&&URL.revokeObjectURL(ve.preview);}),Me([]);}finally{j(false);}}},[A,Le,$,T,h,b]),_e=useCallback(()=>{if(!A||!ht.trim())return;let P={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:ht.trim(),progress:0,startDate:new Date,endDate:new Date},re=[...A.subtasks||[],P],ve={...A,subtasks:re};de(ve),le(""),De(false);},[A,ht,de]),Tt=useCallback(P=>{if(!A?.subtasks)return;let re=A.subtasks.map(Ze=>Ze.id===P?{...Ze,progress:Ze.progress===100?0:100}:Ze),ve={...A,subtasks:re};de(ve);},[A,de]),gt=useCallback(P=>{if(!A?.subtasks)return;let re=A.subtasks.filter(Ze=>Ze.id!==P),ve={...A,subtasks:re};de(ve);},[A,de]),Sr=useCallback(P=>{let re=typeof P=="string"?new Date(P):P,Ze=new Date().getTime()-re.getTime(),ra=Math.floor(Ze/6e4),la=Math.floor(Ze/36e5),oa=Math.floor(Ze/864e5);return ra<1?n==="es"?"Ahora":"Just now":ra<60?n==="es"?`Hace ${ra} min`:`${ra}m ago`:la<24?n==="es"?`Hace ${la}h`:`${la}h ago`:oa<7?n==="es"?`Hace ${oa}d`:`${oa}d ago`:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),br=useCallback(P=>{if(!A)return;let re=A.progress||0;P==="completed"?re=100:P==="in-progress"&&re===0?re=10:P==="todo"&&(re=0);let ve={...A,status:P,progress:re};de(ve),L(false);},[A,de]),Ba=useCallback((P,re)=>{if(!A)return;let ve={...A,startDate:P,endDate:re};de(ve);},[A,de]),Ra=useCallback(()=>{let P=ye.getFullYear(),re=ye.getMonth(),ve=new Date(P,re,1),ra=new Date(P,re+1,0).getDate(),la=ve.getDay(),oa=[],or=new Date(P,re,0).getDate();for(let Sa=la-1;Sa>=0;Sa--)oa.push({date:new Date(P,re-1,or-Sa),isCurrentMonth:false});for(let Sa=1;Sa<=ra;Sa++)oa.push({date:new Date(P,re,Sa),isCurrentMonth:true});let Ta=42-oa.length;for(let Sa=1;Sa<=Ta;Sa++)oa.push({date:new Date(P,re+1,Sa),isCurrentMonth:false});return oa},[ye]),fe=useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),B(false),!A||!d)return;let re=Array.from(P.dataTransfer.files);if(re.length!==0){ge(true);try{await d(A.id,re);}finally{ge(false);}}},[A,d]),Nt=useCallback(async P=>{if(!A||!d||!P.target.files)return;let re=Array.from(P.target.files);if(re.length!==0){ge(true);try{await d(A.id,re);}finally{ge(false);}P.target.value="";}},[A,d]),ot=useCallback(P=>{P.preventDefault(),P.stopPropagation(),B(true);},[]),Or=useCallback(P=>{P.preventDefault(),P.stopPropagation(),B(false);},[]),oo=useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),hr=useCallback(P=>P.startsWith("image/")?Image:P.includes("pdf")||P.includes("document")?FileText:File,[]);return !t||!A?null:jsx(AnimatePresence,{children:t&&A&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",v?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",v?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",v?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:u("text-xs font-mono",v?"text-[#6B7280]":"text-gray-400"),children:A.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let P=A.progress===100?0:100,ve={...A,progress:P,status:P===100?"completed":"todo"};de(ve);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",A.progress===100?"bg-green-500 border-green-500":v?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:A.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:$e,onChange:P=>Ye(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",A.progress===100?"line-through text-[#6B7280]":v?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Ve(),L(!Ie);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",A.progress===100||A.status==="completed"?"bg-green-500/20 text-green-400":A.progress&&A.progress>0||A.status==="in-progress"?"bg-blue-500/20 text-blue-400":v?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.progress===100||A.status==="completed"?n==="es"?"COMPLETADO":"DONE":A.progress&&A.progress>0||A.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:Ie&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",v?"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=>jsxs("button",{onClick:()=>br(P.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",v?"hover:bg-white/5":"hover:bg-gray-50",A.status===P.id&&(v?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:v?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Ve(),J(!K);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",v?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[A.assignees&&A.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[A.assignees.slice(0,3).map((P,re)=>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()},re)),A.assignees.length>3&&jsxs("span",{className:u("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:["+",A.assignees.length-3]})]}):jsx("span",{className:u("text-sm",v?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",v?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:K&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>J(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(P=>{let re=A.assignees?.some(ve=>ve.name===P.name);return jsxs("button",{onClick:()=>{let ve=A.assignees||[],Ze;re?Ze=ve.filter(ra=>ra.name!==P.name):Ze=[...ve,P],V("assignees",Ze);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",v?"hover:bg-white/5":"hover:bg-gray-50",re&&(v?"bg-white/5":"bg-gray-50")),children:[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()}),jsx("span",{className:u("flex-1",v?"text-white":"text-gray-900"),children:P.name}),re&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",v?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ue(ie?null:"start"),Oe(A.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",v?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[A.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",v?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),A.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:ie&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ue(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",v?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,re=new Date(P);re.setDate(P.getDate()+1);let ve=new Date(P);ve.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Ze=new Date(P);Ze.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let ra=new Date(P);ra.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let la=new Date(P);la.setDate(P.getDate()+14);let oa=new Date(P);return oa.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:re,display:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ze,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ra,display:ra.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:la,display:la.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:oa,display:oa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ta,Sa)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",v?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ie==="start"){let no=A.endDate&&Ta.date>A.endDate?Ta.date:A.endDate;Ba(Ta.date,no),ue("end");}else {let no=A.startDate&&Ta.date<A.startDate?Ta.date:A.startDate;Ba(no,Ta.date),ue(null);}},children:[jsx("span",{children:Ta.label}),jsx("span",{className:u("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:Ta.display})]},Sa))})(),jsx("div",{className:u("border-t mt-2 pt-2",v?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Ba(void 0,void 0),ue(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",v?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",v?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ie==="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"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",v?"text-white":"text-gray-900"),children:ye.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>Oe(new Date),className:u("p-1 rounded text-sm transition-colors",v?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Oe(new Date(ye.getFullYear(),ye.getMonth()-1)),className:u("p-1 rounded",v?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>Oe(new Date(ye.getFullYear(),ye.getMonth()+1)),className:u("p-1 rounded",v?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),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=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",v?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ra().map((P,re)=>{let ve=P.date.toDateString()===new Date().toDateString(),Ze=A.startDate?.toDateString()===P.date.toDateString(),ra=A.endDate?.toDateString()===P.date.toDateString(),la=Ze||ra,oa=A.startDate&&A.endDate&&P.date>=A.startDate&&P.date<=A.endDate;return jsx("button",{onClick:()=>{let or=new Date(P.date);if(ie==="start"){let Ta=A.endDate&&or>A.endDate?or:A.endDate;Ba(or,Ta),ue("end");}else {let Ta=A.startDate&&or<A.startDate?or:A.startDate;Ba(Ta,or),ue(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(v?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(v?"text-white":"text-gray-900"),ve&&"ring-2 ring-[#3B82F6]",Ze&&"bg-[#3B82F6] text-white",ra&&!Ze&&"bg-[#7C3AED] text-white",oa&&!la&&(v?"bg-[#7C3AED]/20":"bg-purple-100"),!la&&(v?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},re)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Ve(),S(!U);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",A.priority==="high"||A.priority==="urgent"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":A.priority==="low"?"bg-green-500/20 text-green-400":v?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.priority?A.priority==="high"||A.priority==="urgent"?n==="es"?"Alta":"High":A.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:U&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>S(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",v?"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=>jsxs("button",{onClick:()=>{V("priority",P.id),S(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",v?"hover:bg-white/5":"hover:bg-gray-50",A.priority===P.id&&(v?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:v?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",v?"text-white":"text-gray-900"),children:A.startDate&&A.endDate?`${Math.ceil((A.endDate.getTime()-A.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:u("w-4 h-4 rounded-full border-2",v?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Q?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:A.progress||0,onChange:P=>{let re=parseInt(P.target.value),ve=A.status;re===100?ve="completed":re>0?ve="in-progress":ve="todo";let Ze={...A,progress:re,status:ve};de(Ze);},onBlur:()=>Je(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",v?"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}):jsx("button",{onClick:()=>Je(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",v?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",A.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${A.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",v?"text-white":"text-gray-900"),children:[A.progress||0,"%"]})]})]}),y&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Ge("estimate"),className:u("text-sm px-2 py-0.5 rounded",v?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:es(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Ge("estimate"),className:u("text-sm",v?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ce==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"estimate",locale:n,isDark:v,currentValue:w?.estimateMinutes||null,onSave:async P=>{await R?.(A.id,P),Ge(false);},onClose:()=>Ge(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:A.quotedMinutes?jsx("button",{type:"button",onClick:()=>Ge("quoted"),className:u("text-sm px-2 py-0.5 rounded",v?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:es(A.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Ge("quoted"),className:u("text-sm",v?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ce==="quoted"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"quoted",locale:n,isDark:v,currentValue:A.quotedMinutes||null,onSave:async P=>{I?(await I(A.id,P),ke(re=>re?{...re,quotedMinutes:P}:null)):V("quotedMinutes",P),Ge(false);},onClose:()=>Ge(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[N?jsxs("button",{type:"button",onClick:()=>W?.(A.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),m0(E||0)]}):jsx("button",{type:"button",onClick:()=>C?.(A.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",v?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),jsxs("button",{type:"button",onClick:()=>Ge("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",v?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[jsxs("span",{className:u("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":v?"text-white":"text-gray-900"),children:[es(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:u("font-normal",v?"text-[#6B7280]":"text-gray-400"),children:[" / ",es(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:u("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:ce==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"log",locale:n,isDark:v,currentValue:null,onSave:async(P,re)=>{P&&await k?.(A.id,{durationMinutes:P,note:re,source:"manual"}),Ge(false);},onClose:()=>Ge(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(Gr,{selectedTags:A.tags||[],availableTags:m,onChange:P=>{V("tags",P);},onCreateTag:i,theme:te})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[A.dependencies&&A.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:A.dependencies.map(P=>{let re=f.find(ve=>ve.id===P);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",v?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[re?.name||P.slice(0,8),jsx("button",{onClick:()=>{let ve=(A.dependencies||[]).filter(Ze=>Ze!==P);V("dependencies",ve);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},P)})}),jsxs("button",{onClick:()=>{Ve(),rt(!Pe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",v?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:u("text-sm",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Pe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{rt(false),It("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",v?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ut,onChange:P=>It(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",v?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:f.length>0?f.filter(P=>P.id!==A.id).filter(P=>ut===""||P.name.toLowerCase().includes(ut.toLowerCase())).map(P=>{let re=A.dependencies?.includes(P.id);return jsxs("button",{onClick:()=>{let ve=A.dependencies||[],Ze;re?Ze=ve.filter(ra=>ra!==P.id):Ze=[...ve,P.id],V("dependencies",Ze);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",v?"hover:bg-white/5":"hover:bg-gray-50",re&&(v?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",re?"bg-blue-500 border-blue-500":v?"border-white/30":"border-gray-300"),children:re&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",v?"text-white":"text-gray-900"),children:P.name}),jsx("span",{className:u("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",v?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Ve(),pt(!Xe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",v?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:A.color||"#6366F1"}}),jsx("span",{className:u("text-sm",v?"text-white":"text-gray-900"),children:go.find(P=>P.value===A.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",v?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>pt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:go.map(P=>{let re=A.color===P.value;return jsx("button",{onClick:()=>{V("color",P.value),pt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",re&&"ring-2 ring-offset-2",v?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:re?P.value:void 0},title:P.name,children:re&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:A.isMilestone||false,onChange:P=>V("isMilestone",P.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",A.isMilestone?"bg-purple-500 border-purple-500":v?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",v?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",v?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:u("w-4 h-4",v?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",v?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:Pt,value:Ae,onChange:P=>Se(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("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",v?"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")})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",v?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:u("text-sm font-semibold",v?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",A.subtasks&&A.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",v?"text-[#6B7280]":"text-gray-400"),children:["(",A.subtasks.filter(P=>P.progress===100).length,"/",A.subtasks.length,")"]})]})}),A.subtasks&&A.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:A.subtasks.map(P=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",v?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Tt(P.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":v?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":v?"text-white":"text-gray-900"),children:P.name}),jsx("button",{onClick:()=>gt(P.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",v?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},P.id))}),He?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:ht,onChange:P=>le(P.target.value),onKeyDown:P=>{P.key==="Enter"&&ht.trim()?_e():P.key==="Escape"&&(De(false),le(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",v?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:_e,disabled:!ht.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",ht.trim()?"bg-blue-500 hover:bg-blue-600 text-white":v?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{De(false),le("");},className:u("p-2 rounded-lg transition-colors",v?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>De(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",v?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",v?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",v?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",v?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let re=hr(P.type),ve=P.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",v?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ve&&P.thumbnailUrl?jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",v?"bg-white/10":"bg-gray-200"),children:jsx(re,{className:u("w-5 h-5",v?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",v?"text-white":"text-gray-900"),children:P.name}),jsx("p",{className:u("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:oo(P.size)})]}),g&&jsx("button",{onClick:()=>g(P.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",v?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxs("div",{onDragOver:ot,onDragLeave:Or,onDrop:fe,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Be?v?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":v?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",X$1&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Nt,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||X$1}),X$1?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",v?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",Be?"text-blue-500":v?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",v?"text-[#9CA3AF]":"text-gray-500"),children:Be?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:u("text-xs mt-1",v?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:u("w-96 border-l flex flex-col",v?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",v?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",v?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",x.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",v?"text-[#6B7280]":"text-gray-400"),children:["(",x.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",v?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -13,10 +13,10 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
13
13
|
border-radius: 4px !important;
|
|
14
14
|
}
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
|
-
background: ${
|
|
16
|
+
background: ${v?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:Re,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",x?"scrollbar-slim":"scrollbar-slim-light"),children:b.length>0?jsx("div",{className:"space-y-4",children:[...b].sort((P,re)=>{let ve=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,Ze=typeof re.createdAt=="string"?new Date(re.createdAt):re.createdAt;return ve.getTime()-Ze.getTime()}).map(P=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:u("text-sm font-medium",x?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",x?"text-[#6B7280]":"text-gray-400"),children:Sr(P.createdAt)})]}),jsx("div",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:jsx(dc,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(re=>{let ve=re.type.startsWith("image/");return jsxs("a",{href:re.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",x?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ve?jsx(Image,{className:u("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",x?"text-white":"text-gray-900"),children:re.name})]},re.id)})})]})]},P.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",x?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",x?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",x?"border-white/10":"border-gray-200"),children:jsx(lc,{value:Le,onChange:je,onSubmit:me,users:y,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!w,isSubmitting:qe,theme:s,locale:n,currentUser:f,enableEmoji:true,enableAttachments:!!h,pendingFiles:$,onFilesSelect:ze,onRemoveFile:G})})]})]})]})})}function yi(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function _r({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:m,error:i,children:c,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:b,onDeleteAttachment:w,comments:f,onAddComment:y,currentUser:h,mentionableUsers:v,onTaskOpen:T,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:E,timeEntries:k,timerState:R,onLogTime:I,onUpdateEstimate:C,onStartTimer:W,onStopTimer:H,onDiscardTimer:x}){let[te,oe]=yi(),[ne,A]=useState(null),[ke,Ie]=useState(false),L=useRef(null),U=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),S=o?.theme||"dark",K=S==="dark"||S==="neutral",J=K?"dark":"",ie=useCallback((ce,Ge)=>{t.onCardUpdate?.(ce,Ge);},[t]),ue=useCallback((ce,Ge)=>{t.onColumnUpdate?.(ce,{title:Ge});},[t]),ye=useCallback(ce=>{t.onColumnDelete?.(ce);},[t]),Oe=["todo","in-progress","completed"],Q=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Je=useMemo(()=>{let ce=new Map;return e.columns.forEach(Ge=>{let Be=Ge.cardIds.map(B=>e.cards.find(X=>X.id===B)).filter(B=>B!==void 0).sort((B,X)=>B.position-X.position);ce.set(Ge.id,Be);}),ce},[e.cards,e.columns]);useEffect(()=>{let ce=L.current;if(!ce)return;let Ge=ge=>{let Ae=ge.target,Ue=ge.button===1,nt=Ae===ce||Ae.classList.contains("asakaa-column")&&!Ae.closest(".asakaa-card");(Ue||ge.button===0&&nt&&!te.isDragging)&&(ge.preventDefault(),Ie(true),U.current={x:ge.clientX,y:ge.clientY,scrollLeft:ce.scrollLeft,scrollTop:ce.scrollTop},ce.style.cursor="grabbing",ce.style.userSelect="none");},Be=ge=>{if(!ke)return;let Ae=ge.clientX-U.current.x,Ue=ge.clientY-U.current.y;ce.scrollLeft=U.current.scrollLeft-Ae,ce.scrollTop=U.current.scrollTop-Ue;},B=()=>{ke&&(Ie(false),ce.style.cursor="",ce.style.userSelect="");},X=()=>{ke&&(Ie(false),ce.style.cursor="",ce.style.userSelect="");};return ce.addEventListener("mousedown",Ge),document.addEventListener("mousemove",Be),document.addEventListener("mouseup",B),ce.addEventListener("mouseleave",X),()=>{ce.removeEventListener("mousedown",Ge),document.removeEventListener("mousemove",Be),document.removeEventListener("mouseup",B),ce.removeEventListener("mouseleave",X);}},[ke,te.isDragging]);let Pe=useMemo(()=>e.cards.map(ce=>({id:ce.id,name:ce.title,startDate:ce.startDate?new Date(ce.startDate):void 0,endDate:ce.endDate?new Date(ce.endDate):void 0,progress:ce.progress||0,status:ce.columnId,priority:ce.priority?.toLowerCase(),dependencies:Array.isArray(ce.dependencies)?ce.dependencies.map(Ge=>typeof Ge=="string"?Ge:Ge.taskId):[]})),[e.cards]),rt=useCallback(ce=>{let{active:Ge}=ce,Be=e.cards.find(B=>B.id===Ge.id);Be&&oe({isDragging:true,draggedCardId:Be.id,sourceColumnId:Be.columnId,targetColumnId:Be.columnId});},[e.cards,oe]),ut=useCallback(ce=>{let{active:Ge,over:Be}=ce;if(!Be||!e.cards.find(ge=>ge.id===Ge.id))return;let X=null;Be.data.current?.type==="column"?X=Be.id:Be.data.current?.type==="card"&&(X=e.cards.find(Ae=>Ae.id===Be.id)?.columnId||null),X&&X!==te.targetColumnId&&oe({...te,targetColumnId:X});},[e.cards,te,oe]),It=useCallback(async ce=>{let{active:Ge,over:Be}=ce;if(oe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Be)return;let B=e.cards.find(Ue=>Ue.id===Ge.id);if(!B)return;let X,ge;if(Be.data.current?.type==="column"){X=Be.id;let Ue=Je.get(X)||[];ge=Zs(Ue,0);}else {let Ue=e.cards.find($e=>$e.id===Be.id);if(!Ue)return;X=Ue.columnId;let nt=Je.get(X)||[],Pt=nt.findIndex($e=>$e.id===Be.id);ge=Zs(nt,Pt);}let Ae=e.columns.find(Ue=>Ue.id===X);if(Ae&&Ae.wipLimit&&Ae.wipLimitType==="hard"){let Ue=Je.get(X)||[];if(B.columnId!==X&&Ue.length>=Ae.wipLimit){t.onWipLimitExceeded?.(Ae,B);return}}(B.columnId!==X||B.position!==ge)&&await t.onCardMove?.(B.id,X,ge);},[e.cards,e.columns,Je,t,oe]),Xe=useCallback(ce=>{A(ce),a?.(ce),T?.(ce.id);},[a,T]),pt=useCallback(ce=>{t.onCardUpdate?.(ce.id,ce),A(ce);},[t]);return m?jsx("div",{className:u("asakaa-board",J,n),style:l,children:jsx(f0,{columnCount:3})}):i?jsx("div",{className:u("asakaa-board",J,n),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs($d,{themeName:S,children:[jsxs(DndContext,{sensors:Q,collisionDetection:closestCorners,onDragStart:rt,onDragOver:ut,onDragEnd:It,children:[jsxs("div",{ref:L,className:u("asakaa-board",J,n),style:{...l,cursor:ke?"grabbing":void 0},"data-theme":S,children:[e.columns.sort((ce,Ge)=>ce.position-Ge.position).map(ce=>{let Ge=Je.get(ce.id)||[],Be=!Oe.includes(ce.id);return jsx(Lo,{column:ce,cards:Ge,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:Xe,onCardUpdate:ie,onColumnRename:ue,onColumnDelete:ye,isDeletable:Be,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},ce.id)}),c]}),jsx(DragOverlay,{children:te.draggedCardId?jsx(Er,{card:e.cards.find(ce=>ce.id===te.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(Mr,{task:ne,isOpen:!!ne,onClose:()=>A(null),onCardUpdate:pt,theme:K?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:ne?g?.get(ne.id)||[]:[],onUploadAttachments:b,onDeleteAttachment:w,availableTasks:Pe,comments:f,onAddComment:y,currentUser:h,mentionableUsers:v,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:E,timeEntries:k,isTimerRunning:R?.isRunning,timerElapsedSeconds:R?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:C,onTimerStart:W,onTimerStop:H,onTimerDiscard:x})]})}function f0({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var x0={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)"},k0={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)"},w0={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},C0={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function T0({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=c=>{l.current&&!l.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 jsxs("div",{ref:l,className:"relative",children:[jsxs(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:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(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:jsxs("div",{className:"py-1",children:[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)=>jsxs(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:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function N0({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,m]=useState(null),i=useRef(null);if(useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,b)=>{if(b){m(g);try{await b();}catch(w){console.error(`Export ${g} failed:`,w);}finally{m(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(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:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(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:jsx("div",{className:"py-1",children:d.map((g,b)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function D0({onClick:e,label:t}){return jsxs(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:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function xi({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:m,translations:i}){let c=r==="dark"?x0:k0,d={...o==="es"?w0:C0,...i},p=n||l||m;return 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:jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxs(Fragment,{children:[jsx(N0,{theme:c,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:m}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsx(T0,{columns:e,onSelect:t,theme:c,t:d,createTaskLabel:a}):jsx(D0,{onClick:()=>t(),label:a||d.newTask}))]})})}function wi({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[l,m]=useState(""),i=useCallback(()=>{let p=l.trim();p&&(e(p),m(""),n(false));},[l,e]),c=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(m(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:p=>m(p.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{m(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ci({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:m="es"}){let[i,c]=useState(false),[d,p]=useState(false),[g,b]=useState(""),[w,f]=useState([]),[y,h]=useState(""),[v,T]=useState(""),[D,N]=useState(""),[E,k]=useState(false),[R,I]=useState(false),[C,W]=useState(false),H=useRef(null),x=useRef(null),te={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"},oe=useCallback(()=>{b(""),f([]),h(""),T(""),N(""),k(false),I(false),W(false),c(false);},[]);useEffect(()=>{i&&H.current&&H.current.focus();},[i]),useEffect(()=>{if(!i)return;let L=U=>{x.current&&!x.current.contains(U.target)&&(g.trim()||oe());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[i,g,oe]);let ne=useCallback(async()=>{let L=g.trim();if(!(!L||d)){p(true);try{await t({name:L,columnId:e,assigneeIds:w.length>0?w:void 0,startDate:y?new Date(y):void 0,endDate:v?new Date(v):void 0,priority:D||void 0}),b(""),f([]),h(""),T(""),N(""),k(!1),I(!1),W(!1),H.current?.focus();}catch(U){console.error("Error creating card:",U);}finally{p(false);}}},[g,e,w,y,v,D,t,d]),A=useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),ne()):L.key==="Escape"&&oe();},[ne,oe]),ke=useCallback(L=>{f(U=>U.includes(L)?U.filter(S=>S!==L):[...U,L]);},[]),Ie=l==="dark";return i?jsxs("div",{ref:x,className:u("rounded-lg overflow-hidden shadow-lg",Ie?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:H,type:"text",value:g,onChange:L=>b(L.target.value),onKeyDown:A,placeholder:te.placeholder,disabled:d,className:u("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ie?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>k(!E),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",E||w.length>0?"bg-emerald-500/20 text-emerald-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addAssignee,children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),w.length>0&&jsx("span",{className:"ml-0.5",children:w.length})]}),jsx("button",{onClick:()=>I(!R),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||y||v?"bg-blue-500/20 text-blue-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addDates,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsx("button",{onClick:()=>W(!C),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:ne,disabled:!g.trim()||d,className:u("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):te.save})]})]}),E&&a.length>0&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxs("button",{onClick:()=>ke(L.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",w.includes(L.id)?"bg-emerald-500 text-white":Ie?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:u("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",w.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),R&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:u("block text-[10px] uppercase tracking-wide mb-1",Ie?"text-gray-500":"text-gray-400"),children:te.startDate}),jsx("input",{type:"date",value:y,onChange:L=>h(L.target.value),className:u("w-full px-2 py-1.5 rounded text-xs border",Ie?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:u("block text-[10px] uppercase tracking-wide mb-1",Ie?"text-gray-500":"text-gray-400"),children:te.endDate}),jsx("input",{type:"date",value:v,onChange:L=>T(L.target.value),className:u("w-full px-2 py-1.5 rounded text-xs border",Ie?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsx("button",{onClick:()=>N(D===L?"":L),className:u("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:Ie?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[L]},L))})})]}):jsxs("button",{onClick:()=>c(true),disabled:n,className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ie?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsx("span",{className:"text-sm font-medium",children:te.buttonLabel})]})}var ln=class extends 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=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(jsx(_r,{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(`
|
|
19
|
-
`)}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 $c(e={}){return new ln(e)}var Ro=class extends 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):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:jsxs("div",{className:"flex items-start gap-3",children:[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:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),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 Ti(e,t){let a=r=>jsx(Ro,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Di({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:m,shortcut:i="k",className:c=""}){let[d,p]=useState(false),[g,b]=useState(""),[w,f]=useState("home"),[y,h]=useState(""),[v,T]=useState("");useEffect(()=>{let k=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),p(I=>!I)),R.key==="Escape"&&(p(false),f("home"),b(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),useEffect(()=>{d||(f("home"),b(""),h(""),T(""));},[d]);let D=useCallback(()=>{p(false);},[]),N=useCallback(k=>{let[R,I]=k.split(":");switch(R){case "create-card":f("create-card");break;case "create-card-in":h(I||"");break;case "navigate":I?(a?.(I),D()):f("navigate");break;case "search":r?.(g),D();break;case "priority":f("priority");break;case "set-priority":v&&I&&(o?.(v,I),D());break;case "assign":f("assign");break;case "assign-user":v&&I&&(s?.(v,I),D());break;case "ai":f("ai");break;case "ai-generate-plan":n?.(),D();break;case "ai-predict-risks":l?.(),D();break;case "ai-usage":m?.(),D();break;case "back":f("home");break;}},[g,v,t,a,r,o,s,n,l,m,D]),E=useCallback(()=>{y&&g.trim()&&(t?.(y,g.trim()),D());},[y,g,t,D]);return d?jsx(yt,{children:jsx("div",{className:"command-palette-overlay",onClick:D,children:jsx("div",{className:`command-palette ${c}`,onClick:k=>k.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:b,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:w==="create-card"&&y?"Type card title and press Enter...":w==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&w==="create-card"&&y&&E();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),w==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:N,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:N,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:N,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:N,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(R=>jsx("span",{className:"command-palette-item-label",children:R},R))})]},k.id))})]}),w==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxs(Command.Item,{value:`create-card-in:${k.id}`,onSelect:N,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:k.title}),jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),w==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let R=e.columns.find(I=>I.id===k.columnId);return jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:N,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:k.title}),jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},k.id)})})]}),w==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function Hc(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=`
|
|
18
|
+
`}),jsx("div",{ref:Re,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",v?"scrollbar-slim":"scrollbar-slim-light"),children:x.length>0?jsx("div",{className:"space-y-4",children:[...x].sort((P,re)=>{let ve=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,Ze=typeof re.createdAt=="string"?new Date(re.createdAt):re.createdAt;return ve.getTime()-Ze.getTime()}).map(P=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:u("text-sm font-medium",v?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:Sr(P.createdAt)})]}),jsx("div",{className:u("text-sm",v?"text-[#9CA3AF]":"text-gray-600"),children:jsx(fc,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(re=>{let ve=re.type.startsWith("image/");return jsxs("a",{href:re.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",v?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ve?jsx(Image,{className:u("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",v?"text-white":"text-gray-900"),children:re.name})]},re.id)})})]})]},P.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",v?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",v?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",v?"border-white/10":"border-gray-200"),children:jsx(gc,{value:Le,onChange:je,onSubmit:me,users:h,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!T,isSubmitting:qe,theme:s,locale:n,currentUser:p,enableEmoji:true,enableAttachments:!!b,pendingFiles:$,onFilesSelect:ze,onRemoveFile:G})})]})]})]})})}function wi(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function _r({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:m,error:i,children:c,availableTags:d=[],onCreateTag:g,attachmentsByCard:f,onUploadAttachments:x,onDeleteAttachment:T,comments:p,onAddComment:h,currentUser:b,mentionableUsers:y,onTaskOpen:w,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:E,timeEntries:k,timerState:R,onLogTime:I,onUpdateEstimate:C,onStartTimer:W,onStopTimer:H,onDiscardTimer:v}){let[te,oe]=wi(),[ne,A]=useState(null),[ke,Ie]=useState(false),L=useRef(null),U=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),S=o?.theme||"dark",K=S==="dark"||S==="neutral",J=K?"dark":"",ie=useCallback((ce,Ge)=>{t.onCardUpdate?.(ce,Ge);},[t]),ue=useCallback((ce,Ge)=>{t.onColumnUpdate?.(ce,{title:Ge});},[t]),ye=useCallback(ce=>{t.onColumnDelete?.(ce);},[t]),Oe=["todo","in-progress","completed"],Q=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Je=useMemo(()=>{let ce=new Map;return e.columns.forEach(Ge=>{let Be=Ge.cardIds.map(B=>e.cards.find(X=>X.id===B)).filter(B=>B!==void 0).sort((B,X)=>B.position-X.position);ce.set(Ge.id,Be);}),ce},[e.cards,e.columns]);useEffect(()=>{let ce=L.current;if(!ce)return;let Ge=ge=>{let Ae=ge.target,Ue=ge.button===1,nt=Ae===ce||Ae.classList.contains("asakaa-column")&&!Ae.closest(".asakaa-card");(Ue||ge.button===0&&nt&&!te.isDragging)&&(ge.preventDefault(),Ie(true),U.current={x:ge.clientX,y:ge.clientY,scrollLeft:ce.scrollLeft,scrollTop:ce.scrollTop},ce.style.cursor="grabbing",ce.style.userSelect="none");},Be=ge=>{if(!ke)return;let Ae=ge.clientX-U.current.x,Ue=ge.clientY-U.current.y;ce.scrollLeft=U.current.scrollLeft-Ae,ce.scrollTop=U.current.scrollTop-Ue;},B=()=>{ke&&(Ie(false),ce.style.cursor="",ce.style.userSelect="");},X=()=>{ke&&(Ie(false),ce.style.cursor="",ce.style.userSelect="");};return ce.addEventListener("mousedown",Ge),document.addEventListener("mousemove",Be),document.addEventListener("mouseup",B),ce.addEventListener("mouseleave",X),()=>{ce.removeEventListener("mousedown",Ge),document.removeEventListener("mousemove",Be),document.removeEventListener("mouseup",B),ce.removeEventListener("mouseleave",X);}},[ke,te.isDragging]);let Pe=useMemo(()=>e.cards.map(ce=>({id:ce.id,name:ce.title,startDate:ce.startDate?new Date(ce.startDate):void 0,endDate:ce.endDate?new Date(ce.endDate):void 0,progress:ce.progress||0,status:ce.columnId,priority:ce.priority?.toLowerCase(),dependencies:Array.isArray(ce.dependencies)?ce.dependencies.map(Ge=>typeof Ge=="string"?Ge:Ge.taskId):[]})),[e.cards]),rt=useCallback(ce=>{let{active:Ge}=ce,Be=e.cards.find(B=>B.id===Ge.id);Be&&oe({isDragging:true,draggedCardId:Be.id,sourceColumnId:Be.columnId,targetColumnId:Be.columnId});},[e.cards,oe]),ut=useCallback(ce=>{let{active:Ge,over:Be}=ce;if(!Be||!e.cards.find(ge=>ge.id===Ge.id))return;let X=null;Be.data.current?.type==="column"?X=Be.id:Be.data.current?.type==="card"&&(X=e.cards.find(Ae=>Ae.id===Be.id)?.columnId||null),X&&X!==te.targetColumnId&&oe({...te,targetColumnId:X});},[e.cards,te,oe]),It=useCallback(async ce=>{let{active:Ge,over:Be}=ce;if(oe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Be)return;let B=e.cards.find(Ue=>Ue.id===Ge.id);if(!B)return;let X,ge;if(Be.data.current?.type==="column"){X=Be.id;let Ue=Je.get(X)||[];ge=ai(Ue,0);}else {let Ue=e.cards.find($e=>$e.id===Be.id);if(!Ue)return;X=Ue.columnId;let nt=Je.get(X)||[],Pt=nt.findIndex($e=>$e.id===Be.id);ge=ai(nt,Pt);}let Ae=e.columns.find(Ue=>Ue.id===X);if(Ae&&Ae.wipLimit&&Ae.wipLimitType==="hard"){let Ue=Je.get(X)||[];if(B.columnId!==X&&Ue.length>=Ae.wipLimit){t.onWipLimitExceeded?.(Ae,B);return}}(B.columnId!==X||B.position!==ge)&&await t.onCardMove?.(B.id,X,ge);},[e.cards,e.columns,Je,t,oe]),Xe=useCallback(ce=>{A(ce),a?.(ce),w?.(ce.id);},[a,w]),pt=useCallback(ce=>{t.onCardUpdate?.(ce.id,ce),A(ce);},[t]);return m?jsx("div",{className:u("asakaa-board",J,n),style:l,children:jsx(T0,{columnCount:3})}):i?jsx("div",{className:u("asakaa-board",J,n),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Vd,{themeName:S,children:[jsxs(DndContext,{sensors:Q,collisionDetection:closestCorners,onDragStart:rt,onDragOver:ut,onDragEnd:It,children:[jsxs("div",{ref:L,className:u("asakaa-board",J,n),style:{...l,cursor:ke?"grabbing":void 0},"data-theme":S,children:[e.columns.sort((ce,Ge)=>ce.position-Ge.position).map(ce=>{let Ge=Je.get(ce.id)||[],Be=!Oe.includes(ce.id);return jsx(Lo,{column:ce,cards:Ge,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:Xe,onCardUpdate:ie,onColumnRename:ue,onColumnDelete:ye,isDeletable:Be,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},ce.id)}),c]}),jsx(DragOverlay,{children:te.draggedCardId?jsx(Er,{card:e.cards.find(ce=>ce.id===te.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(Mr,{task:ne,isOpen:!!ne,onClose:()=>A(null),onCardUpdate:pt,theme:K?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:g,attachments:ne?f?.get(ne.id)||[]:[],onUploadAttachments:x,onDeleteAttachment:T,availableTasks:Pe,comments:p,onAddComment:h,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:E,timeEntries:k,isTimerRunning:R?.isRunning,timerElapsedSeconds:R?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:C,onTimerStart:W,onTimerStop:H,onTimerDiscard:v})]})}function T0({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var P0={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)"},M0={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)"},F0={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},A0={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function L0({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=c=>{l.current&&!l.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 jsxs("div",{ref:l,className:"relative",children:[jsxs(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:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(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:jsxs("div",{className:"py-1",children:[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)=>jsxs(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:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function I0({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,m]=useState(null),i=useRef(null);if(useEffect(()=>{let f=x=>{i.current&&!i.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(f=>f.handler),g=async(f,x)=>{if(x){m(f);try{await x();}catch(T){console.error(`Export ${f} failed:`,T);}finally{m(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(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:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(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:jsx("div",{className:"py-1",children:d.map((f,x)=>jsxs(motion.button,{onClick:()=>g(f.id,f.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===f.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):f.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function B0({onClick:e,label:t}){return jsxs(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:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Ti({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:m,translations:i}){let c=r==="dark"?P0:M0,d={...o==="es"?F0:A0,...i},g=n||l||m;return 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:jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxs(Fragment,{children:[jsx(I0,{theme:c,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:m}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsx(L0,{columns:e,onSelect:t,theme:c,t:d,createTaskLabel:a}):jsx(B0,{onClick:()=>t(),label:a||d.newTask}))]})})}function Di({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[l,m]=useState(""),i=useCallback(()=>{let g=l.trim();g&&(e(g),m(""),n(false));},[l,e]),c=useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(m(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:g=>m(g.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{m(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Si({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:m="es"}){let[i,c]=useState(false),[d,g]=useState(false),[f,x]=useState(""),[T,p]=useState([]),[h,b]=useState(""),[y,w]=useState(""),[D,N]=useState(""),[E,k]=useState(false),[R,I]=useState(false),[C,W]=useState(false),H=useRef(null),v=useRef(null),te={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"},oe=useCallback(()=>{x(""),p([]),b(""),w(""),N(""),k(false),I(false),W(false),c(false);},[]);useEffect(()=>{i&&H.current&&H.current.focus();},[i]),useEffect(()=>{if(!i)return;let L=U=>{v.current&&!v.current.contains(U.target)&&(f.trim()||oe());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[i,f,oe]);let ne=useCallback(async()=>{let L=f.trim();if(!(!L||d)){g(true);try{await t({name:L,columnId:e,assigneeIds:T.length>0?T:void 0,startDate:h?new Date(h):void 0,endDate:y?new Date(y):void 0,priority:D||void 0}),x(""),p([]),b(""),w(""),N(""),k(!1),I(!1),W(!1),H.current?.focus();}catch(U){console.error("Error creating card:",U);}finally{g(false);}}},[f,e,T,h,y,D,t,d]),A=useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),ne()):L.key==="Escape"&&oe();},[ne,oe]),ke=useCallback(L=>{p(U=>U.includes(L)?U.filter(S=>S!==L):[...U,L]);},[]),Ie=l==="dark";return i?jsxs("div",{ref:v,className:u("rounded-lg overflow-hidden shadow-lg",Ie?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:H,type:"text",value:f,onChange:L=>x(L.target.value),onKeyDown:A,placeholder:te.placeholder,disabled:d,className:u("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ie?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>k(!E),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",E||T.length>0?"bg-emerald-500/20 text-emerald-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addAssignee,children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),T.length>0&&jsx("span",{className:"ml-0.5",children:T.length})]}),jsx("button",{onClick:()=>I(!R),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||h||y?"bg-blue-500/20 text-blue-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addDates,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsx("button",{onClick:()=>W(!C),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:ne,disabled:!f.trim()||d,className:u("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):te.save})]})]}),E&&a.length>0&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxs("button",{onClick:()=>ke(L.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",T.includes(L.id)?"bg-emerald-500 text-white":Ie?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:u("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",T.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),R&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:u("block text-[10px] uppercase tracking-wide mb-1",Ie?"text-gray-500":"text-gray-400"),children:te.startDate}),jsx("input",{type:"date",value:h,onChange:L=>b(L.target.value),className:u("w-full px-2 py-1.5 rounded text-xs border",Ie?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:u("block text-[10px] uppercase tracking-wide mb-1",Ie?"text-gray-500":"text-gray-400"),children:te.endDate}),jsx("input",{type:"date",value:y,onChange:L=>w(L.target.value),className:u("w-full px-2 py-1.5 rounded text-xs border",Ie?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsx("button",{onClick:()=>N(D===L?"":L),className:u("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:Ie?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[L]},L))})})]}):jsxs("button",{onClick:()=>c(true),disabled:n,className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ie?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsx("span",{className:"text-sm font-medium",children:te.buttonLabel})]})}var dn=class extends 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=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(jsx(_r,{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(`
|
|
19
|
+
`)}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 Vc(e={}){return new dn(e)}var Ro=class extends 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):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:jsxs("div",{className:"flex items-start gap-3",children:[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:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),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=>jsx(Ro,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Mi({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:m,shortcut:i="k",className:c=""}){let[d,g]=useState(false),[f,x]=useState(""),[T,p]=useState("home"),[h,b]=useState(""),[y,w]=useState("");useEffect(()=>{let k=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),g(I=>!I)),R.key==="Escape"&&(g(false),p("home"),x(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),useEffect(()=>{d||(p("home"),x(""),b(""),w(""));},[d]);let D=useCallback(()=>{g(false);},[]),N=useCallback(k=>{let[R,I]=k.split(":");switch(R){case "create-card":p("create-card");break;case "create-card-in":b(I||"");break;case "navigate":I?(a?.(I),D()):p("navigate");break;case "search":r?.(f),D();break;case "priority":p("priority");break;case "set-priority":y&&I&&(o?.(y,I),D());break;case "assign":p("assign");break;case "assign-user":y&&I&&(s?.(y,I),D());break;case "ai":p("ai");break;case "ai-generate-plan":n?.(),D();break;case "ai-predict-risks":l?.(),D();break;case "ai-usage":m?.(),D();break;case "back":p("home");break;}},[f,y,t,a,r,o,s,n,l,m,D]),E=useCallback(()=>{h&&f.trim()&&(t?.(h,f.trim()),D());},[h,f,t,D]);return d?jsx(yt,{children:jsx("div",{className:"command-palette-overlay",onClick:D,children:jsx("div",{className:`command-palette ${c}`,onClick:k=>k.stopPropagation(),children:jsxs(Command,{value:f,onValueChange:x,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:T==="create-card"&&h?"Type card title and press Enter...":T==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&T==="create-card"&&h&&E();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),T==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:N,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:N,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:N,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:N,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(R=>jsx("span",{className:"command-palette-item-label",children:R},R))})]},k.id))})]}),T==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxs(Command.Item,{value:`create-card-in:${k.id}`,onSelect:N,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:k.title}),jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),T==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let R=e.columns.find(I=>I.id===k.columnId);return jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:N,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:k.title}),jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},k.id)})})]}),T==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function Kc(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=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -38,7 +38,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
38
38
|
font-size: 12px !important;
|
|
39
39
|
color: rgba(255, 255, 255, 0.4) !important;
|
|
40
40
|
pointer-events: none !important;
|
|
41
|
-
`;let i=()=>{n.remove(),document.removeEventListener("keydown",c);},c=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let
|
|
41
|
+
`;let i=()=>{n.remove(),document.removeEventListener("keydown",c);},c=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let g=r>0?r-1:a.length-1;i(),o(g);}else if(d.key==="ArrowRight"&&a.length>1){let g=r<a.length-1?r+1:0;i(),o(g);}};if(n.onclick=i,document.addEventListener("keydown",c),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
|
|
42
42
|
position: absolute !important;
|
|
43
43
|
bottom: 48px !important;
|
|
44
44
|
left: 50% !important;
|
|
@@ -48,15 +48,15 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
48
48
|
padding: 8px 12px !important;
|
|
49
49
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
50
50
|
border-radius: 20px !important;
|
|
51
|
-
`,d.onclick=
|
|
51
|
+
`,d.onclick=x=>x.stopPropagation(),a.forEach((x,T)=>{let p=document.createElement("button");p.className=`attachment-lightbox-dot ${T===r?"active":""}`,p.style.cssText=`
|
|
52
52
|
width: 8px !important;
|
|
53
53
|
height: 8px !important;
|
|
54
54
|
border-radius: 50% !important;
|
|
55
|
-
background: ${
|
|
55
|
+
background: ${T===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
59
|
-
`,
|
|
59
|
+
`,p.onclick=h=>{h.stopPropagation(),i(),o(T);},d.appendChild(p);});let g=document.createElement("button");g.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",g.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',g.style.cssText=`
|
|
60
60
|
position: absolute !important;
|
|
61
61
|
left: 0 !important;
|
|
62
62
|
top: 0 !important;
|
|
@@ -69,7 +69,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
69
69
|
border: none !important;
|
|
70
70
|
cursor: pointer !important;
|
|
71
71
|
opacity: 0.5 !important;
|
|
72
|
-
`,
|
|
72
|
+
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=x=>{x.stopPropagation();let T=r>0?r-1:a.length-1;i(),o(T);};let f=document.createElement("button");f.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",f.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',f.style.cssText=`
|
|
73
73
|
position: absolute !important;
|
|
74
74
|
right: 0 !important;
|
|
75
75
|
top: 0 !important;
|
|
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=b=>{b.stopPropagation();let w=r<a.length-1?r+1:0;i(),o(w);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(l),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function A0(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 L0(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 Ei(e){return e.startsWith("image/")}function wr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[m,i]=useState(false),[c,d]=useState(null),p=useRef(null),g=useRef(e);g.current=e;let b=useCallback((k,R)=>{R.preventDefault(),R.stopPropagation();let I=g.current.filter(H=>Ei(H.type)),C=I.findIndex(H=>H.id===k.id),W=H=>{let x=g.current.filter(oe=>Ei(oe.type)),te=x[H];te&&Hc(te.url,te.name,x,H,W);};Hc(k.url,k.name,I,C,W);},[]),w=useCallback(k=>{let R=[],I=[];return e.length+k.length>s?(I.push(`Maximum ${s} files allowed`),{valid:R,errors:I}):(k.forEach(C=>{if(C.size/1048576>r){I.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(H=>C.type.match(H))){I.push(`${C.name} has invalid file type`);return}R.push(C);}),{valid:R,errors:I})},[e.length,s,r,o]),f=useCallback(async k=>{let{valid:R,errors:I}=w(k);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(C){d(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[w,t]),y=useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(true);},[]),h=useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);},[]),v=useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),T=useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);let R=Array.from(k.dataTransfer.files);f(R);},[f]),D=useCallback(k=>{let R=k.target.files?Array.from(k.target.files):[];f(R),p.current&&(p.current.value="");},[f]),N=useCallback(()=>{p.current?.click();},[]),E=useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:v,onDrop:T,onClick:N,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:m?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[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:[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"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),c&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(k=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Ei(k.type)&&k.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>b(k,R),title:"Click to view full size",children:[jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:L0(k.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:A0(k.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>E(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function Pi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:b,onGenerateSubtasks:w,onEstimateEffort:f,currentUserId:y="user-1"}){let[h,v]=useState("details"),[T,D]=useState(false),[N,E]=useState({}),[k,R]=useState(""),[I,C]=useState(false),[W,H]=useState({});if(!t||!e)return null;let x=useCallback(()=>{D(false),E({}),v("details"),R(""),H({}),a();},[a]),te=useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),E({}),D(false));},[e.id,N,r]),oe=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),x());},[e.id,o,x]),ne=useCallback(()=>{c&&k.trim()&&(c(e.id,k.trim()),R(""));},[e.id,k,c]),A=useCallback(async()=>{if(b){C(true);try{let S=await b(e);H(K=>({...K,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{C(false);}}},[e,b]),ke=useCallback(async()=>{if(w){C(true);try{let S=await w(e);H(K=>({...K,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{C(false);}}},[e,w]),Ie=useCallback(async()=>{if(f){C(true);try{let S=await f(e);H(K=>({...K,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{C(false);}}},[e,f]),L={...e,...N},U=s.filter(S=>L.assignedUserIds?.includes(S.id));return jsx(yt,{children:jsx("div",{className:"card-detail-overlay",onClick:x,children:jsxs("div",{className:"card-detail-modal",onClick:S=>S.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),T?jsx("input",{type:"text",value:N.title??L.title,onChange:S=>E({...N,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[T?jsxs(Fragment,{children:[jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{D(false),E({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:oe,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),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"]}),jsx("button",{onClick:x,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>v("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>v("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>v("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>v("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children: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&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>v("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),T?jsx("textarea",{value:N.description??L.description??"",onChange:S=>E({...N,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),T?jsx("select",{multiple:true,value:N.assignedUserIds??L.assignedUserIds??[],onChange:S=>{let K=Array.from(S.target.selectedOptions,J=>J.value);E({...N,assignedUserIds:K});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsx("option",{value:S.id,children:S.name},S.id))}):jsx("div",{className:"card-detail-users",children:U.length>0?U.map(S=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsx("span",{children:S.name})]},S.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),T?jsxs("select",{value:N.priority??L.priority??"",onChange:S=>E({...N,priority:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:L.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:L.labels&&L.labels.length>0?L.labels.map(S=>jsx("span",{className:"card-detail-label-tag",children:S},S)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),T?jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:S=>E({...N,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),T?jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:S=>E({...N,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),T?jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??L.estimatedTime??"",onChange:S=>E({...N,estimatedTime:S.target.value?parseFloat(S.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:L.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:L.dependencies&&L.dependencies.length>0?L.dependencies.map(S=>{let K=typeof S=="string"?S:S.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",K.slice(-4)]},K)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:k,onChange:S=>R(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ne,disabled:!k.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(S=>{let K=s.find(J=>J.id===S.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[K&&jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:K?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(S.id),className:"card-detail-comment-delete",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:S.content})]},S.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsx("div",{className:"card-detail-activity",children:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(S=>{let K=s.find(J=>J.id===S.userId);return jsxs("div",{className:"card-detail-activity-item",children:[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}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:K?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:S.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(wr,{cardId:e.id,attachments:i,onUpload:p?S=>p(e.id,S):void 0,onDelete:g,currentUserId:y,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:A,disabled:I||!b,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:ke,disabled:I||!w,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:Ie,disabled:I||!f,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),W.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((S,K)=>{let J=s.find(ie=>ie.id===S.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},K)})]}),W.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((S,K)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},K))]}),W.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[W.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),m.map(S=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&m.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function cn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,m]=useState({top:0,left:0}),i=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,b=4,w=d.left;w+o>g-10&&(w=g-o-10),w<10&&(w=10);let f=p-d.bottom,y=d.top,h;return f>=s+b?h=d.bottom+b:y>=s+b?h=d.top-s-b:f>=y?h=d.bottom+b:h=Math.max(10,d.top-s-b),{top:h,left:w}},[e,o,s]);return useEffect(()=>{t&&m(c());},[t,c]),useEffect(()=>{if(!t)return;let d=g=>{let b=g.target;i.current&&!i.current.contains(b)&&e.current&&!e.current.contains(b)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(yt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.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 et={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 H0=["LOW","MEDIUM","HIGH","URGENT"],W0=["todo","in-progress","review","done"];function Ai({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:b=[],availableLabels:w=[],availableTags:f=[],onCreateTag:y,onUploadCoverImage:h,unsplashAccessKey:v,theme:T,onSubtasksChange:D,attachments:N=[],onUploadAttachments:E,onDeleteAttachment:k}){let R=Mo(),I=T||R?.themeName||"dark",[C,W]=useState(e),[H,x]=useState(false),[te,oe]=useState(e?.subtasks||[]),[ne,A]=useState(false),[ke,Ie]=useState(""),[L,U]=useState(""),[S,K]=useState("all"),[J,ie]=useState(false),[ue,ye]=useState(false),[Oe,Q]=useState(false),[Je,Pe]=useState(false),[rt,ut]=useState(false),[It,Xe]=useState(false),pt=useRef(null),ce=useRef(null),Ge=useRef(null),Be=useRef(null),B=useRef(null),X=useRef(null),ge=useRef(null),Ae=useRef(null),Ue=useRef(null),nt=useRef(null),Pt=useRef(null),$e=useRef(null);useEffect(()=>{e&&!C?(W({...e}),oe(e.subtasks||[])):e&&C&&e.id!==C.id&&(W({...e}),oe(e.subtasks||[]));},[e,C]),useEffect(()=>{let G=me=>{let _e=me.target;Be.current&&!Be.current.contains(_e)&&ie(false),B.current&&!B.current.contains(_e)&&ye(false),X.current&&!X.current.contains(_e)&&Q(false),ge.current&&!ge.current.contains(_e)&&Pe(false);};if(J||ue||Oe||Je)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[J,ue,Oe,Je]),useEffect(()=>{if(!t)return;let G=me=>{let _e=me.target,Tt=_e.tagName==="INPUT"||_e.tagName==="TEXTAREA"||_e.isContentEditable;if(me.key==="Escape"){me.preventDefault(),J||ue||Oe||Je||rt||It?(ie(false),ye(false),Q(false),Pe(false),ut(false),Xe(false)):Tt||a();return}if(Tt&&me.key!=="Escape")return;let gt=me.metaKey||me.ctrlKey;switch(me.key.toLowerCase()){case "s":me.preventDefault(),ie(true);break;case "a":me.preventDefault(),Q(true);break;case "p":me.preventDefault(),ye(true);break;case "l":me.preventDefault(),Pe(true);break;case "d":gt||(me.preventDefault(),ut(true),setTimeout(()=>Ae.current?.focus(),0));break;case "e":gt||(me.preventDefault(),Xe(true));break;case "i":me.preventDefault(),x(true),setTimeout(()=>ce.current?.focus(),0);break;case "t":me.preventDefault(),A(true);break;case "c":me.preventDefault(),Ge.current?.focus();break}};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[t,a,J,ue,Oe,Je,rt,It]);let O=useCallback(G=>{let me=G.currentTarget.textContent?.trim()||"";if(C&&me!==C.title){let _e={...C,title:me};W(_e),r?.(C.id,{title:me});}},[C,r]),ae=useCallback(G=>{G.key==="Enter"&&(G.preventDefault(),G.currentTarget.blur()),G.key==="Escape"&&(G.preventDefault(),G.currentTarget.textContent=C?.title||"",G.currentTarget.blur());},[C]),Le=useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),x(false);},[C,e,r]),je=useCallback(G=>{if(C){let me={...C,columnId:G};W(me),r?.(C.id,{columnId:G}),ie(false);}},[C,r]),qe=useCallback(G=>{if(C){let me={...C,priority:G};W(me),r?.(C.id,{priority:G}),ye(false);}},[C,r]),j=useCallback(G=>{if(C){let me=C.assignedUserIds||[],_e=me.includes(G)?me.filter(gt=>gt!==G):[...me,G],Tt={...C,assignedUserIds:_e};W(Tt),r?.(C.id,{assignedUserIds:_e});}},[C,r]),$=useCallback(G=>{if(C){let me=C.labels||[],_e=me.includes(G)?me.filter(gt=>gt!==G):[...me,G],Tt={...C,labels:_e};W(Tt),r?.(C.id,{labels:_e});}},[C,r]),Me=useCallback(G=>{if(C){let me={...C,tags:G};W(me),r?.(C.id,{tags:G});}},[C,r]),ht=useCallback(G=>{if(C){let me=G.target.value,_e={...C,endDate:me};W(_e),r?.(C.id,{endDate:me}),ut(false);}},[C,r]),le=useCallback(G=>{if(C){let me={...C,estimatedTime:parseFloat(G)||0};W(me),r?.(C.id,{estimatedTime:parseFloat(G)||0});}},[C,r]),He=useCallback(()=>{if(ke.trim()&&C){let G={id:`subtask-${Date.now()}`,title:ke.trim(),completed:false,createdAt:new Date},me=[...te,G];oe(me),Ie(""),A(false),D?.(C.id,me);}},[ke,te,C,D]),De=useCallback(G=>{let me=te.map(_e=>_e.id===G?{..._e,completed:!_e.completed,updatedAt:new Date}:_e);oe(me),C&&D?.(C.id,me);},[te,C,D]),Re=useCallback(G=>{let me=te.filter(_e=>_e.id!==G);oe(me),C&&D?.(C.id,me);},[te,C,D]),de=useCallback(()=>{L.trim()&&C&&m&&(m(C.id,L.trim()),U(""));},[L,C,m]),Ve=useCallback(G=>{(G.metaKey||G.ctrlKey)&&G.key==="Enter"&&(G.preventDefault(),de());},[de]),V=G=>jsx($0,{remarkPlugins:[z0],rehypePlugins:[U0],components:{a:({node:me,..._e})=>jsx("a",{..._e,target:"_blank",rel:"noopener noreferrer"})},children:G}),q=l.filter(G=>S==="comments"?G.type.includes("COMMENT"):S==="history"?!G.type.includes("COMMENT"):true);if(!t||!e)return null;let Se=C||e,Ye=s.filter(G=>Se.assignedUserIds?.includes(G.id)),ze=te.filter(G=>G.completed).length;return jsx(yt,{children: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:jsxs("div",{className:"modal-v2-container",onClick:G=>G.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:pt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:O,onKeyDown:ae,children:Se.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:Be,children:[jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>ie(!J),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:Se.columnId||"No status"})]}),jsx(cn,{triggerRef:Ue,isOpen:J,onClose:()=>ie(false),width:250,estimatedHeight:200,children:(b.length>0?b:W0.map(G=>({id:G,title:G}))).map(G=>jsx("button",{className:`modal-v2-popover-item ${Se.columnId===G.id?"active":""}`,onClick:()=>je(G.id),children:G.title},G.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:X,children:[jsxs("button",{ref:nt,className:"modal-v2-field",onClick:()=>Q(!Oe),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:Ye.length>0?jsx("div",{className:"modal-v2-avatars",children:Ye.map(G=>jsx("div",{className:"modal-v2-avatar",style:{background:G.color},title:G.name,children:G.initials},G.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(cn,{triggerRef:nt,isOpen:Oe,onClose:()=>Q(false),width:280,estimatedHeight:300,children:s.map(G=>jsxs("button",{className:`modal-v2-popover-item ${Se.assignedUserIds?.includes(G.id)?"active":""}`,onClick:()=>j(G.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:G.color},children:G.initials}),G.name,Se.assignedUserIds?.includes(G.id)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},G.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:B,children:[jsxs("button",{ref:Pt,className:"modal-v2-field",onClick:()=>ye(!ue),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:Se.priority||"None"})]}),jsxs(cn,{triggerRef:Pt,isOpen:ue,onClose:()=>ye(false),width:180,estimatedHeight:220,children:[H0.map(G=>jsx("button",{className:`modal-v2-popover-item priority-${G.toLowerCase()} ${Se.priority===G?"active":""}`,onClick:()=>qe(G),children:G},G)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>qe(""),children:"None"})]})]}),f.length>0||y?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(Gr,{selectedTags:Se.tags||[],availableTags:f,onChange:Me,onCreateTag:y,theme:et[I]||et.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:ge,children:[jsxs("button",{ref:$e,className:"modal-v2-field",onClick:()=>Pe(!Je),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Labels"}),jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsx("div",{className:"modal-v2-field-value",children:Se.labels&&Se.labels.length>0?jsx("span",{children:Se.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(cn,{triggerRef:$e,isOpen:Je,onClose:()=>Pe(false),width:220,estimatedHeight:200,children:(w.length>0?w:["Bug","Feature","Enhancement","Documentation"]).map(G=>jsxs("button",{className:`modal-v2-popover-item ${Se.labels?.includes(G)?"active":""}`,onClick:()=>$(G),children:[G,Se.labels?.includes(G)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},G))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{ut(!rt),setTimeout(()=>Ae.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:Se.endDate?new Date(Se.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Ae,type:"date",value:typeof Se.endDate=="string"?Se.endDate.split("T")[0]:Se.endDate?(()=>{let G=new Date(Se.endDate),me=G.getUTCFullYear(),_e=String(G.getUTCMonth()+1).padStart(2,"0"),Tt=String(G.getUTCDate()).padStart(2,"0");return `${me}-${_e}-${Tt}`})():"",onChange:ht,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Xe(!It),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:Se.estimatedTime?`${Se.estimatedTime}h`:"Not set"})]}),It&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Se.estimatedTime||"",onChange:G=>le(G.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Xe(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"})]}),H?jsx("textarea",{className:"modal-v2-textarea",value:Se.description||"",onChange:G=>{if(C){let me={...C,description:G.target.value};W(me);}},onBlur:Le,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>x(true),children:Se.description?jsx("div",{className:"modal-v2-markdown",children:V(Se.description)}):jsxs("p",{className:"modal-v2-placeholder",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M9 11l3 3L22 4"}),jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsx("h2",{children:"Subtasks"}),te.length>0&&jsxs("span",{className:"modal-v2-count",children:[ze,"/",te.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>A(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[te.map(G=>jsxs("div",{className:`modal-v2-subtask ${G.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>De(G.id),children:G.completed?jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsx("span",{className:"modal-v2-subtask-title",children:G.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Re(G.id),children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},G.id)),ne&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:ke,onChange:G=>Ie(G.target.value),onKeyDown:G=>{G.key==="Enter"&&He(),G.key==="Escape"&&(A(false),Ie(""));},onBlur:He,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(E||N.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children: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"})}),jsx("h2",{children:"Attachments"}),N.length>0&&jsx("span",{className:"modal-v2-count",children:N.length})]}),jsx(wr,{cardId:Se.id,attachments:N,onUpload:E?G=>E(Se.id,G):void 0,onDelete:k,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${S==="all"?"active":""}`,onClick:()=>K("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>K("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>K("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Ge,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:L,onChange:G=>U(G.target.value),onKeyDown:Ve,rows:1}),jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxs("div",{className:"modal-v2-toolbar-left",children:[jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children: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"})})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"4"}),jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsx("button",{className:"modal-v2-send-button",onClick:de,disabled:!L.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[q.map(G=>{let me=s.find(Tt=>Tt.id===G.userId);if(G.type.includes("COMMENT")){let Tt=n.find(gt=>gt.id===G.metadata?.commentId);return Tt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[me&&jsx("div",{className:"modal-v2-avatar",style:{background:me.color},children:me.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:me?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(G.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Tt.content})]})]},G.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[G.type.includes("CREATED")&&"\u2795",G.type.includes("UPDATED")&&"\u270F\uFE0F",G.type.includes("MOVED")&&"\u27A1\uFE0F",G.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",G.type.includes("ASSIGNED")&&"\u{1F464}",G.type.includes("PRIORITY")&&"\u{1F3AF}",G.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:me?.name||"Unknown"})," ",G.type.replace(/_/g," ").toLowerCase(),G.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:G.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(G.timestamp).toLocaleString()})]})]},G.id)}),q.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function J0({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},r))]})}function Ii({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((l,m)=>l+m.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(J0,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function sb({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},r))]})}function Bi({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,l=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(sb,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(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"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),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 fb={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Xc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function bb({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:m,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Jc({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 jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[o,"%"]})]})]})}function Ri({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||fb[m.name]||Xc[e.indexOf(m)%Xc.length]})),l=n.map(m=>m.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?bb:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Jc,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.value} - ${d}%)`}})]}):jsxs(BarChart$1,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Jc,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((m,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,i)=>i.value>m.value?i:m).name})]})]})]})}var as=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[m,i]=useState(false),[c,d]=useState(false),[p,g]=useState(false);if(e.length===0)return null;let b=e.map(T=>T.id),w=T=>{r.onBulkUpdate?.(b,{priority:T}),l(false);},f=T=>{r.onBulkMove?.(b,T),i(false),a();},y=T=>{r.onBulkUpdate?.(b,{assignedUserIds:T}),d(false);},h=T=>{let D=new Set;e.forEach(E=>{E.labels?.forEach(k=>D.add(k));});let N=Array.from(new Set([...D,...T]));r.onBulkUpdate?.(b,{labels:N}),g(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(b),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(T=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w(T),children:[jsx("span",{className:u("asakaa-priority-dot",T==="LOW"&&"bg-asakaa-priority-low",T==="MEDIUM"&&"bg-asakaa-priority-medium",T==="HIGH"&&"bg-asakaa-priority-high",T==="URGENT"&&"bg-asakaa-priority-urgent")}),T]},T))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(T=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(T.id),children:T.title},T.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(T=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([T.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:T.color},children:T.initials}),T.name]},T.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(T=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([T]),children:T},T))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});as.displayName="BulkOperationsToolbar";function kb(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(g=>{let b=a?.find(w=>w.id===g);n=`assignee-${g}`,l=b?.name||`User ${g}`,m=b?.color,i=b?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,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];l=p.title,m=p.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,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 Oi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),l=useMemo(()=>kb(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(_r,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),p={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[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:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(_r,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),l.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var $i=[{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 zi({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=$i.find(i=>i.value===e)||$i[0];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 jsxs("div",{className:u("relative inline-block",a),children:[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:[jsx("span",{className:"text-base leading-none",children:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&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:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:$i.map(i=>jsxs("button",{onClick:()=>m(i.value),className:u("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:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var mn=[{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 Tb(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,l=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&l&&m}function am(e={}){let{shortcuts:t=mn,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(m=>{o.current=[...o.current,m];},[]),l=useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return 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 d of o.current)if(Tb(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Db(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Sb(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 Eb(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Sb(e),r=t?Db(t):"";return a?`${a} + ${r}`:r}function Pb(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 Ui({shortcuts:e=mn,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Pb(e);return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),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:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),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"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([l,m])=>m.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:m.map(i=>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:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),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:Eb(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",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:**
|
|
85
|
+
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=x=>{x.stopPropagation();let T=r<a.length-1?r+1:0;i(),o(T);},n.appendChild(d),n.appendChild(g),n.appendChild(f);}n.appendChild(l),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function H0(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 W0(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 Ai(e){return e.startsWith("image/")}function Cr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[m,i]=useState(false),[c,d]=useState(null),g=useRef(null),f=useRef(e);f.current=e;let x=useCallback((k,R)=>{R.preventDefault(),R.stopPropagation();let I=f.current.filter(H=>Ai(H.type)),C=I.findIndex(H=>H.id===k.id),W=H=>{let v=f.current.filter(oe=>Ai(oe.type)),te=v[H];te&&Kc(te.url,te.name,v,H,W);};Kc(k.url,k.name,I,C,W);},[]),T=useCallback(k=>{let R=[],I=[];return e.length+k.length>s?(I.push(`Maximum ${s} files allowed`),{valid:R,errors:I}):(k.forEach(C=>{if(C.size/1048576>r){I.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(H=>C.type.match(H))){I.push(`${C.name} has invalid file type`);return}R.push(C);}),{valid:R,errors:I})},[e.length,s,r,o]),p=useCallback(async k=>{let{valid:R,errors:I}=T(k);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(C){d(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[T,t]),h=useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(true);},[]),b=useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);},[]),y=useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),w=useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);let R=Array.from(k.dataTransfer.files);p(R);},[p]),D=useCallback(k=>{let R=k.target.files?Array.from(k.target.files):[];p(R),g.current&&(g.current.value="");},[p]),N=useCallback(()=>{g.current?.click();},[]),E=useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:h,onDragLeave:b,onDragOver:y,onDrop:w,onClick:N,children:[jsx("input",{ref:g,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:m?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[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:[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"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),c&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(k=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Ai(k.type)&&k.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>x(k,R),title:"Click to view full size",children:[jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:W0(k.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:H0(k.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>E(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function Li({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:g,onDeleteAttachment:f,onSuggestAssignee:x,onGenerateSubtasks:T,onEstimateEffort:p,currentUserId:h="user-1"}){let[b,y]=useState("details"),[w,D]=useState(false),[N,E]=useState({}),[k,R]=useState(""),[I,C]=useState(false),[W,H]=useState({});if(!t||!e)return null;let v=useCallback(()=>{D(false),E({}),y("details"),R(""),H({}),a();},[a]),te=useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),E({}),D(false));},[e.id,N,r]),oe=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),v());},[e.id,o,v]),ne=useCallback(()=>{c&&k.trim()&&(c(e.id,k.trim()),R(""));},[e.id,k,c]),A=useCallback(async()=>{if(x){C(true);try{let S=await x(e);H(K=>({...K,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{C(false);}}},[e,x]),ke=useCallback(async()=>{if(T){C(true);try{let S=await T(e);H(K=>({...K,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{C(false);}}},[e,T]),Ie=useCallback(async()=>{if(p){C(true);try{let S=await p(e);H(K=>({...K,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{C(false);}}},[e,p]),L={...e,...N},U=s.filter(S=>L.assignedUserIds?.includes(S.id));return jsx(yt,{children:jsx("div",{className:"card-detail-overlay",onClick:v,children:jsxs("div",{className:"card-detail-modal",onClick:S=>S.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsx("input",{type:"text",value:N.title??L.title,onChange:S=>E({...N,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[w?jsxs(Fragment,{children:[jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{D(false),E({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:oe,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),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"]}),jsx("button",{onClick:v,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>y("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>y("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>y("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>y("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children: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&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>y("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),w?jsx("textarea",{value:N.description??L.description??"",onChange:S=>E({...N,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsx("select",{multiple:true,value:N.assignedUserIds??L.assignedUserIds??[],onChange:S=>{let K=Array.from(S.target.selectedOptions,J=>J.value);E({...N,assignedUserIds:K});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsx("option",{value:S.id,children:S.name},S.id))}):jsx("div",{className:"card-detail-users",children:U.length>0?U.map(S=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsx("span",{children:S.name})]},S.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),w?jsxs("select",{value:N.priority??L.priority??"",onChange:S=>E({...N,priority:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:L.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:L.labels&&L.labels.length>0?L.labels.map(S=>jsx("span",{className:"card-detail-label-tag",children:S},S)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),w?jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:S=>E({...N,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:S=>E({...N,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??L.estimatedTime??"",onChange:S=>E({...N,estimatedTime:S.target.value?parseFloat(S.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:L.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:L.dependencies&&L.dependencies.length>0?L.dependencies.map(S=>{let K=typeof S=="string"?S:S.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",K.slice(-4)]},K)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:k,onChange:S=>R(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ne,disabled:!k.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(S=>{let K=s.find(J=>J.id===S.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[K&&jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:K?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(S.id),className:"card-detail-comment-delete",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:S.content})]},S.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsx("div",{className:"card-detail-activity",children:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(S=>{let K=s.find(J=>J.id===S.userId);return jsxs("div",{className:"card-detail-activity-item",children:[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}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:K?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:S.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(Cr,{cardId:e.id,attachments:i,onUpload:g?S=>g(e.id,S):void 0,onDelete:f,currentUserId:h,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:A,disabled:I||!x,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:ke,disabled:I||!T,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:Ie,disabled:I||!p,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),W.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((S,K)=>{let J=s.find(ie=>ie.id===S.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},K)})]}),W.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((S,K)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},K))]}),W.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[W.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),m.map(S=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&m.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function mn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,m]=useState({top:0,left:0}),i=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),g=window.innerHeight,f=window.innerWidth,x=4,T=d.left;T+o>f-10&&(T=f-o-10),T<10&&(T=10);let p=g-d.bottom,h=d.top,b;return p>=s+x?b=d.bottom+x:h>=s+x?b=d.top-s-x:p>=h?b=d.bottom+x:b=Math.max(10,d.top-s-x),{top:b,left:T}},[e,o,s]);return useEffect(()=>{t&&m(c());},[t,c]),useEffect(()=>{if(!t)return;let d=f=>{let x=f.target;i.current&&!i.current.contains(x)&&e.current&&!e.current.contains(x)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(yt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.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 et={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 X0=["LOW","MEDIUM","HIGH","URGENT"],J0=["todo","in-progress","review","done"];function Ri({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:g,onAIFindSimilar:f,availableColumns:x=[],availableLabels:T=[],availableTags:p=[],onCreateTag:h,onUploadCoverImage:b,unsplashAccessKey:y,theme:w,onSubtasksChange:D,attachments:N=[],onUploadAttachments:E,onDeleteAttachment:k}){let R=Mo(),I=w||R?.themeName||"dark",[C,W]=useState(e),[H,v]=useState(false),[te,oe]=useState(e?.subtasks||[]),[ne,A]=useState(false),[ke,Ie]=useState(""),[L,U]=useState(""),[S,K]=useState("all"),[J,ie]=useState(false),[ue,ye]=useState(false),[Oe,Q]=useState(false),[Je,Pe]=useState(false),[rt,ut]=useState(false),[It,Xe]=useState(false),pt=useRef(null),ce=useRef(null),Ge=useRef(null),Be=useRef(null),B=useRef(null),X=useRef(null),ge=useRef(null),Ae=useRef(null),Ue=useRef(null),nt=useRef(null),Pt=useRef(null),$e=useRef(null);useEffect(()=>{e&&!C?(W({...e}),oe(e.subtasks||[])):e&&C&&e.id!==C.id&&(W({...e}),oe(e.subtasks||[]));},[e,C]),useEffect(()=>{let G=me=>{let _e=me.target;Be.current&&!Be.current.contains(_e)&&ie(false),B.current&&!B.current.contains(_e)&&ye(false),X.current&&!X.current.contains(_e)&&Q(false),ge.current&&!ge.current.contains(_e)&&Pe(false);};if(J||ue||Oe||Je)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[J,ue,Oe,Je]),useEffect(()=>{if(!t)return;let G=me=>{let _e=me.target,Tt=_e.tagName==="INPUT"||_e.tagName==="TEXTAREA"||_e.isContentEditable;if(me.key==="Escape"){me.preventDefault(),J||ue||Oe||Je||rt||It?(ie(false),ye(false),Q(false),Pe(false),ut(false),Xe(false)):Tt||a();return}if(Tt&&me.key!=="Escape")return;let gt=me.metaKey||me.ctrlKey;switch(me.key.toLowerCase()){case "s":me.preventDefault(),ie(true);break;case "a":me.preventDefault(),Q(true);break;case "p":me.preventDefault(),ye(true);break;case "l":me.preventDefault(),Pe(true);break;case "d":gt||(me.preventDefault(),ut(true),setTimeout(()=>Ae.current?.focus(),0));break;case "e":gt||(me.preventDefault(),Xe(true));break;case "i":me.preventDefault(),v(true),setTimeout(()=>ce.current?.focus(),0);break;case "t":me.preventDefault(),A(true);break;case "c":me.preventDefault(),Ge.current?.focus();break}};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[t,a,J,ue,Oe,Je,rt,It]);let O=useCallback(G=>{let me=G.currentTarget.textContent?.trim()||"";if(C&&me!==C.title){let _e={...C,title:me};W(_e),r?.(C.id,{title:me});}},[C,r]),ae=useCallback(G=>{G.key==="Enter"&&(G.preventDefault(),G.currentTarget.blur()),G.key==="Escape"&&(G.preventDefault(),G.currentTarget.textContent=C?.title||"",G.currentTarget.blur());},[C]),Le=useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),v(false);},[C,e,r]),je=useCallback(G=>{if(C){let me={...C,columnId:G};W(me),r?.(C.id,{columnId:G}),ie(false);}},[C,r]),qe=useCallback(G=>{if(C){let me={...C,priority:G};W(me),r?.(C.id,{priority:G}),ye(false);}},[C,r]),j=useCallback(G=>{if(C){let me=C.assignedUserIds||[],_e=me.includes(G)?me.filter(gt=>gt!==G):[...me,G],Tt={...C,assignedUserIds:_e};W(Tt),r?.(C.id,{assignedUserIds:_e});}},[C,r]),$=useCallback(G=>{if(C){let me=C.labels||[],_e=me.includes(G)?me.filter(gt=>gt!==G):[...me,G],Tt={...C,labels:_e};W(Tt),r?.(C.id,{labels:_e});}},[C,r]),Me=useCallback(G=>{if(C){let me={...C,tags:G};W(me),r?.(C.id,{tags:G});}},[C,r]),ht=useCallback(G=>{if(C){let me=G.target.value,_e={...C,endDate:me};W(_e),r?.(C.id,{endDate:me}),ut(false);}},[C,r]),le=useCallback(G=>{if(C){let me={...C,estimatedTime:parseFloat(G)||0};W(me),r?.(C.id,{estimatedTime:parseFloat(G)||0});}},[C,r]),He=useCallback(()=>{if(ke.trim()&&C){let G={id:`subtask-${Date.now()}`,title:ke.trim(),completed:false,createdAt:new Date},me=[...te,G];oe(me),Ie(""),A(false),D?.(C.id,me);}},[ke,te,C,D]),De=useCallback(G=>{let me=te.map(_e=>_e.id===G?{..._e,completed:!_e.completed,updatedAt:new Date}:_e);oe(me),C&&D?.(C.id,me);},[te,C,D]),Re=useCallback(G=>{let me=te.filter(_e=>_e.id!==G);oe(me),C&&D?.(C.id,me);},[te,C,D]),de=useCallback(()=>{L.trim()&&C&&m&&(m(C.id,L.trim()),U(""));},[L,C,m]),Ve=useCallback(G=>{(G.metaKey||G.ctrlKey)&&G.key==="Enter"&&(G.preventDefault(),de());},[de]),V=G=>jsx(K0,{remarkPlugins:[Y0],rehypePlugins:[q0],components:{a:({node:me,..._e})=>jsx("a",{..._e,target:"_blank",rel:"noopener noreferrer"})},children:G}),q=l.filter(G=>S==="comments"?G.type.includes("COMMENT"):S==="history"?!G.type.includes("COMMENT"):true);if(!t||!e)return null;let Se=C||e,Ye=s.filter(G=>Se.assignedUserIds?.includes(G.id)),ze=te.filter(G=>G.completed).length;return jsx(yt,{children: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:jsxs("div",{className:"modal-v2-container",onClick:G=>G.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:pt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:O,onKeyDown:ae,children:Se.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:Be,children:[jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>ie(!J),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:Se.columnId||"No status"})]}),jsx(mn,{triggerRef:Ue,isOpen:J,onClose:()=>ie(false),width:250,estimatedHeight:200,children:(x.length>0?x:J0.map(G=>({id:G,title:G}))).map(G=>jsx("button",{className:`modal-v2-popover-item ${Se.columnId===G.id?"active":""}`,onClick:()=>je(G.id),children:G.title},G.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:X,children:[jsxs("button",{ref:nt,className:"modal-v2-field",onClick:()=>Q(!Oe),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:Ye.length>0?jsx("div",{className:"modal-v2-avatars",children:Ye.map(G=>jsx("div",{className:"modal-v2-avatar",style:{background:G.color},title:G.name,children:G.initials},G.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(mn,{triggerRef:nt,isOpen:Oe,onClose:()=>Q(false),width:280,estimatedHeight:300,children:s.map(G=>jsxs("button",{className:`modal-v2-popover-item ${Se.assignedUserIds?.includes(G.id)?"active":""}`,onClick:()=>j(G.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:G.color},children:G.initials}),G.name,Se.assignedUserIds?.includes(G.id)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},G.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:B,children:[jsxs("button",{ref:Pt,className:"modal-v2-field",onClick:()=>ye(!ue),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:Se.priority||"None"})]}),jsxs(mn,{triggerRef:Pt,isOpen:ue,onClose:()=>ye(false),width:180,estimatedHeight:220,children:[X0.map(G=>jsx("button",{className:`modal-v2-popover-item priority-${G.toLowerCase()} ${Se.priority===G?"active":""}`,onClick:()=>qe(G),children:G},G)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>qe(""),children:"None"})]})]}),p.length>0||h?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(Gr,{selectedTags:Se.tags||[],availableTags:p,onChange:Me,onCreateTag:h,theme:et[I]||et.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:ge,children:[jsxs("button",{ref:$e,className:"modal-v2-field",onClick:()=>Pe(!Je),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Labels"}),jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsx("div",{className:"modal-v2-field-value",children:Se.labels&&Se.labels.length>0?jsx("span",{children:Se.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(mn,{triggerRef:$e,isOpen:Je,onClose:()=>Pe(false),width:220,estimatedHeight:200,children:(T.length>0?T:["Bug","Feature","Enhancement","Documentation"]).map(G=>jsxs("button",{className:`modal-v2-popover-item ${Se.labels?.includes(G)?"active":""}`,onClick:()=>$(G),children:[G,Se.labels?.includes(G)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},G))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{ut(!rt),setTimeout(()=>Ae.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:Se.endDate?new Date(Se.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Ae,type:"date",value:typeof Se.endDate=="string"?Se.endDate.split("T")[0]:Se.endDate?(()=>{let G=new Date(Se.endDate),me=G.getUTCFullYear(),_e=String(G.getUTCMonth()+1).padStart(2,"0"),Tt=String(G.getUTCDate()).padStart(2,"0");return `${me}-${_e}-${Tt}`})():"",onChange:ht,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Xe(!It),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:Se.estimatedTime?`${Se.estimatedTime}h`:"Not set"})]}),It&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Se.estimatedTime||"",onChange:G=>le(G.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Xe(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"})]}),H?jsx("textarea",{className:"modal-v2-textarea",value:Se.description||"",onChange:G=>{if(C){let me={...C,description:G.target.value};W(me);}},onBlur:Le,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>v(true),children:Se.description?jsx("div",{className:"modal-v2-markdown",children:V(Se.description)}):jsxs("p",{className:"modal-v2-placeholder",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M9 11l3 3L22 4"}),jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsx("h2",{children:"Subtasks"}),te.length>0&&jsxs("span",{className:"modal-v2-count",children:[ze,"/",te.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>A(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[te.map(G=>jsxs("div",{className:`modal-v2-subtask ${G.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>De(G.id),children:G.completed?jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsx("span",{className:"modal-v2-subtask-title",children:G.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Re(G.id),children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},G.id)),ne&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:ke,onChange:G=>Ie(G.target.value),onKeyDown:G=>{G.key==="Enter"&&He(),G.key==="Escape"&&(A(false),Ie(""));},onBlur:He,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(E||N.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children: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"})}),jsx("h2",{children:"Attachments"}),N.length>0&&jsx("span",{className:"modal-v2-count",children:N.length})]}),jsx(Cr,{cardId:Se.id,attachments:N,onUpload:E?G=>E(Se.id,G):void 0,onDelete:k,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${S==="all"?"active":""}`,onClick:()=>K("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>K("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>K("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Ge,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:L,onChange:G=>U(G.target.value),onKeyDown:Ve,rows:1}),jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxs("div",{className:"modal-v2-toolbar-left",children:[jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children: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"})})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"4"}),jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsx("button",{className:"modal-v2-send-button",onClick:de,disabled:!L.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[q.map(G=>{let me=s.find(Tt=>Tt.id===G.userId);if(G.type.includes("COMMENT")){let Tt=n.find(gt=>gt.id===G.metadata?.commentId);return Tt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[me&&jsx("div",{className:"modal-v2-avatar",style:{background:me.color},children:me.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:me?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(G.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Tt.content})]})]},G.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[G.type.includes("CREATED")&&"\u2795",G.type.includes("UPDATED")&&"\u270F\uFE0F",G.type.includes("MOVED")&&"\u27A1\uFE0F",G.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",G.type.includes("ASSIGNED")&&"\u{1F464}",G.type.includes("PRIORITY")&&"\u{1F3AF}",G.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:me?.name||"Unknown"})," ",G.type.replace(/_/g," ").toLowerCase(),G.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:G.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(G.timestamp).toLocaleString()})]})]},G.id)}),q.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function sb({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},r))]})}function $i({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((l,m)=>l+m.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(sb,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function fb({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},r))]})}function zi({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,l=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(fb,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(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"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),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 Tb={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},am=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Nb({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:m,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function rm({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 jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[o,"%"]})]})]})}function Ui({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||Tb[m.name]||am[e.indexOf(m)%am.length]})),l=n.map(m=>m.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Nb:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(rm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.value} - ${d}%)`}})]}):jsxs(BarChart$1,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(rm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((m,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,i)=>i.value>m.value?i:m).name})]})]})]})}var ns=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[m,i]=useState(false),[c,d]=useState(false),[g,f]=useState(false);if(e.length===0)return null;let x=e.map(w=>w.id),T=w=>{r.onBulkUpdate?.(x,{priority:w}),l(false);},p=w=>{r.onBulkMove?.(x,w),i(false),a();},h=w=>{r.onBulkUpdate?.(x,{assignedUserIds:w}),d(false);},b=w=>{let D=new Set;e.forEach(E=>{E.labels?.forEach(k=>D.add(k));});let N=Array.from(new Set([...D,...w]));r.onBulkUpdate?.(x,{labels:N}),f(false);},y=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>T(w),children:[jsx("span",{className:u("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>p(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!g),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:y,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});ns.displayName="BulkOperationsToolbar";function Mb(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(f=>{let x=a?.find(T=>T.id===f);n=`assignee-${f}`,l=x?.name||`User ${f}`,m=x?.color,i=x?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,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 g={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];l=g.title,m=g.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,l=f,m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,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 Hi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),l=useMemo(()=>Mb(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(_r,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),g={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[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:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(_r,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),l.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Wi=[{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 Gi({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=Wi.find(i=>i.value===e)||Wi[0];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 jsxs("div",{className:u("relative inline-block",a),children:[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:[jsx("span",{className:"text-base leading-none",children:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&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:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Wi.map(i=>jsxs("button",{onClick:()=>m(i.value),className:u("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:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var un=[{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 Lb(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,l=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&l&&m}function lm(e={}){let{shortcuts:t=un,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(m=>{o.current=[...o.current,m];},[]),l=useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return 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 d of o.current)if(Lb(i,d)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Bb(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Rb(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 Ob(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Rb(e),r=t?Bb(t):"";return a?`${a} + ${r}`:r}function $b(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 Vi({shortcuts:e=un,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=$b(e);return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),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:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),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"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([l,m])=>m.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:m.map(i=>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:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),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:Ob(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",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 _i=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,48 +122,48 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Wi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);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 l=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxs("div",{className:u("relative inline-block",a),children:[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:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&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:[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:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),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])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:c.map(d=>jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Vi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[m,i]=useState("json"),[c,d]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let w=o?.current||void 0,f=await Fd(e,m,w);Ad(f,m);},b=async w=>{let f=w.target.files?.[0];if(f){try{let y=await Bd(f),h=f.name.endsWith(".json")?"json":"csv",v=Id(y,h);d(v),v.success&&r&&r(v,y);}catch(y){d({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),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:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),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"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:u("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"}),jsx("button",{onClick:()=>l("import"),className:u("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"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(w=>jsxs("button",{onClick:()=>i(w),className:u("p-4 rounded-lg border-2 transition-all text-center",m===w?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:g,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"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:b,className:"hidden"}),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:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),c&&jsxs("div",{className:u("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:[jsx("h3",{className:u("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:c.errors.map((w,f)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},f))})]})]})]})]})]})}var Ib=["URGENT","HIGH","MEDIUM","LOW"],Bb=[{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"}],Rb=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function _i({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:b}){let[w,f]=useState(true),y=useCallback(N=>{a({search:N.target.value});},[a]),h=useCallback(N=>{a({dateFilter:N.target.value});},[a]),v=useCallback(N=>{r({by:N.target.value});},[r]),T=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${w?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>f(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:w?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&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)"]})]}),!w&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:y,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:N=>{let E=N.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Ib.map(N=>jsx("option",{value:N,children:N},N))]})}),m.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let E=N.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),m.map(N=>jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let E=N.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsx("option",{value:N,children:N},N))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:v,className:"filter-bar__select filter-bar__select--sm",children:Bb.map(N=>jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsx("button",{onClick:T,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:N=>b(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Rb.map(N=>jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ji({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:m}){let[i,c]=useState(false),d=useRef(null);useEffect(()=>{let g=b=>{d.current&&!d.current.contains(b.target)&&c(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let p=g=>{g(),c(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),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"})]}),jsx("span",{children:"Config"})]}),i&&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"?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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),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"]}),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Ki={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"}},Yi={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"}},qi={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"}},yo={dark:Ki,light:Yi,neutral:qi},os="dark";var ns=createContext(void 0),jb="asakaa-theme";function nm({children:e,defaultTheme:t=os,storageKey:a=jb}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,m=yo[r];Object.entries(m.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${Kb(c)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([c,d])=>{let p=m.colors[c];p&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:yo};return jsx(ns.Provider,{value:n,children:e})}function Uo(){let e=useContext(ns);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Kb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Xi({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Uo();return e?jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),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:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),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"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(yo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("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:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),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&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function sm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[e].focusRing)}}var ss={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"}},im={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"}},Ji={en:ss,es:im};function lm(e){return Ji[e]||Ji.en}function Zi(e,t){let a=lm(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 Wo=createContext(ss);function Xr(){return useContext(Wo)}function gh({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,m]=useState(false),[i,c]=useState(null),d=useRef(null),p=Xr();if(useEffect(()=>{let f=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return l&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),!(t||a||r||o||s||n))return null;let b=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(f=>f.handler),w=async(f,y)=>{if(y){c(f);try{await y();}catch(h){console.error(`Export ${f} failed:`,h);}finally{c(null),m(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:p.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:l&&jsx(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:jsx("div",{className:"py-1",children:b.map((f,y)=>jsxs(motion.button,{onClick:()=>w(f.id,f.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:y<b.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:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===f.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):f.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function fh({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return 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 jsxs(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&&jsx(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&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function bh({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(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:[jsx("span",{children:o.label}),s&&jsx(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 hh({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=Xr();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 l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=l.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(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:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(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:jsx("div",{className:"py-1",children:l.map((i,c)=>{let d=t===i.value;return jsxs(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:d?e.accentLight:"transparent",borderBottom:c<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function yh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),m=Xr();useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let g=w=>{l.current&&!l.current.contains(w.target)&&n(false);},b=w=>{w.key==="Escape"&&n(false);};document.addEventListener("mousedown",g),document.addEventListener("keydown",b),l._cleanup=()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b);};},100);return ()=>{clearTimeout(p),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon: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:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:p=>{p.stopPropagation(),n(g=>!g);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"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:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsx(AnimatePresence,{children:s&&jsxs(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:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-2",children:i.map(p=>{let g=t===p.value&&!r,b=()=>p.value==="all"?g?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxs(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:g?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx("span",{className:`${g?p.color:"text-gray-400"} flex-shrink-0`,children:b()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:p.label}),g&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},p.value)})}),jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(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?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function ls({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:b,hideCompleted:w=false,onHideCompletedChange:f,onExportPNG:y,onExportPDF:h,onExportExcel:v,onExportCSV:T,onExportJSON:D,onExportMSProject:N}){let E=Xr(),k=y||h||v||T||D||N,R=[{value:"day",label:E.toolbar.day},{value:"week",label:E.toolbar.week},{value:"month",label:E.toolbar.month}],I=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}];return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(bh,{options:R,value:t,onChange:C=>a(C),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(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:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),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),"%"]}),jsx(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:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(hh,{theme:e,value:l,onChange:m}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(yh,{theme:e,value:g,onChange:b,hideCompleted:w,onHideCompletedChange:f})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[c&&p&&jsxs(Fragment,{children:[jsxs(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:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||E.toolbar.createTask})]}),(k||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxs(Fragment,{children:[jsx(gh,{theme:e,onExportPNG:y,onExportPDF:h,onExportExcel:v,onExportCSV:T,onExportJSON:D,onExportMSProject:N}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(fh,{options:I,value:s,onChange:C=>n(C),theme:e})]})]})}function ds({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),m=useRef(null);useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(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:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(yt,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},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:jsxs("div",{className:"py-1",children:[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=>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:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:c.label}),c.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function Go({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[l,m]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,p=8,g=window.innerWidth,b=window.innerHeight,w=t,f=a;t+c+p>g&&(w=t-c,w<p&&(w=p)),a+d+p>b&&(f=b-d-p,f<p&&(f=p)),m({x:w,y:f});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[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 jsx(AnimatePresence,{children:jsx(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:`${l.x}px`,top:`${l.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:jsx("div",{className:"py-1",children:r.map(c=>jsxs("div",{children:[c.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),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:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Ht={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function hm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:p=true}){let g=useRef(false),b=useCallback(v=>{g.current=v;},[]),w=useCallback(v=>{let T=[],D=N=>{for(let E of N)T.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&D(E.subtasks);};return D(v),T},[]),f=useCallback(()=>{let v=w(e);for(let T of v)if(t.has(T.id))return T;return null},[e,t,w]),y=useCallback((v,T)=>{let D=w(e);if(D.length===0)return;let N=f();if(!N){a(D[0].id,false);return}let E=D.findIndex(I=>I.id===N.id);if(E===-1)return;let k=v==="up"?E-1:E+1;if(k<0||k>=D.length)return;let R=D[k];a(R.id,T);},[e,f,w,a]),h=useCallback(v=>{if(!p)return;let T=v.target;if(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||g.current){v.key==="Escape"&&(T.blur(),g.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),R=f();if(v.key==="ArrowUp"){v.preventDefault(),y("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),y("down",v.shiftKey);return}if(R&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!R.isExpanded||v.key==="ArrowLeft"&&R.isExpanded)&&c(R.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),n(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),m(k));return}if(v.key==="Enter"&&!v.shiftKey&&!E){R&&(v.preventDefault(),r(R.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!E){R&&(v.preventDefault(),r(R.id,"above"));return}if(v.key==="Enter"&&E){R&&(v.preventDefault(),d(R.id));return}if(v.key==="F2"){R&&(v.preventDefault(),i(R.id));return}if(v.key==="Delete"||v.key==="Backspace"&&E){k.length>0&&(v.preventDefault(),o(k));return}if(v.key==="d"&&E&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[p,t,f,y,r,o,s,n,l,m,i,c,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:b}}function vm(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(p=>{let g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=useCallback((d,p)=>{if(!a){o(d);return}let g=p.indexOf(a),b=p.indexOf(d);if(g===-1||b===-1){o(d);return}let w=Math.min(g,b),f=Math.max(g,b),y=p.slice(w,f+1);t(new Set(y)),r(d);},[a,o]),l=useCallback((d,p,g,b)=>{b?n(d,p):g?s(d):o(d);},[o,s,n]),m=useCallback((d,p)=>{p?t(g=>{let b=new Set(g);return b.add(d),b}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let l={...r[n],parentId:o,level:s,position:n};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&a(l.subtasks,l.id,s+1);}};return a(e),t}function xm(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=xm(a.subtasks,t);if(r)return r}}return null}function nl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=nl(a.subtasks,t);if(r)return r}return null}function sl(e,t){if(t.length===0)return e;let a=Vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,p)=>{let g=[];return {tasks:d.filter(w=>{if(p.has(w.id))return g.push(w),false;if(w.subtasks){let f=n(w.subtasks,p);w.subtasks=f.tasks,g.push(...f.removed);}return true}),removed:g}},l=(d,p,g)=>d.map(b=>b.id===p?{...b,subtasks:[...b.subtasks||[],...g],isExpanded:true}:b.subtasks?{...b,subtasks:l(b.subtasks,p,g)}:b),m=new Set(t),{tasks:i,removed:c}=n(e,m);return l(i,s.id,c)}function il(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=nl(a,r);if(!o)continue;let s=nl(a,o.id),n=(i,c,d)=>{for(let p=0;p<i.length;p++){let g=i[p];if(g.id===c&&g.subtasks){let b=g.subtasks.findIndex(w=>w.id===d);if(b!==-1){let[w]=g.subtasks.splice(b,1);return w}}if(g.subtasks){let b=n(g.subtasks,c,d);if(b)return b}}return null},l=(i,c,d)=>{let p=i.findIndex(g=>g.id===c);if(p!==-1)return i.splice(p+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,c,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?l(s.subtasks,o.id,m):l(a,o.id,m));}return a}function ll(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,m)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,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 dl(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 cl(e,t){let a=[...e];for(let r of t){let o=n=>{let l=n.findIndex(c=>c.id===r);if(l===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[l],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(l+1,0,i),true},s=n=>n.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?s(l.subtasks):void 0}));o(a);}return a}function km(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"},l=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function ml(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ml(r.subtasks,t,a)}:r)}function ul(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ul(a.subtasks,t)}:a)}function pl(e,t){let a=c=>{for(let d of c){if(d.id===t)return d;if(d.subtasks){let p=a(d.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,l=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6"},i=c=>c.map(d=>{if(d.id===t){let p=d.subtasks||[];return {...d,subtasks:[...p,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function wm(e,t,a,r){if(t===a)return e;let o=xm(e,t);if(!o)return e;if(a){let l=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>l.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 l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,p=[...c];return p.splice(d,0,{...o,parentId:a}),{...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function us({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:b,onTaskOutdent:w,onTaskMove:f,onMultiTaskDelete:y,onTaskDuplicate:h,onTaskCreate:v,onTaskRename:T,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:E,onTaskReparent:k}){let R=useContext(Wo),[I,C]=useState(null),[W,H]=useState(null),[x,te]=useState(""),oe=useRef(null),[ne,A]=useState(null),[ke,Ie]=useState(0),[L,U]=useState(0),[S,K]=useState({isOpen:false,x:0,y:0,type:"header"}),[J,ie]=useState(null),[ue,ye]=useState(null),[Oe,Q]=useState(null),Je=useRef(0),Pe=5,rt=useRef(false),[ut,It]=useState(null),[Xe,pt]=useState(false),[ce,Ge]=useState(null),[Be,B]=useState(false),X=useRef(null);useEffect(()=>{function V(q){X.current&&!X.current.contains(q.target)&&B(false);}if(Be)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[Be]),useEffect(()=>{W&&oe.current&&(oe.current.focus(),oe.current.select());},[W]),useEffect(()=>{if(!ne)return;let V=Se=>{let Ye=Se.clientX-ke,ze=L+Ye;p?.(ne,ze);},q=()=>{A(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,ke,L,p]);let{selectedTaskIds:ge,handleTaskClick:Ae,isTaskSelected:Ue}=vm(),{setIsEditing:nt}=hm({tasks:e,selectedTaskIds:ge,onTaskSelect:(V,q)=>{let Ye=Vo(e).map(ze=>ze.id);Ae(V,Ye,q||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:f||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:V=>{let q=Vo(e).find(Se=>Se.id===V);q&&je(q);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:V=>{let q=Vo(e).find(Se=>Se.id===V);q&&N&&N(q);},enableKeyboard:true}),Pt=(V,q=0)=>{let Se=[];for(let Ye of V)Se.push({task:Ye,level:q}),Ye.subtasks&&Ye.subtasks.length>0&&Ye.isExpanded&&Se.push(...Pt(Ye.subtasks,q+1));return Se},$e=Pt(e),O=48,ae=Math.max($e.length*a,600-O),Le=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,je=V=>{H(V.id),te(V.name),nt(true);},qe=V=>{x.trim()&&x!==e.find(q=>q.id===V)?.name&&T?.(V,x.trim()),H(null),te(""),nt(false);},j=()=>{H(null),te(""),nt(false);},$=(V,q)=>{q.stopPropagation(),D?.(V.id);},Me=(V,q)=>{q.preventDefault(),Je.current=q.clientY,ie(V),rt.current=false,pt(false),It({x:q.clientX,y:q.clientY});},ht=V=>{if(!J||(Math.abs(V.clientY-Je.current)>Pe&&!rt.current&&(rt.current=true,pt(true)),It({x:V.clientX,y:V.clientY}),!rt.current))return;let Se=document.querySelectorAll("[data-task-row]"),Ye=null,ze=null;Se.forEach(G=>{let me=G.getBoundingClientRect(),_e=G.getAttribute("data-task-row");if(_e&&_e!==J&&V.clientY>=me.top&&V.clientY<=me.bottom){Ye=_e;let Tt=V.clientY-me.top,gt=me.height;Tt<gt*.25?ze="above":Tt>gt*.75?ze="below":ze="child";}}),ye(Ye),Q(ze);},le=()=>{if(rt.current&&J&&ue&&Oe){if(Oe==="child")k?.(J,ue);else if(Oe==="above"||Oe==="below"){let V=(Ye,ze,G=null)=>{for(let me of Ye){if(me.id===ze)return G;if(me.subtasks){let _e=V(me.subtasks,ze,me.id);if(_e!==void 0)return _e}}},q=V(e,ue,null),Se=(Ye,ze)=>{let G=Ye.findIndex(me=>me.id===ze);return Oe==="below"?G+1:G};if(q===null){let Ye=Se(e,ue);k?.(J,null,Ye);}else {let Ye=$e.find(ze=>ze.task.id===q)?.task;if(Ye?.subtasks){let ze=Se(Ye.subtasks,ue);k?.(J,q,ze);}}}}ie(null),ye(null),Q(null),It(null),rt.current=false,pt(false);};useEffect(()=>{if(J)return document.addEventListener("mousemove",ht),document.addEventListener("mouseup",le),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ht),document.removeEventListener("mouseup",le),document.body.style.cursor="",document.body.style.userSelect="";}},[J,ue,Oe]);let He=(V,q,Se)=>{switch(V.id){case "name":let Ye=W===q.id,ze=I===q.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Se*20}px`},children:[k&&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:ze?1:.3},onMouseDown:fe=>Me(q.id,fe),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),q.subtasks&&q.subtasks.length>0?jsx("button",{onClick:fe=>{fe.stopPropagation(),m?.(q.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:q.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:q.color||"#3B82F6",opacity:q.parentId?.6:1,borderColor:q.isMilestone?t.accent:"transparent",borderWidth:q.isMilestone?"2px":"0px"},title:q.isMilestone?"Milestone":q.parentId?"Subtask":"Task"})}),Ye?jsx("input",{ref:oe,type:"text",value:x,onChange:fe=>te(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"?qe(q.id):fe.key==="Escape"&&j();},onBlur:()=>qe(q.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:fe=>fe.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:q.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:q.parentId?"13px":"14px",fontWeight:q.isMilestone?600:q.parentId?400:600,letterSpacing:q.parentId?"0":"-0.01em"},title:q.name,children:q.name}),ze&&!Ye&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:fe=>fe.stopPropagation(),children:[jsx("button",{onClick:fe=>$(q,fe),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:fe=>{fe.stopPropagation(),je(q);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let me=V.id==="startDate"?"startDate":"endDate",_e=q[me],Tt=ce?.taskId===q.id&&ce?.field===me,gt=fe=>fe?(typeof fe=="string"?new Date(fe):fe).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:fe=>fe.stopPropagation(),children:[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(Tt)Ge(null);else {let Nt=fe.currentTarget.getBoundingClientRect();Ge({taskId:q.id,field:me,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:Nt.bottom+4,left:Nt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:gt(_e)})]}),Tt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ge(null)}),jsxs(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:ce?.position.top,left:ce?.position.left},onClick:fe=>fe.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let fe=new Date,Nt=new Date(fe);Nt.setDate(fe.getDate()+1);let ot=new Date(fe);ot.setDate(fe.getDate()+7);let Or=new Date(fe);return Or.setDate(fe.getDate()+14),[{label:"Hoy",date:fe},{label:"Ma\xF1ana",date:Nt},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:Or}].map((br,P)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(q.id,{[me]:br.date}),Ge(null);},children:br.label},P))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),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:()=>{g?.(q.id,{[me]:void 0}),Ge(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>Ge(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:ce?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Ge(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((fe,Nt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:fe},Nt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let fe=ce?.month||new Date,Nt=fe.getFullYear(),ot=fe.getMonth(),Or=new Date(Nt,ot,1).getDay(),oo=new Date(Nt,ot+1,0).getDate(),br=new Date,P=[];for(let ve=Or-1;ve>=0;ve--)P.push({day:new Date(Nt,ot,-ve).getDate(),date:new Date(Nt,ot-1,new Date(Nt,ot,-ve).getDate()),isCurrentMonth:false});for(let ve=1;ve<=oo;ve++)P.push({day:ve,date:new Date(Nt,ot,ve),isCurrentMonth:true});let re=42-P.length;for(let ve=1;ve<=re;ve++)P.push({day:ve,date:new Date(Nt,ot+1,ve),isCurrentMonth:false});return P.map((ve,Ze)=>{let aa=ve.date.toDateString()===br.toDateString(),ra=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===ve.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:ve.isCurrentMonth?ra?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ra?"#3B82F6":"transparent",boxShadow:aa&&!ra?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{g?.(q.id,{[me]:ve.date}),Ge(null);},children:ve.day},Ze)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Le(q)})});case "assignees":let Sr=r.filter(fe=>q.assignees?.some(Nt=>Nt.name===fe.name||Nt.initials===fe.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsx(uo,{assignedUsers:Sr,availableUsers:r,onChange:fe=>{let Nt=fe.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));g?.(q.id,{assignees:Nt.length>0?Nt:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsx(ec,{status:q.status||"todo",onChange:fe=>{g?.(q.id,{status:fe,progress:fe==="completed"?100:q.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${q.progress}%`,backgroundColor:q.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[q.progress,"%"]})]});case "priority":let fr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ia={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ba=fr[q.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsx(co,{priority:Ba,onChange:fe=>{fe&&g?.(q.id,{priority:Ia[fe]||"medium"});}})});default:return null}},De=V=>[{id:"hide",label:"Hide Column",icon:Ht.Hide,onClick:()=>d(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ht.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ht.SortDesc,onClick:()=>{}}],Re=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{D?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{E?E(V.id,V.name):y?.([V.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Ht.Pencil,onClick:()=>{n?.(V);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{D?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ht.MarkIncomplete,onClick:()=>{g?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Ht.SetInProgress,onClick:()=>{g?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Ht.MarkComplete,onClick:()=>{g?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Ht.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{E?E(V.id,V.name):y?.([V.id]);}}],de=c.filter(V=>V.visible),Ve=de.reduce((V,q)=>V+q.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ve},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${O}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:de.map((V,q)=>{let Se=q===de.length-1,Ye=V.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ye?"":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.minWidth??(Ye?200:60)}px`,maxWidth:`${V.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Se?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ze=>{ze.preventDefault(),K({isOpen:true,x:ze.clientX,y:ze.clientY,type:"header",columnId:V.id});},onMouseEnter:ze=>{ze.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ze=>{ze.currentTarget.style.backgroundColor="transparent";},children:[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:V.label,children:V.label}),V.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ne===V.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ze=>{ze.preventDefault(),ze.stopPropagation(),A(V.id),Ie(ze.clientX),U(V.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},V.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsx(ds,{columns:c,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>B(!Be),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),Be&&jsxs("div",{ref:X,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:V=>V.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>B(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:ae},children:$e.map(({task:V,level:q},Se)=>{let Ye=Ue(V.id),ze=ue===V.id,G=ze&&Oe==="above",me=ze&&Oe==="below",_e=ze&&Oe==="child",Tt={};return _e&&(Tt.backgroundColor=`${t.accent}15`,Tt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":V.id,className:`flex items-center cursor-pointer group ${J===V.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ye?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ye?t.accentLight:_e?`${t.accent}15`:Se%2===0?t.bgPrimary:t.bgGrid,...Tt},onMouseEnter:()=>C(V.id),onMouseLeave:()=>C(null),onClick:gt=>{let fr=Vo(e).map(fe=>fe.id),Ba=navigator.platform.toUpperCase().indexOf("MAC")>=0?gt.metaKey:gt.ctrlKey;Ae(V.id,fr,Ba,gt.shiftKey),s?.(V);},onDoubleClick:gt=>{gt.stopPropagation(),n?.(V);},onContextMenu:gt=>{gt.preventDefault(),K({isOpen:true,x:gt.clientX,y:gt.clientY,type:"task",task:V}),l?.(V,gt);},whileHover:{backgroundColor:Ye?t.accentLight:t.hoverBg},children:[G&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),me&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),de.map((gt,Sr)=>{let fr=Sr===de.length-1,Ia=gt.id==="name";return jsx("div",{className:`px-4 flex items-center ${Ia?"justify-start":"justify-center"}`,style:{width:`${gt.width}px`,minWidth:`${gt.minWidth??(Ia?200:60)}px`,maxWidth:`${gt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:fr?"none":`1px solid ${I===V.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:He(gt,V,Ia?q:0)},`${V.id}-${gt.id}`)})]},V.id)})}),jsx(Go,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?De(S.columnId):S.type==="task"&&S.task?Re(S.task):[],onClose:()=>K({...S,isOpen:false}),theme:t}),Xe&&ut&&J&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:ut.x+12,top:ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let V=$e.find(q=>q.task.id===J)?.task;return V?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:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:V.name})}):null})()}),document.body)]})}function Sm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[m,i]=useState(t),[c,d]=useState(null),[p,g]=useState(null),[b,w]=useState(null),[f,y]=useState(null),[h,v]=useState(0),[T,D]=useState(0),[N,E]=useState(null),[k,R]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:b,setActiveZone:w,draggedSegmentIndex:f,setDraggedSegmentIndex:y,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:T,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:E,isHovered:k,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(x,te)=>{r("none"),d(null),g(null),l(x),i(te),D(0),y(null),v(0);}}}function gs({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:b,onHoverChange:w}){let f=Sm(t,r),y=useRef(null),h=useRef(null),v=useRef(null),{dragMode:T,setDragMode:D,dragOffset:N,setDragOffset:E,ghostX:k,setGhostX:R,ghostWidth:I,setGhostWidth:C,connectionLine:W,setConnectionLine:H,hoveredTaskId:x,setHoveredTaskId:te,activeZone:oe,setActiveZone:ne,draggedSegmentIndex:A,setDraggedSegmentIndex:ke,draggedSegmentStartX:Ie,setDraggedSegmentStartX:L,segmentDragOffsetX:U,setSegmentDragOffsetX:S,hoveredSegmentIndex:K,setHoveredSegmentIndex:J,isHovered:ie,setIsHovered:ue,isDragging:ye,isResizing:Oe,isConnecting:Q,resetDragState:Je}=f,Pe=32,rt=8,ut=e.endDate&&e.endDate<new Date&&e.progress<100,It=e.isCriticalPath,Xe=o.name==="neutral"||o.today==="#1C1917",pt=e.status==="completed"||e.progress===100,ce={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Be=e.isCriticalPath||ut?"#DC2626":e.color?e.color:e.priority&&ce[e.priority]?ce[e.priority]:o.taskBarPrimary,X=(le=>le>=80?20:le>=60?15:le>=50?12:10)(r),ge=r<50,Ae=r<40;useEffect(()=>{if(w)if(ie&&!ye&&!e.segments){let le=a<100;w({task:e,x:t,y:a,width:r,height:Pe,showBelow:le});}else w(null);},[ie,ye,e,t,a,r,Pe,w]);let Ue=le=>le.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let le=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${le} day${le!==1?"s":""}`},Pt=le=>Math.round(le/s)*s,$e=le=>{let He=Math.round(le/s),De=new Date(n);return De.setDate(De.getDate()+He),De},O=(le,He)=>{for(let De of g){if(De.id===e.id)continue;let Re=5;if(le>=De.x-Re&&le<=De.x+De.width+Re&&He>=De.y-Re&&He<=De.y+De.height+Re)return De.id}return null},ae=useCallback((le,He,De)=>{le.preventDefault(),le.stopPropagation();let Re=y.current?.ownerSVGElement;if(!Re)return;let de=Re.createSVGPoint();de.x=le.clientX,de.y=le.clientY;let Ve=de.matrixTransform(Re.getScreenCTM()?.inverse()),V=De!==void 0?De:t,q=He;if(!q){let Se=Ve.x-V;le.shiftKey?(q="connect",H({x:t+r,y:a+Pe/2})):le.ctrlKey||le.metaKey?q="move":le.altKey?q=Se<r/2?"resize-start":"resize-end":Ae?Se<r/2?q="move":q="resize-end":ge?Se<=X/2?q="resize-start":Se>=r-X/2?q="resize-end":q="move":Se<=X?q="resize-start":Se>=r-X?q="resize-end":q="move";}D(q),ue(false),ne(null),q==="move"?E(Ve.x-V):q==="connect"?H({x:t+r,y:a+Pe/2}):E(0),R(V),C(r);},[t,r,a,Pe]),Le=useCallback(le=>{let He=y.current?.ownerSVGElement;if(!He)return;let De=He.closest(".gantt-timeline-scroll");if(!De)return;let Re=De.getBoundingClientRect(),de=60,Ve=15,V=0;if(le.clientX<Re.left+de){let q=Re.left+de-le.clientX;V=-Math.min(Ve,q/2);}else if(le.clientX>Re.right-de){let q=le.clientX-(Re.right-de);V=Math.min(Ve,q/2);}return V!==0&&(De.scrollLeft+=V),V!==0},[]),je=useCallback(le=>{if(T==="none")return;v.current=le;let He=y.current?.ownerSVGElement;if(!He)return;if(T==="move"||T==="resize-start"||T==="resize-end"){let de=Le(le);de&&!h.current?h.current=window.setInterval(()=>{v.current&&(Le(v.current),je(v.current));},16):!de&&h.current&&(window.clearInterval(h.current),h.current=null);}let De=He.createSVGPoint();De.x=le.clientX,De.y=le.clientY;let Re=De.matrixTransform(He.getScreenCTM()?.inverse());if(T==="connect"){H({x:Re.x,y:Re.y});let de=O(Re.x,Re.y);te(de);}else if(T==="move"){let de=Re.x-N,Ve=Pt(de);R(Ve),C(r);let V=Math.round((Ve-t)/s);if(b?.(e.id,V,true),e.segments&&e.segments.length>0&&A!==null){let q=Ve-Ie;S(q);}}else if(T==="resize-start"){let de=Re.x,Ve=Pt(de),V=t+r-Ve;V>=s&&(R(Ve),C(V));}else if(T==="resize-end"){let de=Re.x,V=Pt(de)-t;V>=s&&C(V);}},[T,t,r,s,N,e,Pt,A,Ie,O,te,H,R,C,S,b,Le]),qe=useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),v.current=null,T!=="none"){if(T==="connect")x&&p&&p(e,x),H(null),te(null);else {let le=e.endDate.getTime()-e.startDate.getTime(),He,De,Re=true;if(T==="move"){if(He=$e(k),De=new Date(He.getTime()+le),e.segments&&e.segments.length>0&&A!==null){let de=Math.round(U/s),Ve=e.segments.map((Ye,ze)=>{if(ze===A){let G=new Date(Ye.startDate),me=new Date(Ye.endDate);return G.setDate(G.getDate()+de),me.setDate(me.getDate()+de),{startDate:G,endDate:me}}return Ye}),V=Ve.flatMap(Ye=>[Ye.startDate,Ye.endDate]),q=new Date(Math.min(...V.map(Ye=>Ye.getTime()))),Se=new Date(Math.max(...V.map(Ye=>Ye.getTime())));d?.({...e,segments:Ve},q,Se),Je(t,r);return}}else T==="resize-start"?(He=$e(k),De=e.endDate,He>De&&(console.warn("Invalid date range: start date must be before or equal to end date"),Re=false)):T==="resize-end"?(He=e.startDate,De=$e(k+I),De<He&&(console.warn("Invalid date range: end date must be after or equal to start date"),Re=false)):Re=false;Re&&He&&De&&(De.getTime()<He.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,He,De));}b?.(e.id,0,false),Je(t,r);}},[T,k,I,e,d,x,p,t,r,s,$e,U,A,Je,b]);useEffect(()=>{if(T==="none")return;let le=De=>{je(De);},He=()=>{qe();};return window.addEventListener("mousemove",le),window.addEventListener("mouseup",He),()=>{window.removeEventListener("mousemove",le),window.removeEventListener("mouseup",He),h.current&&(window.clearInterval(h.current),h.current=null);}},[T,je,qe]);let j=ye&&!Q?k:t,$=ye&&!Q?I:r,Me=l.taskClass(e);return jsxs("g",{ref:y,"data-task-bar":"true",onClick:()=>!ye&&m?.(e),onDoubleClick:le=>{ye||(le.stopPropagation(),i?.(e));},onContextMenu:le=>{le.preventDefault(),c?.(e,le);},onMouseEnter:()=>!ye&&ue(true),onMouseLeave:()=>{ye||(ue(false),ne(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:Pe,fill:"transparent",style:{pointerEvents:"all"}}),ie&&!ye&&!ge&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:X,height:Pe,fill:oe==="resize-start"?o.accent:"transparent",opacity:oe==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-start"),onMouseDown:le=>ae(le,"resize-start")}),jsx("rect",{x:t+X,y:a,width:r-X*2,height:Pe,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:le=>ae(le,"move")}),jsx("rect",{x:t+r-X,y:a,width:X,height:Pe,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:le=>ae(le,"resize-end")})]}),ie&&!ye&&Ae&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Pe,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:le=>ae(le,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Pe,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:le=>ae(le,"resize-end")}),ie&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Pe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ye&&!Q&&!e.segments&&jsx(motion.rect,{x:k,y:a,width:I,height:Pe,rx:rt,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&&jsx(motion.rect,{x:j,y:a,width:$,height:Pe,rx:rt,fill:Be,"data-task-class":Me,initial:{opacity:0,scale:.95},animate:{opacity:ye&&!Q?.15:e.parentId?.6:ie?.9:.8,scale:ie&&!ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:le=>ae(le),style:{cursor:ye?Q?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:j,y:a,width:$*(e.progress/100),height:Pe,rx:rt,fill:Be,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((le,He)=>{let De=(le.startDate.getTime()-n.getTime())/864e5*s,de=(le.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-De+s,Ve=ye&&T==="move"&&A===He,V=K===He,q=Ve?De+U:De;return jsxs("g",{onMouseEnter:()=>!ye&&J(He),onMouseLeave:()=>!ye&&J(null),children:[jsx(motion.rect,{x:q,y:a,width:de,height:Pe,rx:rt,fill:Be,initial:{opacity:0,scale:.95},animate:{opacity:Ve||e.parentId?.6:V?.9:.8,scale:V&&!ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Se=>{Se.stopPropagation(),ke(He),L(De),ae(Se,void 0,De);},style:{cursor:ye?Q?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:q,y:a,width:de*(e.progress/100),height:Pe,rx:rt,fill:Be,opacity:1,style:{pointerEvents:"none"}})]},`segment-${He}`)}),Xe&&(ut||It)&&!e.segments&&jsxs(Fragment,{children:[It&&!ut&&jsx("rect",{x:j,y:a,width:$,height:Pe,rx:rt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ut&&jsx("rect",{x:j,y:a,width:$,height:Pe,rx:rt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),$>60&&!e.segments&&(()=>{let le=l.taskLabel(e),He=typeof le=="string"?le:e.name,De=He.length>Math.floor($/8)?`${He.substring(0,Math.floor($/8))}...`:He;return jsx("text",{x:j+12,y:a+Pe/2,dominantBaseline:"middle",fill:pt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:pt?"line-through":"none"},children:De})})(),$>100&&e.progress>0&&e.progress<100&&!ye&&!e.segments&&jsxs("text",{x:j+$-12,y:a+Pe/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&&$>80&&!ye&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:j+$-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:j+$-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ie||Oe)&&!Q&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:j-2,y:a,width:16,height:Pe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-start"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"resize-start");}}),jsx(motion.rect,{x:j+4,y:a+8,width:3,height:Pe-16,rx:1.5,fill:oe==="resize-start"||T==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:j+$-14,y:a,width:16,height:Pe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-end"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"resize-end");}}),jsx(motion.rect,{x:j+$-7,y:a+8,width:3,height:Pe-16,rx:1.5,fill:oe==="resize-end"||T==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:ie&&!ye&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+Pe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ne("connect"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Pe/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:oe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Q&&W&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Pe/2,x2:W.x,y2:W.y,stroke:x?o.statusCompleted:o.accent,strokeWidth:x?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:x?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:W.x,cy:W.y,r:x?8:6,fill:x?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),x&&jsx(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"})]}),(ie||ye)&&!Q&&!e.segments&&jsx(motion.rect,{x:j-2,y:a-2,width:$+4,height:Pe+4,rx:rt+2,fill:"none",stroke:ye?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ye?.6:.4,initial:{opacity:0},animate:{opacity:ye?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Oe&&jsxs(Fragment,{children:[jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:k+I,y1:0,x2:k+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:ie&&!ye&&!e.segments&&!w&&(()=>{let De=a<100,Re=De?a+Pe+13:a-82-13,de=De?`M ${j+$/2-6} ${a+Pe+3} L ${j+$/2} ${a+Pe+13} L ${j+$/2+6} ${a+Pe+3}`:`M ${j+$/2-6} ${a-13} L ${j+$/2} ${a-3} L ${j+$/2+6} ${a-13}`,Ve=Re+22,V=Re+40,q=Re+55,Se=Re+70,Ye=De?Re+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:De?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:De?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:de,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:j+$/2-120,y:Re,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))"}),jsx("text",{x:j+$/2,y:Ve,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}),jsx("text",{x:j+$/2-110,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:j+$/2-70,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.startDate)}),jsx("text",{x:j+$/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:j+$/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.endDate)}),jsx("text",{x:j+$/2+10,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:j+$/2+65,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsx("text",{x:j+$/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:j+$/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:j+$/2-110,y:Se,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:j+$/2-50,y:Se,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ze=>ze.name).join(", ").substring(0,30),e.assignees.map(ze=>ze.name).join(", ").length>30?"...":""]})]}),!De&&jsx("text",{x:j+$/2,y:Ye,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ae?"Left: move \u2022 Right: resize":ge?"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 Mm({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:m}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,c=i?130:82,d=13,p=m?s+l+d:s-c-d,g=m?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,b=p+22,w=p+40,f=p+55,y=p+70,h=p+90,v=p+105,T=p+120,D=C=>C.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),N=()=>{if(!r.startDate||!r.endDate)return "N/A";let C=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${C} day${C!==1?"s":""}`},E=C=>{if(C==null||C===0)return "N/A";let W=Math.floor(C/60),H=C%60;return W===0?`${H}m`:H===0?`${W}h`:`${W}h ${H}m`},k={start:a==="es"?"Inicio:":"Start:",end:a==="es"?"Fin:":"End:",duration:a==="es"?"Duraci\xF3n:":"Duration:",progress:a==="es"?"Progreso:":"Progress:",assignees:a==="es"?"Asignados:":"Assignees:",estimated:a==="es"?"Estimado:":"Estimated:",logged:a==="es"?"Registrado:":"Logged:",quoted:a==="es"?"Ofertado:":"Quoted:"};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:g,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:o+n/2-120,y:p,width:240,height:c,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:o+n/2,y:b,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsx("text",{x:o+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.start}),jsx("text",{x:o+n/2-70,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?D(r.startDate):"N/A"}),jsx("text",{x:o+n/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.end}),jsx("text",{x:o+n/2-70,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?D(r.endDate):"N/A"}),jsx("text",{x:o+n/2+10,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.duration}),jsx("text",{x:o+n/2+65,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:N()}),jsx("text",{x:o+n/2+10,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.progress}),jsxs("text",{x:o+n/2+65,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.assignees}),jsxs("text",{x:o+n/2-50,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(C=>C.name).join(", ").substring(0,30),r.assignees.map(C=>C.name).join(", ").length>30?"...":""]})]}),i&&jsxs(Fragment,{children:[r.effortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.estimated}),jsx("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:E(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.logged}),jsx("text",{x:o+n/2-50,y:v,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:E(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.quoted}),jsx("text",{x:o+n/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:E(r.soldEffortMinutes)})]})]})]})})}function bs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false}){let[m,i]=useState(false),[c,d]=useState(null),p=r-t,g=p>0,b=Math.abs(p)<5,w=20,f=!b&&a<=e,y,h,v=a-e,T=e+v/2;if(h=T,n==="squared")if(b)y=`M ${e} ${t} L ${a} ${r}`;else if(f){let ne=e+15,A=a-w,ke=g?t+20:t-20;h=A,y=`M ${e} ${t} L ${ne} ${t} L ${ne} ${ke} L ${A} ${ke} L ${A} ${r} L ${a} ${r}`;}else h=a-w,y=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else y=`M ${e} ${t} C ${T} ${t}, ${T} ${r}, ${a} ${r}`;let D=5,N=`M ${a} ${r} L ${a-D} ${r-D*.5} M ${a} ${r} L ${a-D} ${r+D*.5}`,E=o.dependency,k=o.dependencyHover||E,R="#f87171",I="rgba(248, 113, 113, 0.15)",C=h,W=(t+r)/2;if(c)if(b)C=Math.max(e+10,Math.min(a-10,c.x)),W=t;else if(f){let oe=e+15,ne=a-w,A=g?t+20:t-20,ke=[[e,t,oe,t],[oe,t,oe,A],[oe,A,ne,A],[ne,A,ne,r],[ne,r,a,r]],Ie=1/0,L={x:C,y:W};for(let U of ke){let S=H(c.x,c.y,U[0],U[1],U[2],U[3]),K=Math.hypot(c.x-S.x,c.y-S.y);K<Ie&&(Ie=K,L=S);}C=L.x,W=L.y;}else {let oe=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],ne=1/0,A={x:C,y:W};for(let ke of oe){let Ie=H(c.x,c.y,ke[0],ke[1],ke[2],ke[3]),L=Math.hypot(c.x-Ie.x,c.y-Ie.y);L<ne&&(ne=L,A=Ie);}C=A.x,W=A.y;}function H(oe,ne,A,ke,Ie,L){let U=Ie-A,S=L-ke,K=U*U+S*S;if(K===0)return {x:A,y:ke};let J=((oe-A)*U+(ne-ke)*S)/K;return J=Math.max(0,Math.min(1,J)),{x:A+J*U,y:ke+J*S}}let x=oe=>{let ne=oe.currentTarget.ownerSVGElement;if(!ne)return;let A=ne.getBoundingClientRect();d({x:oe.clientX-A.left,y:oe.clientY-A.top});},te=()=>{i(false),d(null);};return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:te,onMouseMove:x,children:[jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:y,fill:"none",stroke:k,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:y,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:k,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:oe=>{oe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:x,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:y,fill:"none",stroke:m?k:E,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}}}),jsx(motion.path,{d:N,fill:"none",stroke:m?k:E,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsx(motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?k:E,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:oe=>{oe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function ys({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),l=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,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&&jsx(motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+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}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[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))"}),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}),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})`}),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}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),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 xe={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,l=new Set,m=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&m(d))return true;if(l.has(d))return true}}return l.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=xe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=xe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=xe.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=xe.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(`
|
|
126
|
-
`)},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=xe.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=xe.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)=>xe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=xe.findTaskById(e,t);return !a||!a.dependencies?[]:xe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>xe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>xe.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=xe.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=>xe.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=xe.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"]],l=s.map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?xe.formatDate(m.startDate):"N/A",m.endDate?xe.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:l,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=xe.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?xe.formatDate(m.startDate):"","End Date":m.endDate?xe.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 l=a.utils.book_new();a.utils.book_append_sheet(l,s,"Gantt Tasks"),a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=xe.flattenTasks(e),o=new Map;r.forEach((
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ji({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);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 l=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxs("div",{className:u("relative inline-block",a),children:[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:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&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:[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:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),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])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:c.map(d=>jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Yi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[m,i]=useState("json"),[c,d]=useState(null),g=useRef(null);if(!t)return null;let f=async()=>{let T=o?.current||void 0,p=await Od(e,m,T);$d(p,m);},x=async T=>{let p=T.target.files?.[0];if(p){try{let h=await Hd(p),b=p.name.endsWith(".json")?"json":"csv",y=Ud(h,b);d(y),y.success&&r&&r(y,h);}catch(h){d({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),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:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),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"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:u("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"}),jsx("button",{onClick:()=>l("import"),className:u("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"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(T=>jsxs("button",{onClick:()=>i(T),className:u("p-4 rounded-lg border-2 transition-all text-center",m===T?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:f,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"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:g,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxs("button",{onClick:()=>g.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:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),c&&jsxs("div",{className:u("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:[jsx("h3",{className:u("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:c.errors.map((T,p)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},p))})]})]})]})]})]})}var Gb=["URGENT","HIGH","MEDIUM","LOW"],Vb=[{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"}],_b=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function qi({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:g=false,groupBy:f="none",onGroupByChange:x}){let[T,p]=useState(true),h=useCallback(N=>{a({search:N.target.value});},[a]),b=useCallback(N=>{a({dateFilter:N.target.value});},[a]),y=useCallback(N=>{r({by:N.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${g?"filter-bar--compact":""} ${T?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>p(!T),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:T?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:T?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&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)"]})]}),!T&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:h,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:N=>{let E=N.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Gb.map(N=>jsx("option",{value:N,children:N},N))]})}),m.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let E=N.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),m.map(N=>jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let E=N.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsx("option",{value:N,children:N},N))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:y,className:"filter-bar__select filter-bar__select--sm",children:Vb.map(N=>jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:f,onChange:N=>x(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:_b.map(N=>jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Xi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:m}){let[i,c]=useState(false),d=useRef(null);useEffect(()=>{let f=x=>{d.current&&!d.current.contains(x.target)&&c(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let g=f=>{f(),c(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),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"})]}),jsx("span",{children:"Config"})]}),i&&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"?jsxs("button",{onClick:()=>g(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>g(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>g(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>g(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>g(()=>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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>g(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),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"]}),jsxs("button",{onClick:()=>g(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Ji={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"}},Zi={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"}},Qi={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"}},yo={dark:Ji,light:Zi,neutral:Qi},is="dark";var ls=createContext(void 0),th="asakaa-theme";function mm({children:e,defaultTheme:t=is,storageKey:a=th}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,m=yo[r];Object.entries(m.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${ah(c)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([c,d])=>{let g=m.colors[c];g&&l.style.setProperty(d,g);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:yo};return jsx(ls.Provider,{value:n,children:e})}function Uo(){let e=useContext(ls);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ah(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function el({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Uo();return e?jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),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:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),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"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(yo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("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:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),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&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function um(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[e].focusRing)}}var ds={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"}},pm={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"}},tl={en:ds,es:pm};function gm(e){return tl[e]||tl.en}function al(e,t){let a=gm(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 Wo=createContext(ds);function Xr(){return useContext(Wo)}function Ch({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,m]=useState(false),[i,c]=useState(null),d=useRef(null),g=Xr();if(useEffect(()=>{let p=h=>{d.current&&!d.current.contains(h.target)&&m(false);};return l&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]),!(t||a||r||o||s||n))return null;let x=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(p=>p.handler),T=async(p,h)=>{if(h){c(p);try{await h();}catch(b){console.error(`Export ${p} failed:`,b);}finally{c(null),m(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:l&&jsx(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:jsx("div",{className:"py-1",children:x.map((p,h)=>jsxs(motion.button,{onClick:()=>T(p.id,p.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:h<x.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===p.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):p.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:p.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:p.description})]})]},p.id))})})})]})}function Th({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return 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 jsxs(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&&jsx(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&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Nh({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(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:[jsx("span",{children:o.label}),s&&jsx(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 Dh({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=Xr();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 l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=l.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(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:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(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:jsx("div",{className:"py-1",children:l.map((i,c)=>{let d=t===i.value;return jsxs(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:d?e.accentLight:"transparent",borderBottom:c<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function Sh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),m=Xr();useEffect(()=>{if(!s)return;let g=setTimeout(()=>{let f=T=>{l.current&&!l.current.contains(T.target)&&n(false);},x=T=>{T.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",x),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",x);};},100);return ()=>{clearTimeout(g),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon: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:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:g=>{g.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"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:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsx(AnimatePresence,{children:s&&jsxs(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:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-2",children:i.map(g=>{let f=t===g.value&&!r,x=()=>g.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs(motion.button,{onClick:()=>{a(g.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:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx("span",{className:`${f?g.color:"text-gray-400"} flex-shrink-0`,children:x()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:g.label}),f&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},g.value)})}),jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(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?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function ms({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:g,taskFilter:f="all",onTaskFilterChange:x,hideCompleted:T=false,onHideCompletedChange:p,onExportPNG:h,onExportPDF:b,onExportExcel:y,onExportCSV:w,onExportJSON:D,onExportMSProject:N}){let E=Xr(),k=h||b||y||w||D||N,R=[{value:"day",label:E.toolbar.day},{value:"week",label:E.toolbar.week},{value:"month",label:E.toolbar.month}],I=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}];return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(Nh,{options:R,value:t,onChange:C=>a(C),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(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:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),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),"%"]}),jsx(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:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Dh,{theme:e,value:l,onChange:m}),x&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Sh,{theme:e,value:f,onChange:x,hideCompleted:T,onHideCompletedChange:p})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[c&&g&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:g,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:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||E.toolbar.createTask})]}),(k||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxs(Fragment,{children:[jsx(Ch,{theme:e,onExportPNG:h,onExportPDF:b,onExportExcel:y,onExportCSV:w,onExportJSON:D,onExportMSProject:N}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(Th,{options:I,value:s,onChange:C=>n(C),theme:e})]})]})}function us({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),m=useRef(null);useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(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:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(yt,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},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:jsxs("div",{className:"py-1",children:[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=>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:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:c.label}),c.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function Go({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[l,m]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,g=8,f=window.innerWidth,x=window.innerHeight,T=t,p=a;t+c+g>f&&(T=t-c,T<g&&(T=g)),a+d+g>x&&(p=x-d-g,p<g&&(p=g)),m({x:T,y:p});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[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 jsx(AnimatePresence,{children:jsx(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:`${l.x}px`,top:`${l.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:jsx("div",{className:"py-1",children:r.map(c=>jsxs("div",{children:[c.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),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:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Ht={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Cm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:g=true}){let f=useRef(false),x=useCallback(y=>{f.current=y;},[]),T=useCallback(y=>{let w=[],D=N=>{for(let E of N)w.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&D(E.subtasks);};return D(y),w},[]),p=useCallback(()=>{let y=T(e);for(let w of y)if(t.has(w.id))return w;return null},[e,t,T]),h=useCallback((y,w)=>{let D=T(e);if(D.length===0)return;let N=p();if(!N){a(D[0].id,false);return}let E=D.findIndex(I=>I.id===N.id);if(E===-1)return;let k=y==="up"?E-1:E+1;if(k<0||k>=D.length)return;let R=D[k];a(R.id,w);},[e,p,T,a]),b=useCallback(y=>{if(!g)return;let w=y.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||f.current){y.key==="Escape"&&(w.blur(),f.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?y.metaKey:y.ctrlKey,k=Array.from(t),R=p();if(y.key==="ArrowUp"){y.preventDefault(),h("up",y.shiftKey);return}if(y.key==="ArrowDown"){y.preventDefault(),h("down",y.shiftKey);return}if(R&&(y.key==="ArrowRight"||y.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(y.preventDefault(),(y.key==="ArrowRight"&&!R.isExpanded||y.key==="ArrowLeft"&&R.isExpanded)&&c(R.id));return}if(y.altKey&&(y.key==="ArrowUp"||y.key==="ArrowDown")){k.length>0&&(y.preventDefault(),n(k,y.key==="ArrowUp"?"up":"down"));return}if(y.key==="Tab"&&!y.shiftKey){k.length>0&&(y.preventDefault(),l(k));return}if(y.key==="Tab"&&y.shiftKey){k.length>0&&(y.preventDefault(),m(k));return}if(y.key==="Enter"&&!y.shiftKey&&!E){R&&(y.preventDefault(),r(R.id,"below"));return}if(y.key==="Enter"&&y.shiftKey&&!E){R&&(y.preventDefault(),r(R.id,"above"));return}if(y.key==="Enter"&&E){R&&(y.preventDefault(),d(R.id));return}if(y.key==="F2"){R&&(y.preventDefault(),i(R.id));return}if(y.key==="Delete"||y.key==="Backspace"&&E){k.length>0&&(y.preventDefault(),o(k));return}if(y.key==="d"&&E&&!y.shiftKey){k.length>0&&(y.preventDefault(),s(k));return}},[g,t,p,h,r,o,s,n,l,m,i,c,d]);return useEffect(()=>{if(g)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[g,b]),{setIsEditing:x}}function Nm(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(g=>{let f=new Set(g);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=useCallback((d,g)=>{if(!a){o(d);return}let f=g.indexOf(a),x=g.indexOf(d);if(f===-1||x===-1){o(d);return}let T=Math.min(f,x),p=Math.max(f,x),h=g.slice(T,p+1);t(new Set(h)),r(d);},[a,o]),l=useCallback((d,g,f,x)=>{x?n(d,g):f?s(d):o(d);},[o,s,n]),m=useCallback((d,g)=>{g?t(f=>{let x=new Set(f);return x.add(d),x}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let l={...r[n],parentId:o,level:s,position:n};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&a(l.subtasks,l.id,s+1);}};return a(e),t}function Dm(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Dm(a.subtasks,t);if(r)return r}}return null}function dl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=dl(a.subtasks,t);if(r)return r}return null}function cl(e,t){if(t.length===0)return e;let a=Vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let f=[];return {tasks:d.filter(T=>{if(g.has(T.id))return f.push(T),false;if(T.subtasks){let p=n(T.subtasks,g);T.subtasks=p.tasks,f.push(...p.removed);}return true}),removed:f}},l=(d,g,f)=>d.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,f)}:x),m=new Set(t),{tasks:i,removed:c}=n(e,m);return l(i,s.id,c)}function ml(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=dl(a,r);if(!o)continue;let s=dl(a,o.id),n=(i,c,d)=>{for(let g=0;g<i.length;g++){let f=i[g];if(f.id===c&&f.subtasks){let x=f.subtasks.findIndex(T=>T.id===d);if(x!==-1){let[T]=f.subtasks.splice(x,1);return T}}if(f.subtasks){let x=n(f.subtasks,c,d);if(x)return x}}return null},l=(i,c,d)=>{let g=i.findIndex(f=>f.id===c);if(g!==-1)return i.splice(g+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,c,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?l(s.subtasks,o.id,m):l(a,o.id,m));}return a}function ul(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,m)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,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 pl(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 gl(e,t){let a=[...e];for(let r of t){let o=n=>{let l=n.findIndex(c=>c.id===r);if(l===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[l],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(l+1,0,i),true},s=n=>n.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?s(l.subtasks):void 0}));o(a);}return a}function Sm(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"},l=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function fl(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:fl(r.subtasks,t,a)}:r)}function bl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:bl(a.subtasks,t)}:a)}function hl(e,t){let a=c=>{for(let d of c){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6"},i=c=>c.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function Em(e,t,a,r){if(t===a)return e;let o=Dm(e,t);if(!o)return e;if(a){let l=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>l.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 l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,g=[...c];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function fs({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:g,onTaskUpdate:f,onTaskIndent:x,onTaskOutdent:T,onTaskMove:p,onMultiTaskDelete:h,onTaskDuplicate:b,onTaskCreate:y,onTaskRename:w,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:E,onTaskReparent:k}){let R=useContext(Wo),[I,C]=useState(null),[W,H]=useState(null),[v,te]=useState(""),oe=useRef(null),[ne,A]=useState(null),[ke,Ie]=useState(0),[L,U]=useState(0),[S,K]=useState({isOpen:false,x:0,y:0,type:"header"}),[J,ie]=useState(null),[ue,ye]=useState(null),[Oe,Q]=useState(null),Je=useRef(0),Pe=5,rt=useRef(false),[ut,It]=useState(null),[Xe,pt]=useState(false),[ce,Ge]=useState(null),[Be,B]=useState(false),X=useRef(null);useEffect(()=>{function V(q){X.current&&!X.current.contains(q.target)&&B(false);}if(Be)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[Be]),useEffect(()=>{W&&oe.current&&(oe.current.focus(),oe.current.select());},[W]),useEffect(()=>{if(!ne)return;let V=Se=>{let Ye=Se.clientX-ke,ze=L+Ye;g?.(ne,ze);},q=()=>{A(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,ke,L,g]);let{selectedTaskIds:ge,handleTaskClick:Ae,isTaskSelected:Ue}=Nm(),{setIsEditing:nt}=Cm({tasks:e,selectedTaskIds:ge,onTaskSelect:(V,q)=>{let Ye=Vo(e).map(ze=>ze.id);Ae(V,Ye,q||false,false);},onTaskCreate:y||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:p||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:V=>{let q=Vo(e).find(Se=>Se.id===V);q&&je(q);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:V=>{let q=Vo(e).find(Se=>Se.id===V);q&&N&&N(q);},enableKeyboard:true}),Pt=(V,q=0)=>{let Se=[];for(let Ye of V)Se.push({task:Ye,level:q}),Ye.subtasks&&Ye.subtasks.length>0&&Ye.isExpanded&&Se.push(...Pt(Ye.subtasks,q+1));return Se},$e=Pt(e),O=48,ae=Math.max($e.length*a,600-O),Le=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,je=V=>{H(V.id),te(V.name),nt(true);},qe=V=>{v.trim()&&v!==e.find(q=>q.id===V)?.name&&w?.(V,v.trim()),H(null),te(""),nt(false);},j=()=>{H(null),te(""),nt(false);},$=(V,q)=>{q.stopPropagation(),D?.(V.id);},Me=(V,q)=>{q.preventDefault(),Je.current=q.clientY,ie(V),rt.current=false,pt(false),It({x:q.clientX,y:q.clientY});},ht=V=>{if(!J||(Math.abs(V.clientY-Je.current)>Pe&&!rt.current&&(rt.current=true,pt(true)),It({x:V.clientX,y:V.clientY}),!rt.current))return;let Se=document.querySelectorAll("[data-task-row]"),Ye=null,ze=null;Se.forEach(G=>{let me=G.getBoundingClientRect(),_e=G.getAttribute("data-task-row");if(_e&&_e!==J&&V.clientY>=me.top&&V.clientY<=me.bottom){Ye=_e;let Tt=V.clientY-me.top,gt=me.height;Tt<gt*.25?ze="above":Tt>gt*.75?ze="below":ze="child";}}),ye(Ye),Q(ze);},le=()=>{if(rt.current&&J&&ue&&Oe){if(Oe==="child")k?.(J,ue);else if(Oe==="above"||Oe==="below"){let V=(Ye,ze,G=null)=>{for(let me of Ye){if(me.id===ze)return G;if(me.subtasks){let _e=V(me.subtasks,ze,me.id);if(_e!==void 0)return _e}}},q=V(e,ue,null),Se=(Ye,ze)=>{let G=Ye.findIndex(me=>me.id===ze);return Oe==="below"?G+1:G};if(q===null){let Ye=Se(e,ue);k?.(J,null,Ye);}else {let Ye=$e.find(ze=>ze.task.id===q)?.task;if(Ye?.subtasks){let ze=Se(Ye.subtasks,ue);k?.(J,q,ze);}}}}ie(null),ye(null),Q(null),It(null),rt.current=false,pt(false);};useEffect(()=>{if(J)return document.addEventListener("mousemove",ht),document.addEventListener("mouseup",le),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ht),document.removeEventListener("mouseup",le),document.body.style.cursor="",document.body.style.userSelect="";}},[J,ue,Oe]);let He=(V,q,Se)=>{switch(V.id){case "name":let Ye=W===q.id,ze=I===q.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Se*20}px`},children:[k&&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:ze?1:.3},onMouseDown:fe=>Me(q.id,fe),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),q.subtasks&&q.subtasks.length>0?jsx("button",{onClick:fe=>{fe.stopPropagation(),m?.(q.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:q.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:q.color||"#3B82F6",opacity:q.parentId?.6:1,borderColor:q.isMilestone?t.accent:"transparent",borderWidth:q.isMilestone?"2px":"0px"},title:q.isMilestone?"Milestone":q.parentId?"Subtask":"Task"})}),Ye?jsx("input",{ref:oe,type:"text",value:v,onChange:fe=>te(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"?qe(q.id):fe.key==="Escape"&&j();},onBlur:()=>qe(q.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:fe=>fe.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:q.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:q.parentId?"13px":"14px",fontWeight:q.isMilestone?600:q.parentId?400:600,letterSpacing:q.parentId?"0":"-0.01em"},title:q.name,children:q.name}),ze&&!Ye&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:fe=>fe.stopPropagation(),children:[jsx("button",{onClick:fe=>$(q,fe),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:fe=>{fe.stopPropagation(),je(q);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let me=V.id==="startDate"?"startDate":"endDate",_e=q[me],Tt=ce?.taskId===q.id&&ce?.field===me,gt=fe=>fe?(typeof fe=="string"?new Date(fe):fe).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:fe=>fe.stopPropagation(),children:[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(Tt)Ge(null);else {let Nt=fe.currentTarget.getBoundingClientRect();Ge({taskId:q.id,field:me,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:Nt.bottom+4,left:Nt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:gt(_e)})]}),Tt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ge(null)}),jsxs(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:ce?.position.top,left:ce?.position.left},onClick:fe=>fe.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let fe=new Date,Nt=new Date(fe);Nt.setDate(fe.getDate()+1);let ot=new Date(fe);ot.setDate(fe.getDate()+7);let Or=new Date(fe);return Or.setDate(fe.getDate()+14),[{label:"Hoy",date:fe},{label:"Ma\xF1ana",date:Nt},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:Or}].map((hr,P)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(q.id,{[me]:hr.date}),Ge(null);},children:hr.label},P))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),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:()=>{f?.(q.id,{[me]:void 0}),Ge(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>Ge(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:ce?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Ge(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((fe,Nt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:fe},Nt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let fe=ce?.month||new Date,Nt=fe.getFullYear(),ot=fe.getMonth(),Or=new Date(Nt,ot,1).getDay(),oo=new Date(Nt,ot+1,0).getDate(),hr=new Date,P=[];for(let ve=Or-1;ve>=0;ve--)P.push({day:new Date(Nt,ot,-ve).getDate(),date:new Date(Nt,ot-1,new Date(Nt,ot,-ve).getDate()),isCurrentMonth:false});for(let ve=1;ve<=oo;ve++)P.push({day:ve,date:new Date(Nt,ot,ve),isCurrentMonth:true});let re=42-P.length;for(let ve=1;ve<=re;ve++)P.push({day:ve,date:new Date(Nt,ot+1,ve),isCurrentMonth:false});return P.map((ve,Ze)=>{let ra=ve.date.toDateString()===hr.toDateString(),oa=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===ve.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:ve.isCurrentMonth?oa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:oa?"#3B82F6":"transparent",boxShadow:ra&&!oa?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(q.id,{[me]:ve.date}),Ge(null);},children:ve.day},Ze)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Le(q)})});case "assignees":let Sr=r.filter(fe=>q.assignees?.some(Nt=>Nt.name===fe.name||Nt.initials===fe.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsx(uo,{assignedUsers:Sr,availableUsers:r,onChange:fe=>{let Nt=fe.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));f?.(q.id,{assignees:Nt.length>0?Nt:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsx(sc,{status:q.status||"todo",onChange:fe=>{f?.(q.id,{status:fe,progress:fe==="completed"?100:q.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${q.progress}%`,backgroundColor:q.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[q.progress,"%"]})]});case "priority":let br={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ba={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ra=br[q.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsx(co,{priority:Ra,onChange:fe=>{fe&&f?.(q.id,{priority:Ba[fe]||"medium"});}})});default:return null}},De=V=>[{id:"hide",label:"Hide Column",icon:Ht.Hide,onClick:()=>d(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ht.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ht.SortDesc,onClick:()=>{}}],Re=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{D?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{E?E(V.id,V.name):h?.([V.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Ht.Pencil,onClick:()=>{n?.(V);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{D?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ht.MarkIncomplete,onClick:()=>{f?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Ht.SetInProgress,onClick:()=>{f?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Ht.MarkComplete,onClick:()=>{f?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Ht.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{E?E(V.id,V.name):h?.([V.id]);}}],de=c.filter(V=>V.visible),Ve=de.reduce((V,q)=>V+q.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ve},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${O}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:de.map((V,q)=>{let Se=q===de.length-1,Ye=V.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ye?"":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.minWidth??(Ye?200:60)}px`,maxWidth:`${V.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Se?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ze=>{ze.preventDefault(),K({isOpen:true,x:ze.clientX,y:ze.clientY,type:"header",columnId:V.id});},onMouseEnter:ze=>{ze.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ze=>{ze.currentTarget.style.backgroundColor="transparent";},children:[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:V.label,children:V.label}),V.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ne===V.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ze=>{ze.preventDefault(),ze.stopPropagation(),A(V.id),Ie(ze.clientX),U(V.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},V.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsx(us,{columns:c,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>B(!Be),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),Be&&jsxs("div",{ref:X,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:V=>V.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>B(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:ae},children:$e.map(({task:V,level:q},Se)=>{let Ye=Ue(V.id),ze=ue===V.id,G=ze&&Oe==="above",me=ze&&Oe==="below",_e=ze&&Oe==="child",Tt={};return _e&&(Tt.backgroundColor=`${t.accent}15`,Tt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":V.id,className:`flex items-center cursor-pointer group ${J===V.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ye?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ye?t.accentLight:_e?`${t.accent}15`:Se%2===0?t.bgPrimary:t.bgGrid,...Tt},onMouseEnter:()=>C(V.id),onMouseLeave:()=>C(null),onClick:gt=>{let br=Vo(e).map(fe=>fe.id),Ra=navigator.platform.toUpperCase().indexOf("MAC")>=0?gt.metaKey:gt.ctrlKey;Ae(V.id,br,Ra,gt.shiftKey),s?.(V);},onDoubleClick:gt=>{gt.stopPropagation(),n?.(V);},onContextMenu:gt=>{gt.preventDefault(),K({isOpen:true,x:gt.clientX,y:gt.clientY,type:"task",task:V}),l?.(V,gt);},whileHover:{backgroundColor:Ye?t.accentLight:t.hoverBg},children:[G&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),me&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),de.map((gt,Sr)=>{let br=Sr===de.length-1,Ba=gt.id==="name";return jsx("div",{className:`px-4 flex items-center ${Ba?"justify-start":"justify-center"}`,style:{width:`${gt.width}px`,minWidth:`${gt.minWidth??(Ba?200:60)}px`,maxWidth:`${gt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:br?"none":`1px solid ${I===V.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:He(gt,V,Ba?q:0)},`${V.id}-${gt.id}`)})]},V.id)})}),jsx(Go,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?De(S.columnId):S.type==="task"&&S.task?Re(S.task):[],onClose:()=>K({...S,isOpen:false}),theme:t}),Xe&&ut&&J&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:ut.x+12,top:ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let V=$e.find(q=>q.task.id===J)?.task;return V?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:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:V.name})}):null})()}),document.body)]})}function Lm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[m,i]=useState(t),[c,d]=useState(null),[g,f]=useState(null),[x,T]=useState(null),[p,h]=useState(null),[b,y]=useState(0),[w,D]=useState(0),[N,E]=useState(null),[k,R]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:f,activeZone:x,setActiveZone:T,draggedSegmentIndex:p,setDraggedSegmentIndex:h,draggedSegmentStartX:b,setDraggedSegmentStartX:y,segmentDragOffsetX:w,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:E,isHovered:k,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(v,te)=>{r("none"),d(null),f(null),l(v),i(te),D(0),h(null),y(0);}}}function hs({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:g,allTaskPositions:f=[],onDragMove:x,onHoverChange:T}){let p=Lm(t,r),h=useRef(null),b=useRef(null),y=useRef(null),{dragMode:w,setDragMode:D,dragOffset:N,setDragOffset:E,ghostX:k,setGhostX:R,ghostWidth:I,setGhostWidth:C,connectionLine:W,setConnectionLine:H,hoveredTaskId:v,setHoveredTaskId:te,activeZone:oe,setActiveZone:ne,draggedSegmentIndex:A,setDraggedSegmentIndex:ke,draggedSegmentStartX:Ie,setDraggedSegmentStartX:L,segmentDragOffsetX:U,setSegmentDragOffsetX:S,hoveredSegmentIndex:K,setHoveredSegmentIndex:J,isHovered:ie,setIsHovered:ue,isDragging:ye,isResizing:Oe,isConnecting:Q,resetDragState:Je}=p,Pe=32,rt=8,ut=e.endDate&&e.endDate<new Date&&e.progress<100,It=e.isCriticalPath,Xe=o.name==="neutral"||o.today==="#1C1917",pt=e.status==="completed"||e.progress===100,ce={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Be=e.isCriticalPath||ut?"#DC2626":e.color?e.color:e.priority&&ce[e.priority]?ce[e.priority]:o.taskBarPrimary,X=(le=>le>=80?20:le>=60?15:le>=50?12:10)(r),ge=r<50,Ae=r<40;useEffect(()=>{if(T)if(ie&&!ye&&!e.segments){let le=a<100;T({task:e,x:t,y:a,width:r,height:Pe,showBelow:le});}else T(null);},[ie,ye,e,t,a,r,Pe,T]);let Ue=le=>le.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let le=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${le} day${le!==1?"s":""}`},Pt=le=>Math.round(le/s)*s,$e=le=>{let He=Math.round(le/s),De=new Date(n);return De.setDate(De.getDate()+He),De},O=(le,He)=>{for(let De of f){if(De.id===e.id)continue;let Re=5;if(le>=De.x-Re&&le<=De.x+De.width+Re&&He>=De.y-Re&&He<=De.y+De.height+Re)return De.id}return null},ae=useCallback((le,He,De)=>{le.preventDefault(),le.stopPropagation();let Re=h.current?.ownerSVGElement;if(!Re)return;let de=Re.createSVGPoint();de.x=le.clientX,de.y=le.clientY;let Ve=de.matrixTransform(Re.getScreenCTM()?.inverse()),V=De!==void 0?De:t,q=He;if(!q){let Se=Ve.x-V;le.shiftKey?(q="connect",H({x:t+r,y:a+Pe/2})):le.ctrlKey||le.metaKey?q="move":le.altKey?q=Se<r/2?"resize-start":"resize-end":Ae?Se<r/2?q="move":q="resize-end":ge?Se<=X/2?q="resize-start":Se>=r-X/2?q="resize-end":q="move":Se<=X?q="resize-start":Se>=r-X?q="resize-end":q="move";}D(q),ue(false),ne(null),q==="move"?E(Ve.x-V):q==="connect"?H({x:t+r,y:a+Pe/2}):E(0),R(V),C(r);},[t,r,a,Pe]),Le=useCallback(le=>{let He=h.current?.ownerSVGElement;if(!He)return;let De=He.closest(".gantt-timeline-scroll");if(!De)return;let Re=De.getBoundingClientRect(),de=60,Ve=15,V=0;if(le.clientX<Re.left+de){let q=Re.left+de-le.clientX;V=-Math.min(Ve,q/2);}else if(le.clientX>Re.right-de){let q=le.clientX-(Re.right-de);V=Math.min(Ve,q/2);}return V!==0&&(De.scrollLeft+=V),V!==0},[]),je=useCallback(le=>{if(w==="none")return;y.current=le;let He=h.current?.ownerSVGElement;if(!He)return;if(w==="move"||w==="resize-start"||w==="resize-end"){let de=Le(le);de&&!b.current?b.current=window.setInterval(()=>{y.current&&(Le(y.current),je(y.current));},16):!de&&b.current&&(window.clearInterval(b.current),b.current=null);}let De=He.createSVGPoint();De.x=le.clientX,De.y=le.clientY;let Re=De.matrixTransform(He.getScreenCTM()?.inverse());if(w==="connect"){H({x:Re.x,y:Re.y});let de=O(Re.x,Re.y);te(de);}else if(w==="move"){let de=Re.x-N,Ve=Pt(de);R(Ve),C(r);let V=Math.round((Ve-t)/s);if(x?.(e.id,V,true),e.segments&&e.segments.length>0&&A!==null){let q=Ve-Ie;S(q);}}else if(w==="resize-start"){let de=Re.x,Ve=Pt(de),V=t+r-Ve;V>=s&&(R(Ve),C(V));}else if(w==="resize-end"){let de=Re.x,V=Pt(de)-t;V>=s&&C(V);}},[w,t,r,s,N,e,Pt,A,Ie,O,te,H,R,C,S,x,Le]),qe=useCallback(()=>{if(b.current&&(window.clearInterval(b.current),b.current=null),y.current=null,w!=="none"){if(w==="connect")v&&g&&g(e,v),H(null),te(null);else {let le=e.endDate.getTime()-e.startDate.getTime(),He,De,Re=true;if(w==="move"){if(He=$e(k),De=new Date(He.getTime()+le),e.segments&&e.segments.length>0&&A!==null){let de=Math.round(U/s),Ve=e.segments.map((Ye,ze)=>{if(ze===A){let G=new Date(Ye.startDate),me=new Date(Ye.endDate);return G.setDate(G.getDate()+de),me.setDate(me.getDate()+de),{startDate:G,endDate:me}}return Ye}),V=Ve.flatMap(Ye=>[Ye.startDate,Ye.endDate]),q=new Date(Math.min(...V.map(Ye=>Ye.getTime()))),Se=new Date(Math.max(...V.map(Ye=>Ye.getTime())));d?.({...e,segments:Ve},q,Se),Je(t,r);return}}else w==="resize-start"?(He=$e(k),De=e.endDate,He>De&&(console.warn("Invalid date range: start date must be before or equal to end date"),Re=false)):w==="resize-end"?(He=e.startDate,De=$e(k+I),De<He&&(console.warn("Invalid date range: end date must be after or equal to start date"),Re=false)):Re=false;Re&&He&&De&&(De.getTime()<He.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,He,De));}x?.(e.id,0,false),Je(t,r);}},[w,k,I,e,d,v,g,t,r,s,$e,U,A,Je,x]);useEffect(()=>{if(w==="none")return;let le=De=>{je(De);},He=()=>{qe();};return window.addEventListener("mousemove",le),window.addEventListener("mouseup",He),()=>{window.removeEventListener("mousemove",le),window.removeEventListener("mouseup",He),b.current&&(window.clearInterval(b.current),b.current=null);}},[w,je,qe]);let j=ye&&!Q?k:t,$=ye&&!Q?I:r,Me=l.taskClass(e);return jsxs("g",{ref:h,"data-task-bar":"true",onClick:()=>!ye&&m?.(e),onDoubleClick:le=>{ye||(le.stopPropagation(),i?.(e));},onContextMenu:le=>{le.preventDefault(),c?.(e,le);},onMouseEnter:()=>!ye&&ue(true),onMouseLeave:()=>{ye||(ue(false),ne(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:Pe,fill:"transparent",style:{pointerEvents:"all"}}),ie&&!ye&&!ge&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:X,height:Pe,fill:oe==="resize-start"?o.accent:"transparent",opacity:oe==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-start"),onMouseDown:le=>ae(le,"resize-start")}),jsx("rect",{x:t+X,y:a,width:r-X*2,height:Pe,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:le=>ae(le,"move")}),jsx("rect",{x:t+r-X,y:a,width:X,height:Pe,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:le=>ae(le,"resize-end")})]}),ie&&!ye&&Ae&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Pe,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:le=>ae(le,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Pe,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:le=>ae(le,"resize-end")}),ie&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Pe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ye&&!Q&&!e.segments&&jsx(motion.rect,{x:k,y:a,width:I,height:Pe,rx:rt,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&&jsx(motion.rect,{x:j,y:a,width:$,height:Pe,rx:rt,fill:Be,"data-task-class":Me,initial:{opacity:0,scale:.95},animate:{opacity:ye&&!Q?.15:e.parentId?.6:ie?.9:.8,scale:ie&&!ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:le=>ae(le),style:{cursor:ye?Q?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:j,y:a,width:$*(e.progress/100),height:Pe,rx:rt,fill:Be,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((le,He)=>{let De=(le.startDate.getTime()-n.getTime())/864e5*s,de=(le.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-De+s,Ve=ye&&w==="move"&&A===He,V=K===He,q=Ve?De+U:De;return jsxs("g",{onMouseEnter:()=>!ye&&J(He),onMouseLeave:()=>!ye&&J(null),children:[jsx(motion.rect,{x:q,y:a,width:de,height:Pe,rx:rt,fill:Be,initial:{opacity:0,scale:.95},animate:{opacity:Ve||e.parentId?.6:V?.9:.8,scale:V&&!ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Se=>{Se.stopPropagation(),ke(He),L(De),ae(Se,void 0,De);},style:{cursor:ye?Q?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:q,y:a,width:de*(e.progress/100),height:Pe,rx:rt,fill:Be,opacity:1,style:{pointerEvents:"none"}})]},`segment-${He}`)}),Xe&&(ut||It)&&!e.segments&&jsxs(Fragment,{children:[It&&!ut&&jsx("rect",{x:j,y:a,width:$,height:Pe,rx:rt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ut&&jsx("rect",{x:j,y:a,width:$,height:Pe,rx:rt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),$>60&&!e.segments&&(()=>{let le=l.taskLabel(e),He=typeof le=="string"?le:e.name,De=He.length>Math.floor($/8)?`${He.substring(0,Math.floor($/8))}...`:He;return jsx("text",{x:j+12,y:a+Pe/2,dominantBaseline:"middle",fill:pt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:pt?"line-through":"none"},children:De})})(),$>100&&e.progress>0&&e.progress<100&&!ye&&!e.segments&&jsxs("text",{x:j+$-12,y:a+Pe/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&&$>80&&!ye&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:j+$-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:j+$-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ie||Oe)&&!Q&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:j-2,y:a,width:16,height:Pe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-start"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"resize-start");}}),jsx(motion.rect,{x:j+4,y:a+8,width:3,height:Pe-16,rx:1.5,fill:oe==="resize-start"||w==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:j+$-14,y:a,width:16,height:Pe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-end"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"resize-end");}}),jsx(motion.rect,{x:j+$-7,y:a+8,width:3,height:Pe-16,rx:1.5,fill:oe==="resize-end"||w==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:ie&&!ye&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+Pe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ne("connect"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Pe/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:oe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Q&&W&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Pe/2,x2:W.x,y2:W.y,stroke:v?o.statusCompleted:o.accent,strokeWidth:v?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:v?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:W.x,cy:W.y,r:v?8:6,fill:v?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),v&&jsx(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"})]}),(ie||ye)&&!Q&&!e.segments&&jsx(motion.rect,{x:j-2,y:a-2,width:$+4,height:Pe+4,rx:rt+2,fill:"none",stroke:ye?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ye?.6:.4,initial:{opacity:0},animate:{opacity:ye?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Oe&&jsxs(Fragment,{children:[jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:k+I,y1:0,x2:k+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:ie&&!ye&&!e.segments&&!T&&(()=>{let De=a<100,Re=De?a+Pe+13:a-82-13,de=De?`M ${j+$/2-6} ${a+Pe+3} L ${j+$/2} ${a+Pe+13} L ${j+$/2+6} ${a+Pe+3}`:`M ${j+$/2-6} ${a-13} L ${j+$/2} ${a-3} L ${j+$/2+6} ${a-13}`,Ve=Re+22,V=Re+40,q=Re+55,Se=Re+70,Ye=De?Re+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:De?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:De?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:de,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:j+$/2-120,y:Re,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))"}),jsx("text",{x:j+$/2,y:Ve,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}),jsx("text",{x:j+$/2-110,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:j+$/2-70,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.startDate)}),jsx("text",{x:j+$/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:j+$/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.endDate)}),jsx("text",{x:j+$/2+10,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:j+$/2+65,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsx("text",{x:j+$/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:j+$/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:j+$/2-110,y:Se,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:j+$/2-50,y:Se,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ze=>ze.name).join(", ").substring(0,30),e.assignees.map(ze=>ze.name).join(", ").length>30?"...":""]})]}),!De&&jsx("text",{x:j+$/2,y:Ye,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ae?"Left: move \u2022 Right: resize":ge?"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 Rm({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:m}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,c=i?130:82,d=13,g=m?s+l+d:s-c-d,f=m?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,x=g+22,T=g+40,p=g+55,h=g+70,b=g+90,y=g+105,w=g+120,D=C=>C.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),N=()=>{if(!r.startDate||!r.endDate)return "N/A";let C=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${C} day${C!==1?"s":""}`},E=C=>{if(C==null||C===0)return "N/A";let W=Math.floor(C/60),H=C%60;return W===0?`${H}m`:H===0?`${W}h`:`${W}h ${H}m`},k={start:a==="es"?"Inicio:":"Start:",end:a==="es"?"Fin:":"End:",duration:a==="es"?"Duraci\xF3n:":"Duration:",progress:a==="es"?"Progreso:":"Progress:",assignees:a==="es"?"Asignados:":"Assignees:",estimated:a==="es"?"Estimado:":"Estimated:",logged:a==="es"?"Registrado:":"Logged:",quoted:a==="es"?"Ofertado:":"Quoted:"};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:o+n/2-120,y:g,width:240,height:c,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:o+n/2,y:x,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsx("text",{x:o+n/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.start}),jsx("text",{x:o+n/2-70,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?D(r.startDate):"N/A"}),jsx("text",{x:o+n/2-110,y:p,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.end}),jsx("text",{x:o+n/2-70,y:p,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?D(r.endDate):"N/A"}),jsx("text",{x:o+n/2+10,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.duration}),jsx("text",{x:o+n/2+65,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:N()}),jsx("text",{x:o+n/2+10,y:p,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.progress}),jsxs("text",{x:o+n/2+65,y:p,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.assignees}),jsxs("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(C=>C.name).join(", ").substring(0,30),r.assignees.map(C=>C.name).join(", ").length>30?"...":""]})]}),i&&jsxs(Fragment,{children:[r.effortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.estimated}),jsx("text",{x:o+n/2-50,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:E(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.logged}),jsx("text",{x:o+n/2-50,y,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:E(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.quoted}),jsx("text",{x:o+n/2-50,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:E(r.soldEffortMinutes)})]})]})]})})}function vs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false}){let[m,i]=useState(false),[c,d]=useState(null),g=r-t,f=g>0,x=Math.abs(g)<5,T=20,p=!x&&a<=e,h,b,y=a-e,w=e+y/2;if(b=w,n==="squared")if(x)h=`M ${e} ${t} L ${a} ${r}`;else if(p){let ne=e+15,A=a-T,ke=f?t+20:t-20;b=A,h=`M ${e} ${t} L ${ne} ${t} L ${ne} ${ke} L ${A} ${ke} L ${A} ${r} L ${a} ${r}`;}else b=a-T,h=`M ${e} ${t} L ${b} ${t} L ${b} ${r} L ${a} ${r}`;else h=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let D=5,N=`M ${a} ${r} L ${a-D} ${r-D*.5} M ${a} ${r} L ${a-D} ${r+D*.5}`,E=o.dependency,k=o.dependencyHover||E,R="#f87171",I="rgba(248, 113, 113, 0.15)",C=b,W=(t+r)/2;if(c)if(x)C=Math.max(e+10,Math.min(a-10,c.x)),W=t;else if(p){let oe=e+15,ne=a-T,A=f?t+20:t-20,ke=[[e,t,oe,t],[oe,t,oe,A],[oe,A,ne,A],[ne,A,ne,r],[ne,r,a,r]],Ie=1/0,L={x:C,y:W};for(let U of ke){let S=H(c.x,c.y,U[0],U[1],U[2],U[3]),K=Math.hypot(c.x-S.x,c.y-S.y);K<Ie&&(Ie=K,L=S);}C=L.x,W=L.y;}else {let oe=[[e,t,b,t],[b,t,b,r],[b,r,a,r]],ne=1/0,A={x:C,y:W};for(let ke of oe){let Ie=H(c.x,c.y,ke[0],ke[1],ke[2],ke[3]),L=Math.hypot(c.x-Ie.x,c.y-Ie.y);L<ne&&(ne=L,A=Ie);}C=A.x,W=A.y;}function H(oe,ne,A,ke,Ie,L){let U=Ie-A,S=L-ke,K=U*U+S*S;if(K===0)return {x:A,y:ke};let J=((oe-A)*U+(ne-ke)*S)/K;return J=Math.max(0,Math.min(1,J)),{x:A+J*U,y:ke+J*S}}let v=oe=>{let ne=oe.currentTarget.ownerSVGElement;if(!ne)return;let A=ne.getBoundingClientRect();d({x:oe.clientX-A.left,y:oe.clientY-A.top});},te=()=>{i(false),d(null);};return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:te,onMouseMove:v,children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:h,fill:"none",stroke:k,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:h,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:k,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:oe=>{oe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:v,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:h,fill:"none",stroke:m?k:E,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}}}),jsx(motion.path,{d:N,fill:"none",stroke:m?k:E,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsx(motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?k:E,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:oe=>{oe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function ks({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),l=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,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&&jsx(motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+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}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[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))"}),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}),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})`}),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}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),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 xe={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,l=new Set,m=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&m(d))return true;if(l.has(d))return true}}return l.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=xe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=xe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=xe.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=xe.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(`
|
|
126
|
+
`)},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=xe.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=xe.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)=>xe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=xe.findTaskById(e,t);return !a||!a.dependencies?[]:xe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>xe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>xe.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=xe.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=>xe.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=xe.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"]],l=s.map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?xe.formatDate(m.startDate):"N/A",m.endDate?xe.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:l,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=xe.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?xe.formatDate(m.startDate):"","End Date":m.endDate?xe.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 l=a.utils.book_new();a.utils.book_append_sheet(l,s,"Gantt Tasks"),a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=xe.flattenTasks(e),o=new Map;r.forEach((g,f)=>{o.set(g.id,f+1);});let s=g=>g.toISOString().replace("Z",""),n=xe.getEarliestStartDate(e)||new Date,l=xe.getLatestEndDate(e)||new Date,m=r.map((g,f)=>{let x=o.get(g.id),T=g.startDate&&g.endDate?xe.calculateDuration(g.startDate,g.endDate):0,p=(g.dependencies||[]).filter(h=>o.has(h)).map(h=>`
|
|
127
127
|
<PredecessorLink>
|
|
128
|
-
<PredecessorUID>${o.get(
|
|
128
|
+
<PredecessorUID>${o.get(h)}</PredecessorUID>
|
|
129
129
|
<Type>1</Type>
|
|
130
130
|
<CrossProject>0</CrossProject>
|
|
131
131
|
<LinkLag>0</LinkLag>
|
|
132
132
|
<LagFormat>7</LagFormat>
|
|
133
133
|
</PredecessorLink>`).join("");return `
|
|
134
134
|
<Task>
|
|
135
|
-
<UID>${
|
|
136
|
-
<ID>${
|
|
137
|
-
<Name>${
|
|
135
|
+
<UID>${x}</UID>
|
|
136
|
+
<ID>${f+1}</ID>
|
|
137
|
+
<Name>${g.name.replace(/[<>&'"]/g,h=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[h]||h)}</Name>
|
|
138
138
|
<Type>0</Type>
|
|
139
139
|
<IsNull>0</IsNull>
|
|
140
140
|
<CreateDate>${s(new Date)}</CreateDate>
|
|
141
|
-
<WBS>${
|
|
142
|
-
<OutlineNumber>${
|
|
143
|
-
<OutlineLevel>${
|
|
141
|
+
<WBS>${f+1}</WBS>
|
|
142
|
+
<OutlineNumber>${f+1}</OutlineNumber>
|
|
143
|
+
<OutlineLevel>${g.level||0}</OutlineLevel>
|
|
144
144
|
<Priority>500</Priority>
|
|
145
|
-
<Start>${
|
|
146
|
-
<Finish>${
|
|
147
|
-
<Duration>PT${
|
|
145
|
+
<Start>${g.startDate?s(g.startDate):""}</Start>
|
|
146
|
+
<Finish>${g.endDate?s(g.endDate):""}</Finish>
|
|
147
|
+
<Duration>PT${T*8}H0M0S</Duration>
|
|
148
148
|
<DurationFormat>7</DurationFormat>
|
|
149
|
-
<Work>PT${
|
|
150
|
-
<Stop>${
|
|
151
|
-
<Resume>${
|
|
149
|
+
<Work>PT${T*8}H0M0S</Work>
|
|
150
|
+
<Stop>${g.endDate?s(g.endDate):""}</Stop>
|
|
151
|
+
<Resume>${g.startDate?s(g.startDate):""}</Resume>
|
|
152
152
|
<ResumeValid>0</ResumeValid>
|
|
153
153
|
<EffortDriven>1</EffortDriven>
|
|
154
154
|
<Recurring>0</Recurring>
|
|
155
155
|
<OverAllocated>0</OverAllocated>
|
|
156
156
|
<Estimated>0</Estimated>
|
|
157
|
-
<Milestone>${
|
|
158
|
-
<Summary>${
|
|
159
|
-
<Critical>${
|
|
157
|
+
<Milestone>${g.isMilestone?"1":"0"}</Milestone>
|
|
158
|
+
<Summary>${g.subtasks&&g.subtasks.length>0?"1":"0"}</Summary>
|
|
159
|
+
<Critical>${g.isCriticalPath?"1":"0"}</Critical>
|
|
160
160
|
<IsSubproject>0</IsSubproject>
|
|
161
161
|
<IsSubprojectReadOnly>0</IsSubprojectReadOnly>
|
|
162
162
|
<ExternalTask>0</ExternalTask>
|
|
163
|
-
<EarlyStart>${
|
|
164
|
-
<EarlyFinish>${
|
|
165
|
-
<LateStart>${
|
|
166
|
-
<LateFinish>${
|
|
163
|
+
<EarlyStart>${g.startDate?s(g.startDate):""}</EarlyStart>
|
|
164
|
+
<EarlyFinish>${g.endDate?s(g.endDate):""}</EarlyFinish>
|
|
165
|
+
<LateStart>${g.startDate?s(g.startDate):""}</LateStart>
|
|
166
|
+
<LateFinish>${g.endDate?s(g.endDate):""}</LateFinish>
|
|
167
167
|
<StartVariance>0</StartVariance>
|
|
168
168
|
<FinishVariance>0</FinishVariance>
|
|
169
169
|
<WorkVariance>0</WorkVariance>
|
|
@@ -171,22 +171,22 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
171
171
|
<TotalSlack>0</TotalSlack>
|
|
172
172
|
<FixedCost>0</FixedCost>
|
|
173
173
|
<FixedCostAccrual>3</FixedCostAccrual>
|
|
174
|
-
<PercentComplete>${
|
|
175
|
-
<PercentWorkComplete>${
|
|
174
|
+
<PercentComplete>${g.progress}</PercentComplete>
|
|
175
|
+
<PercentWorkComplete>${g.progress}</PercentWorkComplete>
|
|
176
176
|
<Cost>0</Cost>
|
|
177
177
|
<OvertimeCost>0</OvertimeCost>
|
|
178
178
|
<OvertimeWork>PT0H0M0S</OvertimeWork>
|
|
179
|
-
<ActualStart>${
|
|
180
|
-
<ActualFinish>${
|
|
181
|
-
<ActualDuration>PT${Math.round(
|
|
179
|
+
<ActualStart>${g.progress>0&&g.startDate?s(g.startDate):""}</ActualStart>
|
|
180
|
+
<ActualFinish>${g.progress===100&&g.endDate?s(g.endDate):""}</ActualFinish>
|
|
181
|
+
<ActualDuration>PT${Math.round(T*g.progress/100)*8}H0M0S</ActualDuration>
|
|
182
182
|
<ActualCost>0</ActualCost>
|
|
183
183
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
184
|
-
<ActualWork>PT${Math.round(
|
|
184
|
+
<ActualWork>PT${Math.round(T*g.progress/100)*8}H0M0S</ActualWork>
|
|
185
185
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
186
|
-
<RegularWork>PT${
|
|
187
|
-
<RemainingDuration>PT${Math.round(
|
|
186
|
+
<RegularWork>PT${T*8}H0M0S</RegularWork>
|
|
187
|
+
<RemainingDuration>PT${Math.round(T*(100-g.progress)/100)*8}H0M0S</RemainingDuration>
|
|
188
188
|
<RemainingCost>0</RemainingCost>
|
|
189
|
-
<RemainingWork>PT${Math.round(
|
|
189
|
+
<RemainingWork>PT${Math.round(T*(100-g.progress)/100)*8}H0M0S</RemainingWork>
|
|
190
190
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
191
191
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
192
192
|
<ACWP>0</ACWP>
|
|
@@ -205,12 +205,12 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
205
205
|
<PhysicalPercentComplete>0</PhysicalPercentComplete>
|
|
206
206
|
<EarnedValueMethod>0</EarnedValueMethod>
|
|
207
207
|
<IsPublished>1</IsPublished>
|
|
208
|
-
<CommitmentType>0</CommitmentType>${
|
|
208
|
+
<CommitmentType>0</CommitmentType>${p}
|
|
209
209
|
</Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
210
210
|
<Project xmlns="http://schemas.microsoft.com/project">
|
|
211
211
|
<SaveVersion>14</SaveVersion>
|
|
212
|
-
<Name>${t.replace(/[<>&'"]/g,
|
|
213
|
-
<Title>${t.replace(/[<>&'"]/g,
|
|
212
|
+
<Name>${t.replace(/[<>&'"]/g,g=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[g]||g)}</Name>
|
|
213
|
+
<Title>${t.replace(/[<>&'"]/g,g=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[g]||g)}</Title>
|
|
214
214
|
<CreationDate>${s(new Date)}</CreationDate>
|
|
215
215
|
<LastSaved>${s(new Date)}</LastSaved>
|
|
216
216
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
@@ -353,9 +353,9 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
353
353
|
</Calendars>
|
|
354
354
|
<Tasks>${m}
|
|
355
355
|
</Tasks>
|
|
356
|
-
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=xe.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?xe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let b=t.find(w=>w.id===g);if(b){o(b);let w=r.get(g)?.ef||0;d=Math.max(d,w);}}let p=d+c;r.set(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(b=>b.dependencies&&b.dependencies.includes(i.id)),p=s;if(d.length>0)for(let b of d){l(b);let w=n.get(b.id)?.ls||0;p=Math.min(p,w);}let g=p-c;n.set(i.id,{ls:g,lf:p});};a.forEach(l);let m=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let p=d.ls-c.es;Math.abs(p)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=xe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(xe.calculateCriticalPath(e).includes(t))return 0;let o=xe.getDependentTasks(e,t);if(o.length===0){let l=xe.getLatestEndDate(e);if(!l)return null;let m=xe.calculateDuration(a.endDate,l);return Math.max(0,m)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,m)=>l-m)[0];if(!s)return null;let n=xe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>xe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=xe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=xe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=xe.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=xe.calculateEndDate(m,l),c=d=>d.map(p=>p.id===n.id?{...p,startDate:m,endDate:i}:p.subtasks?{...p,subtasks:c(p.subtasks)}:p);s=c(s),s=xe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,d=xe.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(g,b,w=new Set)=>{if(w.has(g))return;w.add(g);let f=xe.getDependentTasks(e,g);for(let y of f){if(!y.startDate||!y.endDate)continue;let h=r.findIndex(C=>C.id===y.id);if(h===-1)continue;let v=y.startDate.getTime(),D=(y.endDate.getTime()-v)/c,E=(v-i)/c*s,k=E+b*s,R=Math.max(D*s,s),I=l+h*n+12;m.push({taskId:y.id,taskName:y.name,originalX:E,previewX:k,width:R,y:I,rowIndex:h,daysDelta:b,color:y.color}),p(y.id,b,w);}};return p(t,a),m},splitTask:(e,t,a,r=3)=>{let o=xe.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 l=new Date(o.endDate);l.setDate(l.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function xs({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:p,onTaskDateChange:g,onDependencyCreate:b,onDependencyDelete:w}){let y=Xr(),[h,v]=useState([]),[T,D]=useState(null),N=useCallback(L=>{D(L);},[]),E=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),k=r==="day"?60:r==="week"?20:8,R=E*k*n,I=L=>{let U=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),S=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-S);let K=new Date(Date.UTC(U.getUTCFullYear(),0,1));return Math.ceil(((U.getTime()-K.getTime())/864e5+1)/7)},C=L=>{let U=L.getDay();return U===0||U===6},W=useCallback(L=>{let U=Math.round(L/(k*n)),S=new Date(o);return S.setDate(S.getDate()+U),S},[o,k,n]),H=useCallback((L,U)=>{if(U.startDate&&U.endDate)return;let S=L.currentTarget.ownerSVGElement;if(!S)return;let K=S.createSVGPoint();K.x=L.clientX,K.y=L.clientY;let J=K.matrixTransform(S.getScreenCTM()?.inverse()),ie=W(J.x),ue=new Date(ie);ue.setDate(ue.getDate()+1),g?.(U,ie,ue);},[W,g]),x=useMemo(()=>{let L=J=>J.map(ie=>{if(ie.subtasks&&ie.subtasks.length>0){let ue=L(ie.subtasks),ye=ue.filter(Oe=>Oe.startDate&&Oe.endDate);if(ye.length>0){let Oe=ye.map(rt=>rt.startDate.getTime()),Q=ye.map(rt=>rt.endDate.getTime()),Je=new Date(Math.min(...Oe)),Pe=new Date(Math.max(...Q));return {...ie,subtasks:ue,startDate:Je,endDate:Pe}}return {...ie,subtasks:ue}}return ie}),U=(J,ie=[])=>{for(let ue of J)ie.push(ue),ue.subtasks&&ue.subtasks.length>0&&(ue.isExpanded===void 0||ue.isExpanded)&&U(ue.subtasks,ie);return ie},S=L(e);return U(S)},[e]),te=useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let U=L.startDate.getTime(),S=L.endDate.getTime(),K=o.getTime(),J=(U-K)/(1e3*60*60*24),ie=(S-U)/(1e3*60*60*24),ue=J*k*n,ye=Math.max(k*n,40),Oe=Math.max(ie*k*n,ye);return {x:ue,width:Oe}},[o,k,n]),oe=useMemo(()=>x.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:U,width:S}=te(L),J=x.findIndex(ie=>ie.id===L.id)*a+12;return {id:L.id,x:U,y:J,width:S,height:32}}),[x,te]),ne=useCallback((L,U,S)=>{if(!S||U===0){v([]);return}let K=xe.calculateCascadePreview(e,L,U,x,o,k*n,a,48);v(K);},[e,x,o,k,n,a,48]),A=useMemo(()=>{let L=[],U=new Date(o);for(;U<=s;){let J=(U.getTime()-o.getTime())/864e5*k*n;if(r==="day")L.push({date:new Date(U),label:U.toLocaleDateString(l,{day:"numeric",month:"short"}),x:J}),U.setDate(U.getDate()+1);else if(r==="week"){let ie=I(U);L.push({date:new Date(U),label:`${y.labels.week} ${ie}`,x:J}),U.setDate(U.getDate()+7);}else L.push({date:new Date(U),label:U.toLocaleDateString(l,{month:"short",year:"numeric"}),x:J}),U.setMonth(U.getMonth()+1);}return L},[o,s,r,k,n,l,y.labels.week]),ke=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*k*n,[o,k,n]),Ie=Math.max(x.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[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:jsxs("svg",{width:Math.max(R,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(R,1e3),height:48,fill:t.bgGrid}),A.map((L,U)=>jsxs("g",{children:[U>0&&jsx("line",{x1:L.x,y1:0,x2:L.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:L.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:L.label})]},`header-${U}`)),ke>=0&&ke<=R&&jsx("circle",{cx:ke,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(R,1e3),height:Ie,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsx("rect",{x:0,y:0,width:Math.max(R,1e3),height:Ie,fill:t.bgPrimary}),A.map((L,U)=>{let S=A[U+1]?.x||R,K=C(L.date);return jsxs("g",{children:[K&&jsx("rect",{x:L.x,y:0,width:S-L.x,height:x.length*a,fill:t.bgWeekend,opacity:1}),U>0&&jsx("line",{x1:L.x,y1:0,x2:L.x,y2:x.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},U)}),x.map((L,U)=>{let S=L.startDate&&L.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:U*a,width:R,height:a,fill:U%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!S&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:U*a,width:R,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>H(K,L),onMouseEnter:K=>{K.currentTarget.setAttribute("fill",t.accentLight),K.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:K=>{K.currentTarget.setAttribute("fill","transparent"),K.currentTarget.setAttribute("opacity","1");}},`clickable-${L.id}`),jsx("text",{x:ke>0?ke:100,y:U*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:y.labels.clickToSetDates},`placeholder-${L.id}`)]})]},`row-group-${L.id}`)}),x.map((L,U)=>{if(!L.startDate||!L.endDate)return null;let{x:S,width:K}=te(L),J=U*a+12,ie=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsx(ys,{task:L,x:S+K/2,y:J+16,theme:t,onClick:c},L.id):ie?jsxs("g",{onClick:()=>c?.(L),onContextMenu:ue=>{ue.preventDefault(),ue.stopPropagation(),p?.(L,ue);},style:{cursor:"default"},children:[jsx("rect",{x:S,y:J,width:K,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:S,y1:J,x2:S+K,y2:J,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:S,y1:J,x2:S,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:S+K,y1:J,x2:S+K,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:S,y1:J+32,x2:S+K,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),K>60&&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:L.name})]},L.id):jsx(gs,{task:L,x:S,y:J,width:K,theme:t,dayWidth:k*n,startDate:o,templates:m,onClick:c,onDoubleClick:d,onContextMenu:p,onDateChange:g,onDependencyCreate:b,allTaskPositions:oe,onDragMove:ne,onHoverChange:N},L.id)}),x.map((L,U)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(S=>{let K=x.find(Pe=>Pe.id===S);if(!K||!K.startDate||!K.endDate)return null;let J=x.findIndex(Pe=>Pe.id===S),ie=te(K),ue=te(L),ye=ie.x+ie.width,Oe=J*a+28,Q=ue.x,Je=U*a+28;return jsx(bs,{x1:ye,y1:Oe,x2:Q,y2:Je,theme:t,lineStyle:i,onDelete:()=>w?.(L.id,S)},`dep-${S}-${L.id}`)})),h.map(L=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:L.previewX,y:L.y-48,width:L.width,height:32,rx:8,fill:L.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(L.daysDelta)>0&&jsx("text",{x:L.previewX+L.width/2,y:L.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:L.daysDelta>0?`+${L.daysDelta}d`:`${L.daysDelta}d`})]},`cascade-preview-${L.taskId}`)),ke>=0&&ke<=R&&jsx("line",{x1:ke,y1:0,x2:ke,y2:Ie,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),T&&jsx(Mm,{tooltipData:T,theme:t,locale:l==="es"?"es":"en"})]})]})}var sy=['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"'],Im=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("circle",{cx:"12",cy:"12",r:"4"})]}),iy=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),ly=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),dy=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),cy=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(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 ks({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:m}){let[i,c]=useState(false),[d,p]=useState(false),[g,b]=useState([]),[w,f]=useState(""),[y,h]=useState(false),[v,T]=useState(true),D=useRef(null),N=useRef(null),E=useRef(null),{enabled:k=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:C,suggestions:W=sy,maxHistory:H=50,persistHistory:x}=a,te=x?.storageKey||"gantt-ai-history",oe=x?.maxMessages??5;useEffect(()=>{if(x?.enabled)try{let U=localStorage.getItem(te);if(U){let K=JSON.parse(U).map(J=>({...J,timestamp:new Date(J.timestamp)}));b(K.slice(-oe));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[x?.enabled,te,oe]),useEffect(()=>{if(x?.enabled&&g.length>0)try{let U=g.filter(S=>!S.isLoading).slice(-oe);localStorage.setItem(te,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,x?.enabled,te,oe]),useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[i,d]);let ne=useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&m?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,m]),A=useCallback(async U=>{if(!U.trim()||y)return;let S={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};b(J=>[...J.slice(-(H-1)),S]),f(""),T(false),h(true);let K={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(J=>[...J,K]);try{if(C){let J=await C(U,e);b(ie=>{let ue=ie.filter(Oe=>!Oe.isLoading),ye={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...ue,ye]}),ne(J);}else b(J=>[...J.filter(ue=>!ue.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){b(ie=>[...ie.filter(ye=>!ye.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);}},[y,H,C,e,ne]),ke=U=>{U.preventDefault(),A(w);},Ie=U=>{f(U),D.current?.focus();};if(useEffect(()=>{let U=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(K=>!K),i||p(false)),S.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=K=>{let J=K.target;E.current&&!E.current.contains(J)&&c(false);},S=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",U);}},[i]),!k)return null;let L={"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 jsxs(yt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(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 ${L[I]} 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:[jsx(Im,{}),jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),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"})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:E,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${L[I]} 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:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsx(Im,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(dy,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(ly,{})})]})]}),jsx(AnimatePresence,{children:!d&&jsxs(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:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&v&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((U,S)=>jsx("button",{onClick:()=>Ie(U),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:U.length>30?U.slice(0,30)+"...":U},S))})]}),g.map(U=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:U.role==="user"?"white":t.textPrimary},children:[U.isLoading?jsx(cy,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:U.command.success?"#10B981":"#EF4444"},children:[U.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsx("div",{ref:N})]}),jsxs("form",{onSubmit:ke,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:D,type:"text",value:w,onChange:U=>f(U.target.value),placeholder:R,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!w.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsx(iy,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Bm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,c=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:p};if(!c)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),m=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function Rm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=l?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&m&&n.key==="y"){n.preventDefault(),t();return}if(l&&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 gy={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${xe.formatDate(e.startDate)} - ${xe.formatDate(e.endDate)}`);let a=xe.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=>xe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Om(e){return {...gy,...e}}var wy=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Um=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:p=true,persistExpandedState:g,persistFilter:b,aiAssistant:w,locale:f="en",customTranslations:y,showCreateTaskButton:h=false,createTaskLabel:v,onCreateTask:T,taskFilter:D,onTaskFilterChange:N,onThemeChange:E,onTaskClick:k,onTaskDblClick:R,onTaskContextMenu:I,onTaskUpdate:C,onProgressChange:W,onTaskEdit:H,onTaskAddSubtask:x,onTaskMarkIncomplete:te,onTaskSetInProgress:oe,onDependencyCreate:ne,onDependencyDelete:A,onBeforeTaskAdd:ke,onAfterTaskAdd:Ie,onBeforeTaskUpdate:L,onAfterTaskUpdate:U,onBeforeTaskDelete:S,onAfterTaskDelete:K}=a,ie=useContext(ns)?.theme,[ue,ye]=useState(ie||s||"dark"),[Oe,Q]=useState(n),[Je,Pe]=useState(l),[rt,ut]=useState(1),It=useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Xe,pt]=useState(()=>{if(!b)return "all";try{let M=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(M);if(F){let _=JSON.parse(F);if(_.taskFilter)return _.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),ce=D??Xe,Ge=N??pt,[Be,B]=useState(()=>{if(!b)return false;try{let M=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(M);if(F){let _=JSON.parse(F);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});useEffect(()=>{let M=It();if(M)try{let F={taskFilter:ce,hideCompleted:Be};localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[ce,Be,It]);let[X,ge]=useState(0),[Ae,Ue]=useState(false),[nt,Pt]=useState(null),[$e,O]=useState({isOpen:false,x:0,y:0,task:null}),[ae,Le]=useState(null),[je,qe]=useState(null);useEffect(()=>{ie&&ie!==ue&&ye(ie);},[ie]),useEffect(()=>{s&&s!==ue&&ye(s);},[s]);let j=useCallback(M=>{ye(M),E?.(M);},[E]),{state:$,setState:Me,undo:ht,redo:le,canUndo:He,canRedo:De,clearHistory:Re}=Bm(t,50),de=useCallback(()=>g?typeof g=="string"?g:"gantt-expanded-tasks":null,[g]),Ve=useRef(new Map),V=useRef(false);if(!V.current&&g){V.current=true;let M=typeof g=="string"?g:"gantt-expanded-tasks";try{let F=localStorage.getItem(M);if(F){let _=JSON.parse(F);Array.isArray(_)&&(Ve.current=new Map(_));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let q=useCallback(()=>{let M=de();if(M)try{let F=Array.from(Ve.current.entries());localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[de]);useEffect(()=>{let M=_=>{let ee=new Map;for(let pe of _){let we=pe.id;ee.get(we)||ee.set(we,pe);}return Array.from(ee.values())},F=_=>_.map(ee=>{let pe=Ve.current.get(ee.id),we=pe!==void 0?{...ee,isExpanded:pe}:ee;if(we.subtasks?.length){let Dt=M(we.subtasks);return {...we,subtasks:F(Dt)}}return we});if(Ve.current.size>0)Me(F(t));else {let _=ee=>ee.map(pe=>pe.subtasks?.length?{...pe,subtasks:M(_(pe.subtasks))}:pe);Me(_(t));}},[t,Me]);let Se=useRef(t),Ye=useRef(true);useEffect(()=>{if(Ye.current){Ye.current=false,Se.current=$;return}if(!r)return;let M=JSON.stringify(Se.current),F=JSON.stringify($);M!==F&&(Se.current=$,r($));},[$,r]);let ze=useMemo(()=>Zi(f,y),[f,y]),G=useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[me,_e]=useState(()=>G(ze));useEffect(()=>{_e(M=>M.map(F=>({...F,label:ze.columns[F.id==="name"?"taskName":F.id]||F.label})));},[ze]);let Tt=useMemo(()=>me.filter(F=>F.visible).reduce((F,_)=>F+_.width,0),[me]),gt=useRef(me.filter(M=>M.visible).map(M=>M.id).join(","));useEffect(()=>{let M=me.filter(ee=>ee.visible),F=M.map(ee=>ee.id).join(","),_=gt.current;if(F!==_){let ee=M.some(we=>we.id!=="name"),pe=_.includes(",");ee?!pe&&ee&&Pt(null):Pt(null),gt.current=F;}},[me]);let Sr=60,fr=.6,Ia=useMemo(()=>{let F=Tt+Sr,_=typeof window<"u"?window.innerWidth*fr:800,ee=Math.max(F,_);return nt!==null?Math.max(200,Math.min(nt,ee)):Math.max(200,F)},[nt,Tt]),Ba=useRef(null),fe=useRef(null),Nt=useRef(null),ot=useMemo(()=>sm(ue),[ue]),Or=useMemo(()=>({theme:ot,themeName:ue}),[ot,ue]),oo=useMemo(()=>Om(d),[d]),br=useMemo(()=>{if(!p)return $;let M=xe.calculateCriticalPath($),F=_=>_.map(ee=>({...ee,isCriticalPath:M.includes(ee.id),subtasks:ee.subtasks?F(ee.subtasks):void 0}));return F($)},[$,p]),P=useMemo(()=>{if(ce==="all"&&!Be)return br;let M=F=>{let _=[];for(let ee of F){let pe=ee.subtasks?.length?M(ee.subtasks):void 0,we=false;if(Be)we=ee.progress<100;else switch(ce){case "all":we=true;break;case "incomplete":we=ee.progress<100;break;case "in_progress":we=ee.progress>0&&ee.progress<100;break;case "completed":we=ee.progress===100;break}(we||pe&&pe.length>0)&&_.push({...ee,subtasks:pe});}return _};return M(br)},[br,ce,Be]),re=wy(Je);Rm({undo:ht,redo:le,canUndo:He,canRedo:De,enabled:true}),useImperativeHandle(o,()=>({getTask:M=>xe.findTaskById($,M),addTask:(M,F)=>{Me(_=>{if(!F)return [..._,{...M,level:0}];let ee=pe=>pe.map(we=>we.id===F?{...we,subtasks:[...we.subtasks||[],{...M,parentId:F,level:(we.level||0)+1}],isExpanded:true}:we.subtasks?{...we,subtasks:ee(we.subtasks)}:we);return ee(_)});},updateTask:(M,F)=>{Me(_=>{let ee=pe=>pe.map(we=>we.id===M?{...we,...F}:we.subtasks?{...we,subtasks:ee(we.subtasks)}:we);return ee(_)});},deleteTask:M=>{Me(F=>{let _=ee=>ee.filter(pe=>pe.id===M?false:(pe.subtasks&&(pe.subtasks=_(pe.subtasks)),true));return _(F)});},deleteTasks:M=>{Me(F=>dl(F,M));},duplicateTask:M=>{Me(F=>cl(F,[M]));},splitTask:(M,F,_=3)=>{Me(ee=>xe.splitTask(ee,M,F,_));},calculateEndDate:xe.calculateEndDate,calculateDuration:xe.calculateDuration,validateDependency:(M,F)=>!xe.validateDependencies($,M,F),getAllTasks:()=>xe.flattenTasks($),getTasksByStatus:M=>xe.flattenTasks($).filter(F=>F.status===M),getTasksByParent:M=>M?xe.findTaskById($,M)?.subtasks||[]:$.filter(_=>!_.parentId),getCriticalPath:()=>xe.flattenTasks($).filter(M=>M.isCriticalPath),indentTask:M=>{Me(F=>sl(F,[M]));},outdentTask:M=>{Me(F=>il(F,[M]));},moveTask:(M,F)=>{Me(_=>ll(_,[M],F));},createSubtask:async M=>{let{tasks:F,newTask:_}=pl($,M);if(ke){let ee=ke({..._,parentId:M});if((ee instanceof Promise?await ee:ee)===false)return}Me(F),Ie&&Ie({..._,parentId:M});},scrollToTask:M=>{let _=xe.flattenTasks($).findIndex(ee=>ee.id===M);if(_!==-1&&Ba.current){let ee=_*re;Ba.current.scrollTo({top:ee,behavior:"smooth"}),fe.current&&fe.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(M,F=2e3)=>{},expandTask:M=>{Me(F=>{let _=ee=>ee.map(pe=>pe.id===M?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(F)});},collapseTask:M=>{Me(F=>{let _=ee=>ee.map(pe=>pe.id===M?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(F)});},expandAll:()=>{Me(M=>{let F=_=>_.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?F(ee.subtasks):void 0}));return F(M)});},collapseAll:()=>{Me(M=>{let F=_=>_.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?F(ee.subtasks):void 0}));return F(M)});},undo:ht,redo:le,canUndo:()=>He,canRedo:()=>De,clearHistory:Re,exportToPNG:async()=>{if(!Nt.current||!Ba.current||!fe.current)throw new Error("Gantt container not found");let M=Nt.current,F=Ba.current.querySelector(".gantt-grid-scroll"),_=fe.current,ee=F?.scrollTop||0,pe=_.scrollTop,we=M.style.overflow,Dt=M.style.height;try{let ft=F?.querySelector(".gantt-taskgrid-content"),_t=_.querySelector("svg"),Na=ft?.scrollHeight||F?.scrollHeight||600,Ea=_t?.getBoundingClientRect().height||_.scrollHeight,so=(M.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Na,Ea)+20;F&&(F.scrollTop=0),_.scrollTop=0,M.style.overflow="visible",M.style.height=`${so}px`,await new Promise(zr=>setTimeout(zr,100));let hr=await zm(M,{backgroundColor:ot.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:zr=>{let Po=window.getComputedStyle(zr),io=parseInt(Po.zIndex,10);return !isNaN(io)&&io>=50||Po.position==="fixed"}});return new Promise((zr,Po)=>{hr.toBlob(io=>{io?zr(io):Po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{M.style.overflow=we,M.style.height=Dt,F&&(F.scrollTop=ee),_.scrollTop=pe;}},exportToPDF:async M=>{await xe.exportToPDF($,M);},exportToExcel:async M=>{await xe.exportToExcel($,M);},exportToJSON:()=>xe.exportToJSON($),exportToCSV:()=>xe.exportToCSV($),importFromJSON:M=>{let F=xe.importFromJSON(M);Me(F);},getTasks:()=>$,refresh:()=>{Me(M=>[...M]);},clearAll:()=>{Me([]);}}),[$,ht,le,He,De,Re,ot,re]);let ve=useCallback(M=>{_e(F=>F.map(_=>_.id===M?{..._,visible:!_.visible}:_));},[]),Ze=useCallback((M,F)=>{_e(_=>_.map(ee=>{if(ee.id!==M)return ee;let pe=ee.minWidth??100,we=ee.maxWidth??800,Dt=Math.max(pe,Math.min(we,F));return {...ee,width:Dt}}));},[]),aa=useCallback(M=>{Me(F=>{let _=ul(F,M),ee=pe=>{for(let we of pe){if(we.id===M){Ve.current.set(M,we.isExpanded??true);return}we.subtasks?.length&&ee(we.subtasks);}};return ee(_),q(),_}),a.onTaskToggleExpand?.(M);},[a,q]),ia=useCallback((M,F)=>{if(L&&L(M,F)===false)return;let ee=xe.findTaskById($,M)?.progress,pe=Dt=>Dt.map(ft=>ft.id===M?{...ft,...F}:ft.subtasks?{...ft,subtasks:pe(ft.subtasks)}:ft);Me(pe($));let we=xe.findTaskById(pe($),M);we&&(C?.(we),U?.(we),F.progress!==void 0&&ee!==void 0&&F.progress!==ee&&W?.(M,ee,F.progress));},[$,C,L,U,W]),ra=useCallback(M=>{M.length!==0&&(Me(F=>sl(F,M)),a.onTaskIndent?.(M[0]));},[a]),rr=useCallback(M=>{M.length!==0&&(Me(F=>il(F,M)),a.onTaskOutdent?.(M[0]));},[a]),Ta=useCallback((M,F,_)=>{Me(ee=>wm(ee,M,F,_)),a.onTaskReparent?.(M,F,_);},[a]),Sa=useCallback((M,F)=>{M.length!==0&&(Me(_=>ll(_,M,F)),a.onTaskMove?.(M[0],F));},[a]),no=useCallback(async M=>{let F=[];for(let _ of M)S&&await Promise.resolve(S(_))===false||F.push(_);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(Me(_=>dl(_,F)),F.forEach(_=>a.onTaskDelete?.(_))),K&&F.forEach(_=>K(_)));},[a,S,K]),rg=useCallback(M=>{Me(F=>cl(F,M)),M.forEach(F=>a.onTaskDuplicate?.(F));},[a]),og=useCallback((M,F)=>{Me(_=>{let{tasks:ee,newTask:pe}=km(_,M,F);return ke&&ke(pe)===false?_:(a.onTaskCreate?.(pe.parentId,pe.position||0),Ie?.(pe),ee)});},[a,ke,Ie]),ng=useCallback((M,F)=>{Me(_=>ml(_,M,F)),a.onTaskRename?.(M,F);},[a]),_s=useCallback(M=>{Me(F=>{let{tasks:_}=pl(F,M);return a.onTaskCreate?.(M,0),_});},[a]),sg=useCallback((M,F,_)=>{let ee=M.startDate?Math.round((F.getTime()-M.startDate.getTime())/864e5):0,pe=ft=>ft.map(_t=>_t.id===M.id?{..._t,startDate:F,endDate:_,...M.segments&&{segments:M.segments}}:_t.subtasks?{..._t,subtasks:pe(_t.subtasks)}:_t),we=pe($);we=xe.autoScheduleDependents(we,M.id,ee),Me(we);let Dt={...M,startDate:F,endDate:_};C?.(Dt);},[$,C]),ig=useCallback((M,F)=>{I?.(M,F),O({isOpen:true,x:F.clientX,y:F.clientY,task:M});},[I]),lg=useCallback((M,F)=>{let _=xe.splitTask($,M.id,F);Me(_),O({isOpen:false,x:0,y:0,task:null});},[$]),yd=useCallback(M=>{let F=xe.findTaskById($,M.id)||M;R?.(F),H||Le(F);},[$,R,H]),vd=useCallback((M,F,_)=>{let ee=new Map,pe=Na=>{Na.forEach(Ea=>{Ea.dependencies&&ee.set(Ea.id,Ea.dependencies),Ea.subtasks&&pe(Ea.subtasks);});};pe(_);let we=ee.get(F)||[];ee.set(F,[...we,M]);let Dt=new Set,ft=new Set,_t=Na=>{if(!Dt.has(Na)){Dt.add(Na),ft.add(Na);let Ea=ee.get(Na)||[];for(let $r of Ea){if(!Dt.has($r)&&_t($r))return true;if(ft.has($r))return true}}return ft.delete(Na),false};return _t(F)},[]),xd=useCallback((M,F)=>{if(vd(M.id,F,$)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
356
|
+
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=xe.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?xe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let x=t.find(T=>T.id===f);if(x){o(x);let T=r.get(f)?.ef||0;d=Math.max(d,T);}}let g=d+c;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),g=s;if(d.length>0)for(let x of d){l(x);let T=n.get(x.id)?.ls||0;g=Math.min(g,T);}let f=g-c;n.set(i.id,{ls:f,lf:g});};a.forEach(l);let m=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let g=d.ls-c.es;Math.abs(g)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=xe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(xe.calculateCriticalPath(e).includes(t))return 0;let o=xe.getDependentTasks(e,t);if(o.length===0){let l=xe.getLatestEndDate(e);if(!l)return null;let m=xe.calculateDuration(a.endDate,l);return Math.max(0,m)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,m)=>l-m)[0];if(!s)return null;let n=xe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>xe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=xe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=xe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=xe.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=xe.calculateEndDate(m,l),c=d=>d.map(g=>g.id===n.id?{...g,startDate:m,endDate:i}:g.subtasks?{...g,subtasks:c(g.subtasks)}:g);s=c(s),s=xe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,d=xe.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(f,x,T=new Set)=>{if(T.has(f))return;T.add(f);let p=xe.getDependentTasks(e,f);for(let h of p){if(!h.startDate||!h.endDate)continue;let b=r.findIndex(C=>C.id===h.id);if(b===-1)continue;let y=h.startDate.getTime(),D=(h.endDate.getTime()-y)/c,E=(y-i)/c*s,k=E+x*s,R=Math.max(D*s,s),I=l+b*n+12;m.push({taskId:h.id,taskName:h.name,originalX:E,previewX:k,width:R,y:I,rowIndex:b,daysDelta:x,color:h.color}),g(h.id,x,T);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=xe.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 l=new Date(o.endDate);l.setDate(l.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Cs({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:g,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:T}){let h=Xr(),[b,y]=useState([]),[w,D]=useState(null),N=useCallback(L=>{D(L);},[]),E=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),k=r==="day"?60:r==="week"?20:8,R=E*k*n,I=L=>{let U=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),S=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-S);let K=new Date(Date.UTC(U.getUTCFullYear(),0,1));return Math.ceil(((U.getTime()-K.getTime())/864e5+1)/7)},C=L=>{let U=L.getDay();return U===0||U===6},W=useCallback(L=>{let U=Math.round(L/(k*n)),S=new Date(o);return S.setDate(S.getDate()+U),S},[o,k,n]),H=useCallback((L,U)=>{if(U.startDate&&U.endDate)return;let S=L.currentTarget.ownerSVGElement;if(!S)return;let K=S.createSVGPoint();K.x=L.clientX,K.y=L.clientY;let J=K.matrixTransform(S.getScreenCTM()?.inverse()),ie=W(J.x),ue=new Date(ie);ue.setDate(ue.getDate()+1),f?.(U,ie,ue);},[W,f]),v=useMemo(()=>{let L=J=>J.map(ie=>{if(ie.subtasks&&ie.subtasks.length>0){let ue=L(ie.subtasks),ye=ue.filter(Oe=>Oe.startDate&&Oe.endDate);if(ye.length>0){let Oe=ye.map(rt=>rt.startDate.getTime()),Q=ye.map(rt=>rt.endDate.getTime()),Je=new Date(Math.min(...Oe)),Pe=new Date(Math.max(...Q));return {...ie,subtasks:ue,startDate:Je,endDate:Pe}}return {...ie,subtasks:ue}}return ie}),U=(J,ie=[])=>{for(let ue of J)ie.push(ue),ue.subtasks&&ue.subtasks.length>0&&(ue.isExpanded===void 0||ue.isExpanded)&&U(ue.subtasks,ie);return ie},S=L(e);return U(S)},[e]),te=useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let U=L.startDate.getTime(),S=L.endDate.getTime(),K=o.getTime(),J=(U-K)/(1e3*60*60*24),ie=(S-U)/(1e3*60*60*24),ue=J*k*n,ye=Math.max(k*n,40),Oe=Math.max(ie*k*n,ye);return {x:ue,width:Oe}},[o,k,n]),oe=useMemo(()=>v.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:U,width:S}=te(L),J=v.findIndex(ie=>ie.id===L.id)*a+12;return {id:L.id,x:U,y:J,width:S,height:32}}),[v,te]),ne=useCallback((L,U,S)=>{if(!S||U===0){y([]);return}let K=xe.calculateCascadePreview(e,L,U,v,o,k*n,a,48);y(K);},[e,v,o,k,n,a,48]),A=useMemo(()=>{let L=[],U=new Date(o);for(;U<=s;){let J=(U.getTime()-o.getTime())/864e5*k*n;if(r==="day")L.push({date:new Date(U),label:U.toLocaleDateString(l,{day:"numeric",month:"short"}),x:J}),U.setDate(U.getDate()+1);else if(r==="week"){let ie=I(U);L.push({date:new Date(U),label:`${h.labels.week} ${ie}`,x:J}),U.setDate(U.getDate()+7);}else L.push({date:new Date(U),label:U.toLocaleDateString(l,{month:"short",year:"numeric"}),x:J}),U.setMonth(U.getMonth()+1);}return L},[o,s,r,k,n,l,h.labels.week]),ke=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*k*n,[o,k,n]),Ie=Math.max(v.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[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:jsxs("svg",{width:Math.max(R,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(R,1e3),height:48,fill:t.bgGrid}),A.map((L,U)=>jsxs("g",{children:[U>0&&jsx("line",{x1:L.x,y1:0,x2:L.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:L.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:L.label})]},`header-${U}`)),ke>=0&&ke<=R&&jsx("circle",{cx:ke,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(R,1e3),height:Ie,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsx("rect",{x:0,y:0,width:Math.max(R,1e3),height:Ie,fill:t.bgPrimary}),A.map((L,U)=>{let S=A[U+1]?.x||R,K=C(L.date);return jsxs("g",{children:[K&&jsx("rect",{x:L.x,y:0,width:S-L.x,height:v.length*a,fill:t.bgWeekend,opacity:1}),U>0&&jsx("line",{x1:L.x,y1:0,x2:L.x,y2:v.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},U)}),v.map((L,U)=>{let S=L.startDate&&L.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:U*a,width:R,height:a,fill:U%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!S&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:U*a,width:R,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>H(K,L),onMouseEnter:K=>{K.currentTarget.setAttribute("fill",t.accentLight),K.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:K=>{K.currentTarget.setAttribute("fill","transparent"),K.currentTarget.setAttribute("opacity","1");}},`clickable-${L.id}`),jsx("text",{x:ke>0?ke:100,y:U*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:h.labels.clickToSetDates},`placeholder-${L.id}`)]})]},`row-group-${L.id}`)}),v.map((L,U)=>{if(!L.startDate||!L.endDate)return null;let{x:S,width:K}=te(L),J=U*a+12,ie=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsx(ks,{task:L,x:S+K/2,y:J+16,theme:t,onClick:c},L.id):ie?jsxs("g",{onClick:()=>c?.(L),onContextMenu:ue=>{ue.preventDefault(),ue.stopPropagation(),g?.(L,ue);},style:{cursor:"default"},children:[jsx("rect",{x:S,y:J,width:K,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:S,y1:J,x2:S+K,y2:J,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:S,y1:J,x2:S,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:S+K,y1:J,x2:S+K,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:S,y1:J+32,x2:S+K,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),K>60&&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:L.name})]},L.id):jsx(hs,{task:L,x:S,y:J,width:K,theme:t,dayWidth:k*n,startDate:o,templates:m,onClick:c,onDoubleClick:d,onContextMenu:g,onDateChange:f,onDependencyCreate:x,allTaskPositions:oe,onDragMove:ne,onHoverChange:N},L.id)}),v.map((L,U)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(S=>{let K=v.find(Pe=>Pe.id===S);if(!K||!K.startDate||!K.endDate)return null;let J=v.findIndex(Pe=>Pe.id===S),ie=te(K),ue=te(L),ye=ie.x+ie.width,Oe=J*a+28,Q=ue.x,Je=U*a+28;return jsx(vs,{x1:ye,y1:Oe,x2:Q,y2:Je,theme:t,lineStyle:i,onDelete:()=>T?.(L.id,S)},`dep-${S}-${L.id}`)})),b.map(L=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:L.previewX,y:L.y-48,width:L.width,height:32,rx:8,fill:L.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(L.daysDelta)>0&&jsx("text",{x:L.previewX+L.width/2,y:L.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:L.daysDelta>0?`+${L.daysDelta}d`:`${L.daysDelta}d`})]},`cascade-preview-${L.taskId}`)),ke>=0&&ke<=R&&jsx("line",{x1:ke,y1:0,x2:ke,y2:Ie,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),w&&jsx(Rm,{tooltipData:w,theme:t,locale:l==="es"?"es":"en"})]})]})}var fy=['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"'],Um=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("circle",{cx:"12",cy:"12",r:"4"})]}),by=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),hy=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),yy=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),vy=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(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 Ts({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:m}){let[i,c]=useState(false),[d,g]=useState(false),[f,x]=useState([]),[T,p]=useState(""),[h,b]=useState(false),[y,w]=useState(true),D=useRef(null),N=useRef(null),E=useRef(null),{enabled:k=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:C,suggestions:W=fy,maxHistory:H=50,persistHistory:v}=a,te=v?.storageKey||"gantt-ai-history",oe=v?.maxMessages??5;useEffect(()=>{if(v?.enabled)try{let U=localStorage.getItem(te);if(U){let K=JSON.parse(U).map(J=>({...J,timestamp:new Date(J.timestamp)}));x(K.slice(-oe));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[v?.enabled,te,oe]),useEffect(()=>{if(v?.enabled&&f.length>0)try{let U=f.filter(S=>!S.isLoading).slice(-oe);localStorage.setItem(te,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[f,v?.enabled,te,oe]),useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[f]),useEffect(()=>{i&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[i,d]);let ne=useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&m?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,m]),A=useCallback(async U=>{if(!U.trim()||h)return;let S={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};x(J=>[...J.slice(-(H-1)),S]),p(""),w(false),b(true);let K={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(J=>[...J,K]);try{if(C){let J=await C(U,e);x(ie=>{let ue=ie.filter(Oe=>!Oe.isLoading),ye={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...ue,ye]}),ne(J);}else x(J=>[...J.filter(ue=>!ue.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){x(ie=>[...ie.filter(ye=>!ye.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[h,H,C,e,ne]),ke=U=>{U.preventDefault(),A(T);},Ie=U=>{p(U),D.current?.focus();};if(useEffect(()=>{let U=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(K=>!K),i||g(false)),S.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=K=>{let J=K.target;E.current&&!E.current.contains(J)&&c(false);},S=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",U);}},[i]),!k)return null;let L={"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 jsxs(yt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(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 ${L[I]} 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:[jsx(Um,{}),jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),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"})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:E,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${L[I]} 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:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsx(Um,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>g(U=>!U),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(yy,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(hy,{})})]})]}),jsx(AnimatePresence,{children:!d&&jsxs(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:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[f.length===0&&y&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((U,S)=>jsx("button",{onClick:()=>Ie(U),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:U.length>30?U.slice(0,30)+"...":U},S))})]}),f.map(U=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:U.role==="user"?"white":t.textPrimary},children:[U.isLoading?jsx(vy,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:U.command.success?"#10B981":"#EF4444"},children:[U.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsx("div",{ref:N})]}),jsxs("form",{onSubmit:ke,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:D,type:"text",value:T,onChange:U=>p(U.target.value),placeholder:R,disabled:h,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!T.trim()||h,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:T.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:T.trim()?"white":t.textSecondary},children:jsx(by,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Hm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,c=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!c)return {...d,present:g};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:g,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),m=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function Wm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=l?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&m&&n.key==="y"){n.preventDefault(),t();return}if(l&&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 Cy={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${xe.formatDate(e.startDate)} - ${xe.formatDate(e.endDate)}`);let a=xe.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=>xe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Gm(e){return {...Cy,...e}}var Fy=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},jm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:f,persistFilter:x,aiAssistant:T,locale:p="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:w,taskFilter:D,onTaskFilterChange:N,onThemeChange:E,onTaskClick:k,onTaskDblClick:R,onTaskContextMenu:I,onTaskUpdate:C,onProgressChange:W,onTaskEdit:H,onTaskAddSubtask:v,onTaskMarkIncomplete:te,onTaskSetInProgress:oe,onDependencyCreate:ne,onDependencyDelete:A,onBeforeTaskAdd:ke,onAfterTaskAdd:Ie,onBeforeTaskUpdate:L,onAfterTaskUpdate:U,onBeforeTaskDelete:S,onAfterTaskDelete:K}=a,ie=useContext(ls)?.theme,[ue,ye]=useState(ie||s||"dark"),[Oe,Q]=useState(n),[Je,Pe]=useState(l),[rt,ut]=useState(1),It=useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Xe,pt]=useState(()=>{if(!x)return "all";try{let M=typeof x=="string"?x:"gantt-filter-state",F=localStorage.getItem(M);if(F){let _=JSON.parse(F);if(_.taskFilter)return _.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),ce=D??Xe,Ge=N??pt,[Be,B]=useState(()=>{if(!x)return false;try{let M=typeof x=="string"?x:"gantt-filter-state",F=localStorage.getItem(M);if(F){let _=JSON.parse(F);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});useEffect(()=>{let M=It();if(M)try{let F={taskFilter:ce,hideCompleted:Be};localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[ce,Be,It]);let[X,ge]=useState(0),[Ae,Ue]=useState(false),[nt,Pt]=useState(null),[$e,O]=useState({isOpen:false,x:0,y:0,task:null}),[ae,Le]=useState(null),[je,qe]=useState(null);useEffect(()=>{ie&&ie!==ue&&ye(ie);},[ie]),useEffect(()=>{s&&s!==ue&&ye(s);},[s]);let j=useCallback(M=>{ye(M),E?.(M);},[E]),{state:$,setState:Me,undo:ht,redo:le,canUndo:He,canRedo:De,clearHistory:Re}=Hm(t,50),de=useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),Ve=useRef(new Map),V=useRef(false);if(!V.current&&f){V.current=true;let M=typeof f=="string"?f:"gantt-expanded-tasks";try{let F=localStorage.getItem(M);if(F){let _=JSON.parse(F);Array.isArray(_)&&(Ve.current=new Map(_));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let q=useCallback(()=>{let M=de();if(M)try{let F=Array.from(Ve.current.entries());localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[de]);useEffect(()=>{let M=_=>{let ee=new Map;for(let pe of _){let we=pe.id;ee.get(we)||ee.set(we,pe);}return Array.from(ee.values())},F=_=>_.map(ee=>{let pe=Ve.current.get(ee.id),we=pe!==void 0?{...ee,isExpanded:pe}:ee;if(we.subtasks?.length){let Dt=M(we.subtasks);return {...we,subtasks:F(Dt)}}return we});if(Ve.current.size>0)Me(F(t));else {let _=ee=>ee.map(pe=>pe.subtasks?.length?{...pe,subtasks:M(_(pe.subtasks))}:pe);Me(_(t));}},[t,Me]);let Se=useRef(t),Ye=useRef(true);useEffect(()=>{if(Ye.current){Ye.current=false,Se.current=$;return}if(!r)return;let M=JSON.stringify(Se.current),F=JSON.stringify($);M!==F&&(Se.current=$,r($));},[$,r]);let ze=useMemo(()=>al(p,h),[p,h]),G=useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[me,_e]=useState(()=>G(ze));useEffect(()=>{_e(M=>M.map(F=>({...F,label:ze.columns[F.id==="name"?"taskName":F.id]||F.label})));},[ze]);let Tt=useMemo(()=>me.filter(F=>F.visible).reduce((F,_)=>F+_.width,0),[me]),gt=useRef(me.filter(M=>M.visible).map(M=>M.id).join(","));useEffect(()=>{let M=me.filter(ee=>ee.visible),F=M.map(ee=>ee.id).join(","),_=gt.current;if(F!==_){let ee=M.some(we=>we.id!=="name"),pe=_.includes(",");ee?!pe&&ee&&Pt(null):Pt(null),gt.current=F;}},[me]);let Sr=60,br=.6,Ba=useMemo(()=>{let F=Tt+Sr,_=typeof window<"u"?window.innerWidth*br:800,ee=Math.max(F,_);return nt!==null?Math.max(200,Math.min(nt,ee)):Math.max(200,F)},[nt,Tt]),Ra=useRef(null),fe=useRef(null),Nt=useRef(null),ot=useMemo(()=>um(ue),[ue]),Or=useMemo(()=>({theme:ot,themeName:ue}),[ot,ue]),oo=useMemo(()=>Gm(d),[d]),hr=useMemo(()=>{if(!g)return $;let M=xe.calculateCriticalPath($),F=_=>_.map(ee=>({...ee,isCriticalPath:M.includes(ee.id),subtasks:ee.subtasks?F(ee.subtasks):void 0}));return F($)},[$,g]),P=useMemo(()=>{if(ce==="all"&&!Be)return hr;let M=F=>{let _=[];for(let ee of F){let pe=ee.subtasks?.length?M(ee.subtasks):void 0,we=false;if(Be)we=ee.progress<100;else switch(ce){case "all":we=true;break;case "incomplete":we=ee.progress<100;break;case "in_progress":we=ee.progress>0&&ee.progress<100;break;case "completed":we=ee.progress===100;break}(we||pe&&pe.length>0)&&_.push({...ee,subtasks:pe});}return _};return M(hr)},[hr,ce,Be]),re=Fy(Je);Wm({undo:ht,redo:le,canUndo:He,canRedo:De,enabled:true}),useImperativeHandle(o,()=>({getTask:M=>xe.findTaskById($,M),addTask:(M,F)=>{Me(_=>{if(!F)return [..._,{...M,level:0}];let ee=pe=>pe.map(we=>we.id===F?{...we,subtasks:[...we.subtasks||[],{...M,parentId:F,level:(we.level||0)+1}],isExpanded:true}:we.subtasks?{...we,subtasks:ee(we.subtasks)}:we);return ee(_)});},updateTask:(M,F)=>{Me(_=>{let ee=pe=>pe.map(we=>we.id===M?{...we,...F}:we.subtasks?{...we,subtasks:ee(we.subtasks)}:we);return ee(_)});},deleteTask:M=>{Me(F=>{let _=ee=>ee.filter(pe=>pe.id===M?false:(pe.subtasks&&(pe.subtasks=_(pe.subtasks)),true));return _(F)});},deleteTasks:M=>{Me(F=>pl(F,M));},duplicateTask:M=>{Me(F=>gl(F,[M]));},splitTask:(M,F,_=3)=>{Me(ee=>xe.splitTask(ee,M,F,_));},calculateEndDate:xe.calculateEndDate,calculateDuration:xe.calculateDuration,validateDependency:(M,F)=>!xe.validateDependencies($,M,F),getAllTasks:()=>xe.flattenTasks($),getTasksByStatus:M=>xe.flattenTasks($).filter(F=>F.status===M),getTasksByParent:M=>M?xe.findTaskById($,M)?.subtasks||[]:$.filter(_=>!_.parentId),getCriticalPath:()=>xe.flattenTasks($).filter(M=>M.isCriticalPath),indentTask:M=>{Me(F=>cl(F,[M]));},outdentTask:M=>{Me(F=>ml(F,[M]));},moveTask:(M,F)=>{Me(_=>ul(_,[M],F));},createSubtask:async M=>{let{tasks:F,newTask:_}=hl($,M);if(ke){let ee=ke({..._,parentId:M});if((ee instanceof Promise?await ee:ee)===false)return}Me(F),Ie&&Ie({..._,parentId:M});},scrollToTask:M=>{let _=xe.flattenTasks($).findIndex(ee=>ee.id===M);if(_!==-1&&Ra.current){let ee=_*re;Ra.current.scrollTo({top:ee,behavior:"smooth"}),fe.current&&fe.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(M,F=2e3)=>{},expandTask:M=>{Me(F=>{let _=ee=>ee.map(pe=>pe.id===M?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(F)});},collapseTask:M=>{Me(F=>{let _=ee=>ee.map(pe=>pe.id===M?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(F)});},expandAll:()=>{Me(M=>{let F=_=>_.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?F(ee.subtasks):void 0}));return F(M)});},collapseAll:()=>{Me(M=>{let F=_=>_.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?F(ee.subtasks):void 0}));return F(M)});},undo:ht,redo:le,canUndo:()=>He,canRedo:()=>De,clearHistory:Re,exportToPNG:async()=>{if(!Nt.current||!Ra.current||!fe.current)throw new Error("Gantt container not found");let M=Nt.current,F=Ra.current.querySelector(".gantt-grid-scroll"),_=fe.current,ee=F?.scrollTop||0,pe=_.scrollTop,we=M.style.overflow,Dt=M.style.height;try{let ft=F?.querySelector(".gantt-taskgrid-content"),jt=_.querySelector("svg"),Na=ft?.scrollHeight||F?.scrollHeight||600,Ea=jt?.getBoundingClientRect().height||_.scrollHeight,so=(M.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Na,Ea)+20;F&&(F.scrollTop=0),_.scrollTop=0,M.style.overflow="visible",M.style.height=`${so}px`,await new Promise(zr=>setTimeout(zr,100));let yr=await _m(M,{backgroundColor:ot.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:zr=>{let Po=window.getComputedStyle(zr),io=parseInt(Po.zIndex,10);return !isNaN(io)&&io>=50||Po.position==="fixed"}});return new Promise((zr,Po)=>{yr.toBlob(io=>{io?zr(io):Po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{M.style.overflow=we,M.style.height=Dt,F&&(F.scrollTop=ee),_.scrollTop=pe;}},exportToPDF:async M=>{await xe.exportToPDF($,M);},exportToExcel:async M=>{await xe.exportToExcel($,M);},exportToJSON:()=>xe.exportToJSON($),exportToCSV:()=>xe.exportToCSV($),importFromJSON:M=>{let F=xe.importFromJSON(M);Me(F);},getTasks:()=>$,refresh:()=>{Me(M=>[...M]);},clearAll:()=>{Me([]);}}),[$,ht,le,He,De,Re,ot,re]);let ve=useCallback(M=>{_e(F=>F.map(_=>_.id===M?{..._,visible:!_.visible}:_));},[]),Ze=useCallback((M,F)=>{_e(_=>_.map(ee=>{if(ee.id!==M)return ee;let pe=ee.minWidth??100,we=ee.maxWidth??800,Dt=Math.max(pe,Math.min(we,F));return {...ee,width:Dt}}));},[]),ra=useCallback(M=>{Me(F=>{let _=bl(F,M),ee=pe=>{for(let we of pe){if(we.id===M){Ve.current.set(M,we.isExpanded??true);return}we.subtasks?.length&&ee(we.subtasks);}};return ee(_),q(),_}),a.onTaskToggleExpand?.(M);},[a,q]),la=useCallback((M,F)=>{if(L&&L(M,F)===false)return;let ee=xe.findTaskById($,M)?.progress,pe=Dt=>Dt.map(ft=>ft.id===M?{...ft,...F}:ft.subtasks?{...ft,subtasks:pe(ft.subtasks)}:ft);Me(pe($));let we=xe.findTaskById(pe($),M);we&&(C?.(we),U?.(we),F.progress!==void 0&&ee!==void 0&&F.progress!==ee&&W?.(M,ee,F.progress));},[$,C,L,U,W]),oa=useCallback(M=>{M.length!==0&&(Me(F=>cl(F,M)),a.onTaskIndent?.(M[0]));},[a]),or=useCallback(M=>{M.length!==0&&(Me(F=>ml(F,M)),a.onTaskOutdent?.(M[0]));},[a]),Ta=useCallback((M,F,_)=>{Me(ee=>Em(ee,M,F,_)),a.onTaskReparent?.(M,F,_);},[a]),Sa=useCallback((M,F)=>{M.length!==0&&(Me(_=>ul(_,M,F)),a.onTaskMove?.(M[0],F));},[a]),no=useCallback(async M=>{let F=[];for(let _ of M)S&&await Promise.resolve(S(_))===false||F.push(_);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(Me(_=>pl(_,F)),F.forEach(_=>a.onTaskDelete?.(_))),K&&F.forEach(_=>K(_)));},[a,S,K]),ug=useCallback(M=>{Me(F=>gl(F,M)),M.forEach(F=>a.onTaskDuplicate?.(F));},[a]),pg=useCallback((M,F)=>{Me(_=>{let{tasks:ee,newTask:pe}=Sm(_,M,F);return ke&&ke(pe)===false?_:(a.onTaskCreate?.(pe.parentId,pe.position||0),Ie?.(pe),ee)});},[a,ke,Ie]),gg=useCallback((M,F)=>{Me(_=>fl(_,M,F)),a.onTaskRename?.(M,F);},[a]),qs=useCallback(M=>{Me(F=>{let{tasks:_}=hl(F,M);return a.onTaskCreate?.(M,0),_});},[a]),fg=useCallback((M,F,_)=>{let ee=M.startDate?Math.round((F.getTime()-M.startDate.getTime())/864e5):0,pe=ft=>ft.map(jt=>jt.id===M.id?{...jt,startDate:F,endDate:_,...M.segments&&{segments:M.segments}}:jt.subtasks?{...jt,subtasks:pe(jt.subtasks)}:jt),we=pe($);we=xe.autoScheduleDependents(we,M.id,ee),Me(we);let Dt={...M,startDate:F,endDate:_};C?.(Dt);},[$,C]),bg=useCallback((M,F)=>{I?.(M,F),O({isOpen:true,x:F.clientX,y:F.clientY,task:M});},[I]),hg=useCallback((M,F)=>{let _=xe.splitTask($,M.id,F);Me(_),O({isOpen:false,x:0,y:0,task:null});},[$]),Td=useCallback(M=>{let F=xe.findTaskById($,M.id)||M;R?.(F),H||Le(F);},[$,R,H]),Nd=useCallback((M,F,_)=>{let ee=new Map,pe=Na=>{Na.forEach(Ea=>{Ea.dependencies&&ee.set(Ea.id,Ea.dependencies),Ea.subtasks&&pe(Ea.subtasks);});};pe(_);let we=ee.get(F)||[];ee.set(F,[...we,M]);let Dt=new Set,ft=new Set,jt=Na=>{if(!Dt.has(Na)){Dt.add(Na),ft.add(Na);let Ea=ee.get(Na)||[];for(let $r of Ea){if(!Dt.has($r)&&jt($r))return true;if(ft.has($r))return true}}return ft.delete(Na),false};return jt(F)},[]),Dd=useCallback((M,F)=>{if(Nd(M.id,F,$)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
357
357
|
|
|
358
|
-
Task dependencies must flow in one direction only.`);return}let _=ee=>ee.map(pe=>{if(pe.id===F){let we=pe.dependencies||[];if(!we.includes(M.id))return {...pe,dependencies:[...we,M.id]}}return pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe});Me(_($)),ne?.(M.id,F);},[$,ne,vd]),kd=useCallback((M,F)=>{let _=ee=>ee.map(pe=>{if(pe.id===M&&pe.dependencies){let we=pe.dependencies.filter(Dt=>Dt!==F);return {...pe,dependencies:we}}return pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe});Me(_($)),A?.(M,F);},[$,A]),{startDate:Mn,endDate:dg}=useMemo(()=>{let M=$.filter(we=>we.startDate&&we.endDate);if(M.length===0){let we=new Date,Dt=new Date(we);Dt.setDate(Dt.getDate()-30);let ft=new Date(we);return ft.setDate(ft.getDate()+60),{startDate:Dt,endDate:ft}}let F=M.flatMap(we=>[we.startDate,we.endDate]).filter(we=>we!==void 0),_=new Date(Math.min(...F.map(we=>we.getTime()))),ee=new Date(Math.max(...F.map(we=>we.getTime()))),pe=Oe==="day"?7:Oe==="week"?14:30;return _.setDate(_.getDate()-pe),ee.setDate(ee.getDate()+pe),{startDate:_,endDate:ee}},[$,Oe]),cg=useCallback(async()=>{if(!Nt.current||!Ba.current||!fe.current)return;await new Promise(so=>setTimeout(so,200));let M=Nt.current,F=Ba.current.querySelector(".gantt-grid-scroll"),_=fe.current,ee=F?.scrollTop||0,pe=F?.scrollLeft||0,we=_.scrollTop,Dt=_.scrollLeft,ft=M.style.overflow,_t=M.style.height,Na=F?.style.overflow||"",Ea=_.style.overflow,$r=M.style.width,Fn=_.style.width;try{let so=F?.querySelector(".gantt-taskgrid-content"),hr=_.querySelector("svg"),zr=hr?.getAttribute("height")?parseInt(hr.getAttribute("height"),10):hr?.getBoundingClientRect().height||0,Po=so?.scrollHeight||F?.scrollHeight||600,io=Math.max(zr,_.scrollHeight),Td=hr?.getAttribute("width")?parseInt(hr.getAttribute("width"),10):hr?.getBoundingClientRect().width||_.scrollWidth,yg=M.querySelector('[class*="h-12"]')?.offsetHeight||48,Ks=Math.max(Po,io,zr),Ys=yg+Ks+50,qs=(F?.offsetWidth||300)+Td+10;F&&(F.scrollTop=0,F.scrollLeft=0),_.scrollTop=0,_.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Ys}px`,M.style.width=`${qs}px`,F&&(F.style.overflow="visible",F.style.height=`${Ks+50}px`),_.style.overflow="visible",_.style.height=`${Ks+50}px`,_.style.width=`${Td+10}px`,await new Promise(Js=>setTimeout(Js,150));let vg=await zm(M,{backgroundColor:ot.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:qs,height:Ys,windowWidth:qs+100,windowHeight:Ys+100,scrollX:0,scrollY:0,ignoreElements:Js=>{let Nd=window.getComputedStyle(Js),Dd=parseInt(Nd.zIndex,10);return !isNaN(Dd)&&Dd>=50||Nd.position==="fixed"}}),Xs=document.createElement("a");Xs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Xs.href=vg.toDataURL("image/png"),Xs.click();}finally{M.style.overflow=ft,M.style.height=_t,M.style.width=$r,F&&(F.style.overflow=Na,F.style.height="",F.scrollTop=ee,F.scrollLeft=pe),_.style.overflow=Ea,_.style.height="",_.style.width=Fn,_.scrollTop=we,_.scrollLeft=Dt;}},[ot]),mg=useCallback(async()=>{await xe.exportToPDF($);},[$]),ug=useCallback(async()=>{await xe.exportToExcel($);},[$]),pg=useCallback(()=>{let M=xe.exportToCSV($),F=new Blob([M],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[$]),gg=useCallback(()=>{let M=xe.exportToJSON($),F=new Blob([M],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[$]),fg=useCallback(()=>{xe.exportToMSProject($,"Gantt Project","project.xml");},[$]),bg=M=>{M.preventDefault(),Ue(true);},Eo=useRef(false),[js,wd]=useState(false),Xo=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let M=fe.current,F=Ba.current?.querySelector(".gantt-grid-scroll");if(!M||!F)return;let _=()=>{if(Eo.current)return;Eo.current=true;let ft=M.scrollTop;ge(ft),F.scrollTop=ft,requestAnimationFrame(()=>{Eo.current=false;});},ee=()=>{if(Eo.current)return;Eo.current=true;let ft=F.scrollTop;ge(ft),M.scrollTop=ft,requestAnimationFrame(()=>{Eo.current=false;});},pe=ft=>{if(Ae&&F){let Na=F.parentElement?.getBoundingClientRect()?.left||0,Ea=ft.clientX-Na,$r=200,Fn=Tt+Sr,so=window.innerWidth*fr,hr=Math.max(Fn,so);Ea>=$r&&Ea<=hr&&Pt(Ea);}if(js&&M){let _t=ft.clientX-Xo.current.x,Na=ft.clientY-Xo.current.y;M.scrollLeft=Xo.current.scrollLeft-_t,M.scrollTop=Xo.current.scrollTop-Na;}},we=()=>{Ue(false),wd(false);},Dt=ft=>{if(ft.button!==0)return;let _t=ft.target;_t.closest("[data-task-bar]")||_t.closest("[data-dependency-line]")||_t.closest("button")||_t.closest('[role="button"]')||_t.tagName==="rect"&&_t.getAttribute("data-clickable")==="true"||(wd(true),Xo.current={x:ft.clientX,y:ft.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},ft.preventDefault());};return M.addEventListener("scroll",_),F.addEventListener("scroll",ee),M.addEventListener("mousedown",Dt),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",we),()=>{M.removeEventListener("scroll",_),F.removeEventListener("scroll",ee),M.removeEventListener("mousedown",Dt),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",we);}},[Ae,js,Tt]);let Cd=useRef(false),hg=useRef(null);return useLayoutEffect(()=>{if(Cd.current||$.length===0||!fe.current)return;Cd.current=true,hg.current=Mn;let M=fe.current,F=new Date,_=Oe==="day"?60:Oe==="week"?20:8,ee=(F.getTime()-Mn.getTime())/(1e3*60*60*24),pe=M.clientWidth,Dt=ee*_*rt-pe/2;ee>=0&&pe>0&&(M.scrollLeft=Math.max(0,Dt));},[$.length,Mn,Oe,rt]),jsx(Wo.Provider,{value:ze,children:jsx(ai.Provider,{value:Or,children:jsxs("div",{ref:Nt,className:"flex flex-col h-full w-full",style:{backgroundColor:ot.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(ls,{theme:ot,timeScale:Oe,onTimeScaleChange:Q,zoom:rt,onZoomChange:ut,currentTheme:ue,onThemeChange:j,rowDensity:Je,onRowDensityChange:Pe,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:v,onCreateTask:T,taskFilter:ce,onTaskFilterChange:Ge,hideCompleted:Be,onHideCompletedChange:B,onExportPNG:i?cg:void 0,onExportPDF:i?mg:void 0,onExportExcel:i?ug:void 0,onExportCSV:i?pg:void 0,onExportJSON:i?gg:void 0,onExportMSProject:i?fg:void 0}),jsxs("div",{ref:Ba,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Ia,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(us,{tasks:P,theme:ot,rowHeight:re,availableUsers:c,templates:oo,onTaskClick:k,onTaskDblClick:yd,onTaskContextMenu:I,onTaskToggle:aa,scrollTop:X,columns:me,onToggleColumn:ve,onColumnResize:Ze,onTaskUpdate:ia,onTaskIndent:ra,onTaskOutdent:rr,onTaskMove:Sa,onMultiTaskDelete:no,onTaskDuplicate:rg,onTaskCreate:og,onTaskRename:ng,onCreateSubtask:_s,onOpenTaskModal:k?M=>k(M):void 0,onDeleteRequest:(M,F)=>qe({taskId:M,taskName:F}),onTaskReparent:Ta})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ot.border,zIndex:15},onMouseDown:bg}),jsx("div",{ref:fe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:js?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(xs,{tasks:P,theme:ot,rowHeight:re,timeScale:Oe,startDate:Mn,endDate:dg,zoom:rt,locale:f,templates:oo,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:k,onTaskDblClick:yd,onTaskContextMenu:ig,onTaskDateChange:sg,onDependencyCreate:xd,onDependencyDelete:kd})})]}),$e.task&&jsx(Go,{isOpen:$e.isOpen,x:$e.x,y:$e.y,theme:ot,onClose:()=>O({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=$e.task;if(!M)return [];let F=xe.findTaskById($,M.id)||M;return F.subtasks&&F.subtasks.length>0?[{id:"addSubtask",label:ze.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{x?x(F):_s(F.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ze.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{qe({taskId:F.id,taskName:F.name});}}]:[{id:"edit",label:ze.contextMenu?.editTask||"Edit Task",icon:Ht.Pencil,onClick:()=>{H?H(F):Le(F);}},{id:"addSubtask",label:ze.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{x?x(F):_s(F.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ze.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ht.MarkIncomplete,onClick:()=>{te?te(F):ia(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"},{id:"setInProgress",label:ze.contextMenu?.setInProgress||"Set In Progress",icon:Ht.SetInProgress,onClick:()=>{oe?oe(F):ia(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"},{id:"markComplete",label:ze.contextMenu?.markComplete||"Mark Complete",icon:Ht.MarkComplete,onClick:()=>{ia(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ze.contextMenu?.splitTask||"Split Task",icon:Ht.Split,onClick:()=>{if(!F.startDate||!F.endDate){console.warn("Cannot split task without dates");return}let ee=F.startDate.getTime(),pe=F.endDate.getTime(),we=ee+(pe-ee)/2,Dt=new Date(we);lg(F,Dt);},disabled:!F.startDate||!F.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ze.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{qe({taskId:F.id,taskName:F.name});}}]})()}),jsx(Mr,{task:ae,isOpen:!!ae,onClose:()=>Le(null),onTaskUpdate:M=>{ae&&(ia(ae.id,M),Le(null));},theme:ue==="light"?"light":"dark",locale:f==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsx(AnimatePresence,{children:je&&jsx(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:()=>qe(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ot.bgSecondary,border:`1px solid ${ot.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ot.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[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:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:ot.textPrimary,fontFamily:"Inter, sans-serif"},children:[ze.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:ot.textSecondary,fontFamily:"Inter, sans-serif"},children:f==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:ot.textSecondary,fontFamily:"Inter, sans-serif"},children:[f==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:ot.textPrimary},children:['"',je.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ot.bgPrimary,borderTop:`1px solid ${ot.border}`},children:[jsx("button",{onClick:()=>qe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ot.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=ot.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:f==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{no([je.taskId]),qe(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:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),f==="es"?"Eliminar":"Delete"]})]})]})})}),w?.enabled&&jsx(ks,{tasks:$,theme:ot,config:w,onTasksUpdate:Me,onTaskUpdate:ia,onTaskCreate:M=>{Me(F=>[...F,M]);},onTaskDelete:M=>{no([M]);},onDependencyCreate:(M,F)=>{let _=xe.findTaskById($,M);_&&xd(_,F);},onDependencyDelete:kd})]})})})});function Ly(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Iy(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),m=parseInt(a[2],10);return l*60+m}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10):null}var yl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],vl=[{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 Vm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:b}){let w=[...yl,...i.filter(B=>!yl.some(X=>X.id===B.id))],f=et[m]||et.dark,[y,h]=useState(false),[v,T]=useState(false),[D,N]=useState(false),[E,k]=useState(false),[R,I]=useState({top:0,left:0}),[C,W]=useState(null),[H,x]=useState(new Date),[te,oe]=useState({top:0,left:0}),[ne,A]=useState(false),[ke,Ie]=useState([]),[L,U]=useState(false),[S,K]=useState(""),J=useRef(null),ie=useRef(null),ue=useRef(null),ye=useRef(null),Oe=useRef(null),[Q,Je]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Pe,rt]=useState({});useEffect(()=>{a?(Je({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)&&A(true)):(Je({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),A(false),Ie([]));},[a,e]),useEffect(()=>{let B=X=>{J.current&&!J.current.contains(X.target)&&h(false),ie.current&&!ie.current.contains(X.target)&&T(false),ue.current&&!ue.current.contains(X.target)&&N(false),ye.current&&!ye.current.contains(X.target)&&k(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let ut=()=>{let B={};return Q.name.trim()||(B.name="El nombre es requerido"),Q.startDate&&Q.endDate&&Q.startDate>Q.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),rt(B),Object.keys(B).length===0},It=async B=>{if(B.preventDefault(),!!ut())try{let X=l==="create"&&ke.length>0?{...Q,pendingFiles:ke}:Q;await s(X),Ie([]),t();}catch(X){console.error("Error submitting task:",X);}},Xe=(B,X)=>{Je(ge=>{let Ae={...ge,[B]:X};if(B==="status"){let Ue=X;Ue==="todo"?Ae.progress=0:Ue==="in-progress"?(ge.progress===0||ge.progress===100)&&(Ae.progress=50):Ue==="completed"||Ue==="closed"?Ae.progress=100:(Ue==="in-review"||Ue==="review")&&(Ae.progress=75);}if(B==="progress"){let Ue=typeof X=="number"?X:parseInt(X,10);Ue===100&&ge.status!=="completed"?Ae.status="completed":Ue>0&&Ue<100&&ge.status==="todo"?Ae.status="in-progress":Ue===0&&ge.status!=="todo"&&(Ae.status="todo");}return Ae}),Pe[B]&&rt(ge=>{let Ae={...ge};return delete Ae[B],Ae});},pt=w.find(B=>B.id===Q.status)??yl[0],ce=vl.find(B=>B.id===Q.priority)??vl[1],Ge=go.find(B=>B.value===Q.color)??go[0],Be={backgroundColor:f.bgSecondary,border:`1px solid ${f.borderLight}`,color:f.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsx(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:jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:f.bgPrimary,border:`1px solid ${f.border}`},onClick:B=>B.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:pt.color||f.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:f.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=f.hoverBg,B.currentTarget.style.color=f.textPrimary;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:It,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:Q.name,onChange:B=>Xe("name",B.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:f.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Pe.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Pe.name]})]}),jsx("div",{children:jsx("textarea",{value:Q.description||"",onChange:B=>Xe("description",B.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:f.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:J,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&h(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Be,borderColor:pt.color,backgroundColor:`${pt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:pt.color}}),jsx("span",{style:{color:pt.color},children:pt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:pt.color}})]}),jsx(AnimatePresence,{children:y&&jsx(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:f.bgPrimary,border:`1px solid ${f.border}`},children:w.map(B=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("status",B.id),h(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,Q.status===B.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},B.id))})})]}),jsxs("div",{ref:ie,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&T(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ce.color}}),jsx("span",{children:ce.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:v&&jsx(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:f.bgPrimary,border:`1px solid ${f.border}`},children:vl.map(B=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("priority",B.id),T(false);},children:[jsx("span",{children:B.icon}),B.label,Q.priority===B.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},B.id))})})]}),o.length>0&&jsxs("div",{ref:ue,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[Q.assignees&&Q.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:Q.assignees.slice(0,3).map((B,X)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:B.color||f.accent,borderColor:f.bgSecondary},children:B.initials},X))}),Q.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",Q.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:D&&jsx(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:f.bgPrimary,border:`1px solid ${f.border}`},children:o.map(B=>{let X=Q.assignees?.some(ge=>ge.name===B.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ge=>ge.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ge=X?(Q.assignees||[]).filter(Ae=>Ae.name!==B.name):[...Q.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(Ae=>Ae[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Xe("assignees",ge);},children:[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:f.accent},children:B.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:B.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:X&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},B.id)})})})]}),jsxs("div",{ref:ye,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(E)k(false);else {if(ye.current){let B=ye.current.getBoundingClientRect(),X=window.innerHeight,ge=120,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;I({top:Ue,left:B.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Q.color}}),jsx("span",{children:Ge.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:E&&jsxs(yt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:f.bgPrimary,border:`1px solid ${f.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:B=>B.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:go.slice(0,18).map(B=>{let X=Q.color===B.value;return jsx("button",{type:"button",onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),Xe("color",B.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:B.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:B.value,outline:X?`2px solid ${B.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},B.value)})})})})]})})]}),c.length>0||d?jsx(Gr,{selectedTags:Q.tags||[],availableTags:c,onChange:B=>Xe("tags",B),onCreateTag:d,theme:f,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{ref:Oe,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!Q.isMilestone)if(C==="start")W(null);else {if(Oe.current){let B=Oe.current.getBoundingClientRect(),X=window.innerHeight,ge=320,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;oe({top:Ue,left:B.left});}W("start"),x(Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Be,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.startDate?Q.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!Q.isMilestone)if(C==="end")W(null);else {if(Oe.current){let B=Oe.current.getBoundingClientRect(),X=window.innerHeight,ge=320,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;oe({top:Ue,left:B.left});}W("end"),x(Q.endDate||Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Be,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.endDate?Q.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:C&&jsxs(yt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>W(null)}),jsxs(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:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:f.bgPrimary,border:`1px solid ${f.border}`},onClick:B=>B.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${f.border}`},children:[(()=>{let B=new Date,X=new Date(B);X.setDate(B.getDate()+1);let ge=new Date(B);ge.setDate(B.getDate()+7);let Ae=new Date(B);return Ae.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:X},{label:"Pr\xF3xima semana",date:ge},{label:"2 semanas",date:Ae}].map((nt,Pt)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:$e=>$e.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:$e=>$e.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(Xe("startDate",nt.date),(!Q.endDate||nt.date>Q.endDate)&&Xe("endDate",nt.date),W("end")):(Xe("endDate",nt.date),(!Q.startDate||nt.date<Q.startDate)&&Xe("startDate",nt.date),W(null));},children:nt.label},Pt))})(),jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:B=>B.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("startDate",void 0),Xe("endDate",void 0),W(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>x(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>x(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((B,X)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:B},X))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=H.getFullYear(),X=H.getMonth(),ge=new Date(B,X,1).getDay(),Ae=new Date(B,X+1,0).getDate(),Ue=new Date,nt=[];for(let $e=ge-1;$e>=0;$e--)nt.push({day:new Date(B,X,-$e).getDate(),date:new Date(B,X-1,new Date(B,X,-$e).getDate()),isCurrentMonth:false});for(let $e=1;$e<=Ae;$e++)nt.push({day:$e,date:new Date(B,X,$e),isCurrentMonth:true});let Pt=42-nt.length;for(let $e=1;$e<=Pt;$e++)nt.push({day:$e,date:new Date(B,X+1,$e),isCurrentMonth:false});return nt.map(($e,O)=>{let ae=$e.date.toDateString()===Ue.toDateString(),Le=Q.startDate?.toDateString()===$e.date.toDateString(),je=Q.endDate?.toDateString()===$e.date.toDateString(),qe=Q.startDate&&Q.endDate&&$e.date>=Q.startDate&&$e.date<=Q.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:$e.isCurrentMonth?Le||je?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Le?"#3B82F6":je?"#7C3AED":qe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ae&&!Le&&!je?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(Xe("startDate",$e.date),Q.endDate&&$e.date>Q.endDate&&Xe("endDate",$e.date),W("end")):(Xe("endDate",$e.date),Q.startDate&&$e.date<Q.startDate&&Xe("startDate",$e.date),W(null));},children:$e.day},O)})})()})]})]})]})})]}),Pe.endDate&&jsx("span",{className:"text-xs text-red-400",children:Pe.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:Q.progress,onChange:B=>Xe("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"}20`,color:Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"},children:[Q.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>A(!ne),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${ne?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:ne&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 2h 30m, 4h, 1d",value:Q.effortMinutes?Ly(Q.effortMinutes):"",onChange:B=>{let X=Iy(B.target.value);Xe("effortMinutes",X);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:'Formatos: "2h 30m", "4h", "1d" (1 d\xEDa = 8h)'})]}),(g||p.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children: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"})}),jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",l==="create"?ke.length>0&&`(${ke.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(wr,{cardId:"pending",attachments:ke.map((B,X)=>({id:`pending-${X}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>Ie(X=>[...X,...B]),onDelete:B=>{let X=parseInt(B.replace("pending-",""),10);Ie(ge=>ge.filter((Ae,Ue)=>Ue!==X));},maxSizeMB:10,maxFiles:20}):jsx(wr,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?B=>g(a.id,B):void 0,onDelete:b,maxSizeMB:10,maxFiles:20}),l==="create"&&ke.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[ke.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsx("input",{type:"checkbox",checked:Q.isMilestone,onChange:B=>Xe("isMilestone",B.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),Q.dependencies&&Q.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Q.dependencies.map(B=>{let X$1=r.find(ge=>ge.id===B);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[X$1?.name||B.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ge=(Q.dependencies||[]).filter(Ae=>Ae!==B);Xe("dependencies",ge);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},B)})}),jsxs("button",{type:"button",onClick:()=>{U(!L),K("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:L&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),K("");}}),jsxs(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:f.bgPrimary,border:`1px solid ${f.border}`},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsx("input",{type:"text",value:S,onChange:B=>K(B.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(B=>B.id!==a?.id).filter(B=>S===""||B.name.toLowerCase().includes(S.toLowerCase())).map(B=>{let X=Q.dependencies?.includes(B.id);return jsxs("button",{type:"button",onClick:()=>{let ge=Q.dependencies||[],Ae;X?Ae=ge.filter(Ue=>Ue!==B.id):Ae=[...ge,B.id],Xe("dependencies",Ae);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:X?`${f.accent}10`:"transparent"},onMouseEnter:ge=>{X||(ge.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ge=>{ge.currentTarget.style.backgroundColor=X?`${f.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:X?f.accent:"transparent",borderColor:X?f.accent:f.borderLight},children:X&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:B.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:B.id.slice(0,8)})]})]},B.id)}),r.filter(B=>B.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:f.textSecondary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),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:f.accent,color:"#FFF"},onMouseEnter:B=>!n&&(B.currentTarget.style.opacity="0.9"),onMouseLeave:B=>!n&&(B.currentTarget.style.opacity="1"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var _m=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
358
|
+
Task dependencies must flow in one direction only.`);return}let _=ee=>ee.map(pe=>{if(pe.id===F){let we=pe.dependencies||[];if(!we.includes(M.id))return {...pe,dependencies:[...we,M.id]}}return pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe});Me(_($)),ne?.(M.id,F);},[$,ne,Nd]),Sd=useCallback((M,F)=>{let _=ee=>ee.map(pe=>{if(pe.id===M&&pe.dependencies){let we=pe.dependencies.filter(Dt=>Dt!==F);return {...pe,dependencies:we}}return pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe});Me(_($)),A?.(M,F);},[$,A]),{startDate:Ln,endDate:yg}=useMemo(()=>{let M=$.filter(we=>we.startDate&&we.endDate);if(M.length===0){let we=new Date,Dt=new Date(we);Dt.setDate(Dt.getDate()-30);let ft=new Date(we);return ft.setDate(ft.getDate()+60),{startDate:Dt,endDate:ft}}let F=M.flatMap(we=>[we.startDate,we.endDate]).filter(we=>we!==void 0),_=new Date(Math.min(...F.map(we=>we.getTime()))),ee=new Date(Math.max(...F.map(we=>we.getTime()))),pe=Oe==="day"?7:Oe==="week"?14:30;return _.setDate(_.getDate()-pe),ee.setDate(ee.getDate()+pe),{startDate:_,endDate:ee}},[$,Oe]),vg=useCallback(async()=>{if(!Nt.current||!Ra.current||!fe.current)return;await new Promise(so=>setTimeout(so,200));let M=Nt.current,F=Ra.current.querySelector(".gantt-grid-scroll"),_=fe.current,ee=F?.scrollTop||0,pe=F?.scrollLeft||0,we=_.scrollTop,Dt=_.scrollLeft,ft=M.style.overflow,jt=M.style.height,Na=F?.style.overflow||"",Ea=_.style.overflow,$r=M.style.width,In=_.style.width;try{let so=F?.querySelector(".gantt-taskgrid-content"),yr=_.querySelector("svg"),zr=yr?.getAttribute("height")?parseInt(yr.getAttribute("height"),10):yr?.getBoundingClientRect().height||0,Po=so?.scrollHeight||F?.scrollHeight||600,io=Math.max(zr,_.scrollHeight),Md=yr?.getAttribute("width")?parseInt(yr.getAttribute("width"),10):yr?.getBoundingClientRect().width||_.scrollWidth,Sg=M.querySelector('[class*="h-12"]')?.offsetHeight||48,Js=Math.max(Po,io,zr),Zs=Sg+Js+50,Qs=(F?.offsetWidth||300)+Md+10;F&&(F.scrollTop=0,F.scrollLeft=0),_.scrollTop=0,_.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Zs}px`,M.style.width=`${Qs}px`,F&&(F.style.overflow="visible",F.style.height=`${Js+50}px`),_.style.overflow="visible",_.style.height=`${Js+50}px`,_.style.width=`${Md+10}px`,await new Promise(ti=>setTimeout(ti,150));let Eg=await _m(M,{backgroundColor:ot.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Qs,height:Zs,windowWidth:Qs+100,windowHeight:Zs+100,scrollX:0,scrollY:0,ignoreElements:ti=>{let Fd=window.getComputedStyle(ti),Ad=parseInt(Fd.zIndex,10);return !isNaN(Ad)&&Ad>=50||Fd.position==="fixed"}}),ei=document.createElement("a");ei.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ei.href=Eg.toDataURL("image/png"),ei.click();}finally{M.style.overflow=ft,M.style.height=jt,M.style.width=$r,F&&(F.style.overflow=Na,F.style.height="",F.scrollTop=ee,F.scrollLeft=pe),_.style.overflow=Ea,_.style.height="",_.style.width=In,_.scrollTop=we,_.scrollLeft=Dt;}},[ot]),xg=useCallback(async()=>{await xe.exportToPDF($);},[$]),kg=useCallback(async()=>{await xe.exportToExcel($);},[$]),wg=useCallback(()=>{let M=xe.exportToCSV($),F=new Blob([M],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[$]),Cg=useCallback(()=>{let M=xe.exportToJSON($),F=new Blob([M],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[$]),Tg=useCallback(()=>{xe.exportToMSProject($,"Gantt Project","project.xml");},[$]),Ng=M=>{M.preventDefault(),Ue(true);},Eo=useRef(false),[Xs,Ed]=useState(false),Jo=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let M=fe.current,F=Ra.current?.querySelector(".gantt-grid-scroll");if(!M||!F)return;let _=()=>{if(Eo.current)return;Eo.current=true;let ft=M.scrollTop;ge(ft),F.scrollTop=ft,requestAnimationFrame(()=>{Eo.current=false;});},ee=()=>{if(Eo.current)return;Eo.current=true;let ft=F.scrollTop;ge(ft),M.scrollTop=ft,requestAnimationFrame(()=>{Eo.current=false;});},pe=ft=>{if(Ae&&F){let Na=F.parentElement?.getBoundingClientRect()?.left||0,Ea=ft.clientX-Na,$r=200,In=Tt+Sr,so=window.innerWidth*br,yr=Math.max(In,so);Ea>=$r&&Ea<=yr&&Pt(Ea);}if(Xs&&M){let jt=ft.clientX-Jo.current.x,Na=ft.clientY-Jo.current.y;M.scrollLeft=Jo.current.scrollLeft-jt,M.scrollTop=Jo.current.scrollTop-Na;}},we=()=>{Ue(false),Ed(false);},Dt=ft=>{if(ft.button!==0)return;let jt=ft.target;jt.closest("[data-task-bar]")||jt.closest("[data-dependency-line]")||jt.closest("button")||jt.closest('[role="button"]')||jt.tagName==="rect"&&jt.getAttribute("data-clickable")==="true"||(Ed(true),Jo.current={x:ft.clientX,y:ft.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},ft.preventDefault());};return M.addEventListener("scroll",_),F.addEventListener("scroll",ee),M.addEventListener("mousedown",Dt),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",we),()=>{M.removeEventListener("scroll",_),F.removeEventListener("scroll",ee),M.removeEventListener("mousedown",Dt),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",we);}},[Ae,Xs,Tt]);let Pd=useRef(false),Dg=useRef(null);return useLayoutEffect(()=>{if(Pd.current||$.length===0||!fe.current)return;Pd.current=true,Dg.current=Ln;let M=fe.current,F=new Date,_=Oe==="day"?60:Oe==="week"?20:8,ee=(F.getTime()-Ln.getTime())/(1e3*60*60*24),pe=M.clientWidth,Dt=ee*_*rt-pe/2;ee>=0&&pe>0&&(M.scrollLeft=Math.max(0,Dt));},[$.length,Ln,Oe,rt]),jsx(Wo.Provider,{value:ze,children:jsx(si.Provider,{value:Or,children:jsxs("div",{ref:Nt,className:"flex flex-col h-full w-full",style:{backgroundColor:ot.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(ms,{theme:ot,timeScale:Oe,onTimeScaleChange:Q,zoom:rt,onZoomChange:ut,currentTheme:ue,onThemeChange:j,rowDensity:Je,onRowDensityChange:Pe,showThemeSelector:m,showCreateTaskButton:b,createTaskLabel:y,onCreateTask:w,taskFilter:ce,onTaskFilterChange:Ge,hideCompleted:Be,onHideCompletedChange:B,onExportPNG:i?vg:void 0,onExportPDF:i?xg:void 0,onExportExcel:i?kg:void 0,onExportCSV:i?wg:void 0,onExportJSON:i?Cg:void 0,onExportMSProject:i?Tg:void 0}),jsxs("div",{ref:Ra,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Ba,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(fs,{tasks:P,theme:ot,rowHeight:re,availableUsers:c,templates:oo,onTaskClick:k,onTaskDblClick:Td,onTaskContextMenu:I,onTaskToggle:ra,scrollTop:X,columns:me,onToggleColumn:ve,onColumnResize:Ze,onTaskUpdate:la,onTaskIndent:oa,onTaskOutdent:or,onTaskMove:Sa,onMultiTaskDelete:no,onTaskDuplicate:ug,onTaskCreate:pg,onTaskRename:gg,onCreateSubtask:qs,onOpenTaskModal:k?M=>k(M):void 0,onDeleteRequest:(M,F)=>qe({taskId:M,taskName:F}),onTaskReparent:Ta})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ot.border,zIndex:15},onMouseDown:Ng}),jsx("div",{ref:fe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Xs?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Cs,{tasks:P,theme:ot,rowHeight:re,timeScale:Oe,startDate:Ln,endDate:yg,zoom:rt,locale:p,templates:oo,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:k,onTaskDblClick:Td,onTaskContextMenu:bg,onTaskDateChange:fg,onDependencyCreate:Dd,onDependencyDelete:Sd})})]}),$e.task&&jsx(Go,{isOpen:$e.isOpen,x:$e.x,y:$e.y,theme:ot,onClose:()=>O({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=$e.task;if(!M)return [];let F=xe.findTaskById($,M.id)||M;return F.subtasks&&F.subtasks.length>0?[{id:"addSubtask",label:ze.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{v?v(F):qs(F.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ze.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{qe({taskId:F.id,taskName:F.name});}}]:[{id:"edit",label:ze.contextMenu?.editTask||"Edit Task",icon:Ht.Pencil,onClick:()=>{H?H(F):Le(F);}},{id:"addSubtask",label:ze.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{v?v(F):qs(F.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ze.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ht.MarkIncomplete,onClick:()=>{te?te(F):la(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"},{id:"setInProgress",label:ze.contextMenu?.setInProgress||"Set In Progress",icon:Ht.SetInProgress,onClick:()=>{oe?oe(F):la(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"},{id:"markComplete",label:ze.contextMenu?.markComplete||"Mark Complete",icon:Ht.MarkComplete,onClick:()=>{la(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ze.contextMenu?.splitTask||"Split Task",icon:Ht.Split,onClick:()=>{if(!F.startDate||!F.endDate){console.warn("Cannot split task without dates");return}let ee=F.startDate.getTime(),pe=F.endDate.getTime(),we=ee+(pe-ee)/2,Dt=new Date(we);hg(F,Dt);},disabled:!F.startDate||!F.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ze.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{qe({taskId:F.id,taskName:F.name});}}]})()}),jsx(Mr,{task:ae,isOpen:!!ae,onClose:()=>Le(null),onTaskUpdate:M=>{ae&&(la(ae.id,M),Le(null));},theme:ue==="light"?"light":"dark",locale:p==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsx(AnimatePresence,{children:je&&jsx(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:()=>qe(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ot.bgSecondary,border:`1px solid ${ot.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ot.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[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:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:ot.textPrimary,fontFamily:"Inter, sans-serif"},children:[ze.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:ot.textSecondary,fontFamily:"Inter, sans-serif"},children:p==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:ot.textSecondary,fontFamily:"Inter, sans-serif"},children:[p==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:ot.textPrimary},children:['"',je.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ot.bgPrimary,borderTop:`1px solid ${ot.border}`},children:[jsx("button",{onClick:()=>qe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ot.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=ot.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:p==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{no([je.taskId]),qe(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:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),p==="es"?"Eliminar":"Delete"]})]})]})})}),T?.enabled&&jsx(Ts,{tasks:$,theme:ot,config:T,onTasksUpdate:Me,onTaskUpdate:la,onTaskCreate:M=>{Me(F=>[...F,M]);},onTaskDelete:M=>{no([M]);},onDependencyCreate:(M,F)=>{let _=xe.findTaskById($,M);_&&Dd(_,F);},onDependencyDelete:Sd})]})})})});function Wy(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Gy(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),m=parseInt(a[2],10);return l*60+m}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10):null}var wl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Cl=[{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 Xm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:g=[],onUploadAttachments:f,onDeleteAttachment:x}){let T=[...wl,...i.filter(B=>!wl.some(X=>X.id===B.id))],p=et[m]||et.dark,[h,b]=useState(false),[y,w]=useState(false),[D,N]=useState(false),[E,k]=useState(false),[R,I]=useState({top:0,left:0}),[C,W]=useState(null),[H,v]=useState(new Date),[te,oe]=useState({top:0,left:0}),[ne,A]=useState(false),[ke,Ie]=useState([]),[L,U]=useState(false),[S,K]=useState(""),J=useRef(null),ie=useRef(null),ue=useRef(null),ye=useRef(null),Oe=useRef(null),[Q,Je]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Pe,rt]=useState({});useEffect(()=>{a?(Je({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)&&A(true)):(Je({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),A(false),Ie([]));},[a,e]),useEffect(()=>{let B=X=>{J.current&&!J.current.contains(X.target)&&b(false),ie.current&&!ie.current.contains(X.target)&&w(false),ue.current&&!ue.current.contains(X.target)&&N(false),ye.current&&!ye.current.contains(X.target)&&k(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let ut=()=>{let B={};return Q.name.trim()||(B.name="El nombre es requerido"),Q.startDate&&Q.endDate&&Q.startDate>Q.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),rt(B),Object.keys(B).length===0},It=async B=>{if(B.preventDefault(),!!ut())try{let X=l==="create"&&ke.length>0?{...Q,pendingFiles:ke}:Q;await s(X),Ie([]),t();}catch(X){console.error("Error submitting task:",X);}},Xe=(B,X)=>{Je(ge=>{let Ae={...ge,[B]:X};if(B==="status"){let Ue=X;Ue==="todo"?Ae.progress=0:Ue==="in-progress"?(ge.progress===0||ge.progress===100)&&(Ae.progress=50):Ue==="completed"||Ue==="closed"?Ae.progress=100:(Ue==="in-review"||Ue==="review")&&(Ae.progress=75);}if(B==="progress"){let Ue=typeof X=="number"?X:parseInt(X,10);Ue===100&&ge.status!=="completed"?Ae.status="completed":Ue>0&&Ue<100&&ge.status==="todo"?Ae.status="in-progress":Ue===0&&ge.status!=="todo"&&(Ae.status="todo");}return Ae}),Pe[B]&&rt(ge=>{let Ae={...ge};return delete Ae[B],Ae});},pt=T.find(B=>B.id===Q.status)??wl[0],ce=Cl.find(B=>B.id===Q.priority)??Cl[1],Ge=go.find(B=>B.value===Q.color)??go[0],Be={backgroundColor:p.bgSecondary,border:`1px solid ${p.borderLight}`,color:p.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsx(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:jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},onClick:B=>B.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${p.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:pt.color||p.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:p.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:p.textTertiary},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=p.hoverBg,B.currentTarget.style.color=p.textPrimary;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=p.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:It,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:Q.name,onChange:B=>Xe("name",B.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:p.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Pe.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Pe.name]})]}),jsx("div",{children:jsx("textarea",{value:Q.description||"",onChange:B=>Xe("description",B.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:p.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${p.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:J,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&b(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Be,borderColor:pt.color,backgroundColor:`${pt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:pt.color}}),jsx("span",{style:{color:pt.color},children:pt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:pt.color}})]}),jsx(AnimatePresence,{children:h&&jsx(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:p.bgPrimary,border:`1px solid ${p.border}`},children:T.map(B=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:p.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("status",B.id),b(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,Q.status===B.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:p.accent}})]},B.id))})})]}),jsxs("div",{ref:ie,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ce.color}}),jsx("span",{children:ce.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:p.textTertiary}})]}),jsx(AnimatePresence,{children:y&&jsx(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:p.bgPrimary,border:`1px solid ${p.border}`},children:Cl.map(B=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:p.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("priority",B.id),w(false);},children:[jsx("span",{children:B.icon}),B.label,Q.priority===B.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:p.accent}})]},B.id))})})]}),o.length>0&&jsxs("div",{ref:ue,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[Q.assignees&&Q.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:Q.assignees.slice(0,3).map((B,X)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:B.color||p.accent,borderColor:p.bgSecondary},children:B.initials},X))}),Q.assignees.length>3&&jsxs("span",{style:{color:p.textTertiary},children:["+",Q.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:p.textTertiary}}),jsx("span",{style:{color:p.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:p.textTertiary}})]}),jsx(AnimatePresence,{children:D&&jsx(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:p.bgPrimary,border:`1px solid ${p.border}`},children:o.map(B=>{let X=Q.assignees?.some(ge=>ge.name===B.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:p.textPrimary},onMouseEnter:ge=>ge.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ge=X?(Q.assignees||[]).filter(Ae=>Ae.name!==B.name):[...Q.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(Ae=>Ae[0]).join("").toUpperCase().slice(0,2),color:p.accent}];Xe("assignees",ge);},children:[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:p.accent},children:B.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:B.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:X&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:p.accent}})})]},B.id)})})})]}),jsxs("div",{ref:ye,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(E)k(false);else {if(ye.current){let B=ye.current.getBoundingClientRect(),X=window.innerHeight,ge=120,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;I({top:Ue,left:B.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Q.color}}),jsx("span",{children:Ge.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:p.textTertiary}})]}),jsx(AnimatePresence,{children:E&&jsxs(yt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:B=>B.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:go.slice(0,18).map(B=>{let X=Q.color===B.value;return jsx("button",{type:"button",onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),Xe("color",B.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:B.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:B.value,outline:X?`2px solid ${B.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},B.value)})})})})]})})]}),c.length>0||d?jsx(Gr,{selectedTags:Q.tags||[],availableTags:c,onChange:B=>Xe("tags",B),onCreateTag:d,theme:p,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:p.textTertiary}}),jsxs("div",{ref:Oe,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!Q.isMilestone)if(C==="start")W(null);else {if(Oe.current){let B=Oe.current.getBoundingClientRect(),X=window.innerHeight,ge=320,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;oe({top:Ue,left:B.left});}W("start"),v(Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Be,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.startDate?Q.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:p.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!Q.isMilestone)if(C==="end")W(null);else {if(Oe.current){let B=Oe.current.getBoundingClientRect(),X=window.innerHeight,ge=320,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;oe({top:Ue,left:B.left});}W("end"),v(Q.endDate||Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Be,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.endDate?Q.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:C&&jsxs(yt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>W(null)}),jsxs(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:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},onClick:B=>B.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${p.border}`},children:[(()=>{let B=new Date,X=new Date(B);X.setDate(B.getDate()+1);let ge=new Date(B);ge.setDate(B.getDate()+7);let Ae=new Date(B);return Ae.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:X},{label:"Pr\xF3xima semana",date:ge},{label:"2 semanas",date:Ae}].map((nt,Pt)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:p.textPrimary},onMouseEnter:$e=>$e.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:$e=>$e.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(Xe("startDate",nt.date),(!Q.endDate||nt.date>Q.endDate)&&Xe("endDate",nt.date),W("end")):(Xe("endDate",nt.date),(!Q.startDate||nt.date<Q.startDate)&&Xe("startDate",nt.date),W(null));},children:nt.label},Pt))})(),jsx("div",{style:{borderTop:`1px solid ${p.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:B=>B.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("startDate",void 0),Xe("endDate",void 0),W(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>v(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:p.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:p.textPrimary},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>v(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:p.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((B,X)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:p.textTertiary},children:B},X))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=H.getFullYear(),X=H.getMonth(),ge=new Date(B,X,1).getDay(),Ae=new Date(B,X+1,0).getDate(),Ue=new Date,nt=[];for(let $e=ge-1;$e>=0;$e--)nt.push({day:new Date(B,X,-$e).getDate(),date:new Date(B,X-1,new Date(B,X,-$e).getDate()),isCurrentMonth:false});for(let $e=1;$e<=Ae;$e++)nt.push({day:$e,date:new Date(B,X,$e),isCurrentMonth:true});let Pt=42-nt.length;for(let $e=1;$e<=Pt;$e++)nt.push({day:$e,date:new Date(B,X+1,$e),isCurrentMonth:false});return nt.map(($e,O)=>{let ae=$e.date.toDateString()===Ue.toDateString(),Le=Q.startDate?.toDateString()===$e.date.toDateString(),je=Q.endDate?.toDateString()===$e.date.toDateString(),qe=Q.startDate&&Q.endDate&&$e.date>=Q.startDate&&$e.date<=Q.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:$e.isCurrentMonth?Le||je?"#FFF":p.textPrimary:p.textTertiary,backgroundColor:Le?"#3B82F6":je?"#7C3AED":qe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ae&&!Le&&!je?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(Xe("startDate",$e.date),Q.endDate&&$e.date>Q.endDate&&Xe("endDate",$e.date),W("end")):(Xe("endDate",$e.date),Q.startDate&&$e.date<Q.startDate&&Xe("startDate",$e.date),W(null));},children:$e.day},O)})})()})]})]})]})})]}),Pe.endDate&&jsx("span",{className:"text-xs text-red-400",children:Pe.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:p.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:Q.progress,onChange:B=>Xe("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:p.bgSecondary,accentColor:Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"}20`,color:Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"},children:[Q.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>A(!ne),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:p.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${ne?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:ne&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:p.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:p.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 2h 30m, 4h, 1d",value:Q.effortMinutes?Wy(Q.effortMinutes):"",onChange:B=>{let X=Gy(B.target.value);Xe("effortMinutes",X);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:p.bgSecondary,color:p.textPrimary,border:`1px solid ${p.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:p.textTertiary},children:'Formatos: "2h 30m", "4h", "1d" (1 d\xEDa = 8h)'})]}),(f||g.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:p.textTertiary},children: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"})}),jsxs("span",{className:"text-xs",style:{color:p.textTertiary},children:["Adjuntos ",l==="create"?ke.length>0&&`(${ke.length})`:g.length>0&&`(${g.length})`]})]}),l==="create"?jsx(Cr,{cardId:"pending",attachments:ke.map((B,X)=>({id:`pending-${X}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>Ie(X=>[...X,...B]),onDelete:B=>{let X=parseInt(B.replace("pending-",""),10);Ie(ge=>ge.filter((Ae,Ue)=>Ue!==X));},maxSizeMB:10,maxFiles:20}):jsx(Cr,{cardId:a?.id||"new",attachments:g,onUpload:f&&a?.id?B=>f(a.id,B):void 0,onDelete:x,maxSizeMB:10,maxFiles:20}),l==="create"&&ke.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:p.textTertiary},children:[ke.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsx("input",{type:"checkbox",checked:Q.isMilestone,onChange:B=>Xe("isMilestone",B.target.checked),className:"w-4 h-4 rounded",style:{accentColor:p.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:p.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:p.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),Q.dependencies&&Q.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Q.dependencies.map(B=>{let X$1=r.find(ge=>ge.id===B);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${p.accent}20`,color:p.accent},children:[X$1?.name||B.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ge=(Q.dependencies||[]).filter(Ae=>Ae!==B);Xe("dependencies",ge);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},B)})}),jsxs("button",{type:"button",onClick:()=>{U(!L),K("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:p.bgSecondary,color:p.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:L&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),K("");}}),jsxs(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:p.bgPrimary,border:`1px solid ${p.border}`},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${p.border}`},children:jsx("input",{type:"text",value:S,onChange:B=>K(B.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:p.bgSecondary,color:p.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(B=>B.id!==a?.id).filter(B=>S===""||B.name.toLowerCase().includes(S.toLowerCase())).map(B=>{let X=Q.dependencies?.includes(B.id);return jsxs("button",{type:"button",onClick:()=>{let ge=Q.dependencies||[],Ae;X?Ae=ge.filter(Ue=>Ue!==B.id):Ae=[...ge,B.id],Xe("dependencies",Ae);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:X?`${p.accent}10`:"transparent"},onMouseEnter:ge=>{X||(ge.currentTarget.style.backgroundColor=p.hoverBg);},onMouseLeave:ge=>{ge.currentTarget.style.backgroundColor=X?`${p.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:X?p.accent:"transparent",borderColor:X?p.accent:p.borderLight},children:X&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:p.textPrimary},children:B.name}),jsx("span",{className:"text-[10px]",style:{color:p.textTertiary},children:B.id.slice(0,8)})]})]},B.id)}),r.filter(B=>B.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:p.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${p.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:p.textSecondary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),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:p.accent,color:"#FFF"},onMouseEnter:B=>!n&&(B.currentTarget.style.opacity="0.9"),onMouseLeave:B=>!n&&(B.currentTarget.style.opacity="1"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Jm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
359
359
|
|
|
360
360
|
AVAILABLE COMMANDS:
|
|
361
361
|
1. move_task - Move a task to a different date
|
|
@@ -396,39 +396,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
396
396
|
|
|
397
397
|
Always try to match task names case-insensitively and handle partial matches.
|
|
398
398
|
If you can't find a task by name, search through the provided task list.
|
|
399
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
400
|
-
${
|
|
399
|
+
If ambiguous, ask for clarification in the message field.`;function Zm(e){return `CURRENT TASKS:
|
|
400
|
+
${Qm(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(`
|
|
401
401
|
`)}
|
|
402
402
|
|
|
403
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Km(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=Km(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let m=l.name.toLowerCase();return n.every(i=>m.includes(i))})}function xl(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 g={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(g!==void 0){let b=new Date(r),w=b.getDay(),f=g-w;return f<=0&&(f+=7),b.setDate(b.getDate()+f),b}}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),g=s[2].toLowerCase(),b=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?b.setDate(b.getDate()+p):g==="week"||g==="semana"||g==="semanas"?b.setDate(b.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&b.setMonth(b.getMonth()+p),b}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),g=parseInt(l[2],10)-1,b=parseInt(l[3],10);return new Date(b,g,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),g=m[i[2].toLowerCase()],b=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(b,g,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},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=c[d[1].toLowerCase()],g=parseInt(d[2],10),b=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(b,p,g)}return null}function kl(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 wl(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 Ym(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 qm(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(),d=Br(t,i),p=xl(c);if(!d)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:d.id,taskName:d.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 g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,b=new Date(p);return b.setDate(b.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:b},message:`Moved "${d.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(),d=Br(t,i),p=kl(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.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(),d=Br(t,i),p=wl(c);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.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(),d=Br(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.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 l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=Br(t,i),p=Br(t,c);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.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 Xm(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 By(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 Ry(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ts(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let d=a.find(p=>p.id===c);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Ts(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},l=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||l&&m&&Math.abs(m.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:m,progress:e.progress||0,status:By(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 Jm(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:Ry(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Zm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ts(r,e,t))}var Cl={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags"},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"}},Tl={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas"},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"}},Ns={en:Cl,es:Tl};function Nl(e){return Ns[e]||Ns.en}function Ds(e,t){let a=Nl(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 Dl=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-blue-500"},{value:"completed",icon:CheckCircle2,color:"text-green-500"}];function Qm(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function eu({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let m=Qm(e),i=Dl[0],c=Dl.find(g=>g.value===m)??i,d=c.icon,p=g=>{switch(Qm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:u("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:Dl.map(g=>{let b=g.icon;return jsxs("button",{onClick:w=>{w.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",m===g.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx(b,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Sl=[{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 au({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=Sl.find(c=>c.value===e)??Sl[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",m.color)}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Flag,{className:u("w-4 h-4",m.color)}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:u("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:Sl.map(c=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(c.value),n(false);},className:u("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:[jsx("div",{className:u("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function Ps(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ms(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 ou({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=useState(false),[m,i]=useState(""),c=useRef(null);useEffect(()=>{let b=w=>{c.current&&!c.current.contains(w.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]);let d=t.filter(b=>b.name.toLowerCase().includes(m.toLowerCase())||b.email?.toLowerCase().includes(m.toLowerCase())),p=b=>e.some(w=>w.name===b),g=b=>{if(a)if(p(b.name))a(e.filter(w=>w.name!==b.name));else {let w={name:b.name,initials:Ps(b.name),color:b.color||Ms(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl};a([...e,w]);}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,w)=>jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!b.avatar&&Ms(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Ps(b.name)},`${b.name}-${w}`)),e.length>3&&jsxs("div",{className:u("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]})]}):jsxs("div",{ref:c,className:"relative",children:[jsx("button",{onClick:b=>{b.stopPropagation(),l(!n);},className:u("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?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,w)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!b.avatar&&Ms(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Ps(b.name)},`${b.name}-${w}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:u("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:[jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsx("input",{type:"text",value:m,onChange:b=>i(b.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:u("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:b=>b.stopPropagation()})}),jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:d.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):d.map(b=>jsxs("button",{onClick:w=>{w.stopPropagation(),g(b);},className:u("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:[jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!b.avatarUrl&&Ms(b.name)),children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):Ps(b.name)}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:r?"text-white":"text-gray-900",children:b.name}),b.email&&jsx("div",{className:u("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:b.email})]}),p(b.name)&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},b.id))}),e.length>0&&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((b,w)=>jsxs("span",{className:u("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:[b.name,jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(y=>y.name!==b.name));},className:"hover:text-red-500",children:jsx(X,{className:"w-3 h-3"})})]},`${b.name}-${w}`))})]})]})}function iu({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:m}){let[i,c]=useState(false),[d,p]=useState(o),[g,b]=useState(()=>{let E=o==="start"?e:t;if(E){let k=E instanceof Date?E:new Date(E);return new Date(k.getFullYear(),k.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),w=useRef(null),f=e?e instanceof Date?e:new Date(e):null,y=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let E=k=>{w.current&&!w.current.contains(k.target)&&c(false);};return i&&document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[i]),useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let h=E=>E?E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):m||"-",v=useCallback(()=>{let E=g.getFullYear(),k=g.getMonth(),R=new Date(E,k,1),C=new Date(E,k+1,0).getDate(),W=R.getDay(),H=[],te=new Date(E,k,0).getDate();for(let ne=W-1;ne>=0;ne--)H.push({date:new Date(E,k-1,te-ne),isCurrentMonth:false});for(let ne=1;ne<=C;ne++)H.push({date:new Date(E,k,ne),isCurrentMonth:true});let oe=42-H.length;for(let ne=1;ne<=oe;ne++)H.push({date:new Date(E,k+1,ne),isCurrentMonth:false});return H},[g]),T=E=>{if(r)o==="start"?a(E,y||void 0):a(f||void 0,E),c(false);else if(d==="start"){let k=y&&E>y?E:y;a(E,k||void 0),p("end");}else {let k=f&&E<f?E:f;a(k||void 0,E),c(false);}},D=()=>{let E=new Date,k=new Date(E);k.setDate(E.getDate()+1);let R=new Date(E);R.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let I=new Date(E);I.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let C=new Date(E);C.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let W=new Date(E);W.setDate(E.getDate()+14);let H=new Date(E);return H.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:R,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:W,display:W.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let E=r&&o==="start"?f:y;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(E)})]})}let N=r&&o==="start"?f:y;return jsxs("div",{ref:w,className:"relative",children:[jsxs("button",{onClick:E=>{E.stopPropagation(),c(!i);let k=o==="start"?f:y;k&&b(new Date(k.getFullYear(),k.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(N)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-white/10":"border-gray-200"),children:[D().map((E,k)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>T(E.date),children:[jsx("span",{children:E.label}),jsx("span",{className:u("text-xs",s?"text-[#6B7280]":"text-gray-400"),children:E.display})]},k)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,y||void 0):a(f||void 0,void 0):a(void 0,void 0),c(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:d==="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"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>b(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),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(E=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:v().map((E,k)=>{let R=E.date.toDateString()===new Date().toDateString(),I=f?.toDateString()===E.date.toDateString(),C=y?.toDateString()===E.date.toDateString(),W=I||C,H=!r&&f&&y&&E.date>=f&&E.date<=y;return jsx("button",{onClick:()=>T(new Date(E.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(s?"text-[#4B5563]":"text-gray-300"),E.isCurrentMonth&&(s?"text-white":"text-gray-900"),R&&"ring-2 ring-[#3B82F6]",I&&"bg-[#3B82F6] text-white",C&&!I&&"bg-[#7C3AED] text-white",H&&!W&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!W&&(s?"hover:bg-white/10":"hover:bg-gray-100")),children:E.date.getDate()},k)})})]})]})]})]})}function Fs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let m=e?e instanceof Date?e:new Date(e):null;return jsx(iu,{startDate:s==="start"?m:n||null,endDate:s==="end"?m:l||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function cu({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),l=s.clientX-n.left,m=Math.round(l/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxs("span",{className:u("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function pu({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[l,m]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{m(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=p=>{p.key==="Enter"?c():p.key==="Escape"&&(m(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:p=>m(p.target.value),onBlur:c,onKeyDown:d,onClick:p=>p.stopPropagation(),className:u("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")}):jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:u("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 bu({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[l,m]=useState(false),[i,c]=useState(e?.toString()||""),d=useRef(null);useEffect(()=>{l&&d.current&&(d.current.focus(),d.current.select());},[l]),useEffect(()=>{c(e?.toString()||"");},[e]);let p=()=>{let b=parseFloat(i);if(!isNaN(b)){let w=b;o!==void 0&&(w=Math.max(o,w)),s!==void 0&&(w=Math.min(s,w)),w!==e&&t?.(w);}m(false);},g=b=>{b.key==="Enter"?p():b.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):l?jsx("input",{ref:d,type:"number",value:i,onChange:b=>c(b.target.value),onBlur:p,onKeyDown:g,onClick:b=>b.stopPropagation(),min:o,max:s,className:u("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")}):jsx("button",{onClick:b=>{b.stopPropagation(),m(true);},className:u("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 hu({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=useState(false),m=useRef(null);return useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:u("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:[jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsx("div",{className:u("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?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:u("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:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function vu({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:u("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&&jsx(Check,{className:"w-3 h-3 text-white"})})}function wu({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>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&&jsxs("span",{className:u("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 hv(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?t==="es"?`${r}min`:`${r}m`:r===0?`${a}h`:t==="es"?`${a}h ${r}min`:`${a}h ${r}m`}function yv(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a){let l=parseInt(a[1],10),m=parseInt(a[2],10);return l*60+m}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r){let l=parseFloat(r[1]),m=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+m}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o)return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)?$/);if(s)return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n)}function ko({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false}){let [n,l]=useState(false),[m,i]=useState(""),c=useRef(null),p=hv(e,r);useEffect(()=>{n&&c.current&&(c.current.focus(),c.current.select());},[n]),useEffect(()=>{if(e){let w=Math.floor(e/60),f=e%60;w>0&&f>0?i(`${w}h ${f}m`):w>0?i(`${w}h`):i(`${f}m`);}else i("");},[e,n]);let g=()=>{let w=yv(m);w!==e&&t?.(w),l(false);},b=w=>{w.key==="Enter"?g():w.key==="Escape"&&l(false);};return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:p})]}):n?jsx("input",{ref:c,type:"text",value:m,onChange:w=>i(w.target.value),onBlur:g,onKeyDown:b,onClick:w=>w.stopPropagation(),placeholder:"1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:w=>{w.stopPropagation(),l(true);},className:u("flex items-center gap-1.5 text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e!=null&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400"),children:[e!=null&&e>0&&jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{children:p})]})}function Av(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Lv(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 Mu({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let d=useRef(null),p=r==="es"?Eu.es:Eu.en;if(useEffect(()=>{let y=v=>{d.current&&!d.current.contains(v.target)&&t();},h=v=>{v.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let g=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:p.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),l&&(y.push({id:"status",label:p.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:p.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&y.push({id:"assign",label:p.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon: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 v=e.task.assignees||[],D=v.some(N=>N.name===h.name)?v.filter(N=>N.name!==h.name):[...v,{name:h.name,initials:Av(h.name),color:h.color||Lv(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:D}),t();}}))})),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:p.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:p.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},b=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:p.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:p.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:p.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),y},w=e.type==="task"?g():b(),f={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:d,style:f,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:w.map(y=>y.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/10":"bg-gray-200")},y.id):y.submenu?jsx(Iv,{item:y,isDark:a},y.id):jsxs("button",{onClick:y.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(y.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function Iv({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:u("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:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:u("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(l=>jsxs("button",{onClick:l.onClick,className:u("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:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Eu={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 Ru={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},Xv=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function $u({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[m,i]=useState(""),c=useRef(null),d=l==="es"?Ou.es:Ou.en;if(useEffect(()=>{if(!e)return;let y=setTimeout(()=>{let h=T=>{c.current&&!c.current.contains(T.target)&&t();},v=T=>{T.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let p=y=>d.columns[y]||y,g=y=>{if(y==="name")return;let h=a.map(v=>v.id===y?{...v,visible:!v.visible}:v);o(h);},b=(y,h)=>{let v=a.find(D=>D.type===y&&(!h||D.customFieldId===h));if(v){g(v.id);return}let T={id:h||y,type:y,label:h?r.find(D=>D.id===h)?.name||y:p(y),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,T]);},w=Xv.filter(y=>p(y).toLowerCase().includes(m.toLowerCase())),f=r.filter(y=>y.name.toLowerCase().includes(m.toLowerCase()));return jsxs("div",{ref:c,className:u("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:[jsxs("div",{className:u("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:u("font-medium",n?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:u("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsx("div",{className:"p-3",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:d.searchPlaceholder,className:u("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")})]})}),jsxs("div",{className:"overflow-y-auto max-h-[calc(100vh-300px)] min-h-[200px]",children:[jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:u("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.standardFields}),jsx("div",{className:"space-y-1",children:w.map(y=>{let h=a.find(D=>D.type===y&&!D.customFieldId),v=h?.visible??false,T=y==="name";return jsxs("button",{onClick:()=>{T||(h?g(h.id):b(y));},disabled:T,className:u("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",T&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center",v?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:v&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Ru[y]}),jsx("span",{className:n?"text-white":"text-gray-900",children:p(y)})]},y)})})]}),f.length>0&&jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:u("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.customFields}),jsx("div",{className:"space-y-1",children:f.map(y=>{let v=a.find(T=>T.customFieldId===y.id)?.visible??false;return jsxs("button",{onClick:()=>b(y.type,y.id),className:u("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:[jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center",v?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:v&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Ru[y.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{className:n?"text-white":"text-gray-900",children:y.name})]},y.id)})})]})]}),s&&jsx("div",{className:u("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:s,className:u("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:[jsx(Plus,{className:"w-4 h-4"}),d.createField]})})]})}var Ou={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",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",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",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var nx=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function Hu({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[l,m]=useState("text"),[i,c]=useState([""]),d=o==="es"?Uu.es:Uu.en;useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),useEffect(()=>{let f=y=>{y.key==="Escape"&&t();};return e&&document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,t]);let p=()=>{if(!s.trim())return;let f={name:s.trim(),type:l};l==="dropdown"&&(f.options=i.filter(y=>y.trim())),a(f),t();},g=()=>{c([...i,""]);},b=(f,y)=>{let h=[...i];h[f]=y,c(h);},w=f=>{i.length>1&&c(i.filter((y,h)=>h!==f));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:f=>n(f.target.value),placeholder:d.fieldNamePlaceholder,className:u("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})]}),jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:nx.map(f=>jsxs("button",{onClick:()=>m(f.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===f.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===f.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:f.icon}),jsx("span",{className:u("text-xs",l===f.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[f.type]})]},f.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[i.map((f,y)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:f,onChange:h=>b(y,h.target.value),placeholder:`${d.option} ${y+1}`,className:u("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&&jsx("button",{onClick:()=>w(y),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},y)),jsxs("button",{onClick:g,className:u("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:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsx("button",{onClick:t,className:u("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:d.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:u("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:d.create})]})]})]}):null}var Uu={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 Vu={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 _u({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=useState(false),m=useRef(null),i=useRef(0),c=s==="es"?Vu.es:Vu.en;useEffect(()=>{if(!n)return;let g=w=>{Date.now()-i.current<100||m.current&&!m.current.contains(w.target)&&l(false);},b=w=>{w.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b);}},[n]);let d=[{value:"all",label:c.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(b=>!b);},className:u("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:[jsx(Filter,{className:"w-4 h-4"}),c.filters,p&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("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:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let b=e===g.value&&!t,w=()=>g.value==="all"?b?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:u("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",b&&(o?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u(b?g.color:"text-gray-400","flex-shrink-0"),children:w()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),b&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:u("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:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var vx=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,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 qu(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(...qu(r.subtasks,t+1));return a}function Xu({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:d,showSearch:p=true,showHierarchy:g=true,tableColumns:b,allowColumnCustomization:w=true,allowColumnResize:f=true,enableContextMenu:y=true,showCreateTaskButton:h=false,onCreateTask:v,persistFilter:T=false}=t,D=Ds(c,d),N=i==="dark",E=useCallback(()=>{if(!T||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let O=localStorage.getItem(T);if(O){let ae=JSON.parse(O);return {statusFilter:ae.statusFilter||"all",hideCompleted:ae.hideCompleted||!1}}}catch(O){console.error("Error loading persisted filter:",O);}return {statusFilter:"all",hideCompleted:false}},[T]),[k,R]=useState("startDate"),[I,C]=useState("asc"),[W,H]=useState(""),[x,te]=useState(()=>E().statusFilter),[oe,ne]=useState(()=>E().hideCompleted),[A,ke]=useState(b||vx),[Ie,L]=useState(false),[U,S]=useState(false),[K,J]=useState({isOpen:false,x:0,y:0,type:"task"}),[ie,ue]=useState(null),[ye,Oe]=useState(0),[Q,Je]=useState(0),Pe=useRef(null);useEffect(()=>{b&&ke(b);},[b]),useEffect(()=>{if(!(!T||typeof window>"u"))try{localStorage.setItem(T,JSON.stringify({statusFilter:x,hideCompleted:oe}));}catch(O){console.error("Error persisting filter state:",O);}},[T,x,oe]);let rt=useMemo(()=>{let O=new Set;function ae(Le){for(let je of Le)je.subtasks?.length&&(je.isExpanded!==false&&O.add(je.id),ae(je.subtasks));}return ae(e),O},[e]),ut=useMemo(()=>A.filter(O=>O.visible),[A]),It=useCallback(O=>{a.onTaskToggleExpand?.(O);},[a]),Xe=useCallback(O=>{k===O?C(ae=>ae==="asc"?"desc":"asc"):(R(O),C("asc")),a.onSortChange?.({column:O,direction:I==="asc"?"desc":"asc"});},[k,I,a]),pt=useCallback(O=>{ke(O),a.onColumnsChange?.(O);},[a]),ce=useCallback(O=>{let ae=A.map(Le=>Le.id===O?{...Le,visible:false}:Le);pt(ae);},[A,pt]),Ge=useCallback((O,ae)=>{R(O),C(ae);},[]),Be=useCallback((O,ae,Le)=>{y&&(O.preventDefault(),J({isOpen:true,x:O.clientX,y:O.clientY,type:ae?"task":"header",task:ae,columnId:Le}));},[y]),B=useCallback(()=>{J(O=>({...O,isOpen:false}));},[]),X=useCallback((O,ae)=>{if(!f)return;O.preventDefault(),O.stopPropagation();let Le=A.find(je=>je.id===ae);Le&&(ue(ae),Oe(O.clientX),Je(Le.width));},[A,f]);useEffect(()=>{if(!ie)return;let O=Le=>{let je=Le.clientX-ye,qe=Math.max(50,Q+je),j=A.map($=>$.id===ie?{...$,width:qe}:$);ke(j);},ae=()=>{ie&&a.onColumnsChange?.(A),ue(null);};return document.addEventListener("mousemove",O),document.addEventListener("mouseup",ae),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",ae);}},[ie,ye,Q,A,a]);let ge=useCallback(async O=>{if(a.onCreateCustomField){let ae={...O,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(ae);}S(false);},[a]),Ae=useCallback(O=>O.progress===100||O.status==="completed"?"completed":O.progress&&O.progress>0||O.status==="in-progress"?"in-progress":"todo",[]),Ue=useMemo(()=>{let O=qu(e);if(W.trim()){let ae=W.toLowerCase();O=O.filter(Le=>Le.name.toLowerCase().includes(ae));}return x!=="all"&&(O=O.filter(ae=>Ae(ae)===x)),oe&&(O=O.filter(ae=>Ae(ae)!=="completed")),O.sort((ae,Le)=>{let je,qe;switch(k){case "name":je=ae.name.toLowerCase(),qe=Le.name.toLowerCase();break;case "startDate":je=ae.startDate?.getTime()||0,qe=Le.startDate?.getTime()||0;break;case "endDate":je=ae.endDate?.getTime()||0,qe=Le.endDate?.getTime()||0;break;case "progress":je=ae.progress||0,qe=Le.progress||0;break;case "status":je=ae.status||"todo",qe=Le.status||"todo";break;case "priority":let j={urgent:0,high:1,medium:2,low:3,none:4};je=j[ae.priority]??4,qe=j[Le.priority]??4;break;default:return 0}return je<qe?I==="asc"?-1:1:je>qe?I==="asc"?1:-1:0}),O},[e,W,x,oe,k,I,Ae]),nt=useCallback((O,ae)=>{let Le=j=>{a.onTaskUpdate?.({...O,...j});},je=j=>j?O.customFields?.find(Me=>Me.fieldId===j)?.value:void 0,qe=(j,$)=>{if(!j)return;let ht=[...O.customFields||[]],le=ht.findIndex(He=>He.fieldId===j);le>=0?ht[le]={fieldId:j,value:$}:ht.push({fieldId:j,value:$}),Le({customFields:ht});};switch(ae.type){case "name":return null;case "status":return jsx(eu,{value:O.status||(O.progress===100?"completed":O.progress&&O.progress>0?"in-progress":"todo"),onChange:$=>{Le({status:$,progress:$==="completed"?100:$==="in-progress"?50:0});},isDark:N,locale:c,translations:D.status});case "priority":return jsx(au,{value:O.priority,onChange:$=>Le({priority:$}),isDark:N,locale:c});case "assignees":return jsx(ou,{value:O.assignees||[],availableUsers:l,onChange:$=>Le({assignees:$}),isDark:N,locale:c});case "startDate":return jsx(Fs,{value:O.startDate,onChange:$=>Le({startDate:$}),isDark:N,locale:c,dateField:"start",startDate:O.startDate,endDate:O.endDate});case "endDate":return jsx(Fs,{value:O.endDate,onChange:$=>Le({endDate:$}),isDark:N,locale:c,dateField:"end",startDate:O.startDate,endDate:O.endDate});case "progress":return jsx(cu,{value:O.progress||0,onChange:$=>{let Me=$===100?"completed":$>0?"in-progress":"todo";Le({progress:$,status:Me});},isDark:N});case "tags":return jsx(wu,{value:O.tags||[],isDark:N});case "text":return jsx(pu,{value:je(ae.customFieldId)||"",onChange:$=>qe(ae.customFieldId,$),isDark:N});case "number":return jsx(bu,{value:je(ae.customFieldId)||0,onChange:$=>qe(ae.customFieldId,$),isDark:N});case "date":let j=je(ae.customFieldId);return jsx(Fs,{value:j?new Date(j):void 0,onChange:$=>qe(ae.customFieldId,$),isDark:N,locale:c});case "dropdown":return jsx(hu,{value:je(ae.customFieldId)||"",options:ae.options||[],onChange:$=>qe(ae.customFieldId,$),isDark:N});case "checkbox":return jsx(vu,{value:je(ae.customFieldId)||false,onChange:$=>qe(ae.customFieldId,$),isDark:N});case "estimatedTime":return jsx(ko,{value:O.estimatedTime,onChange:$=>Le({estimatedTime:$}),isDark:N,locale:c});case "quotedTime":return jsx(ko,{value:O.quotedTime,onChange:$=>Le({quotedTime:$}),isDark:N,locale:c});case "elapsedTime":return jsx(ko,{value:O.elapsedTime,onChange:$=>Le({elapsedTime:$}),isDark:N,locale:c});case "effortMinutes":return jsx(ko,{value:O.effortMinutes,onChange:$=>Le({effortMinutes:$}),isDark:N,locale:c});case "timeLoggedMinutes":return jsx(ko,{value:O.timeLoggedMinutes,onChange:a.onLogTime?$=>{a.onLogTime?.(O,$);}:void 0,isDark:N,locale:c,placeholder:c==="es"?"Agregar":"Add"});case "soldEffortMinutes":return jsx(ko,{value:O.soldEffortMinutes,onChange:$=>Le({soldEffortMinutes:$}),isDark:N,locale:c});default:return jsx("span",{className:u("text-sm",N?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,N,c,l,D]),Pt=useCallback(O=>{let Le={name:D.columns.name,status:D.columns.status,priority:D.columns.priority,assignees:D.columns.assignees,startDate:D.columns.startDate,endDate:D.columns.endDate,progress:D.columns.progress,tags:D.columns.tags||(c==="es"?"Etiquetas":"Tags"),estimatedTime:D.columns.estimatedTime||(c==="es"?"Estimado":"Estimated"),quotedTime:D.columns.quotedTime||(c==="es"?"Ofertado":"Quoted"),elapsedTime:D.columns.elapsedTime||(c==="es"?"Tiempo":"Time Spent"),effortMinutes:D.columns.effortMinutes||(c==="es"?"Estimado":"Estimated"),timeLoggedMinutes:D.columns.timeLoggedMinutes||(c==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:D.columns.soldEffortMinutes||(c==="es"?"Ofertado":"Quoted")}[O.type]||O.label;return typeof Le=="string"?Le:String(Le||O.type)},[D,c]),$e=useMemo(()=>ut.reduce((O,ae)=>O+ae.width,0)+(w?48:0),[ut,w]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",N?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:[D.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",N?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",N?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:D.empty.noTasks}),jsx("p",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.addFirstTask})]})}):jsxs("div",{ref:Pe,className:u("flex-1 flex flex-col w-full h-full overflow-hidden",N?"bg-[#0F1117]":"bg-white",ie&&"select-none",s),style:n,children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",N?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(_u,{value:x,hideCompleted:oe,onChange:te,onHideCompletedChange:ne,isDark:N,locale:c}),jsxs("div",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:[Ue.length," ",D.pagination.tasks]}),p&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",N?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:W,onChange:O=>H(O.target.value),placeholder:D.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",N?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),h&&v&&jsxs(motion.button,{onClick:v,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:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:D.toolbar.newTask})]})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsxs("div",{style:{minWidth:$e},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",N?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[ut.map(O=>jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-3",N?"text-[#9CA3AF]":"text-gray-500"),style:{width:O.width,minWidth:O.minWidth},onContextMenu:ae=>Be(ae,void 0,O.id),children:[O.sortable?jsxs("button",{onClick:()=>Xe(O.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Pt(O),jsx(ArrowUpDown,{className:u("w-3 h-3",k===O.id&&"text-[#3B82F6]")})]}):jsx("span",{children:Pt(O)}),f&&O.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",ie===O.id&&"bg-[#3B82F6]"),onMouseDown:ae=>X(ae,O.id)})]},O.id)),w&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsx("button",{onClick:O=>{O.stopPropagation(),L(ae=>!ae);},className:u("p-1.5 rounded-lg transition-colors",N?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Ie&&(N?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-4 h-4"})}),jsx($u,{isOpen:Ie,onClose:()=>L(false),columns:A,customFields:m,onColumnsChange:pt,onCreateCustomField:()=>{L(false),S(true);},isDark:N,locale:c})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ue.map((O,ae)=>{let Le=rt.has(O.id),je=Math.min(ae*.01,.2);return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:je},className:u("flex items-center border-b transition-colors",N?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(O),onDoubleClick:()=>a.onTaskDoubleClick?.(O),onContextMenu:qe=>Be(qe,O),children:[ut.map(qe=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:qe.width,minWidth:qe.minWidth},children:qe.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[g&&O.level>0&&jsx("div",{style:{width:`${O.level*24}px`},className:"flex-shrink-0"}),g&&O.hasChildren&&jsx("button",{onClick:j=>{j.stopPropagation(),It(O.id);},className:u("p-0.5 rounded flex-shrink-0",N?"hover:bg-white/10":"hover:bg-gray-200"),children:Le?jsx(ChevronDown,{className:u("w-4 h-4",N?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",N?"text-[#9CA3AF]":"text-gray-400")})}),g&&!O.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsx("span",{className:u("truncate font-medium",N?"text-white":"text-gray-900",O.progress===100&&(N?"line-through text-[#6B7280]":"line-through text-gray-400")),children:O.name})]}):nt(O,qe)},qe.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]},O.id)})}),Ue.length===0&&W&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",N?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u(N?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.noResults})]})})]})}),jsx(Mu,{state:K,onClose:B,isDark:N,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ce,onColumnSort:Ge,availableUsers:l}),jsx(Hu,{isOpen:U,onClose:()=>S(false),onSave:ge,isDark:N,locale:c})]})}var Ju=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,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},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true}],Zu=[{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"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"}],Qu=[{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 Bl={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"},Rl={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"},Ol={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"},Is={dark:Bl,light:Rl,neutral:Ol};function ep(e){return Is[e]||Is.dark}var $l={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"}},zl={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"}},Bs={en:$l,es:zl};function kn(e){return Bs[e]||Bs.en}function Rs(e,t){let a=kn(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 tp(e){let t=kn(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 ap(e,t=0,a=true){let r=kn(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 ip(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 Hl(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 lp({task:e}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsx(Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function cp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:p,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:w,onTaskOpen:f,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:v,timerState:T,onLogTime:D,onUpdateEstimate:N,onStartTimer:E,onStopTimer:k,onDiscardTimer:R}){let{theme:I="dark",locale:C="en",customTranslations:W}=t,H=Rs(C,W),x=I==="dark",[te,oe]=useState(r||new Date),[ne,A]=useState(null),[ke,Ie]=useState(null),[L,U]=useState({}),S=4,K=3,[J,ie]=useState(null),[ue,ye]=useState(""),[Oe,Q]=useState(void 0),[Je,Pe]=useState(null),[rt,ut]=useState(false),[It,Xe]=useState(false),[pt,ce]=useState(null),[Ge,Be]=useState(false),[B,X$1]=useState(new Date),ge=useCallback(()=>{oe(new Date(te.getFullYear(),te.getMonth()-1,1));},[te]),Ae=useCallback(()=>{oe(new Date(te.getFullYear(),te.getMonth()+1,1));},[te]),Ue=useCallback(()=>{oe(new Date);},[]),nt=useMemo(()=>{let O=te.getFullYear(),ae=te.getMonth(),Le=new Date(O,ae,1),je=new Date(O,ae+1,0),qe=Le.getDay(),j=je.getDate(),$=ip(e),Me=new Date;Me.setHours(0,0,0,0);let ht=[],le=qe,He=new Date(O,ae,0).getDate();for(let Re=le-1;Re>=0;Re--){let de=new Date(O,ae-1,He-Re);ht.push({date:de,isCurrentMonth:false,isToday:false,isWeekend:de.getDay()===0||de.getDay()===6,events:$.filter(Ve=>Hl(de,Ve)).map(Ve=>({id:Ve.id,title:Ve.name,start:Ve.startDate,end:Ve.endDate,task:Ve}))});}for(let Re=1;Re<=j;Re++){let de=new Date(O,ae,Re),Ve=de.getTime()===Me.getTime();ht.push({date:de,isCurrentMonth:true,isToday:Ve,isWeekend:de.getDay()===0||de.getDay()===6,events:$.filter(V=>Hl(de,V)).map(V=>({id:V.id,title:V.name,start:V.startDate,end:V.endDate,task:V}))});}let De=42-ht.length;for(let Re=1;Re<=De;Re++){let de=new Date(O,ae+1,Re);ht.push({date:de,isCurrentMonth:false,isToday:false,isWeekend:de.getDay()===0||de.getDay()===6,events:$.filter(Ve=>Hl(de,Ve)).map(Ve=>({id:Ve.id,title:Ve.name,start:Ve.startDate,end:Ve.endDate,task:Ve}))});}return ht},[te,e]),Pt=C==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],$e=te.toLocaleDateString(C==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsx("div",{className:u("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[H.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:H.labels.noEvents}),jsx("p",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:H.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:u("text-xl font-semibold capitalize",x?"text-white":"text-gray-900"),children:$e}),jsx("button",{onClick:Ue,className:u("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:H.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:ge,className:u("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:Ae,className:u("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:Pt.map(O=>jsx("div",{className:u("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsx("div",{className:u("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:nt.map((O,ae)=>{let Le=O.date.getDay()===0||O.date.getDay()===6;return jsxs("div",{className:u("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?Le?"bg-[#1C1F26]":O.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Le?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let je=L[ae]||S,qe=O.events.slice(0,je),j=O.events.length-je;return jsxs("div",{className:"space-y-1 flex-1",children:[qe.map($=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{A($.task),a.onEventClick?.($),f?.($.task.id);},whileHover:{scale:1.02},className:u("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",$.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:[jsx(lp,{task:$.task}),jsx("span",{className:"truncate",children:$.title})]})},$.id)),j>0&&jsxs("button",{onClick:$=>{$.stopPropagation(),U(Me=>({...Me,[ae]:je+K}));},className:u("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:["+",j," ",C==="es"?"M\xC1S":"MORE"]}),je>S&&O.events.length>S&&jsx("button",{onClick:$=>{$.stopPropagation(),U(Me=>({...Me,[ae]:S}));},className:u("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:C==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let je=ae>=28,qe=ae%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:j=>{j.stopPropagation(),J===ae?ie(null):(ie(ae),ye(""),Q(void 0),Pe(null),ce(null),ut(false),Xe(false),Be(false),X$1(O.date));},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",J===ae?"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:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",J===ae&&"rotate-45")})}),jsx(AnimatePresence,{children:J===ae&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ie(null),ye(""),Q(void 0),Pe(null),ce(null),ut(false),Xe(false),Be(false);}}),jsxs(motion.div,{initial:{opacity:0,y:je?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:je?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",je?"bottom-full mb-1":"top-full mt-1",qe?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:j=>{j.stopPropagation(),ut(false),Xe(false),Be(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:ue,onChange:j=>ye(j.target.value),placeholder:C==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:u("w-full bg-transparent text-sm outline-none placeholder:opacity-40",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:j=>{if(j.key==="Enter"&&ue.trim()){let $=t.availableUsers?.find(ht=>ht.id===Je),Me=pt||O.date;a.onTaskCreate?.({name:ue.trim(),startDate:Me,endDate:Me,priority:Oe,assignees:$?[$]:void 0}),ye(""),Q(void 0),Pe(null),ce(null),ie(null);}j.key==="Escape"&&(ie(null),ye(""),Q(void 0),Pe(null),ce(null));}})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",x?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:j=>{j.stopPropagation(),ut(!rt),Xe(false);},className:u("p-1 rounded transition-colors",Oe?Oe==="urgent"||Oe==="high"?"text-red-400 bg-red-500/20":Oe==="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:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:rt&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:j=>j.stopPropagation(),children:[{id:"urgent",label:C==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:C==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:C==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:C==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:C==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(j=>jsxs("button",{onClick:()=>{Q(j.id),ut(false);},className:u("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",Oe===j.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",j.color)}),jsx("span",{className:x?"text-white":"text-gray-900",children:j.label})]},j.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:j=>{j.stopPropagation(),Be(!Ge),ut(false),Xe(false),X$1(pt||O.date);},className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",pt?"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:[jsx(CalendarDays,{className:"w-3 h-3"}),(pt||O.date).toLocaleDateString(C==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:Ge&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:j=>j.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",x?"border-white/10":"border-gray-200"),children:(()=>{let j=new Date,$=new Date(j);$.setDate(j.getDate()+1);let Me=new Date(j);Me.setDate(j.getDate()+((6-j.getDay()+7)%7||7));let ht=new Date(j);ht.setDate(j.getDate()+((1-j.getDay()+7)%7||7));let le=new Date(j);le.setDate(j.getDate()+14);let He=new Date(j);return He.setDate(j.getDate()+28),[{label:C==="es"?"Hoy":"Today",date:j,display:j.toLocaleDateString(C==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:C==="es"?"Ma\xF1ana":"Tomorrow",date:$,display:$.toLocaleDateString(C==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:C==="es"?"Este fin de semana":"This weekend",date:Me,display:C==="es"?"s\xE1b.":"sat."},{label:C==="es"?"Pr\xF3xima semana":"Next week",date:ht,display:C==="es"?"lun.":"mon."},{label:C==="es"?"2 semanas":"2 weeks",date:le,display:le.toLocaleDateString(C==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:C==="es"?"4 semanas":"4 weeks",date:He,display:He.toLocaleDateString(C==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Re,de)=>jsxs("button",{className:u("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:()=>{ce(Re.date),Be(false);},children:[jsx("span",{children:Re.label}),jsx("span",{className:u("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:Re.display})]},de))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium",x?"text-white":"text-gray-900"),children:B.toLocaleDateString(C==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>X$1(new Date),className:u("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:C==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>X$1(new Date(B.getFullYear(),B.getMonth()-1)),className:u("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>X$1(new Date(B.getFullYear(),B.getMonth()+1)),className:u("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(C==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(j=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:j},j))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let j=B.getFullYear(),$=B.getMonth(),Me=new Date(j,$,1).getDay(),ht=new Date(j,$+1,0).getDate(),le=new Date(j,$,0).getDate(),He=new Date,De=[];for(let de=Me-1;de>=0;de--)De.push({dayNum:le-de,isCurrentMonth:false,date:new Date(j,$-1,le-de)});for(let de=1;de<=ht;de++)De.push({dayNum:de,isCurrentMonth:true,date:new Date(j,$,de)});let Re=42-De.length;for(let de=1;de<=Re;de++)De.push({dayNum:de,isCurrentMonth:false,date:new Date(j,$+1,de)});return De.map((de,Ve)=>{let V=de.date.toDateString()===He.toDateString(),q=(pt||O.date).toDateString()===de.date.toDateString();return jsx("button",{className:u("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"),V&&"ring-1 ring-[#3B82F6]",q&&"bg-[#7C3AED] text-white",!q&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ce(de.date),Be(false);},children:de.dayNum},Ve)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:j=>{j.stopPropagation(),Xe(!It),ut(false);},className:u("p-1 rounded transition-colors",Je?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Je?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(j=>j.id===Je)?.color||"#7C3AED"},children:t.availableUsers?.find(j=>j.id===Je)?.initials||t.availableUsers?.find(j=>j.id===Je)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:It&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:j=>j.stopPropagation(),children:[jsxs("button",{onClick:()=>{Pe(null),Xe(false);},className:u("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",!Je&&(x?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:C==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(j=>jsxs("button",{onClick:()=>{Pe(j.id),Xe(false);},className:u("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",Je===j.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:j.color||"#7C3AED"},children:j.initials||j.name?.slice(0,2).toUpperCase()}),jsx("span",{className:x?"text-white":"text-gray-900",children:j.name})]},j.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:u("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:C==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(ue.trim()){let j=t.availableUsers?.find(Me=>Me.id===Je),$=pt||O.date;a.onTaskCreate?.({name:ue.trim(),startDate:$,endDate:$,priority:Oe,assignees:j?[j]:void 0}),ye(""),Q(void 0),Pe(null),ce(null),ie(null);}},disabled:!ue.trim(),className:u("px-2.5 py-1 rounded text-xs font-medium transition-colors",ue.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:C==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:u("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},ae)})})]})}),jsx(Mr,{task:ne,isOpen:!!ne,onClose:()=>A(null),onTaskUpdate:O=>{a.onTaskUpdate?.(O),A(O);},theme:I==="dark"?"dark":"light",locale:C,availableUsers:t.availableUsers?.map(O=>({id:O.id,name:O.name,avatar:O.avatar,initials:O.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:ne?c?.get(ne.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ip(e).filter(O=>O.id!==ne?.id),comments:d?.filter(O=>O.taskId===ne?.id).map(O=>({...O,createdAt:O.createdAt instanceof Date?O.createdAt:new Date(O.createdAt),updatedAt:O.updatedAt instanceof Date?O.updatedAt:O.updatedAt?new Date(O.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:w,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:v,isTimerRunning:T?.isRunning,timerElapsedSeconds:T?.elapsedSeconds,onTimeLog:D,onEstimateUpdate:N,onTimerStart:E,onTimerStop:k,onTimerDiscard:R}),jsx(AnimatePresence,{children:ke&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ie(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("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:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsx("span",{className:u("font-medium",x?"text-white":"text-gray-900"),children:ke.date.toLocaleDateString(C==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ie(null),className:u("p-1 rounded",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:ke.events.map(O=>jsxs("button",{onClick:()=>{Ie(null),A(O.task),f?.(O.task.id);},className:u("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:[jsx(lp,{task:O.task}),jsx("span",{className:u("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var Wl={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"},Gl={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"},Vl={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"},Os={dark:Wl,light:Gl,neutral:Vl};function mp(e){return Os[e]||Os.dark}function Px({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[m,i]=useState(false),c=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=useMemo(()=>{let g=c.length,b=new Set(c.flatMap(y=>y.assignedUserIds||[])).size,w=c.map(y=>y.priority).filter(Boolean),f=new Set(c.flatMap(y=>y.labels||[])).size;return {totalCards:g,uniqueAssignees:b,priorities:w,labels:f}},[c]),p=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),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&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),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&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:c.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:c.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:b=>{b.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var pp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Cn(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 Tn(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 gp(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 fp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let m=useMemo(()=>({...pp,...n}),[n]),[i,c]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(v=>{let T=v.timestamp.toISOString().split("T")[0],D=h.get(T);D?D.push(v):h.set(T,[v]);}),Array.from(h.entries()).sort((v,T)=>T[0].localeCompare(v[0])).map(([v,T])=>({date:new Date(v),events:T.sort((D,N)=>N.timestamp.getTime()-D.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:g,uniqueTypes:b}=useMemo(()=>{let h=new Set,v=new Set;return e.forEach(T=>{h.add(T.userId),v.add(T.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(v)}},[e]),w=h=>{c(v=>{let T=new Set(v);return T.has(h)?T.delete(h):T.add(h),T});},f=h=>{let T=new Date().getTime()-h.getTime(),D=Math.floor(T/6e4),N=Math.floor(T/36e5),E=Math.floor(T/864e5);return D<1?"just now":D<60?`${D}m ago`:N<24?`${N}h ago`:E<7?`${E}d ago`:h.toLocaleDateString()},y=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 useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",m.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let v=h.target.value;a({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),b.map(h=>jsxs("option",{value:h,children:[Tn(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let v=h.target.value;a({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),y>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:p.map(h=>jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((v,T)=>{let D=i.has(v.id),N=s===v.id,E=gp(v.type);return jsxs("div",{"data-event-id":v.id,className:u("history-timeline-event",D&&"expanded",N&&"selected"),onClick:()=>o?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:E},children:m.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Tn(v.type)})}),T<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:E}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&v.userAvatar&&jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsx("span",{className:"history-timeline-event-action",children:Cn(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?f(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),w(v.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([k,R])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},k)),v.metadata&&Object.keys(v.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([k,R])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},k))]})]})]})]},v.id)})})]},h.date?.toISOString()||"all"))})]})}function hp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&Tn(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Cn(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,b)=>jsx("div",{className:u("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>l(b),title:Cn(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:c.map(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>m(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function _l(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 jl(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 yp(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 vp(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Bx(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})),l=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let d=a/2,p=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(g=>{if(c.id===g.id)return;let b=c.x-g.x,w=c.y-g.y,f=Math.sqrt(b*b+w*w)||1,y=o.chargeStrength*i/(f*f);c.vx+=b/f*y,c.vy+=w/f*y;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),p=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!p)return;let g=p.x-d.x,b=p.y-d.y,w=Math.sqrt(g*g+b*b)||1,f=(w-o.linkDistance)/w*o.forceStrength*i;d.vx+=g*f,d.vy+=b*f,p.vx-=g*f,p.vy-=b*f;}),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 xp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:m}){let i=useRef(null),[c,d]=useState([]),[p,g]=useState(null),[b,w]=useState(null),[f,y]=useState(null),[h,v]=useState(1),[T,D]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let H=Bx(e,t,a.width,a.height,a,150);d(H);},[e,t,a]);let N=useCallback((H,x)=>{a.enableDragging&&(x.stopPropagation(),g(H));},[a.enableDragging]),E=useCallback(H=>{if(!p||!i.current)return;let te=i.current.getBoundingClientRect(),oe=(H.clientX-te.left-T.x)/h,ne=(H.clientY-te.top-T.y)/h;d(A=>A.map(ke=>ke.id===p?{...ke,x:oe,y:ne,fx:oe,fy:ne}:ke));},[p,h,T]),k=useCallback(()=>{g(null);},[]),R=useCallback((H,x)=>{x.stopPropagation(),l?.({type:"node-click",node:H,position:{x:x.clientX,y:x.clientY}});},[l]),I=useCallback((H,x)=>{x.stopPropagation(),l?.({type:"edge-click",edge:H,position:{x:x.clientX,y:x.clientY}});},[l]),C=useCallback(H=>{let x=c.find(te=>te.id===H);return x?{x:x.x,y:x.y}:{x:0,y:0}},[c]),W=useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let x=H.card.priority;return x==="URGENT"?"#ef4444":x==="HIGH"?"#f59e0b":x==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("relationships-graph-empty",m),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:u("relationships-graph",m),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(H=>Math.min(H+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),D({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:_l(H)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[yp(H)," ",jl(H)]})]},H))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:E,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${T.x}, ${T.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let x=C(typeof H.source=="string"?H.source:H.source.id),te=C(typeof H.target=="string"?H.target:H.target.id),oe=vp(H.type),ne=f===H.id,A=H.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",ne&&"hovered",A&&"critical"),onMouseEnter:()=>y(H.id),onMouseLeave:()=>y(null),onClick:ke=>I(H,ke),children:[jsx("line",{x1:x.x,y1:x.y,x2:te.x,y2:te.y,stroke:_l(H.type),strokeWidth:A?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ne?1:.6,markerEnd:oe?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ne&&jsx("text",{x:(x.x+te.x)/2,y:(x.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:jl(H.type)})]},H.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(H=>{let x=b===H.id,te=H.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",x&&"hovered",te&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:oe=>N(H.id,oe),onMouseEnter:()=>w(H.id),onMouseLeave:()=>w(null),onClick:oe=>R(H,oe),children:[jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:W(H),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:x?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Cp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[l,m]=useState(false),[i,c]=useState(null),[d,p]=useState(null),g=useRef(null),b=l||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let h=v=>{v.key==="Escape"&&!b&&w();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,b]);let w=()=>{b||(n(""),c(null),p(null),t());},f=async()=>{if(!(!s.trim()||b)){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);}}},y=()=>{d&&(a(d),w());};return e?jsxs(yt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:w,disabled:b,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,v)=>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},v))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,v)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&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})]})},v)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,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:b}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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,v)=>jsx("button",{onClick:()=>n(h),disabled:b,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},v))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:b&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:w,disabled:b,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick:y,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"}):jsx("button",{onClick:f,disabled:!s.trim()||b,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:b?"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 Ox={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},$x={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 zx(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 Yl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=zx(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),l=a.filter(d=>d.success),m=a.reduce((d,p)=>d+p.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?l.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 l=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:m,percentUsed:i,isExceeded:l>=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)}},To=new Yl;function Dp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(To.getStats()),[s,n]=useState(To.checkLimit(a));if(useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(To.getStats()),n(To.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),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 l=To.getRecentOperations(5);return jsxs(yt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[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:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Nn(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,i])=>{let c=r.costsByFeature[m]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Nn(c)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(m=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Nn(m.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),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 Pp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=useState(""),[m,i]=useState(""),[c,d]=useState(""),[p,g]=useState(false),[b,w]=useState(null),[f,y]=useState(null),[h,v]=useState(null),T=useRef(null),D=p||o;useEffect(()=>{e&&T.current&&T.current.focus();},[e]),useEffect(()=>{let I=C=>{C.key==="Escape"&&!D&&N();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,D]);let N=()=>{D||(l(""),i(""),d(""),w(null),y(null),v(null),t());},E=async()=>{if(!(!n.trim()||D)){g(true),w(null),y(null),v(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});y(I.tasks.tasks),v({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){w(I instanceof Error?I.message:"Failed to generate tasks");}finally{g(false);}}},k=()=>{f&&(a(f),N());};if(!e)return null;let R=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(yt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:I=>I.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:N,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:f?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&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?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):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"}),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&&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"]}),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:[f.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:f.map((I,C)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",C+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:I.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),I.start," \u2192 ",I.end]}),jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:T,value:n,onChange:I=>l(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:I=>i(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),b&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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((I,C)=>jsx("button",{onClick:()=>l(I),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:I},C))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:D&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:N,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),f?jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:E,disabled:!n.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Us({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(f=>{t&&Bn(()=>Promise.resolve(t(f)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,h,v)=>{console.warn(`Retry attempt ${h} after ${v}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),s=useCallback(async(f,y,h)=>{r(v=>{let T=v.cards.find(I=>I.id===f);if(!T)return v;let D=T.columnId,N={...T,columnId:y,position:h},E=v.cards.map(I=>I.id===f?N:I),k=v.columns.map(I=>{if(I.id===D)return {...I,cardIds:I.cardIds.filter(C=>C!==f)};if(I.id===y){let C=E.filter(W=>W.columnId===y).sort((W,H)=>W.position-H.position);return {...I,cardIds:C.map(W=>W.id)}}return I}),R={...v,cards:E,columns:k};return o(R),R});},[o]),n=useCallback(async(f,y)=>{r(h=>{let v=h.cards.map(D=>D.id===f?{...D,...y}:D),T={...h,cards:v};return o(T),T});},[o]),l=useCallback(async f=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...f,id:y},T=h.columns.map(N=>N.id===f.columnId?{...N,cardIds:[...N.cardIds,y]}:N),D={...h,cards:[...h.cards,v],columns:T};return o(D),D});},[o]),m=useCallback(async f=>{r(y=>{let h=y.cards.find(N=>N.id===f);if(!h)return y;let v=y.cards.filter(N=>N.id!==f),T=y.columns.map(N=>N.id===h.columnId?{...N,cardIds:N.cardIds.filter(E=>E!==f)}:N),D={...y,cards:v,columns:T};return o(D),D});},[o]),i=useCallback(async f=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...f,id:y,cardIds:[]},T={...h,columns:[...h.columns,v]};return o(T),T});},[o]),c=useCallback(async(f,y)=>{r(h=>{let v=h.columns.map(D=>D.id===f?{...D,...y}:D),T={...h,columns:v};return o(T),T});},[o]),d=useCallback(async f=>{r(y=>{let h=y.cards.filter(D=>D.columnId!==f),v=y.columns.filter(D=>D.id!==f),T={...y,cards:h,columns:v};return o(T),T});},[o]),p=useCallback(f=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(f),y},[l]),g=useCallback(f=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(f),y},[i]),b=useCallback(()=>{r(f=>{let y={...f,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:m,deleteColumn:d,clearBoard:b}}}function Fp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Us({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Dn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Lp={by:"none",order:"asc"};function Ip({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...Dn,...e}),[s,n]=useState({...Lp,...t}),l=useCallback(w=>{o(f=>({...f,...w}));},[]),m=useCallback(w=>{n(f=>({...f,...w}));},[]),i=useCallback(()=>{o(Dn),n(Lp);},[]),c=useCallback(()=>{a&&o({...Dn,assignees:[a]});},[a]),d=useCallback(()=>{o({...Dn,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...Dn,priorities:["HIGH","URGENT"]});},[]),g=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]),b=useCallback(w=>{let f=[...w];if(r.search){let y=r.search.toLowerCase();f=f.filter(h=>h.title.toLowerCase().includes(y)||h.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,h=y.getFullYear(),v=String(y.getMonth()+1).padStart(2,"0"),T=String(y.getDate()).padStart(2,"0"),D=`${h}-${v}-${T}`;f=f.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let E=N.endDate||N.dueDate;if(!E)return false;let k;if(typeof E=="string")k=E.split("T")[0]||E;else {let R=E.getUTCFullYear(),I=String(E.getUTCMonth()+1).padStart(2,"0"),C=String(E.getUTCDate()).padStart(2,"0");k=`${R}-${I}-${C}`;}switch(r.dateFilter){case "overdue":return k<D;case "today":return k===D;case "this-week":let R=new Date(D+"T00:00:00"),I=new Date(k+"T00:00:00"),C=new Date(R);return C.setDate(C.getDate()+7),I>=R&&I<=C;case "custom":if(r.dateRange){let W=typeof E=="string"?new Date(E):E;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(f=f.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(f=f.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(v=>r.assignees.includes(v)))),r.labels.length>0&&(f=f.filter(y=>y.labels&&y.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(f=f.filter(y=>r.columns.includes(y.columnId))),s.by!=="none"&&f.sort((y,h)=>{let v=0;switch(s.by){case "created":let T=y.createdAt?new Date(y.createdAt).getTime():0,D=h.createdAt?new Date(h.createdAt).getTime():0;v=T-D;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},E=N[y.priority||"LOW"],k=N[h.priority||"LOW"];v=E-k;break;case "dueDate":let R=y.endDate||y.dueDate,I=h.endDate||h.dueDate;if(!R)return 1;if(!I)return -1;let C=typeof R=="string"?new Date(R).getTime():R.getTime(),W=typeof I=="string"?new Date(I).getTime():I.getTime();v=C-W;break;case "title":v=y.title.localeCompare(h.title);break;case "estimate":let H=y.estimatedTime||0,x=h.estimatedTime||0;v=H-x;break;default:v=0;}return s.order==="asc"?v:-v}),f},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:p,applyFilters:b,hasActiveFilters:g}}var Rp,Op;if(typeof window<"u")try{let e=An("ai");Rp=e.generateObject,Op=e.generateText;}catch{}function $p(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(Rp&&Op&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function Xl(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function zp(e){let{cards:t}=e,[a,r]=Xl(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,b=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(w=>w!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(b&&a.lastSelectedCardId){let w=t.find(y=>y.id===d),f=t.find(y=>y.id===a.lastSelectedCardId);if(w&&f&&w.columnId===f.columnId){let y=t.filter(k=>k.columnId===w.columnId).sort((k,R)=>k.position-R.position),h=y.findIndex(k=>k.id===a.lastSelectedCardId),v=y.findIndex(k=>k.id===d),[T,D]=h<v?[h,v]:[v,h],N=y.slice(T,D+1).map(k=>k.id),E=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:E,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:m,toggleCard:i,getSelectedCards:c}}var Up={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Hp(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...Up,...a}),[a]),[s,n]=useState([]),l=useCallback((w,f,y,h,v)=>{if(f.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let T={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:w,cardIds:f,columnId:y,strategy:h,color:v,isExpanded:true,position:s.filter(D=>D.columnId===y).length,createdAt:new Date};n(D=>[...D,T]);},[o.minCardsPerStack,s]),m=useCallback(w=>{n(f=>f.filter(y=>y.id!==w));},[]),i=useCallback(w=>{n(f=>f.map(y=>y.id===w?{...y,isExpanded:!y.isExpanded}:y));},[]),c=useCallback((w,f)=>{n(y=>y.map(h=>h.id===w&&!h.cardIds.includes(f)?{...h,cardIds:[...h.cardIds,f]}:h));},[]),d=useCallback((w,f)=>{n(y=>y.map(h=>{if(h.id===w){let v=h.cardIds.filter(T=>T!==f);return v.length<o.minCardsPerStack?null:{...h,cardIds:v}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=useCallback(w=>s.filter(f=>f.columnId===w).sort((f,y)=>f.position-y.position),[s]),g=useCallback(async w=>{let f=t.filter(D=>D.columnId===w);if(f.length<o.minCardsPerStack*2)return [];let y=[],h=new Map;f.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(D);});}),h.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:D.map(E=>E.id),columnId:w,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${N}"`,confidence:.85});});let v=new Map;f.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(N=>{v.has(N)||v.set(N,[]),v.get(N).push(D);});}),v.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:D.map(E=>E.id),columnId:w,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let T=new Map;if(f.forEach(D=>{D.priority&&(T.has(D.priority)||T.set(D.priority,[]),T.get(D.priority).push(D));}),T.forEach((D,N)=>{if(D.length>=o.minCardsPerStack){let E={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";y.push({stack:{title:`${E} ${N} Priority`,cardIds:D.map(k=>k.id),columnId:w,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of f){let E=(await r.findSimilar(D,f)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(E.length>=o.minCardsPerStack-1){let k=[D.id,...E.map(I=>I.card.id)],R=E.reduce((I,C)=>I+C.similarity,0)/E.length;y.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:k,columnId:w,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${E.length+1} similar tasks`,confidence:R});}}return y.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,N)=>N.confidence-D.confidence).slice(0,5)},[t,o,r]),b=useCallback(w=>{l(w.stack.title,w.stack.cardIds,w.stack.columnId,w.stack.strategy,w.stack.color);},[l]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(f=>f.columnId)).forEach(async f=>{let y=await g(f),h=y[0];y.length>0&&h&&h.confidence>=.9&&b(h);});},[]),{stacks:s,createStack:l,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:b,config:o}}var Wp=createContext(null);function Gp({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=An("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=An("@libxai/core");n.set(m.id,new i(m));});let l=null;if(t?.board){let{Board:m}=An("@libxai/core");l=new m(t.board);}r.current=new BoardStore({board:l,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(Wp.Provider,{value:{store:o},children:e})}function Hs(){let e=useContext(Wp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function En(){let e=Hs(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=useCallback(h=>{e.updateBoard(h);},[e]),m=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,v)=>{e.updateColumn(h,v);},[e]),c=useCallback(h=>{e.deleteColumn(h);},[e]),d=useCallback(h=>e.getColumn(h),[e]),p=useCallback(h=>{e.addCard(h);},[e]),g=useCallback((h,v)=>{e.updateCard(h,v);},[e]),b=useCallback(h=>{e.deleteCard(h);},[e]),w=useCallback((h,v,T)=>{e.moveCard(h,v,T);},[e]),f=useCallback(h=>e.getCard(h),[e]),y=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:d,addCard:p,updateCard:g,deleteCard:b,moveCard:w,getCard:f,getCardsByColumn:y}}function _p(e){let{cards:t}=En();return 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 jp(e="position",t="asc"){let{cards:a}=En();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?l[o.priority]:0,i=s.priority?l[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 Ws=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Pd.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 l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{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);}},a2=new Ws;function Yp({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:m}){let i=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:p,className:o,children:jsx("div",{style:g,children:d.map(b=>{let w=e[b.index];if(!w)return null;let f=m?m(w,b.index):b.index,y={position:"absolute",top:n?0:b.start,left:n?b.start:0,width:n?b.size:"100%",height:n?"100%":b.size};return jsx("div",{style:y,"data-index":b.index,children:r(w,b.index)},f)})})})}function qp(e){return useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function Jp({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:m,horizontal:i=true}){let c=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},b={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:c,style:g,className:s,children:jsx("div",{style:b,children:p.map(w=>{let f=e[w.index];if(!f)return null;let y=m?m(f,w.index):w.index,h={position:"absolute",top:0,left:w.start,width:w.size,height:"100%"};return jsx("div",{style:h,"data-index":w.index,children:o(f,w.index)},y)})})})}function Zp(e){let t=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 Qp(e,t=10){return e>t}var ed={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},td={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ad={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},rd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},od={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},nd={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},sd={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},id={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)"},ld={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)"},dd={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},cd={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}},md={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}},Gs={spacing:ed,borderRadius:td,fontSize:ad,fontWeight:rd,lineHeight:od,zIndex:nd,duration:sd,easing:id,shadows:ld,opacity:dd,kanban:cd,gantt:md};function eg(e,t,a){return e[t]??a}function ud(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)?ud(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function n2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function pd(e="asakaa"){let t=ud(Gs),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=n2(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
403
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Qm(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=Qm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let m=l.name.toLowerCase();return n.every(i=>m.includes(i))})}function Tl(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 g=new Date(r);return g.setDate(g.getDate()+1),g}if(a==="yesterday"||a==="ayer"){let g=new Date(r);return g.setDate(g.getDate()-1),g}if(a==="next week"||a==="la pr\xF3xima semana"){let g=new Date(r);return g.setDate(g.getDate()+7),g}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 f={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(f!==void 0){let x=new Date(r),T=x.getDay(),p=f-T;return p<=0&&(p+=7),x.setDate(x.getDate()+p),x}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let g=parseInt(s[1],10),f=s[2].toLowerCase(),x=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?x.setDate(x.getDate()+g):f==="week"||f==="semana"||f==="semanas"?x.setDate(x.getDate()+g*7):(f==="month"||f==="mes"||f==="meses")&&x.setMonth(x.getMonth()+g),x}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let g=parseInt(l[1],10),f=parseInt(l[2],10)-1,x=parseInt(l[3],10);return new Date(x,f,g)}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 g=parseInt(i[1],10),f=m[i[2].toLowerCase()],x=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(x,f,g)}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},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let g=c[d[1].toLowerCase()],f=parseInt(d[2],10),x=d[3]?parseInt(d[3],10):r.getFullYear();if(g!==void 0)return new Date(x,g,f)}return null}function Nl(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 Dl(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 eu(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 tu(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(),d=Br(t,i),g=Tl(c);if(!d)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(!g)return {type:"move_task",taskId:d.id,taskName:d.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 f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(g);return x.setDate(x.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:g,endDate:x},message:`Moved "${d.name}" to ${g.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(),d=Br(t,i),g=Nl(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+g),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.name}" by ${g} days. New end date: ${f.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(),d=Br(t,i),g=Dl(c);return d?g===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:g},message:`Set "${d.name}" progress to ${g}%.`,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(),d=Br(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.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 l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=Br(t,i),g=Br(t,c);return d?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:d.id,dependencyTo:g.id,message:`Linked "${d.name}" \u2192 "${g.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 au(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 Vy(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 _y(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ss(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let d=a.find(g=>g.id===c);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Ss(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},l=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||l&&m&&Math.abs(m.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:m,progress:e.progress||0,status:Vy(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 ru(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:_y(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function ou(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ss(r,e,t))}var Sl={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags"},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",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas"},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:Sl,es:El};function Pl(e){return Es[e]||Es.en}function Ps(e,t){let a=Pl(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 Ml=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-blue-500"},{value:"completed",icon:CheckCircle2,color:"text-green-500"}];function nu(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function su({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let f=x=>{l.current&&!l.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let m=nu(e),i=Ml[0],c=Ml.find(f=>f.value===m)??i,d=c.icon,g=f=>{switch(nu(f)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:g(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:g(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:u("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:Ml.map(f=>{let x=f.icon;return jsxs("button",{onClick:T=>{T.stopPropagation(),t(f.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",m===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx(x,{className:u("w-4 h-4",f.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:g(f.value)})]},f.value)})})]})}var Fl=[{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 lu({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=Fl.find(c=>c.value===e)??Fl[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",m.color)}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Flag,{className:u("w-4 h-4",m.color)}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:u("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:Fl.map(c=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(c.value),n(false);},className:u("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:[jsx("div",{className:u("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function As(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ls(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 cv(e,t){if(!e)return null;let a=Math.round(e.assignedHoursThisWeek/e.weeklyCapacity*100);switch(e.level){case "light":return {color:t?"text-green-400 bg-green-500/20":"text-green-600 bg-green-100",icon:null,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "moderate":return {color:t?"text-yellow-400 bg-yellow-500/20":"text-yellow-600 bg-yellow-100",icon:Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "heavy":return {color:t?"text-orange-400 bg-orange-500/20":"text-orange-600 bg-orange-100",icon:Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "overloaded":return {color:t?"text-red-400 bg-red-500/20":"text-red-600 bg-red-100",icon:AlertTriangle,label:`${a}%`,tooltip:`SOBRECARGADO: ${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`}}}function mu({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false,showWorkloadIndicators:n=true}){let[l,m]=useState(false),[i,c]=useState(""),d=useRef(null);useEffect(()=>{let p=h=>{d.current&&!d.current.contains(h.target)&&(m(false),c(""));};return l&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]);let g=t.filter(p=>p.name.toLowerCase().includes(i.toLowerCase())||p.email?.toLowerCase().includes(i.toLowerCase())),f=n?[...g].sort((p,h)=>{let b={light:0,moderate:1,heavy:2,overloaded:3},y=p.workload?.level??"light",w=h.workload?.level??"light";return b[y]-b[w]}):g,x=p=>e.some(h=>h.name===p),T=p=>{if(a)if(x(p.name))a(e.filter(h=>h.name!==p.name));else {let h={name:p.name,initials:As(p.name),color:p.color||Ls(p.name).replace("bg-","").replace("-500",""),avatar:p.avatarUrl};a([...e,h]);}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((p,h)=>jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!p.avatar&&Ls(p.name)),style:p.color&&!p.avatar?{backgroundColor:p.color}:void 0,title:p.name,children:p.avatar?jsx("img",{src:p.avatar,alt:p.name,className:"w-full h-full rounded-full object-cover"}):p.initials||As(p.name)},`${p.name}-${h}`)),e.length>3&&jsxs("div",{className:u("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]})]}):jsxs("div",{ref:d,className:"relative",children:[jsx("button",{onClick:p=>{p.stopPropagation(),m(!l);},className:u("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?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((p,h)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!p.avatar&&Ls(p.name)),style:p.color&&!p.avatar?{backgroundColor:p.color}:void 0,children:p.avatar?jsx("img",{src:p.avatar,alt:p.name,className:"w-full h-full rounded-full object-cover"}):p.initials||As(p.name)},`${p.name}-${h}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),l&&jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-72",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[n&&jsxs("div",{className:u("px-3 py-2 text-xs border-b flex items-center gap-3",r?"text-[#9CA3AF] border-white/10":"text-gray-500 border-gray-200"),children:[jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),o==="es"?"Ligera":"Light"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-yellow-500"}),o==="es"?"Moderada":"Moderate"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"}),o==="es"?"Alta":"Heavy"]})]}),jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsx("input",{type:"text",value:i,onChange:p=>c(p.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:u("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:p=>p.stopPropagation()})}),jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:f.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):f.map(p=>{let h=cv(p.workload,r);return jsxs("button",{onClick:b=>{b.stopPropagation(),T(p);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",p.workload?.level==="overloaded"&&(r?"bg-red-500/5":"bg-red-50")),title:h?.tooltip,children:[jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!p.avatarUrl&&Ls(p.name)),children:p.avatarUrl?jsx("img",{src:p.avatarUrl,alt:p.name,className:"w-full h-full rounded-full object-cover"}):As(p.name)}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:r?"text-white":"text-gray-900",children:p.name}),p.email&&jsx("div",{className:u("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:p.email})]}),n&&h&&jsxs("div",{className:u("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",h.color),children:[h.icon&&jsx(h.icon,{className:"w-3 h-3"}),h.label]}),x(p.name)&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},p.id)})}),e.length>0&&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((p,h)=>jsxs("span",{className:u("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:[p.name,jsx("button",{onClick:b=>{b.stopPropagation(),a(e.filter(y=>y.name!==p.name));},className:"hover:text-red-500",children:jsx(X,{className:"w-3 h-3"})})]},`${p.name}-${h}`))})]})]})}function gu({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:m}){let[i,c]=useState(false),[d,g]=useState(o),[f,x]=useState(()=>{let E=o==="start"?e:t;if(E){let k=E instanceof Date?E:new Date(E);return new Date(k.getFullYear(),k.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),T=useRef(null),p=e?e instanceof Date?e:new Date(e):null,h=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let E=k=>{T.current&&!T.current.contains(k.target)&&c(false);};return i&&document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[i]),useEffect(()=>{i&&g(r?o:"start");},[i,r,o]);let b=E=>E?E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):m||"-",y=useCallback(()=>{let E=f.getFullYear(),k=f.getMonth(),R=new Date(E,k,1),C=new Date(E,k+1,0).getDate(),W=R.getDay(),H=[],te=new Date(E,k,0).getDate();for(let ne=W-1;ne>=0;ne--)H.push({date:new Date(E,k-1,te-ne),isCurrentMonth:false});for(let ne=1;ne<=C;ne++)H.push({date:new Date(E,k,ne),isCurrentMonth:true});let oe=42-H.length;for(let ne=1;ne<=oe;ne++)H.push({date:new Date(E,k+1,ne),isCurrentMonth:false});return H},[f]),w=E=>{if(r)o==="start"?a(E,h||void 0):a(p||void 0,E),c(false);else if(d==="start"){let k=h&&E>h?E:h;a(E,k||void 0),g("end");}else {let k=p&&E<p?E:p;a(k||void 0,E),c(false);}},D=()=>{let E=new Date,k=new Date(E);k.setDate(E.getDate()+1);let R=new Date(E);R.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let I=new Date(E);I.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let C=new Date(E);C.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let W=new Date(E);W.setDate(E.getDate()+14);let H=new Date(E);return H.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:R,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:W,display:W.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let E=r&&o==="start"?p:h;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:b(E)})]})}let N=r&&o==="start"?p:h;return jsxs("div",{ref:T,className:"relative",children:[jsxs("button",{onClick:E=>{E.stopPropagation(),c(!i);let k=o==="start"?p:h;k&&x(new Date(k.getFullYear(),k.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:b(N)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-white/10":"border-gray-200"),children:[D().map((E,k)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>w(E.date),children:[jsx("span",{children:E.label}),jsx("span",{className:u("text-xs",s?"text-[#6B7280]":"text-gray-400"),children:E.display})]},k)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,h||void 0):a(p||void 0,void 0):a(void 0,void 0),c(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:d==="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"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:f.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>x(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>x(new Date(f.getFullYear(),f.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>x(new Date(f.getFullYear(),f.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),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(E=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:y().map((E,k)=>{let R=E.date.toDateString()===new Date().toDateString(),I=p?.toDateString()===E.date.toDateString(),C=h?.toDateString()===E.date.toDateString(),W=I||C,H=!r&&p&&h&&E.date>=p&&E.date<=h;return jsx("button",{onClick:()=>w(new Date(E.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(s?"text-[#4B5563]":"text-gray-300"),E.isCurrentMonth&&(s?"text-white":"text-gray-900"),R&&"ring-2 ring-[#3B82F6]",I&&"bg-[#3B82F6] text-white",C&&!I&&"bg-[#7C3AED] text-white",H&&!W&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!W&&(s?"hover:bg-white/10":"hover:bg-gray-100")),children:E.date.getDate()},k)})})]})]})]})]})}function Is({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let m=e?e instanceof Date?e:new Date(e):null;return jsx(gu,{startDate:s==="start"?m:n||null,endDate:s==="end"?m:l||null,onChange:(g,f)=>{t&&t(s==="start"?g:f);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function hu({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),l=s.clientX-n.left,m=Math.round(l/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxs("span",{className:u("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function xu({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[l,m]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{m(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=g=>{g.key==="Enter"?c():g.key==="Escape"&&(m(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:g=>m(g.target.value),onBlur:c,onKeyDown:d,onClick:g=>g.stopPropagation(),className:u("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")}):jsx("button",{onClick:g=>{g.stopPropagation(),n(true);},className:u("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 Bs(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function ku(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[l,m]=useState(false),i=useRef(e),c=useRef([]);return useEffect(()=>{if(c.current.forEach(clearTimeout),c.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,g=e,f=g-d,x=r/o;m(true);for(let T=1;T<=o;T++){let p=setTimeout(()=>{let h=T/o,b=1-Math.pow(1-h,3),y=Math.round(d+f*b);n(y),T===o&&(m(false),n(g));},x*T);c.current.push(p);}return i.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function wu(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,l]=useState(0),m=useRef(null),i=useRef(null),c=useCallback(f=>{m.current&&clearTimeout(m.current),i.current&&clearInterval(i.current),s(f),l(0);let x=Date.now();i.current=setInterval(()=>{let T=Date.now()-x,p=Math.min(T/a*100,100);l(p);},16),m.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(f),s(null),l(0);},a);},[a,e]),d=useCallback(()=>{m.current&&clearTimeout(m.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{m.current&&clearTimeout(m.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:c,cancelChange:d}}function Nu({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:m=true}){let[i,c]=useState(false),[d,g]=useState(e?.toString()||""),f=useRef(null),{isFlashing:x,triggerFlash:T}=Bs(),{displayValue:p,isAnimating:h}=ku(e,{enabled:l&&!i});useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]),useEffect(()=>{g(e?.toString()||"");},[e]);let b=()=>{let w=parseFloat(d);if(!isNaN(w)){let D=w;o!==void 0&&(D=Math.max(o,D)),s!==void 0&&(D=Math.min(s,D)),D!==e&&(t?.(D),m&&T());}c(false);},y=w=>{w.key==="Enter"?b():w.key==="Escape"&&(g(e?.toString()||""),c(false));};return n||!t?jsx("span",{className:u("text-sm transition-all",a?"text-[#94A3B8]":"text-gray-500",h&&"font-medium"),children:p!==void 0?p:r}):i?jsx("input",{ref:f,type:"number",value:d,onChange:w=>g(w.target.value),onBlur:b,onKeyDown:y,onClick:w=>w.stopPropagation(),min:o,max:s,className:u("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")}):jsx("button",{onClick:w=>{w.stopPropagation(),c(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-all duration-300",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",p===void 0&&(a?"text-[#6B7280]":"text-gray-400"),x&&(a?"bg-green-500/30":"bg-green-500/20"),h&&"font-medium scale-105"),children:p!==void 0?p:r})}function Du({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=useState(false),m=useRef(null);return useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:u("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:[jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsx("div",{className:u("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?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:u("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:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Eu({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:m,startChange:i,cancelChange:c}=wu(t,{delay:s}),d=f=>{f.stopPropagation(),!r&&t&&(o?l?c():i(!e):t(!e));},g=l?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-all",g?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&g&&"ring-green-500/50",l&&!g&&"ring-red-500/50",l&&(a?"ring-offset-[#0F1117]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:g?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${m/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):g?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:f=>{f.stopPropagation(),c();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function Fu({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>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&&jsxs("span",{className:u("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 Mv(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function Fv(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a){let l=parseInt(a[1],10),m=parseInt(a[2],10);return l*60+m}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r){let l=parseFloat(r[1]),m=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+m}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o)return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)?$/);if(s)return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n)}function ko({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true}){let [l,m]=useState(false),[i,c]=useState(""),d=useRef(null),{isFlashing:g,triggerFlash:f}=Bs(),T=Mv(e,r);useEffect(()=>{l&&d.current&&(d.current.focus(),d.current.select());},[l]),useEffect(()=>{if(e){let b=Math.floor(e/60),y=e%60;b>0&&y>0?c(`${b}h ${y}m`):b>0?c(`${b}h`):c(`${y}m`);}else c("");},[e,l]);let p=()=>{let b=Fv(i);b!==e&&(t?.(b),n&&f()),m(false);},h=b=>{b.key==="Enter"?p():b.key==="Escape"&&m(false);};return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:T})]}):l?jsx("input",{ref:d,type:"text",value:i,onChange:b=>c(b.target.value),onBlur:p,onKeyDown:h,onClick:b=>b.stopPropagation(),placeholder:"1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:b=>{b.stopPropagation(),m(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-all duration-300 overflow-hidden",a?"hover:bg-white/10":"hover:bg-gray-100",e!=null&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400",g&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(Clock,{className:u("w-3 h-3 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:"truncate",children:T})]})}function _v(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function jv(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 zu({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let d=useRef(null),g=r==="es"?Ou.es:Ou.en;if(useEffect(()=>{let h=y=>{d.current&&!d.current.contains(y.target)&&t();},b=y=>{y.key==="Escape"&&t();};return document.addEventListener("mousedown",h),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",b);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let h=[];return o&&h.push({id:"edit",label:g.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),h.push({id:"sep1",label:"",icon:null,separator:true}),l&&(h.push({id:"status",label:g.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:g.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:g.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:g.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),h.push({id:"priority",label:g.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:g.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:g.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:g.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:g.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&h.push({id:"assign",label:g.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(b=>({id:`assign-${b.id}`,label:b.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:b.name.charAt(0).toUpperCase()}),onClick:()=>{let y=e.task.assignees||[],D=y.some(N=>N.name===b.name)?y.filter(N=>N.name!==b.name):[...y,{name:b.name,initials:_v(b.name),color:b.color||jv(b.name),avatar:b.avatarUrl}];l({...e.task,assignees:D}),t();}}))})),h.push({id:"sep2",label:"",icon:null,separator:true}),s&&h.push({id:"duplicate",label:g.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&h.push({id:"delete",label:g.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),h},x=()=>{if(!e.columnId)return [];let h=[];return i&&(h.push({id:"sort-asc",label:g.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),h.push({id:"sort-desc",label:g.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(h.push({id:"sep-hide",label:"",icon:null,separator:true}),h.push({id:"hide",label:g.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),h},T=e.type==="task"?f():x(),p={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:d,style:p,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:T.map(h=>h.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/10":"bg-gray-200")},h.id):h.submenu?jsx(Kv,{item:h,isDark:a},h.id):jsxs("button",{onClick:h.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",h.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(h.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:h.icon}),h.label]},h.id))})}function Kv({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:u("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:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:u("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(l=>jsxs("button",{onClick:l.onClick,className:u("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:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Ou={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 _u={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},dx=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function Ku({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[m,i]=useState(""),c=useRef(null),d=l==="es"?ju.es:ju.en;if(useEffect(()=>{if(!e)return;let h=setTimeout(()=>{let b=w=>{c.current&&!c.current.contains(w.target)&&t();},y=w=>{w.key==="Escape"&&t();};document.addEventListener("mousedown",b),document.addEventListener("keydown",y),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(h),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let g=h=>d.columns[h]||h,f=h=>{if(h==="name")return;let b=a.map(y=>y.id===h?{...y,visible:!y.visible}:y);o(b);},x=(h,b)=>{let y=a.find(D=>D.type===h&&(!b||D.customFieldId===b));if(y){f(y.id);return}let w={id:b||h,type:h,label:b?r.find(D=>D.id===b)?.name||h:g(h),width:120,visible:true,sortable:true,resizable:true,customFieldId:b};o([...a,w]);},T=dx.filter(h=>g(h).toLowerCase().includes(m.toLowerCase())),p=r.filter(h=>h.name.toLowerCase().includes(m.toLowerCase()));return jsxs("div",{ref:c,className:u("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:[jsxs("div",{className:u("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:u("font-medium",n?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:u("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsx("div",{className:"p-3",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsx("input",{type:"text",value:m,onChange:h=>i(h.target.value),placeholder:d.searchPlaceholder,className:u("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")})]})}),jsxs("div",{className:"overflow-y-auto max-h-[calc(100vh-300px)] min-h-[200px]",children:[jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:u("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.standardFields}),jsx("div",{className:"space-y-1",children:T.map(h=>{let b=a.find(D=>D.type===h&&!D.customFieldId),y=b?.visible??false,w=h==="name";return jsxs("button",{onClick:()=>{w||(b?f(b.id):x(h));},disabled:w,className:u("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",w&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center",y?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:y&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_u[h]}),jsx("span",{className:n?"text-white":"text-gray-900",children:g(h)})]},h)})})]}),p.length>0&&jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:u("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.customFields}),jsx("div",{className:"space-y-1",children:p.map(h=>{let y=a.find(w=>w.customFieldId===h.id)?.visible??false;return jsxs("button",{onClick:()=>x(h.type,h.id),className:u("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:[jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center",y?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:y&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_u[h.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{className:n?"text-white":"text-gray-900",children:h.name})]},h.id)})})]})]}),s&&jsx("div",{className:u("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:s,className:u("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:[jsx(Plus,{className:"w-4 h-4"}),d.createField]})})]})}var ju={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",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",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",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var yx=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function Xu({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[l,m]=useState("text"),[i,c]=useState([""]),d=o==="es"?qu.es:qu.en;useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),useEffect(()=>{let p=h=>{h.key==="Escape"&&t();};return e&&document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]);let g=()=>{if(!s.trim())return;let p={name:s.trim(),type:l};l==="dropdown"&&(p.options=i.filter(h=>h.trim())),a(p),t();},f=()=>{c([...i,""]);},x=(p,h)=>{let b=[...i];b[p]=h,c(b);},T=p=>{i.length>1&&c(i.filter((h,b)=>b!==p));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:p=>n(p.target.value),placeholder:d.fieldNamePlaceholder,className:u("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})]}),jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:yx.map(p=>jsxs("button",{onClick:()=>m(p.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===p.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===p.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:p.icon}),jsx("span",{className:u("text-xs",l===p.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[p.type]})]},p.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[i.map((p,h)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:p,onChange:b=>x(h,b.target.value),placeholder:`${d.option} ${h+1}`,className:u("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&&jsx("button",{onClick:()=>T(h),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},h)),jsxs("button",{onClick:f,className:u("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:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsx("button",{onClick:t,className:u("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:d.cancel}),jsx("button",{onClick:g,disabled:!s.trim(),className:u("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:d.create})]})]})]}):null}var qu={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 Qu={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 ep({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=useState(false),m=useRef(null),i=useRef(0),c=s==="es"?Qu.es:Qu.en;useEffect(()=>{if(!n)return;let f=T=>{Date.now()-i.current<100||m.current&&!m.current.contains(T.target)&&l(false);},x=T=>{T.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",x);}},[n]);let d=[{value:"all",label:c.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],g=e!=="all"||t;return jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),l(x=>!x);},className:u("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",g&&(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:[jsx(Filter,{className:"w-4 h-4"}),c.filters,g&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("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:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(f=>{let x=e===f.value&&!t,T=()=>f.value==="all"?x?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxs("button",{onClick:()=>{a(f.value),r(false),l(false);},className:u("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",x&&(o?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u(x?f.color:"text-gray-400","flex-shrink-0"),children:T()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),x&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let f=!t;r(f),f&&a("all"),l(false);},className:u("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:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var Ax=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,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 np({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:d,showSearch:g=true,showHierarchy:f=true,tableColumns:x,allowColumnCustomization:T=true,allowColumnResize:p=true,enableContextMenu:h=true,showCreateTaskButton:b=false,onCreateTask:y,persistFilter:w=false}=t,D=Ps(c,d),N=i==="dark",E=useCallback(()=>{if(!w||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let O=localStorage.getItem(w);if(O){let ae=JSON.parse(O);return {statusFilter:ae.statusFilter||"all",hideCompleted:ae.hideCompleted||!1}}}catch(O){console.error("Error loading persisted filter:",O);}return {statusFilter:"all",hideCompleted:false}},[w]),[k,R]=useState("startDate"),[I,C]=useState("asc"),[W,H]=useState(""),[v,te]=useState(()=>E().statusFilter),[oe,ne]=useState(()=>E().hideCompleted),[A,ke]=useState(x||Ax),[Ie,L]=useState(false),[U,S]=useState(false),[K,J]=useState({isOpen:false,x:0,y:0,type:"task"}),[ie,ue]=useState(null),[ye,Oe]=useState(0),[Q,Je]=useState(0),Pe=useRef(null);useEffect(()=>{x&&ke(x);},[x]),useEffect(()=>{if(!(!w||typeof window>"u"))try{localStorage.setItem(w,JSON.stringify({statusFilter:v,hideCompleted:oe}));}catch(O){console.error("Error persisting filter state:",O);}},[w,v,oe]);let rt=useMemo(()=>{let O=new Set;function ae(Le){for(let je of Le)je.subtasks?.length&&(je.isExpanded!==false&&O.add(je.id),ae(je.subtasks));}return ae(e),O},[e]),ut=useMemo(()=>A.filter(O=>O.visible),[A]),It=useCallback(O=>{a.onTaskToggleExpand?.(O);},[a]),Xe=useCallback(O=>{k===O?C(ae=>ae==="asc"?"desc":"asc"):(R(O),C("asc")),a.onSortChange?.({column:O,direction:I==="asc"?"desc":"asc"});},[k,I,a]),pt=useCallback(O=>{ke(O),a.onColumnsChange?.(O);},[a]),ce=useCallback(O=>{let ae=A.map(Le=>Le.id===O?{...Le,visible:false}:Le);pt(ae);},[A,pt]),Ge=useCallback((O,ae)=>{R(O),C(ae);},[]),Be=useCallback((O,ae,Le)=>{h&&(O.preventDefault(),J({isOpen:true,x:O.clientX,y:O.clientY,type:ae?"task":"header",task:ae,columnId:Le}));},[h]),B=useCallback(()=>{J(O=>({...O,isOpen:false}));},[]),X=useCallback((O,ae)=>{if(!p)return;O.preventDefault(),O.stopPropagation();let Le=A.find(je=>je.id===ae);Le&&(ue(ae),Oe(O.clientX),Je(Le.width));},[A,p]);useEffect(()=>{if(!ie)return;let O=Le=>{let je=Le.clientX-ye,qe=Math.max(50,Q+je),j=A.map($=>$.id===ie?{...$,width:qe}:$);ke(j);},ae=()=>{ie&&a.onColumnsChange?.(A),ue(null);};return document.addEventListener("mousemove",O),document.addEventListener("mouseup",ae),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",ae);}},[ie,ye,Q,A,a]);let ge=useCallback(async O=>{if(a.onCreateCustomField){let ae={...O,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(ae);}S(false);},[a]),Ae=useCallback(O=>O.progress===100||O.status==="completed"?"completed":O.progress&&O.progress>0||O.status==="in-progress"?"in-progress":"todo",[]),Ue=useMemo(()=>{let O=op(e);if(W.trim()){let ae=W.toLowerCase();O=O.filter(Le=>Le.name.toLowerCase().includes(ae));}return v!=="all"&&(O=O.filter(ae=>Ae(ae)===v)),oe&&(O=O.filter(ae=>Ae(ae)!=="completed")),O.sort((ae,Le)=>{let je,qe;switch(k){case "name":je=ae.name.toLowerCase(),qe=Le.name.toLowerCase();break;case "startDate":je=ae.startDate?.getTime()||0,qe=Le.startDate?.getTime()||0;break;case "endDate":je=ae.endDate?.getTime()||0,qe=Le.endDate?.getTime()||0;break;case "progress":je=ae.progress||0,qe=Le.progress||0;break;case "status":je=ae.status||"todo",qe=Le.status||"todo";break;case "priority":let j={urgent:0,high:1,medium:2,low:3,none:4};je=j[ae.priority]??4,qe=j[Le.priority]??4;break;default:return 0}return je<qe?I==="asc"?-1:1:je>qe?I==="asc"?1:-1:0}),O},[e,W,v,oe,k,I,Ae]),nt=useCallback((O,ae)=>{let Le=j=>{a.onTaskUpdate?.({...O,...j});},je=j=>j?O.customFields?.find(Me=>Me.fieldId===j)?.value:void 0,qe=(j,$)=>{if(!j)return;let ht=[...O.customFields||[]],le=ht.findIndex(He=>He.fieldId===j);le>=0?ht[le]={fieldId:j,value:$}:ht.push({fieldId:j,value:$}),Le({customFields:ht});};switch(ae.type){case "name":return null;case "status":return jsx(su,{value:O.status||(O.progress===100?"completed":O.progress&&O.progress>0?"in-progress":"todo"),onChange:$=>{Le({status:$,progress:$==="completed"?100:$==="in-progress"?50:0});},isDark:N,locale:c,translations:D.status});case "priority":return jsx(lu,{value:O.priority,onChange:$=>Le({priority:$}),isDark:N,locale:c});case "assignees":return jsx(mu,{value:O.assignees||[],availableUsers:l,onChange:$=>Le({assignees:$}),isDark:N,locale:c});case "startDate":return jsx(Is,{value:O.startDate,onChange:$=>Le({startDate:$}),isDark:N,locale:c,dateField:"start",startDate:O.startDate,endDate:O.endDate});case "endDate":return jsx(Is,{value:O.endDate,onChange:$=>Le({endDate:$}),isDark:N,locale:c,dateField:"end",startDate:O.startDate,endDate:O.endDate});case "progress":return jsx(hu,{value:O.progress||0,onChange:$=>{let Me=$===100?"completed":$>0?"in-progress":"todo";Le({progress:$,status:Me});},isDark:N});case "tags":return jsx(Fu,{value:O.tags||[],isDark:N});case "text":return jsx(xu,{value:je(ae.customFieldId)||"",onChange:$=>qe(ae.customFieldId,$),isDark:N});case "number":return jsx(Nu,{value:je(ae.customFieldId)||0,onChange:$=>qe(ae.customFieldId,$),isDark:N});case "date":let j=je(ae.customFieldId);return jsx(Is,{value:j?new Date(j):void 0,onChange:$=>qe(ae.customFieldId,$),isDark:N,locale:c});case "dropdown":return jsx(Du,{value:je(ae.customFieldId)||"",options:ae.options||[],onChange:$=>qe(ae.customFieldId,$),isDark:N});case "checkbox":return jsx(Eu,{value:je(ae.customFieldId)||false,onChange:$=>qe(ae.customFieldId,$),isDark:N});case "estimatedTime":return jsx(ko,{value:O.estimatedTime,onChange:$=>Le({estimatedTime:$}),isDark:N,locale:c});case "quotedTime":return jsx(ko,{value:O.quotedTime,onChange:$=>Le({quotedTime:$}),isDark:N,locale:c});case "elapsedTime":return jsx(ko,{value:O.elapsedTime,onChange:$=>Le({elapsedTime:$}),isDark:N,locale:c});case "effortMinutes":return jsx(ko,{value:O.effortMinutes,onChange:$=>Le({effortMinutes:$}),isDark:N,locale:c});case "timeLoggedMinutes":return jsx(ko,{value:O.timeLoggedMinutes,onChange:a.onLogTime?$=>{a.onLogTime?.(O,$);}:void 0,isDark:N,locale:c,placeholder:c==="es"?"Agregar":"Add"});case "soldEffortMinutes":return jsx(ko,{value:O.soldEffortMinutes,onChange:$=>Le({soldEffortMinutes:$}),isDark:N,locale:c});default:return jsx("span",{className:u("text-sm",N?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,N,c,l,D]),Pt=useCallback(O=>{let Le={name:D.columns.name,status:D.columns.status,priority:D.columns.priority,assignees:D.columns.assignees,startDate:D.columns.startDate,endDate:D.columns.endDate,progress:D.columns.progress,tags:D.columns.tags||(c==="es"?"Etiquetas":"Tags"),estimatedTime:D.columns.estimatedTime||(c==="es"?"Estimado":"Estimated"),quotedTime:D.columns.quotedTime||(c==="es"?"Ofertado":"Quoted"),elapsedTime:D.columns.elapsedTime||(c==="es"?"Tiempo":"Time Spent"),effortMinutes:D.columns.effortMinutes||(c==="es"?"Estimado":"Estimated"),timeLoggedMinutes:D.columns.timeLoggedMinutes||(c==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:D.columns.soldEffortMinutes||(c==="es"?"Ofertado":"Quoted")}[O.type]||O.label;return typeof Le=="string"?Le:String(Le||O.type)},[D,c]),$e=useMemo(()=>ut.reduce((O,ae)=>O+ae.width,0)+(T?48:0),[ut,T]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",N?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:[D.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",N?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",N?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:D.empty.noTasks}),jsx("p",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.addFirstTask})]})}):jsxs("div",{ref:Pe,className:u("flex-1 flex flex-col w-full h-full overflow-hidden",N?"bg-[#0F1117]":"bg-white",ie&&"select-none",s),style:n,children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",N?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(ep,{value:v,hideCompleted:oe,onChange:te,onHideCompletedChange:ne,isDark:N,locale:c}),jsxs("div",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:[Ue.length," ",D.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",N?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:W,onChange:O=>H(O.target.value),placeholder:D.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",N?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),b&&y&&jsxs(motion.button,{onClick:y,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:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:D.toolbar.newTask})]})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsxs("div",{style:{minWidth:$e},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",N?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[ut.map(O=>jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-3",N?"text-[#9CA3AF]":"text-gray-500"),style:{width:O.width,minWidth:O.minWidth},onContextMenu:ae=>Be(ae,void 0,O.id),children:[O.sortable?jsxs("button",{onClick:()=>Xe(O.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Pt(O),jsx(ArrowUpDown,{className:u("w-3 h-3",k===O.id&&"text-[#3B82F6]")})]}):jsx("span",{children:Pt(O)}),p&&O.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",ie===O.id&&"bg-[#3B82F6]"),onMouseDown:ae=>X(ae,O.id)})]},O.id)),T&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsx("button",{onClick:O=>{O.stopPropagation(),L(ae=>!ae);},className:u("p-1.5 rounded-lg transition-colors",N?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Ie&&(N?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-4 h-4"})}),jsx(Ku,{isOpen:Ie,onClose:()=>L(false),columns:A,customFields:m,onColumnsChange:pt,onCreateCustomField:()=>{L(false),S(true);},isDark:N,locale:c})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ue.map((O,ae)=>{let Le=rt.has(O.id),je=Math.min(ae*.01,.2);return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:je},className:u("flex items-center border-b transition-colors",N?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(O),onDoubleClick:()=>a.onTaskDoubleClick?.(O),onContextMenu:qe=>Be(qe,O),children:[ut.map(qe=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:qe.width,minWidth:qe.minWidth},children:qe.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&O.level>0&&jsx("div",{style:{width:`${O.level*24}px`},className:"flex-shrink-0"}),f&&O.hasChildren&&jsx("button",{onClick:j=>{j.stopPropagation(),It(O.id);},className:u("p-0.5 rounded flex-shrink-0",N?"hover:bg-white/10":"hover:bg-gray-200"),children:Le?jsx(ChevronDown,{className:u("w-4 h-4",N?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",N?"text-[#9CA3AF]":"text-gray-400")})}),f&&!O.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsx("span",{className:u("truncate font-medium",N?"text-white":"text-gray-900",O.progress===100&&(N?"line-through text-[#6B7280]":"line-through text-gray-400")),children:O.name})]}):nt(O,qe)},qe.id)),T&&jsx("div",{className:"w-12 flex-shrink-0"})]},O.id)})}),Ue.length===0&&W&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",N?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u(N?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.noResults})]})})]})}),jsx(zu,{state:K,onClose:B,isDark:N,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ce,onColumnSort:Ge,availableUsers:l}),jsx(Xu,{isOpen:U,onClose:()=>S(false),onSave:ge,isDark:N,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:140,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},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,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"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"}],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 Hl={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"},Wl={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"},Gl={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"},$s={dark:Hl,light:Wl,neutral:Gl};function dp(e){return $s[e]||$s.dark}var Vl={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"}},_l={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"}},zs={en:Vl,es:_l};function Tn(e){return zs[e]||zs.en}function Us(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 Kl(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"?jsx(CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsx(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:l,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:g,currentUser:f,mentionableUsers:x,onUploadCommentAttachments:T,onTaskOpen:p,enableTimeTracking:h,timeTrackingSummary:b,timeEntries:y,timerState:w,onLogTime:D,onUpdateEstimate:N,onStartTimer:E,onStopTimer:k,onDiscardTimer:R}){let{theme:I="dark",locale:C="en",customTranslations:W}=t,H=Us(C,W),v=I==="dark",[te,oe]=useState(r||new Date),[ne,A]=useState(null),[ke,Ie]=useState(null),[L,U]=useState({}),S=4,K=3,[J,ie]=useState(null),[ue,ye]=useState(""),[Oe,Q]=useState(void 0),[Je,Pe]=useState(null),[rt,ut]=useState(false),[It,Xe]=useState(false),[pt,ce]=useState(null),[Ge,Be]=useState(false),[B,X$1]=useState(new Date),ge=useCallback(()=>{oe(new Date(te.getFullYear(),te.getMonth()-1,1));},[te]),Ae=useCallback(()=>{oe(new Date(te.getFullYear(),te.getMonth()+1,1));},[te]),Ue=useCallback(()=>{oe(new Date);},[]),nt=useMemo(()=>{let O=te.getFullYear(),ae=te.getMonth(),Le=new Date(O,ae,1),je=new Date(O,ae+1,0),qe=Le.getDay(),j=je.getDate(),$=bp(e),Me=new Date;Me.setHours(0,0,0,0);let ht=[],le=qe,He=new Date(O,ae,0).getDate();for(let Re=le-1;Re>=0;Re--){let de=new Date(O,ae-1,He-Re);ht.push({date:de,isCurrentMonth:false,isToday:false,isWeekend:de.getDay()===0||de.getDay()===6,events:$.filter(Ve=>Kl(de,Ve)).map(Ve=>({id:Ve.id,title:Ve.name,start:Ve.startDate,end:Ve.endDate,task:Ve}))});}for(let Re=1;Re<=j;Re++){let de=new Date(O,ae,Re),Ve=de.getTime()===Me.getTime();ht.push({date:de,isCurrentMonth:true,isToday:Ve,isWeekend:de.getDay()===0||de.getDay()===6,events:$.filter(V=>Kl(de,V)).map(V=>({id:V.id,title:V.name,start:V.startDate,end:V.endDate,task:V}))});}let De=42-ht.length;for(let Re=1;Re<=De;Re++){let de=new Date(O,ae+1,Re);ht.push({date:de,isCurrentMonth:false,isToday:false,isWeekend:de.getDay()===0||de.getDay()===6,events:$.filter(Ve=>Kl(de,Ve)).map(Ve=>({id:Ve.id,title:Ve.name,start:Ve.startDate,end:Ve.endDate,task:Ve}))});}return ht},[te,e]),Pt=C==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],$e=te.toLocaleDateString(C==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsx("div",{className:u("flex-1 flex items-center justify-center",v?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:u("text-sm",v?"text-[#9CA3AF]":"text-gray-600"),children:[H.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",v?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",v?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",v?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",v?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",v?"text-white":"text-gray-900"),children:H.labels.noEvents}),jsx("p",{className:u("text-sm",v?"text-[#9CA3AF]":"text-gray-600"),children:H.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-auto",v?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",v?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:u("text-xl font-semibold capitalize",v?"text-white":"text-gray-900"),children:$e}),jsx("button",{onClick:Ue,className:u("px-3 py-1.5 text-sm rounded-lg transition-colors",v?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:H.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:ge,className:u("p-2 rounded-lg transition-colors",v?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-5 h-5",v?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:Ae,className:u("p-2 rounded-lg transition-colors",v?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-5 h-5",v?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:Pt.map(O=>jsx("div",{className:u("py-2 text-center text-xs font-medium uppercase",v?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsx("div",{className:u("grid grid-cols-7 auto-rows-min gap-px rounded-lg",v?"bg-[#2D2D2D]":"bg-gray-300"),children:nt.map((O,ae)=>{let Le=O.date.getDay()===0||O.date.getDay()===6;return jsxs("div",{className:u("min-h-[120px] p-2 transition-colors flex flex-col relative group",v?Le?"bg-[#1C1F26]":O.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Le?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let je=L[ae]||S,qe=O.events.slice(0,je),j=O.events.length-je;return jsxs("div",{className:"space-y-1 flex-1",children:[qe.map($=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{A($.task),a.onEventClick?.($),p?.($.task.id);},whileHover:{scale:1.02},className:u("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",$.task.progress===100?v?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":v?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(hp,{task:$.task}),jsx("span",{className:"truncate",children:$.title})]})},$.id)),j>0&&jsxs("button",{onClick:$=>{$.stopPropagation(),U(Me=>({...Me,[ae]:je+K}));},className:u("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",v?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",j," ",C==="es"?"M\xC1S":"MORE"]}),je>S&&O.events.length>S&&jsx("button",{onClick:$=>{$.stopPropagation(),U(Me=>({...Me,[ae]:S}));},className:u("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",v?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:C==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let je=ae>=28,qe=ae%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:j=>{j.stopPropagation(),J===ae?ie(null):(ie(ae),ye(""),Q(void 0),Pe(null),ce(null),ut(false),Xe(false),Be(false),X$1(O.date));},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",J===ae?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",v?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",J===ae&&"rotate-45")})}),jsx(AnimatePresence,{children:J===ae&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ie(null),ye(""),Q(void 0),Pe(null),ce(null),ut(false),Xe(false),Be(false);}}),jsxs(motion.div,{initial:{opacity:0,y:je?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:je?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",je?"bottom-full mb-1":"top-full mt-1",qe?"right-0":"left-0",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:j=>{j.stopPropagation(),ut(false),Xe(false),Be(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:ue,onChange:j=>ye(j.target.value),placeholder:C==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:u("w-full bg-transparent text-sm outline-none placeholder:opacity-40",v?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:j=>{if(j.key==="Enter"&&ue.trim()){let $=t.availableUsers?.find(ht=>ht.id===Je),Me=pt||O.date;a.onTaskCreate?.({name:ue.trim(),startDate:Me,endDate:Me,priority:Oe,assignees:$?[$]:void 0}),ye(""),Q(void 0),Pe(null),ce(null),ie(null);}j.key==="Escape"&&(ie(null),ye(""),Q(void 0),Pe(null),ce(null));}})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",v?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:j=>{j.stopPropagation(),ut(!rt),Xe(false);},className:u("p-1 rounded transition-colors",Oe?Oe==="urgent"||Oe==="high"?"text-red-400 bg-red-500/20":Oe==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":v?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:rt&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:j=>j.stopPropagation(),children:[{id:"urgent",label:C==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:C==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:C==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:C==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:C==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(j=>jsxs("button",{onClick:()=>{Q(j.id),ut(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",v?"hover:bg-white/5":"hover:bg-gray-50",Oe===j.id&&(v?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",j.color)}),jsx("span",{className:v?"text-white":"text-gray-900",children:j.label})]},j.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:j=>{j.stopPropagation(),Be(!Ge),ut(false),Xe(false),X$1(pt||O.date);},className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",pt?"bg-[#7C3AED]/20 text-[#7C3AED]":v?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),(pt||O.date).toLocaleDateString(C==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:Ge&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:j=>j.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",v?"border-white/10":"border-gray-200"),children:(()=>{let j=new Date,$=new Date(j);$.setDate(j.getDate()+1);let Me=new Date(j);Me.setDate(j.getDate()+((6-j.getDay()+7)%7||7));let ht=new Date(j);ht.setDate(j.getDate()+((1-j.getDay()+7)%7||7));let le=new Date(j);le.setDate(j.getDate()+14);let He=new Date(j);return He.setDate(j.getDate()+28),[{label:C==="es"?"Hoy":"Today",date:j,display:j.toLocaleDateString(C==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:C==="es"?"Ma\xF1ana":"Tomorrow",date:$,display:$.toLocaleDateString(C==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:C==="es"?"Este fin de semana":"This weekend",date:Me,display:C==="es"?"s\xE1b.":"sat."},{label:C==="es"?"Pr\xF3xima semana":"Next week",date:ht,display:C==="es"?"lun.":"mon."},{label:C==="es"?"2 semanas":"2 weeks",date:le,display:le.toLocaleDateString(C==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:C==="es"?"4 semanas":"4 weeks",date:He,display:He.toLocaleDateString(C==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Re,de)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",v?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ce(Re.date),Be(false);},children:[jsx("span",{children:Re.label}),jsx("span",{className:u("text-[10px]",v?"text-[#6B7280]":"text-gray-400"),children:Re.display})]},de))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium",v?"text-white":"text-gray-900"),children:B.toLocaleDateString(C==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>X$1(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors",v?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:C==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>X$1(new Date(B.getFullYear(),B.getMonth()-1)),className:u("p-0.5 rounded",v?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>X$1(new Date(B.getFullYear(),B.getMonth()+1)),className:u("p-0.5 rounded",v?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(C==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(j=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px]",v?"text-[#6B7280]":"text-gray-400"),children:j},j))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let j=B.getFullYear(),$=B.getMonth(),Me=new Date(j,$,1).getDay(),ht=new Date(j,$+1,0).getDate(),le=new Date(j,$,0).getDate(),He=new Date,De=[];for(let de=Me-1;de>=0;de--)De.push({dayNum:le-de,isCurrentMonth:false,date:new Date(j,$-1,le-de)});for(let de=1;de<=ht;de++)De.push({dayNum:de,isCurrentMonth:true,date:new Date(j,$,de)});let Re=42-De.length;for(let de=1;de<=Re;de++)De.push({dayNum:de,isCurrentMonth:false,date:new Date(j,$+1,de)});return De.map((de,Ve)=>{let V=de.date.toDateString()===He.toDateString(),q=(pt||O.date).toDateString()===de.date.toDateString();return jsx("button",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!de.isCurrentMonth&&(v?"text-[#4B5563]":"text-gray-300"),de.isCurrentMonth&&(v?"text-white":"text-gray-900"),V&&"ring-1 ring-[#3B82F6]",q&&"bg-[#7C3AED] text-white",!q&&(v?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ce(de.date),Be(false);},children:de.dayNum},Ve)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:j=>{j.stopPropagation(),Xe(!It),ut(false);},className:u("p-1 rounded transition-colors",Je?"text-[#7C3AED] bg-[#7C3AED]/20":v?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Je?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(j=>j.id===Je)?.color||"#7C3AED"},children:t.availableUsers?.find(j=>j.id===Je)?.initials||t.availableUsers?.find(j=>j.id===Je)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:It&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:j=>j.stopPropagation(),children:[jsxs("button",{onClick:()=>{Pe(null),Xe(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",v?"hover:bg-white/5":"hover:bg-gray-50",!Je&&(v?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",v?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:v?"text-[#9CA3AF]":"text-gray-500",children:C==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(j=>jsxs("button",{onClick:()=>{Pe(j.id),Xe(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",v?"hover:bg-white/5":"hover:bg-gray-50",Je===j.id&&(v?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:j.color||"#7C3AED"},children:j.initials||j.name?.slice(0,2).toUpperCase()}),jsx("span",{className:v?"text-white":"text-gray-900",children:j.name})]},j.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:u("px-3 py-2 text-xs",v?"text-[#6B7280]":"text-gray-400"),children:C==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(ue.trim()){let j=t.availableUsers?.find(Me=>Me.id===Je),$=pt||O.date;a.onTaskCreate?.({name:ue.trim(),startDate:$,endDate:$,priority:Oe,assignees:j?[j]:void 0}),ye(""),Q(void 0),Pe(null),ce(null),ie(null);}},disabled:!ue.trim(),className:u("px-2.5 py-1 rounded text-xs font-medium transition-colors",ue.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":v?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:C==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:u("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?v?"text-white":"text-gray-900":v?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},ae)})})]})}),jsx(Mr,{task:ne,isOpen:!!ne,onClose:()=>A(null),onTaskUpdate:O=>{a.onTaskUpdate?.(O),A(O);},theme:I==="dark"?"dark":"light",locale:C,availableUsers:t.availableUsers?.map(O=>({id:O.id,name:O.name,avatar:O.avatar,initials:O.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:ne?c?.get(ne.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:bp(e).filter(O=>O.id!==ne?.id),comments:d?.filter(O=>O.taskId===ne?.id).map(O=>({...O,createdAt:O.createdAt instanceof Date?O.createdAt:new Date(O.createdAt),updatedAt:O.updatedAt instanceof Date?O.updatedAt:O.updatedAt?new Date(O.updatedAt):void 0})),onAddComment:g,currentUser:f,mentionableUsers:x,onUploadCommentAttachments:T,enableTimeTracking:h,timeTrackingSummary:b,timeEntries:y,isTimerRunning:w?.isRunning,timerElapsedSeconds:w?.elapsedSeconds,onTimeLog:D,onEstimateUpdate:N,onTimerStart:E,onTimerStop:k,onTimerDiscard:R}),jsx(AnimatePresence,{children:ke&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ie(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("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",v?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",v?"border-white/10":"border-gray-200"),children:[jsx("span",{className:u("font-medium",v?"text-white":"text-gray-900"),children:ke.date.toLocaleDateString(C==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ie(null),className:u("p-1 rounded",v?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:ke.events.map(O=>jsxs("button",{onClick:()=>{Ie(null),A(O.task),p?.(O.task.id);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",v?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(hp,{task:O.task}),jsx("span",{className:u("text-sm truncate flex-1",v?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var Yl={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"},ql={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"},Xl={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"},Hs={dark:Yl,light:ql,neutral:Xl};function xp(e){return Hs[e]||Hs.dark}function Wx({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[m,i]=useState(false),c=useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=useMemo(()=>{let f=c.length,x=new Set(c.flatMap(h=>h.assignedUserIds||[])).size,T=c.map(h=>h.priority).filter(Boolean),p=new Set(c.flatMap(h=>h.labels||[])).size;return {totalCards:f,uniqueAssignees:x,priorities:T,labels:p}},[c]),g=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:g,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),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&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:f=>{f.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),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&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:c.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:c.map(f=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsx("h4",{children:f.title}),f.description&&jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),s?.(e.id,f.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},f.id))})})]})}var wp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Dn(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 Sn(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:l}){let m=useMemo(()=>({...wp,...n}),[n]),[i,c]=useState(new Set),d=useRef(null),g=useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(y=>{let w=y.timestamp.toISOString().split("T")[0],D=b.get(w);D?D.push(y):b.set(w,[y]);}),Array.from(b.entries()).sort((y,w)=>w[0].localeCompare(y[0])).map(([y,w])=>({date:new Date(y),events:w.sort((D,N)=>N.timestamp.getTime()-D.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:f,uniqueTypes:x}=useMemo(()=>{let b=new Set,y=new Set;return e.forEach(w=>{b.add(w.userId),y.add(w.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(y)}},[e]),T=b=>{c(y=>{let w=new Set(y);return w.has(b)?w.delete(b):w.add(b),w});},p=b=>{let w=new Date().getTime()-b.getTime(),D=Math.floor(w/6e4),N=Math.floor(w/36e5),E=Math.floor(w/864e5);return D<1?"just now":D<60?`${D}m ago`:N<24?`${N}h ago`:E<7?`${E}d ago`:b.toLocaleDateString()},h=useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",m.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let y=b.target.value;a({...t,types:y?[y]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),x.map(b=>jsxs("option",{value:b,children:[Sn(b)," ",b.replace("_"," ")]},b))]}),f.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let y=b.target.value;a({...t,users:y?[y]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),f.map(b=>jsx("option",{value:b,children:b},b))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),h>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",h,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:g.map(b=>jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&b.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:b.events.map((y,w)=>{let D=i.has(y.id),N=s===y.id,E=Cp(y.type);return jsxs("div",{"data-event-id":y.id,className:u("history-timeline-event",D&&"expanded",N&&"selected"),onClick:()=>o?.(y),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:E},children:m.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Sn(y.type)})}),w<b.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:E}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&y.userAvatar&&jsx("img",{src:y.userAvatar,alt:y.userName||y.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:y.userName||y.userId}),jsx("span",{className:"history-timeline-event-action",children:Dn(y)})]})]}),jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?p(y.timestamp):y.timestamp.toLocaleString()})]}),Object.keys(y.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),T(y.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(y.changes).map(([k,R])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},k)),y.metadata&&Object.keys(y.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(y.metadata).map(([k,R])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},k))]})]})]})]},y.id)})})]},b.date?.toISOString()||"all"))})]})}function Dp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),g=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&Sn(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Dn(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:f=>l(parseInt(f.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((f,x)=>jsx("div",{className:u("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>l(x),title:Dn(f)},f.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:c.map(f=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>m(f),children:[f,"x"]},f))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(f=>jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Jl(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 Zl(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 Yx(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})),l=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let d=a/2,g=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(g-c.y)*o.centerForce*i,n.forEach(f=>{if(c.id===f.id)return;let x=c.x-f.x,T=c.y-f.y,p=Math.sqrt(x*x+T*T)||1,h=o.chargeStrength*i/(p*p);c.vx+=x/p*h,c.vy+=T/p*h;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),g=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!g)return;let f=g.x-d.x,x=g.y-d.y,T=Math.sqrt(f*f+x*x)||1,p=(T-o.linkDistance)/T*o.forceStrength*i;d.vx+=f*p,d.vy+=x*p,g.vx-=f*p,g.vy-=x*p;}),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:l,className:m}){let i=useRef(null),[c,d]=useState([]),[g,f]=useState(null),[x,T]=useState(null),[p,h]=useState(null),[b,y]=useState(1),[w,D]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let H=Yx(e,t,a.width,a.height,a,150);d(H);},[e,t,a]);let N=useCallback((H,v)=>{a.enableDragging&&(v.stopPropagation(),f(H));},[a.enableDragging]),E=useCallback(H=>{if(!g||!i.current)return;let te=i.current.getBoundingClientRect(),oe=(H.clientX-te.left-w.x)/b,ne=(H.clientY-te.top-w.y)/b;d(A=>A.map(ke=>ke.id===g?{...ke,x:oe,y:ne,fx:oe,fy:ne}:ke));},[g,b,w]),k=useCallback(()=>{f(null);},[]),R=useCallback((H,v)=>{v.stopPropagation(),l?.({type:"node-click",node:H,position:{x:v.clientX,y:v.clientY}});},[l]),I=useCallback((H,v)=>{v.stopPropagation(),l?.({type:"edge-click",edge:H,position:{x:v.clientX,y:v.clientY}});},[l]),C=useCallback(H=>{let v=c.find(te=>te.id===H);return v?{x:v.x,y:v.y}:{x:0,y:0}},[c]),W=useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let v=H.card.priority;return v==="URGENT"?"#ef4444":v==="HIGH"?"#f59e0b":v==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("relationships-graph-empty",m),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:u("relationships-graph",m),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>y(H=>Math.min(H+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>y(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{y(1),D({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Jl(H)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Sp(H)," ",Zl(H)]})]},H))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:E,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${b})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let v=C(typeof H.source=="string"?H.source:H.source.id),te=C(typeof H.target=="string"?H.target:H.target.id),oe=Ep(H.type),ne=p===H.id,A=H.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",ne&&"hovered",A&&"critical"),onMouseEnter:()=>h(H.id),onMouseLeave:()=>h(null),onClick:ke=>I(H,ke),children:[jsx("line",{x1:v.x,y1:v.y,x2:te.x,y2:te.y,stroke:Jl(H.type),strokeWidth:A?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ne?1:.6,markerEnd:oe?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ne&&jsx("text",{x:(v.x+te.x)/2,y:(v.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Zl(H.type)})]},H.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(H=>{let v=x===H.id,te=H.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",v&&"hovered",te&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:oe=>N(H.id,oe),onMouseEnter:()=>T(H.id),onMouseLeave:()=>T(null),onClick:oe=>R(H,oe),children:[jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:W(H),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:v?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children: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]=useState(""),[l,m]=useState(false),[i,c]=useState(null),[d,g]=useState(null),f=useRef(null),x=l||o;useEffect(()=>{e&&f.current&&f.current.focus();},[e]),useEffect(()=>{let b=y=>{y.key==="Escape"&&!x&&T();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,x]);let T=()=>{x||(n(""),c(null),g(null),t());},p=async()=>{if(!(!s.trim()||x)){m(true),c(null),g(null);try{let b=await r(s.trim());g(b);}catch(b){c(b instanceof Error?b.message:"Failed to generate plan");}finally{m(false);}}},h=()=>{d&&(a(d),T());};return e?jsxs(yt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:T}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:T,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,y)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},y))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,y)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},y)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:f,value:s,onChange:b=>n(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}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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,y)=>jsx("button",{onClick:()=>n(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},y))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:x&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:T,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick:h,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"}):jsx("button",{onClick:p,disabled:!s.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Ql={"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 Xx={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Jx={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 Zx(e,t,a){let r=Ql[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function En(e){return `$${e.toFixed(4)}`}var ed=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Zx(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,g)=>d+g.cost,0),s=a.reduce((d,g)=>d+g.inputTokens,0),n=a.reduce((d,g)=>d+g.outputTokens,0),l=a.filter(d=>d.success),m=a.reduce((d,g)=>d+g.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?l.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 l=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:m,percentUsed:i,isExceeded:l>=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)}},To=new ed;function Bp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(To.getStats()),[s,n]=useState(To.checkLimit(a));if(useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(To.getStats()),n(To.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),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 l=To.getRecentOperations(5);return jsxs(yt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[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:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:En(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,i])=>{let c=r.costsByFeature[m]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:En(c)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(m=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:En(m.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),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 $p({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=useState(""),[m,i]=useState(""),[c,d]=useState(""),[g,f]=useState(false),[x,T]=useState(null),[p,h]=useState(null),[b,y]=useState(null),w=useRef(null),D=g||o;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let I=C=>{C.key==="Escape"&&!D&&N();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,D]);let N=()=>{D||(l(""),i(""),d(""),T(null),h(null),y(null),t());},E=async()=>{if(!(!n.trim()||D)){f(true),T(null),h(null),y(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});h(I.tasks.tasks),y({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){T(I instanceof Error?I.message:"Failed to generate tasks");}finally{f(false);}}},k=()=>{p&&(a(p),N());};if(!e)return null;let R=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxs(yt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:I=>I.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:N,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:p?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&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"}),b?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):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"}),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:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&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:[b.tokens_saved," tokens saved"]}),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:[p.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:p.map((I,C)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",C+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:I.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),I.start," \u2192 ",I.end]}),jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:n,onChange:I=>l(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:I=>i(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),x&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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((I,C)=>jsx("button",{onClick:()=>l(I),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:I},C))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:D&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:N,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),p?jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:E,disabled:!n.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Vs({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(p=>{t&&$n(()=>Promise.resolve(t(p)),{maxAttempts:3,initialDelay:1e3,onRetry:(h,b,y)=>{console.warn(`Retry attempt ${b} after ${y}ms: ${h.message}`);}}).then(h=>{h.success||console.error(`Failed to persist board after ${h.attempts} attempts:`,h.error);});},[t]),s=useCallback(async(p,h,b)=>{r(y=>{let w=y.cards.find(I=>I.id===p);if(!w)return y;let D=w.columnId,N={...w,columnId:h,position:b},E=y.cards.map(I=>I.id===p?N:I),k=y.columns.map(I=>{if(I.id===D)return {...I,cardIds:I.cardIds.filter(C=>C!==p)};if(I.id===h){let C=E.filter(W=>W.columnId===h).sort((W,H)=>W.position-H.position);return {...I,cardIds:C.map(W=>W.id)}}return I}),R={...y,cards:E,columns:k};return o(R),R});},[o]),n=useCallback(async(p,h)=>{r(b=>{let y=b.cards.map(D=>D.id===p?{...D,...h}:D),w={...b,cards:y};return o(w),w});},[o]),l=useCallback(async p=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let y={...p,id:h},w=b.columns.map(N=>N.id===p.columnId?{...N,cardIds:[...N.cardIds,h]}:N),D={...b,cards:[...b.cards,y],columns:w};return o(D),D});},[o]),m=useCallback(async p=>{r(h=>{let b=h.cards.find(N=>N.id===p);if(!b)return h;let y=h.cards.filter(N=>N.id!==p),w=h.columns.map(N=>N.id===b.columnId?{...N,cardIds:N.cardIds.filter(E=>E!==p)}:N),D={...h,cards:y,columns:w};return o(D),D});},[o]),i=useCallback(async p=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let y={...p,id:h,cardIds:[]},w={...b,columns:[...b.columns,y]};return o(w),w});},[o]),c=useCallback(async(p,h)=>{r(b=>{let y=b.columns.map(D=>D.id===p?{...D,...h}:D),w={...b,columns:y};return o(w),w});},[o]),d=useCallback(async p=>{r(h=>{let b=h.cards.filter(D=>D.columnId!==p),y=h.columns.filter(D=>D.id!==p),w={...h,cards:b,columns:y};return o(w),w});},[o]),g=useCallback(p=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(p),h},[l]),f=useCallback(p=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(p),h},[i]),x=useCallback(()=>{r(p=>{let h={...p,cards:[],columns:[]};return o(h),h});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:g,addColumn:f,deleteCard:m,deleteColumn:d,clearBoard:x}}}function Up({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Vs({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Pn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Wp={by:"none",order:"asc"};function Gp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...Pn,...e}),[s,n]=useState({...Wp,...t}),l=useCallback(T=>{o(p=>({...p,...T}));},[]),m=useCallback(T=>{n(p=>({...p,...T}));},[]),i=useCallback(()=>{o(Pn),n(Wp);},[]),c=useCallback(()=>{a&&o({...Pn,assignees:[a]});},[a]),d=useCallback(()=>{o({...Pn,dateFilter:"overdue"});},[]),g=useCallback(()=>{o({...Pn,priorities:["HIGH","URGENT"]});},[]),f=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),x=useCallback(T=>{let p=[...T];if(r.search){let h=r.search.toLowerCase();p=p.filter(b=>b.title.toLowerCase().includes(h)||b.description?.toLowerCase().includes(h));}if(r.dateFilter!=="all"){let h=new Date,b=h.getFullYear(),y=String(h.getMonth()+1).padStart(2,"0"),w=String(h.getDate()).padStart(2,"0"),D=`${b}-${y}-${w}`;p=p.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let E=N.endDate||N.dueDate;if(!E)return false;let k;if(typeof E=="string")k=E.split("T")[0]||E;else {let R=E.getUTCFullYear(),I=String(E.getUTCMonth()+1).padStart(2,"0"),C=String(E.getUTCDate()).padStart(2,"0");k=`${R}-${I}-${C}`;}switch(r.dateFilter){case "overdue":return k<D;case "today":return k===D;case "this-week":let R=new Date(D+"T00:00:00"),I=new Date(k+"T00:00:00"),C=new Date(R);return C.setDate(C.getDate()+7),I>=R&&I<=C;case "custom":if(r.dateRange){let W=typeof E=="string"?new Date(E):E;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(p=p.filter(h=>h.priority&&r.priorities.includes(h.priority))),r.assignees.length>0&&(p=p.filter(h=>(h.assignedUserIds||(h.assigneeId?[h.assigneeId]:[])).some(y=>r.assignees.includes(y)))),r.labels.length>0&&(p=p.filter(h=>h.labels&&h.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(p=p.filter(h=>r.columns.includes(h.columnId))),s.by!=="none"&&p.sort((h,b)=>{let y=0;switch(s.by){case "created":let w=h.createdAt?new Date(h.createdAt).getTime():0,D=b.createdAt?new Date(b.createdAt).getTime():0;y=w-D;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},E=N[h.priority||"LOW"],k=N[b.priority||"LOW"];y=E-k;break;case "dueDate":let R=h.endDate||h.dueDate,I=b.endDate||b.dueDate;if(!R)return 1;if(!I)return -1;let C=typeof R=="string"?new Date(R).getTime():R.getTime(),W=typeof I=="string"?new Date(I).getTime():I.getTime();y=C-W;break;case "title":y=h.title.localeCompare(b.title);break;case "estimate":let H=h.estimatedTime||0,v=b.estimatedTime||0;y=H-v;break;default:y=0;}return s.order==="asc"?y:-y}),p},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:g,applyFilters:x,hasActiveFilters:f}}var _p,jp;if(typeof window<"u")try{let e=Bn("ai");_p=e.generateObject,jp=e.generateText;}catch{}function Kp(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(_p&&jp&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(g){let f=g instanceof Error?g:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(g){let f=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(g){let f=g instanceof Error?g:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(g){let f=g instanceof Error?g:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(g){let f=g instanceof Error?g:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function ad(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Yp(e){let{cards:t}=e,[a,r]=ad(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,g)=>{if(!g){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=g.ctrlKey||g.metaKey,x=g.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(T=>T!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(x&&a.lastSelectedCardId){let T=t.find(h=>h.id===d),p=t.find(h=>h.id===a.lastSelectedCardId);if(T&&p&&T.columnId===p.columnId){let h=t.filter(k=>k.columnId===T.columnId).sort((k,R)=>k.position-R.position),b=h.findIndex(k=>k.id===a.lastSelectedCardId),y=h.findIndex(k=>k.id===d),[w,D]=b<y?[b,y]:[y,b],N=h.slice(w,D+1).map(k=>k.id),E=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:E,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(g=>g!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,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=useMemo(()=>({...qp,...a}),[a]),[s,n]=useState([]),l=useCallback((T,p,h,b,y)=>{if(p.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:T,cardIds:p,columnId:h,strategy:b,color:y,isExpanded:true,position:s.filter(D=>D.columnId===h).length,createdAt:new Date};n(D=>[...D,w]);},[o.minCardsPerStack,s]),m=useCallback(T=>{n(p=>p.filter(h=>h.id!==T));},[]),i=useCallback(T=>{n(p=>p.map(h=>h.id===T?{...h,isExpanded:!h.isExpanded}:h));},[]),c=useCallback((T,p)=>{n(h=>h.map(b=>b.id===T&&!b.cardIds.includes(p)?{...b,cardIds:[...b.cardIds,p]}:b));},[]),d=useCallback((T,p)=>{n(h=>h.map(b=>{if(b.id===T){let y=b.cardIds.filter(w=>w!==p);return y.length<o.minCardsPerStack?null:{...b,cardIds:y}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),g=useCallback(T=>s.filter(p=>p.columnId===T).sort((p,h)=>p.position-h.position),[s]),f=useCallback(async T=>{let p=t.filter(D=>D.columnId===T);if(p.length<o.minCardsPerStack*2)return [];let h=[],b=new Map;p.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(N=>{b.has(N)||b.set(N,[]),b.get(N).push(D);});}),b.forEach((D,N)=>{D.length>=o.minCardsPerStack&&h.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:D.map(E=>E.id),columnId:T,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${N}"`,confidence:.85});});let y=new Map;p.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(N=>{y.has(N)||y.set(N,[]),y.get(N).push(D);});}),y.forEach((D,N)=>{D.length>=o.minCardsPerStack&&h.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:D.map(E=>E.id),columnId:T,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(p.forEach(D=>{D.priority&&(w.has(D.priority)||w.set(D.priority,[]),w.get(D.priority).push(D));}),w.forEach((D,N)=>{if(D.length>=o.minCardsPerStack){let E={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";h.push({stack:{title:`${E} ${N} Priority`,cardIds:D.map(k=>k.id),columnId:T,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of p){let E=(await r.findSimilar(D,p)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(E.length>=o.minCardsPerStack-1){let k=[D.id,...E.map(I=>I.card.id)],R=E.reduce((I,C)=>I+C.similarity,0)/E.length;h.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:k,columnId:T,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${E.length+1} similar tasks`,confidence:R});}}return h.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,N)=>N.confidence-D.confidence).slice(0,5)},[t,o,r]),x=useCallback(T=>{l(T.stack.title,T.stack.cardIds,T.stack.columnId,T.stack.strategy,T.stack.color);},[l]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(p=>p.columnId)).forEach(async p=>{let h=await f(p),b=h[0];h.length>0&&b&&b.confidence>=.9&&x(b);});},[]),{stacks:s,createStack:l,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:g,getSuggestions:f,applySuggestion:x,config:o}}var Jp=createContext(null);function Zp({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=Bn("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=Bn("@libxai/core");n.set(m.id,new i(m));});let l=null;if(t?.board){let{Board:m}=Bn("@libxai/core");l=new m(t.board);}r.current=new BoardStore({board:l,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(Jp.Provider,{value:{store:o},children:e})}function _s(){let e=useContext(Jp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Fn(){let e=_s(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=useCallback(b=>{e.updateBoard(b);},[e]),m=useCallback(b=>{e.addColumn(b);},[e]),i=useCallback((b,y)=>{e.updateColumn(b,y);},[e]),c=useCallback(b=>{e.deleteColumn(b);},[e]),d=useCallback(b=>e.getColumn(b),[e]),g=useCallback(b=>{e.addCard(b);},[e]),f=useCallback((b,y)=>{e.updateCard(b,y);},[e]),x=useCallback(b=>{e.deleteCard(b);},[e]),T=useCallback((b,y,w)=>{e.moveCard(b,y,w);},[e]),p=useCallback(b=>e.getCard(b),[e]),h=useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:d,addCard:g,updateCard:f,deleteCard:x,moveCard:T,getCard:p,getCardsByColumn:h}}function eg(e){let{cards:t}=Fn();return 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 tg(e="position",t="asc"){let{cards:a}=Fn();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?l[o.priority]:0,i=s.priority?l[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 js=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Bd.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 l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{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);}},f2=new js;function rg({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:m}){let i=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:g,className:o,children:jsx("div",{style:f,children:d.map(x=>{let T=e[x.index];if(!T)return null;let p=m?m(T,x.index):x.index,h={position:"absolute",top:n?0:x.start,left:n?x.start:0,width:n?x.size:"100%",height:n?"100%":x.size};return jsx("div",{style:h,"data-index":x.index,children:r(T,x.index)},p)})})})}function og(e){return useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function sg({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:m,horizontal:i=true}){let c=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),g=d.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:c,style:f,className:s,children:jsx("div",{style:x,children:g.map(T=>{let p=e[T.index];if(!p)return null;let h=m?m(p,T.index):T.index,b={position:"absolute",top:0,left:T.start,width:T.size,height:"100%"};return jsx("div",{style:b,"data-index":T.index,children:o(p,T.index)},h)})})})}function ig(e){let t=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 lg(e,t=10){return e>t}var sd={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},id={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ld={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},dd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},cd={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},md={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ud={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},pd={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)"},gd={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)"},fd={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},bd={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}},hd={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}},Ks={spacing:sd,borderRadius:id,fontSize:ld,fontWeight:dd,lineHeight:cd,zIndex:md,duration:ud,easing:pd,shadows:gd,opacity:fd,kanban:bd,gantt:hd};function dg(e,t,a){return e[t]??a}function yd(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)?yd(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function y2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function vd(e="asakaa"){let t=yd(Ks),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=y2(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
404
404
|
${a.join(`
|
|
405
405
|
`)}
|
|
406
|
-
}`}function
|
|
406
|
+
}`}function An(e,t="asakaa"){let a=[],r=yd(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
407
407
|
${a.join(`
|
|
408
408
|
`)}
|
|
409
|
-
}`}var
|
|
409
|
+
}`}var Ys={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"}},xd={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"}},kd={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 wd(e=Ys,t="asakaa"){let a=vd(t),r=An(e,t);return `${a}
|
|
410
410
|
|
|
411
|
-
${r}`}function
|
|
411
|
+
${r}`}function cg(){return `/**
|
|
412
412
|
* ASAKAA Design Tokens
|
|
413
413
|
* Auto-generated from design-tokens.ts
|
|
414
414
|
* Do not edit this file directly
|
|
415
415
|
*/
|
|
416
416
|
|
|
417
|
-
${
|
|
417
|
+
${wd(Ys)}
|
|
418
418
|
|
|
419
419
|
/* Light theme */
|
|
420
420
|
[data-theme="light"] {
|
|
421
|
-
${
|
|
421
|
+
${An(xd,"asakaa").split(`
|
|
422
422
|
`).slice(1,-1).join(`
|
|
423
423
|
`)}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
/* Neutral theme */
|
|
427
427
|
[data-theme="neutral"] {
|
|
428
|
-
${
|
|
428
|
+
${An(kd,"asakaa").split(`
|
|
429
429
|
`).slice(1,-1).join(`
|
|
430
430
|
`)}
|
|
431
431
|
}
|
|
432
|
-
`}var
|
|
433
|
-
export{
|
|
432
|
+
`}var v2=({theme:e})=>{switch(e){case "dark":return jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children: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 jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),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 jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function mg({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Uo();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let m=n,i=m===r;return jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(v2,{theme:m})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},m)})})}
|
|
433
|
+
export{Bp as AIUsageDashboard,Jx as AI_FEATURES,Ql as AI_MODELS,Si as AddCardButton,Di as AddColumnButton,Cr as AttachmentUploader,Zp as BoardProvider,ns as BulkOperationsToolbar,zi as BurnDownChart,lp as CUSTOM_FIELD_TYPES,vp as CalendarBoard,Er as Card,Li as CardDetailModal,Ri as CardDetailModalV2,Dp as CardHistoryReplay,Tp as CardHistoryTimeline,Pp as CardRelationshipsGraph,Wx as CardStack,ji as CardTemplateSelector,ri as CircuitBreaker,Lo as Column,us as ColumnManager,Mi as CommandPalette,Xi as ConfigMenu,Go as ContextMenu,un as DEFAULT_SHORTCUTS,sp as DEFAULT_TABLE_COLUMNS,_i as DEFAULT_TEMPLATES,Zo as DateRangePicker,en as DependenciesSelector,vs as DependencyLine,Ui as DistributionCharts,mi as EditableColumnTitle,Ro as ErrorBoundary,Yi as ExportImportModal,qi as FilterBar,Jm as GANTT_AI_SYSTEM_PROMPT,Ts as GanttAIAssistant,jm as GanttBoard,Wo as GanttI18nContext,ks as GanttMilestone,ms as GanttToolbar,$p as GenerateGanttTasksDialog,Ap as GeneratePlanModal,Gi as GroupBySelector,yi as HealthBar,_r as KanbanBoard,Ti as KanbanToolbar,dn as KanbanViewAdapter,Vi as KeyboardShortcutsHelp,np as ListView,Ht as MenuIcons,js as PluginManager,co as PrioritySelector,vi as ProfitabilityReport,Xx as RATE_LIMITS,ip as STANDARD_FIELDS,Hi as SwimlaneBoardView,pi as TagBadge,hc as TagList,Gr as TagPicker,hs as TaskBar,Mr as TaskDetailModal,Xm as TaskFormModal,fs as TaskGrid,el as ThemeModal,mm as ThemeProvider,mg as ThemeSwitcher,fo as TimeInputPopover,gi as TimePill,fi as TimePopover,Cs as Timeline,uo as UserAssignmentSelector,$i as VelocityChart,sg as VirtualGrid,rg as VirtualList,To as aiUsageTracker,id as borderRadius,On as calculatePosition,Yl as calendarDarkTheme,Vl as calendarEnTranslations,_l as calendarEsTranslations,ql as calendarLightTheme,Xl as calendarNeutralTheme,Hs as calendarThemes,zs as calendarTranslations,Ss as cardToGanttTask,ou as cardsToGanttTasks,u as cn,Vc as createKanbanView,Bg as createRetryWrapper,Ji as darkTheme,Ys as darkTokenTheme,is as defaultTheme,Ks as designTokens,ud as duration,pd as easing,cg as exportTokensToCSS,Br as findTaskByName,ld as fontSize,dd as fontWeight,En as formatCost,ds as ganttEnTranslations,pm as ganttEsTranslations,ru as ganttTaskToCardUpdate,et as ganttThemes,hd as ganttTokens,tl as ganttTranslations,xe as ganttUtils,vd as generateCSSVariables,wd as generateCompleteCSS,Fg as generateInitialPositions,Zm as generateTasksContext,An as generateThemeVariables,xp as getCalendarTheme,Tn as getCalendarTranslations,dp as getListViewTheme,Pl as getListViewTranslations,cp as getMonthNames,dg as getToken,gm as getTranslations,mp as getWeekdayNames,bd as kanbanTokens,Zi as lightTheme,xd as lightTokenTheme,cd as lineHeight,Hl as listViewDarkTheme,Sl as listViewEnTranslations,El as listViewEsTranslations,Wl as listViewLightTheme,Gl as listViewNeutralTheme,$s as listViewThemes,Es as listViewTranslations,Us as mergeCalendarTranslations,Ps as mergeListViewTranslations,al as mergeTranslations,Qi as neutralTheme,kd as neutralTokenTheme,fd as opacity,tu as parseLocalCommand,Tl as parseNaturalDate,Nl as parseNaturalDuration,Dl as parseProgress,eu as parseStatus,f2 as pluginManager,Ig as retrySyncOperation,$n as retryWithBackoff,gd as shadows,lg as shouldVirtualizeGrid,sd as spacing,yo as themes,Kp as useAI,Up as useBoard,Fn as useBoardCore,_s as useBoardStore,Xp as useCardStacking,wi as useDragState,eg as useFilteredCards,Gp as useFilters,Xr as useGanttI18n,Vs as useKanbanState,lm as useKeyboardShortcuts,Yp as useMultiSelect,ad as useSelectionState,tg as useSortedCards,Uo as useTheme,ig as useVirtualGrid,og as useVirtualList,au as validateAIResponse,Ei as withErrorBoundary,Un as wouldCreateCircularDependency,md as zIndex};//# sourceMappingURL=index.js.map
|
|
434
434
|
//# sourceMappingURL=index.js.map
|