@libxai/board 1.5.10 → 1.5.11
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 +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),bf=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Bh=require('react-markdown'),Rh=require('remark-gfm'),Oh=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var bf__default=/*#__PURE__*/_interopDefault(bf);var Bh__default=/*#__PURE__*/_interopDefault(Bh);var Rh__default=/*#__PURE__*/_interopDefault(Rh);var Oh__default=/*#__PURE__*/_interopDefault(Oh);var xs=(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 vs=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 [vs.Translate.toString(e),vs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function p(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function ws(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 uf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Qi(e,t){return e.length===0?1e3:t===0?ws(null,e[0].position):t>=e.length?ws(e[e.length-1].position,null):ws(e[t-1].position,e[t].position)}function zc(e,t=100){return e>t}var pf=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 mf(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 ks(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=pf,onRetry:d}=t,c,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(c=l,u===a||!n(c,u))return {error:c,attempts:i,success:false};let g=mf(u,r,o,s);if(d)try{d(c,u,g);}catch(x){console.error("Error in retry callback:",x);}await new Promise(x=>setTimeout(x,g));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function gf(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 ff(e,t={}){return async(...a)=>ks(()=>e(...a),t)}var Zi=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 Uc=(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))(Uc||{}),Co=class Co{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,d=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(d,o,c?n:"");break;case "INFO":console.info(d,o,c?n:"");break;case "WARN":console.warn(d,o,c?n:"");break;case "ERROR":console.error(d,o,c?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",...Co.globalOptions};}static configure(t){Co.globalOptions={...Co.globalOptions,...t};}child(t){return new Co({...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 Cs((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Cs(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Uc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Co.globalOptions={};var el=Co,Cs=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}},Wc=new el;function hf(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 yf(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(d=>d.id===s.columnId);return [s.id,tl(s.title),tl(s.description||""),tl(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
2
|
`)}async function xf(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 bf__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),d=n.toDataURL("image/png"),c=297,i=210,u=n.width/n.height,l=c-20,m=l/u;m>i-20&&(m=i-20,l=m*u);let g=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let x=(c-l)/2;return g.addImage(d,"PNG",x,20,l,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let d=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,d.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):d.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(c.description,160);o.text(u,25,s),s+=u.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let u=[];c.startDate&&u.push(`Start: ${c.startDate}`),c.endDate&&u.push(`End: ${c.endDate}`),i.push(u.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 tl(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
3
|
`)?`"${e.replace(/"/g,'""')}"`:e}async function Vc(e,t,a,r){switch(t){case "json":return hf(e,r);case "csv":return yf(e);case "pdf":return await xf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function _c(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},d=new Blob([e],{type:n[t]}),c=URL.createObjectURL(d),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function vf(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 wf(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=jc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=jc(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((g,x)=>{i[g]=d[x]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let l=o.get(u),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),l.cardIds.push(m.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function jc(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 Kc(e,t){switch(t){case "json":return vf(e);case "csv":return wf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Yc(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 al=react.createContext(null);function qc(){return react.useContext(al)}var Xc=react.createContext(null);function Jc({children:e,themeName:t}){return jsxRuntime.jsx(Xc.Provider,{value:{themeName:t},children:e})}function qo(){return react.useContext(Xc)}function Lt({children:e,container:t}){let[a,r]=react.useState(false),o=qc(),s=qo();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:d,themeName:c}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var au={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Ff="#BDC3C7",Pf=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function To({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),d=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,v=160,f=220,h=4,w=g.right-v;w<10&&(w=g.left),w+v>b-10&&(w=b-v-10);let y=x-g.bottom,k=g.top,C;y>=f+h?C=g.bottom+h:k>=f+h?C=g.top-f-h:C=y>=k?g.bottom+h:Math.max(10,g.top-f-h),n({top:C,left:w}),o(true);};react.useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&!c.current?.contains(x.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=x=>{x.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let u=g=>{t(g),o(false);},l=e?au[e]:null,m=l?.color||Ff;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,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?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsxs("div",{ref:d,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(au).map(([g,x])=>jsxRuntime.jsxs("button",{onClick:()=>u(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:x.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Pf,{color:x.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:x.label}),e===g&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Mf=[{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 En({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),m=(qo()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let w=i.current.getBoundingClientRect(),y=window.innerHeight,k=window.innerWidth,C=320,E=380,T=4,I=w.left;I+C>k-10&&(I=k-C-10),I<10&&(I=10);let O=y-w.bottom,F=w.top,$;O>=E+T?$=w.bottom+T:F>=E+T?$=w.top-E-T:$=O>=F?w.bottom+T:Math.max(10,w.top-E-T),d({top:$,left:I}),s(true);};react.useEffect(()=>{let w=y=>{c.current&&!c.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),react.useEffect(()=>{let w=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let x=w=>{let y=new Date,k=I=>{let O=I.getFullYear(),F=String(I.getMonth()+1).padStart(2,"0"),$=String(I.getDate()).padStart(2,"0");return `${O}-${F}-${$}`},C=k(y),E=new Date(y);E.setDate(E.getDate()+w);let T=k(E);a(C,T),s(false);},b=()=>{if(!e||!t)return "Set date";let w=E=>{if(E instanceof Date)return E;if(typeof E!="string"||!E.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=E.split("-").map(Number);if(T.length!==3||T.some($=>isNaN($)))return null;let I=T[0],O=T[1],F=T[2];return I===void 0||O===void 0||F===void 0?null:new Date(I,O-1,F)},y=w(e),k=w(t);if(!y||!k||isNaN(y.getTime())||isNaN(k.getTime()))return "Set date";let C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${C[y.getMonth()]} ${y.getDate()} \u2013 ${C[k.getMonth()]} ${k.getDate()}`},v=e&&t,h=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,y=new Date;return y.setHours(0,0,0,0),w<y})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.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:v?`${b()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:b()})]}),o&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:m?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Mf.map(w=>jsxRuntime.jsx("button",{onClick:()=>x(w.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",y.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:y=>{y.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",y.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Do({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[d,c]=react.useState(""),[i,u]=react.useState({top:0,left:0}),l=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),w=window.innerHeight,y=window.innerWidth,k=300,C=380,E=4,T=h.right-k;T<10&&(T=h.left),T+k>y-10&&(T=y-k-10);let I=w-h.bottom,O=h.top,F;I>=C+E?F=h.bottom+E:O>=C+E?F=h.top-C-E:F=I>=O?h.bottom+E:Math.max(10,h.top-C-E),u({top:F,left:T}),n(true);};react.useEffect(()=>{let h=w=>{l.current&&!l.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let x=h=>{let w=e.some(y=>y.id===h.id);a(w?e.filter(y=>y.id!==h.id):[...e,h]);},b=t.filter(h=>h.name.toLowerCase().includes(d.toLowerCase())),v=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,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?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[v.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:d,onChange:h=>c(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:b.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):b.map(h=>{let w=e.some(y=>y.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>x(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:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},h.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Ts(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let l=u;return l.taskId||l.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,d=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let u of i){if(!s.has(u)&&d(u))return true;if(n.has(u))return true}}return n.delete(c),false};return d(a)}function Pn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,c]=react.useState(false),[i,u]=react.useState(""),[l,m]=react.useState(t.length>0),[g,x]=react.useState({top:0,left:0}),[b,v]=react.useState(null),f=react.useRef(null),h=react.useRef(null),w=()=>{if(!h.current)return;let T=h.current.getBoundingClientRect(),I=window.innerHeight,O=window.innerWidth,F=300,$=l?380:120,z=4,de=T.right-F;de<10&&(de=T.left),de+F>O-10&&(de=O-F-10);let A=I-T.bottom,J=T.top,xe;A>=$+z?xe=T.bottom+z:J>=$+z?xe=T.top-$-z:xe=A>=J?T.bottom+z:Math.max(10,T.top-$-z),x({top:xe,left:de}),c(true);};react.useEffect(()=>{if(!d||!h.current)return;let T=h.current.getBoundingClientRect(),I=window.innerHeight,O=window.innerWidth,F=300,$=l?380:120,z=4,de=T.right-F;de<10&&(de=T.left),de+F>O-10&&(de=O-F-10);let A=I-T.bottom,J=T.top,xe;A>=$+z?xe=T.bottom+z:J>=$+z?xe=T.top-$-z:xe=A>=J?T.bottom+z:Math.max(10,T.top-$-z),x({top:xe,left:de});},[l,d]),react.useEffect(()=>{let T=I=>{f.current&&!f.current.contains(I.target)&&!h.current?.contains(I.target)&&(c(false),u(""));};if(d)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[d]),react.useEffect(()=>{let T=I=>{I.key==="Escape"&&(c(false),u(""));};if(d)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[d]);let y=T=>{let I=t.includes(T),O=a.find(F=>F.id===T);if(v(null),I){let F=t.filter($=>$!==T);r(F),F.length===0&&m(false);}else {if(s&&Ts(a,T,e)){let $=`Cannot add "${O?.title||T}" as dependency - would create circular reference`;v($),n?.(T,O?.title||T),setTimeout(()=>v(null),3e3);return}r([...t,T]),m(true);}},k=()=>{let T=!l;m(T),T||r([]);},C=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),E=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>d?c(false):w(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:E,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:E},children:t.length})]}),d&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsxs("div",{ref:f,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:[b&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:b})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:k,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:T=>u(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:C.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):C.map(T=>{let I=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>y(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:O=>{O.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:O=>{O.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:I?"#3b82f6":"transparent",borderColor:I?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:I&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var _r=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:l,transform:m,transition:g,isDragging:x}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:vs.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:l,style:b,...i,...u,onClick:()=>a?.(e),children:t(e)});let v=d.filter(y=>e.assignedUserIds?.includes(y.id)),f=e.progress===100,h=(e.attachments||[]).filter(y=>y.type.startsWith("image/")),w={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:w,className:p("asakaa-card",x&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:y=>{y.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:y=>{y.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:y=>{y.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((y,k)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:y.url,alt:y.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:C=>{C.currentTarget.style.display="none";}}),k===3&&h.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},y.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(To,{priority:e.priority,onChange:y=>n?.(e.id,{priority:y})})}),jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(En,{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:(y,k)=>n?.(e.id,{startDate:y,endDate:k})})}),d.length>0&&jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Do,{assignedUsers:v,availableUsers:d,onChange:y=>n?.(e.id,{assignedUserIds:y.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Pn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(y=>typeof y=="string"?y:y.taskId):[],availableTasks:c,onChange:y=>n?.(e.id,{dependencies:y})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(y=>jsxRuntime.jsx("span",{className:"asakaa-label",children:y},y))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#2E94FF"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#2E94FF"}})})]})]})},(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&&e.render===t.render&&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)));_r.displayName="Card";var Ns={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"}},pu=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function mu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),u=[...Object.entries(Ns).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Ns).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let v=Ns[e];if(v)return {...v,id:e};let f=r.find(h=>h.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ns.todo,id:"todo"}},m=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),f=window.innerHeight,h=window.innerWidth,w=180,y=280,k=4,C=v.right-w;C<10&&(C=v.left),C+w>h-10&&(C=h-w-10);let E=f-v.bottom,T=v.top,I;E>=y+k?I=v.bottom+k:T>=y+k?I=v.top-y-k:I=E>=T?v.bottom+k:Math.max(10,v.top-y-k),d({top:I,left:C}),s(true);};react.useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},x=l(),b=x.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):m(),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:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:x.label,children:jsxRuntime.jsx(pu,{icon:x.icon,color:b})}),o&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:u.map(v=>jsxRuntime.jsxs("button",{onClick:()=>g(v.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:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(pu,{icon:v.icon,color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:v.label}),e===v.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}var gu={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function fu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=gu[s]||gu.en,[d,c]=react.useState(false),[i,u]=react.useState(false),[l,m]=react.useState(e),[g,x]=react.useState({top:0,left:0}),b=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(d&&v.current){let k=v.current.getBoundingClientRect();x({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[d]),react.useEffect(()=>{let k=C=>{b.current&&!b.current.contains(C.target)&&!v.current?.contains(C.target)&&(c(false),u(false));};if(d)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[d]),react.useEffect(()=>{let k=C=>{C.key==="Escape"&&(c(false),u(false),m(e));};if(d)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[d,e]),react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let h=()=>{u(true),m(e);},w=()=>{let k=l.trim();k&&k!==e&&t(k),u(false),c(false),m(e);},y=k=>{k.key==="Enter"?w():k.key==="Escape"&&(u(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>c(!d),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),d&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.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:i?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:l,onChange:k=>m(k.target.value),onKeyDown:y,onBlur:w,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:n.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:n.rename})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:n.delete})]})]})]})})})]})}var Qo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:l=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:x,onColumnDelete:b,isDeletable:v=false,className:f,renderMetrics:h,locale:w})=>{let{setNodeRef:y,isOver:k}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),C=react.useRef(null),E=u??zc(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>l,enabled:E});if(a)return jsxRuntime.jsx("div",{ref:y,className:f,children:a(e,t)});let O=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let z=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:z}:z>=80?{state:"warning",percentage:z}:z>=60?{state:"approaching",percentage:z}:{state:"ok",percentage:z}})(),F=O.state==="exceeded",$=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:y,className:p("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",F&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:p($()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&O.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${O.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[O.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),O.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),O.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),O.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(x||b)&&jsxRuntime.jsx(fu,{columnTitle:e.title,onRename:z=>x?.(e.id,z),onDelete:b?()=>b(e.id):void 0,isDeletable:v,locale:w}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!m&&jsxRuntime.jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:E?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(z=>z.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):E?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(z=>{let de=t[z.index];return de?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${z.start}px)`},children:jsxRuntime.jsx(_r,{card:de,render:r,onClick:n,onUpdate:d,availableUsers:c,allCards:i})},de.id):null})}):t.map(z=>jsxRuntime.jsx(_r,{card:z,render:r,onClick:n,onUpdate:d,availableUsers:c,allCards:i},z.id))})})]})});Qo.displayName="Column";function il({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),d=react.useRef(null);react.useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let c=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:d,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:c,onKeyDown:i,className:p("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:p("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Jf(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 wu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let c=d.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Qf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Zf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var eb=["\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 ku({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:l=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:x,maxFileSizeMB:b=10}){let v=d==="dark",[f,h]=react.useState(false),[w,y]=react.useState([]),[k,C]=react.useState(0),[E,T]=react.useState(null),[I,O]=react.useState(false),F=react.useRef(null),$=react.useRef(null),z=react.useRef(null),de=react.useRef(null),A=react.useCallback((H,X)=>{let Z=Jf(H,X);if(T(Z),Z){let ge=r.filter(Le=>Le.name.toLowerCase().includes(Z.query)||Le.email&&Le.email.toLowerCase().includes(Z.query)).slice(0,5);y(ge),h(ge.length>0),C(0);}else h(false),y([]);},[r]),J=H=>{let X=H.target.value;if(t(X),A(X,H.target.selectionStart||0),F.current){F.current.style.height="24px";let Z=F.current.scrollHeight,ge=280,Le=Math.min(Z,ge);F.current.style.height=`${Le}px`,F.current.style.overflowY=Z>ge?"auto":"hidden";}},xe=()=>{F.current&&A(e,F.current.selectionStart||0);},Ge=react.useCallback(H=>{if(!E||!F.current)return;let X=e.slice(0,E.start),Z=e.slice(E.end),ge=`@${H.name.replace(/\s+/g,"")} `,Le=X+ge+Z;t(Le),h(false),T(null),setTimeout(()=>{if(F.current){let Oe=E.start+ge.length;F.current.selectionStart=Oe,F.current.selectionEnd=Oe,F.current.focus();}},0);},[E,e,t]),M=H=>{if(f&&w.length>0)switch(H.key){case "ArrowDown":H.preventDefault(),C(X=>X<w.length-1?X+1:0);break;case "ArrowUp":H.preventDefault(),C(X=>X>0?X-1:w.length-1);break;case "Enter":{H.preventDefault();let X=w[k];X&&Ge(X);break}case "Tab":{H.preventDefault();let X=w[k];X&&Ge(X);break}case "Escape":H.preventDefault(),h(false);break}else H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),a());};react.useEffect(()=>{let H=X=>{$.current&&!$.current.contains(X.target)&&F.current&&!F.current.contains(X.target)&&h(false),de.current&&!de.current.contains(X.target)&&O(false);};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[]);let G=react.useCallback(H=>{if(!F.current)return;let X=F.current.selectionStart||e.length,Z=e.slice(0,X)+H+e.slice(X);t(Z),O(false),setTimeout(()=>{if(F.current){let ge=X+H.length;F.current.selectionStart=ge,F.current.selectionEnd=ge,F.current.focus();}},0);},[e,t]),ae=react.useCallback(H=>{if(!g||!H.target.files)return;let X=Array.from(H.target.files),Z=b*1024*1024,ge=X.filter(Le=>Le.size>Z?(console.warn(`File ${Le.name} exceeds max size of ${b}MB`),false):true);ge.length>0&&g(ge),H.target.value="";},[g,b]),we=react.useCallback(H=>H.type.startsWith("image/")?lucideReact.Image:H.type.includes("pdf")||H.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&$.current){let H=$.current.children[k];H&&H.scrollIntoView({block:"nearest"});}},[k,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:m.map(H=>{let X=we(H.file),Z=H.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:p("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[Z&&H.preview?jsxRuntime.jsx("img",{src:H.preview,alt:H.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(X,{className:p("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:p("text-xs truncate",v?"text-white":"text-gray-900"),children:H.file.name}),jsxRuntime.jsx("p",{className:p("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:Zf(H.file.size)})]}),x&&jsxRuntime.jsx("button",{onClick:()=>x(H.id),className:p("p-0.5 rounded-full transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},H.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:p("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:p("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O(!I),disabled:s||n,className:p("p-1 rounded transition-colors flex-shrink-0",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsx(framerMotion.motion.div,{ref:de,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:eb.map(H=>jsxRuntime.jsx("button",{type:"button",onClick:()=>G(H),className:p("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:H},H))})})})]}),l&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>z.current?.click(),disabled:s||n,className:p("p-1.5 rounded transition-colors",v?"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:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:z,type:"file",multiple:true,onChange:ae,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:F,value:e,onChange:J,onSelect:xe,onKeyDown:M,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:p("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"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"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:p("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&w.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:$,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((H,X)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ge(H),className:p("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",X===k?v?"bg-white/10":"bg-gray-100":v?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:H.color||"#8B5CF6"},children:Qf(H.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:p("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:H.name}),H.email&&jsxRuntime.jsx("p",{className:p("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:H.email})]})]},H.id))})})]})]})]})}function Cu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((d,c)=>d.type==="mention"?jsxRuntime.jsx("span",{className:p("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:d.value},c):jsxRuntime.jsx("span",{children:d.value},c))})}var Ps=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function no({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[d,c]=react.useState(false),[i,u]=react.useState(""),[l,m]=react.useState(false),[g,x]=react.useState(Ps[10]||"#2E94FF"),[b,v]=react.useState({top:0,left:0}),f=react.useRef(null),h=react.useRef(null),w=react.useRef(null),y=react.useRef(null),k=t.filter(F=>F.name.toLowerCase().includes(i.toLowerCase())),C=t.some(F=>F.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(d&&h.current){let F=h.current.getBoundingClientRect();v({top:F.bottom+6,left:F.left});}},[d]),react.useEffect(()=>{let F=$=>{let z=$.target,de=f.current?.contains(z),A=w.current?.contains(z);!de&&!A&&(c(false),u(""),m(false));};if(d)return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[d]),react.useEffect(()=>{d&&y.current&&y.current.focus();},[d]);let E=F=>{let $=e.some(z=>z.id===F.id);a($?e.filter(z=>z.id!==F.id):[...e,F]);},T=async()=>{if(!(!r||!i.trim())){m(true);try{let F=await r(i.trim(),g);F&&(a([...e,F]),u(""),x(Ps[Math.floor(Math.random()*Ps.length)]||"#2E94FF"));}finally{m(false);}}},I=(F,$)=>{$.stopPropagation(),a(e.filter(z=>z.id!==F));},O={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&c(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:O,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(F=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${F.color}20`,color:F.color},children:F.name},F.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:w,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:b.top,left:b.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:y,type:"text",value:i,onChange:F=>u(F.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:F=>{F.key==="Enter"&&i.trim()&&!C&&r&&T();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(F=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${F.color}20`,color:F.color},onClick:$=>I(F.id,$),children:[F.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},F.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(F=>{let $=e.some(z=>z.id===F.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>E(F),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:$?`${F.color}15`:"transparent",color:o.textPrimary},onMouseEnter:z=>{$||(z.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:z=>{$||(z.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:F.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:F.name}),$&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:F.color}})]},F.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!C&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Ps.map(F=>jsxRuntime.jsx("button",{type:"button",onClick:()=>x(F),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:F,outline:g===F?`2px solid ${F}`:"none",outlineOffset:"2px"}},F))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:l?.7:1},children:[l?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function dl({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Nu({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(dl,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Eo=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{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 Du(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 db(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 cb({className:e}){return jsxRuntime.jsxs("svg",{className:p("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function cl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=db(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"},d={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Du(e.loggedMinutes),i=e.estimateMinutes?Du(e.estimateMinutes):null,u=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:p("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:[jsxRuntime.jsx(cb,{className:d[t]}),jsxRuntime.jsx("span",{children:u})]})}function Eu(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*60)}function As(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 mb(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 gb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function fb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Fu({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function bb({className:e}){return jsxRuntime.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function ul({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:d,onStopTimer:c,onDiscardTimer:i,onClose:u,className:l}){let[m,g]=react.useState(""),[x,b]=react.useState(t.estimateMinutes?As(t.estimateMinutes):""),[v,f]=react.useState(""),[h,w]=react.useState(false),[y,k]=react.useState(false),C=react.useRef(null);react.useEffect(()=>{C.current?.focus();},[]);let E=async()=>{let O=Eu(m);if(!(O<=0||!s)){w(true);try{await s({durationMinutes:O,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},T=async()=>{if(!n)return;let O=x.trim()?Eu(x):null;await n(O),k(false);},I=O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),E()),O.key==="Escape"&&u?.();};return jsxRuntime.jsxs("div",{className:p("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",l),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Fu,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:r?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"relative flex h-2 w-2",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsxRuntime.jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:mb(o)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(fb,{className:"w-4 h-4"})}),jsxRuntime.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:jsxRuntime.jsx(Fu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:d,className:p("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:[jsxRuntime.jsx(gb,{className:"w-4 h-4"}),"Start Timer"]})}),jsxRuntime.jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"relative flex-1",children:[jsxRuntime.jsx(bb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:C,type:"text",value:m,onChange:O=>g(O.target.value),onKeyDown:I,placeholder:"8 (=8h), 2h 30m",className:p("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")})]}),jsxRuntime.jsx("button",{onClick:E,disabled:h||!m.trim(),className:p("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"})]}),jsxRuntime.jsx("input",{type:"text",value:v,onChange:O=>f(O.target.value),onKeyDown:I,placeholder:"Note (optional)",className:p("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")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:As(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),y?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:x,onChange:O=>b(O.target.value),onKeyDown:O=>{O.key==="Enter"&&T(),O.key==="Escape"&&k(false);},onBlur:T,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"})}):jsxRuntime.jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?As(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:p("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,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:p("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&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(O=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsxRuntime.jsx("span",{className:"truncate flex-1",children:O.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:As(O.durationMinutes)})]},O.id))})]})]})}function wb(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*60)}function kb(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 Ir({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[d,c]=react.useState(kb(r)),[i,u]=react.useState(""),[l,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let x=async()=>{m(true);let w=wb(d);await o(w&&w>0?w:null,i||void 0),m(false);},b=async()=>{m(true),await o(null),m(false);},v=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),x()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxRuntime.jsxs("div",{className:p("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:g,type:"text",value:d,onChange:w=>c(w.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 2:30"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>u(w.target.value),onKeyDown:v,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:l||!d.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:l?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:b,disabled:l,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function Cb(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 Tb(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 ml({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Cb(e.health),s=Tb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},d=e.progressPercent??0,c=Math.min(100,d),i=d>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:p("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:p("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:p("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:p("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:p("h-full transition-all duration-300",o),style:{width:`${c}%`}}),i&&jsxRuntime.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&&jsxRuntime.jsxs("span",{className:p("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[d,"%"]})]})}function Zo(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 Db(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 Sb(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 Eb(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 Fb({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",d=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-1",d),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:p("text-2xl font-bold",o),children:[r?"+":"",Zo(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:p("text-xs mt-1",d),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-2",d),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-2",d),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:d,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:Zo(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:d,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:Zo(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:p("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:d,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Pb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",d=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:p("border-b",s,r&&p("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:p("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:p("text-xs mt-1",d),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Zo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Zo(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:p("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":d),children:[o,Zo(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:p("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":d),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:p("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Sb(e.status,a),Db(e.status,a)),children:Eb(e.status,t)})})]})}function gl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",d=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",u=n?"text-white/[0.92]":"text-gray-900",l=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((x,b)=>x.varianceMinutes===null?1:b.varianceMinutes===null?-1:b.varianceMinutes-x.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:p("p-8 text-center",l,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:p("p-8 text-center",l,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:p("space-y-6 p-6",d,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:p("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:p("text-sm mt-1",l),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Fb,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:p("rounded-lg border overflow-hidden",c,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:m,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:p("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:"%"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:p("divide-y",i),children:g.map(x=>jsxRuntime.jsx(Pb,{task:x,locale:a,isDark:n,onClick:s},x.taskId))})]})})}),jsxRuntime.jsx("div",{className:p("text-xs text-center",l),children:a==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function en(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 Vb(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 Hu(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,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function _b(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 Kr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:l,onDeleteAttachment:m,availableTasks:g=[],comments:x=[],onAddComment:b,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:h,enableTimeTracking:w=false,timeTrackingSummary:y,timeEntries:k=[],isTimerRunning:C=false,timerElapsedSeconds:E=0,onTimeLog:T,onEstimateUpdate:I,onSoldEffortUpdate:O,onTimerStart:F,onTimerStop:$,onTimerDiscard:z,blurFinancials:de=false}){let A=s==="dark",J={textTertiary:A?"#6B7280":"#9CA3AF",textSecondary:A?"#9CA3AF":"#6B7280",textPrimary:A?"#FFFFFF":"#111827",borderLight:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:A?"#1A1D25":"#FFFFFF",bgSecondary:A?"#0A0A0A":"#F9FAFB",hoverBg:A?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},xe=e&&"title"in e&&!("name"in e),Ge=e,[M,G]=react.useState(e?Hu(e,d):null),[ae,we]=react.useState(false),[H,X]=react.useState(false),[Z,ge]=react.useState(false),[Le,Oe]=react.useState(null),[rt,at]=react.useState(new Date),[re,it]=react.useState(false),[Ie,bt]=react.useState(false),[pt,ct]=react.useState(""),[Ce,_e]=react.useState(false),[tt,Ke]=react.useState(false),[U,ne]=react.useState(false),[S,q]=react.useState(false),[le,fe]=react.useState(""),_=react.useRef(null),Q=react.useRef(null),[$e,ke]=react.useState(""),Be=react.useRef(null),[De,He]=react.useState(""),[st,ot]=react.useState(false),[nt,mt]=react.useState([]),[Bt,Tt]=react.useState(""),[lt,ut]=react.useState(false),Et=react.useRef(null);react.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 L=Hu(e,d);console.log("\u{1F4E5} After normalizeToTask:",{taskId:L?.id,taskName:L?.name,soldEffortMinutes:L?.soldEffortMinutes,quotedMinutes:L?.quotedMinutes,effortMinutes:L?.effortMinutes,timeLoggedMinutes:L?.timeLoggedMinutes}),G(L),fe(L.description||""),ke(L.name||"");}},[e?.id,e?.quotedMinutes,d,t]),react.useEffect(()=>{if(!t||!le)return;let L=setTimeout(()=>{let ce=Q.current;ce&&(ce.style.height="auto",ce.style.height=`${Math.max(100,ce.scrollHeight)}px`);},50);return ()=>clearTimeout(L)},[t,le]),react.useEffect(()=>()=>{_.current&&clearTimeout(_.current),Be.current&&clearTimeout(Be.current);},[]),react.useEffect(()=>{t&&Et.current&&x.length>0&&setTimeout(()=>{Et.current&&(Et.current.scrollTop=Et.current.scrollHeight);},100);},[t,x.length]);let Nt=react.useCallback(L=>{G(L),xe&&o&&Ge?o(_b(L,Ge)):r&&r(L);},[xe,Ge,o,r]),Fe=react.useCallback(()=>{we(false),X(false),ge(false),Oe(null),bt(false),ct(""),_e(false);},[]),We=react.useCallback((L,ce)=>{if(!M)return;let Re={...M,[L]:ce};Nt(Re);},[M,Nt]),Y=react.useCallback(()=>{let L=Q.current;L&&(L.style.height="auto",L.style.height=`${Math.max(100,L.scrollHeight)}px`);},[]),he=react.useCallback(L=>{fe(L),setTimeout(Y,0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{if(M){let ce={...M,description:L};Nt(ce);}},800);},[M,Nt,Y]),N=react.useCallback(L=>{ke(L),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{if(M&&L.trim()){let ce={...M,name:L.trim()};Nt(ce);}},800);},[M,Nt]),D=react.useCallback(L=>{let ce=L.map(Re=>{let je={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Re};return Re.type.startsWith("image/")&&(je.preview=URL.createObjectURL(Re)),je});mt(Re=>[...Re,...ce]);},[]),B=react.useCallback(L=>{mt(ce=>{let Re=ce.find(je=>je.id===L);return Re?.preview&&URL.revokeObjectURL(Re.preview),ce.filter(je=>je.id!==L)});},[]),j=react.useCallback(async()=>{if(!(!M||!De.trim()&&nt.length===0||!b)){ot(true);try{let L=wu(De,f),ce=[];if(nt.length>0&&h){let Re=nt.map(je=>je.file);ce=await h(Re);}await b(M.id,De.trim(),L.length>0?L:void 0,ce.length>0?ce:void 0),He(""),nt.forEach(Re=>{Re.preview&&URL.revokeObjectURL(Re.preview);}),mt([]);}finally{ot(false);}}},[M,De,nt,b,f,h]),se=react.useCallback(()=>{if(!M||!Bt.trim())return;let L=M.subtasks||[],ce={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Bt.trim(),progress:0,startDate:new Date,endDate:new Date,position:L.length},Re=[...L,ce],je={...M,subtasks:Re};Nt(je),Tt(""),ut(false);},[M,Bt,Nt]),pe=react.useCallback(L=>{if(!M?.subtasks)return;let ce=M.subtasks.map(je=>je.id===L?{...je,progress:je.progress===100?0:100}:je),Re={...M,subtasks:ce};Nt(Re);},[M,Nt]),te=react.useCallback(L=>{if(!M?.subtasks)return;let ce=M.subtasks.filter(je=>je.id!==L),Re={...M,subtasks:ce};Nt(Re);},[M,Nt]),me=react.useCallback(L=>{let ce=typeof L=="string"?new Date(L):L,je=new Date().getTime()-ce.getTime(),ht=Math.floor(je/6e4),Ua=Math.floor(je/36e5),aa=Math.floor(je/864e5);return ht<1?n==="es"?"Ahora":"Just now":ht<60?n==="es"?`Hace ${ht} min`:`${ht}m ago`:Ua<24?n==="es"?`Hace ${Ua}h`:`${Ua}h ago`:aa<7?n==="es"?`Hace ${aa}d`:`${aa}d ago`:ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ye=react.useCallback(L=>{if(!M)return;let ce=M.progress||0;L==="completed"?ce=100:L==="in-progress"&&ce===0?ce=10:L==="todo"&&(ce=0);let Re={...M,status:L,progress:ce};Nt(Re),we(false);},[M,Nt]),qe=react.useCallback((L,ce)=>{if(!M)return;let Re={...M,startDate:L,endDate:ce};Nt(Re);},[M,Nt]),At=react.useCallback(()=>{let L=rt.getFullYear(),ce=rt.getMonth(),Re=new Date(L,ce,1),ht=new Date(L,ce+1,0).getDate(),Ua=Re.getDay(),aa=[],nr=new Date(L,ce,0).getDate();for(let la=Ua-1;la>=0;la--)aa.push({date:new Date(L,ce-1,nr-la),isCurrentMonth:false});for(let la=1;la<=ht;la++)aa.push({date:new Date(L,ce,la),isCurrentMonth:true});let ia=42-aa.length;for(let la=1;la<=ia;la++)aa.push({date:new Date(L,ce+1,la),isCurrentMonth:false});return aa},[rt]),jt=react.useCallback(async L=>{if(L.preventDefault(),L.stopPropagation(),ne(false),!M||!l)return;let ce=Array.from(L.dataTransfer.files);if(ce.length!==0){q(true);try{await l(M.id,ce);}finally{q(false);}}},[M,l]),sa=react.useCallback(async L=>{if(!M||!l||!L.target.files)return;let ce=Array.from(L.target.files);if(ce.length!==0){q(true);try{await l(M.id,ce);}finally{q(false);}L.target.value="";}},[M,l]),Me=react.useCallback(L=>{L.preventDefault(),L.stopPropagation(),ne(true);},[]),W=react.useCallback(L=>{L.preventDefault(),L.stopPropagation(),ne(false);},[]),ve=react.useCallback(L=>L<1024?`${L} B`:L<1024*1024?`${(L/1024).toFixed(1)} KB`:`${(L/(1024*1024)).toFixed(1)} MB`,[]),$t=react.useCallback(L=>L.startsWith("image/")?lucideReact.Image:L.includes("pdf")||L.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!M?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:p("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",A?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:p("px-6 py-3 border-b flex items-center gap-3 h-[49px]",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:p("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:p("text-xs px-2 py-0.5 rounded",A?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:p("text-xs font-mono",A?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let L=M.progress===100?0:100,Re={...M,progress:L,status:L===100?"completed":"todo"};Nt(Re);},className:p("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",M.progress===100?"bg-green-500 border-green-500":A?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:M.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:$e,onChange:L=>N(L.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:p("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",M.progress===100?"line-through text-[#6B7280]":A?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Fe(),we(!ae);},className:p("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",M.progress===100||M.status==="completed"?"bg-green-500/20 text-green-400":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/20 text-blue-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.progress===100||M.status==="completed"?n==="es"?"COMPLETADO":"DONE":M.progress&&M.progress>0||M.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>we(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",A?"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(L=>jsxRuntime.jsxs("button",{onClick:()=>Ye(L.id),className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",M.status===L.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",L.color)}),jsxRuntime.jsx("span",{className:A?"text-white":"text-gray-900",children:L.label})]},L.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),ge(!Z);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[M.assignees&&M.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[M.assignees.slice(0,3).map((L,ce)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:L.color||"#8B5CF6"},title:L.name,children:L.initials||L.name.slice(0,2).toUpperCase()},ce)),M.assignees.length>3&&jsxRuntime.jsxs("span",{className:p("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:["+",M.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:p("text-sm",A?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ge(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:d.length>0?d.map(L=>{let ce=M.assignees?.some(Re=>Re.name===L.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Re=M.assignees||[],je;ce?je=Re.filter(ht=>ht.name!==L.name):je=[...Re,L],We("assignees",je);},className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",ce&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:L.color||"#8B5CF6"},children:L.initials||L.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:p("flex-1",A?"text-white":"text-gray-900"),children:L.name}),ce&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},L.name)}):jsxRuntime.jsx("div",{className:p("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Oe(Le?null:"start"),at(M.startDate||new Date);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[M.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:p("mx-1",A?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),M.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Oe(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:p("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:p("w-44 py-2 border-r",A?"border-white/10":"border-gray-200"),children:[(()=>{let L=new Date,ce=new Date(L);ce.setDate(L.getDate()+1);let Re=new Date(L);Re.setDate(L.getDate()+((6-L.getDay()+7)%7||7));let je=new Date(L);je.setDate(L.getDate()+((1-L.getDay()+7)%7||7));let ht=new Date(L);ht.setDate(L.getDate()+(6-L.getDay()+7)%7+7);let Ua=new Date(L);Ua.setDate(L.getDate()+14);let aa=new Date(L);return aa.setDate(L.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:L,display:L.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ce,display:ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Re,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:je,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ht,display:ht.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Ua,display:Ua.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:aa,display:aa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ia,la)=>jsxRuntime.jsxs("button",{className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Le==="start"){let Wo=M.endDate&&ia.date>M.endDate?ia.date:M.endDate;qe(ia.date,Wo),Oe("end");}else {let Wo=M.startDate&&ia.date<M.startDate?ia.date:M.startDate;qe(Wo,ia.date),Oe(null);}},children:[jsxRuntime.jsx("span",{children:ia.label}),jsxRuntime.jsx("span",{className:p("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:ia.display})]},la))})(),jsxRuntime.jsx("div",{className:p("border-t mt-2 pt-2",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{qe(void 0,void 0),Oe(null);},className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:p("text-xs mb-3 px-2 py-1 rounded",A?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Le==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:p("font-medium",A?"text-white":"text-gray-900"),children:rt.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>at(new Date),className:p("p-1 rounded text-sm transition-colors",A?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>at(new Date(rt.getFullYear(),rt.getMonth()-1)),className:p("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>at(new Date(rt.getFullYear(),rt.getMonth()+1)),className:p("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(L=>jsxRuntime.jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",A?"text-[#6B7280]":"text-gray-400"),children:L},L))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:At().map((L,ce)=>{let Re=L.date.toDateString()===new Date().toDateString(),je=M.startDate?.toDateString()===L.date.toDateString(),ht=M.endDate?.toDateString()===L.date.toDateString(),Ua=je||ht,aa=M.startDate&&M.endDate&&L.date>=M.startDate&&L.date<=M.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let nr=new Date(L.date);if(Le==="start"){let ia=M.endDate&&nr>M.endDate?nr:M.endDate;qe(nr,ia),Oe("end");}else {let ia=M.startDate&&nr<M.startDate?nr:M.startDate;qe(ia,nr),Oe(null);}},className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!L.isCurrentMonth&&(A?"text-[#4B5563]":"text-gray-300"),L.isCurrentMonth&&(A?"text-white":"text-gray-900"),Re&&"ring-2 ring-[#2E94FF]",je&&"bg-[#2E94FF] text-white",ht&&!je&&"bg-[#7C3AED] text-white",aa&&!Ua&&(A?"bg-[#7C3AED]/20":"bg-purple-100"),!Ua&&(A?"hover:bg-white/10":"hover:bg-gray-100")),children:L.date.getDate()},ce)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Fe(),X(!H);},className:p("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",M.priority==="high"||M.priority==="urgent"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":M.priority==="low"?"bg-green-500/20 text-green-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.priority?M.priority==="high"||M.priority==="urgent"?n==="es"?"Alta":"High":M.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",A?"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(L=>jsxRuntime.jsxs("button",{onClick:()=>{We("priority",L.id),X(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",M.priority===L.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",L.color)}),jsxRuntime.jsx("span",{className:A?"text-white":"text-gray-900",children:L.label})]},L.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:p("text-sm",A?"text-white":"text-gray-900"),children:M.startDate&&M.endDate?`${Math.ceil((M.endDate.getTime()-M.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:p("w-4 h-4 rounded-full border-2",A?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[re?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:M.progress||0,onChange:L=>{let ce=parseInt(L.target.value),Re=M.status;ce===100?Re="completed":ce>0?Re="in-progress":Re="todo";let je={...M,progress:ce,status:Re};Nt(je);},onBlur:()=>it(false),className:p("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",A?"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-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>it(true),className:p("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",A?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${M.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:p("text-sm font-medium min-w-[40px]",A?"text-white":"text-gray-900"),children:[M.progress||0,"%"]})]})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:M.status==="completed"||M.progress===100?jsxRuntime.jsx("span",{className:p("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:y?.estimateMinutes?en(y.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):y?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("estimate"),className:p("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:en(y.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("estimate"),className:p("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="estimate"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Ir,{mode:"estimate",locale:n,isDark:A,currentValue:y?.estimateMinutes||null,onSave:async L=>{await I?.(M.id,L),Ke(false);},onClose:()=>Ke(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:de?jsxRuntime.jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",A?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):M.status==="completed"||M.progress===100?jsxRuntime.jsx("span",{className:p("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:M.quotedMinutes?en(M.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):M.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("quoted"),className:p("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:en(M.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("quoted"),className:p("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="quoted"&&!de&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Ir,{mode:"quoted",locale:n,isDark:A,currentValue:M.quotedMinutes||null,onSave:async L=>{O?(await O(M.id,L),G(ce=>ce?{...ce,quotedMinutes:L}:null)):We("quotedMinutes",L),Ke(false);},onClose:()=>Ke(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[M.status==="completed"||M.progress===100?jsxRuntime.jsx("div",{className:p("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",A?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):C?jsxRuntime.jsxs("button",{type:"button",onClick:()=>$?.(M.id),className:p("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:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),Vb(E||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>F?.(M.id),className:p("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",A?"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:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),M.status==="completed"||M.progress===100?jsxRuntime.jsxs("div",{className:p("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ke("log"),className:p("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",A?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),y&&y.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:p("text-sm font-medium",y.health==="over-budget"?"text-red-500":y.health==="at-risk"?"text-yellow-500":A?"text-white":"text-gray-900"),children:[en(y.loggedMinutes),y.estimateMinutes&&jsxRuntime.jsxs("span",{className:p("font-normal",A?"text-[#6B7280]":"text-gray-400"),children:[" / ",en(y.estimateMinutes)]})]}),y.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-all",y.health==="over-budget"?"bg-red-500":y.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,y.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="log"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Ir,{mode:"log",locale:n,isDark:A,currentValue:null,onSave:async(L,ce)=>{L&&await T?.(M.id,{durationMinutes:L,note:ce,source:"manual"}),Ke(false);},onClose:()=>Ke(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(no,{selectedTags:M.tags||[],availableTags:c,onChange:L=>{We("tags",L);},onCreateTag:i,theme:J})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:p("w-4 h-4 mt-1.5",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0 mt-1",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[M.dependencies&&M.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:M.dependencies.map(L=>{let ce=g.find(Re=>Re.id===L);return jsxRuntime.jsxs("span",{className:p("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",A?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ce?.name||L.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Re=(M.dependencies||[]).filter(je=>je!==L);We("dependencies",Re);},className:p("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},L)})}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),bt(!Ie);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:p("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{bt(false),ct("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("p-2 border-b",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:pt,onChange:L=>ct(L.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:p("w-full px-3 py-2 rounded-md text-sm outline-none",A?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(L=>L.id!==M.id).filter(L=>pt===""||L.name.toLowerCase().includes(pt.toLowerCase())).map(L=>{let ce=M.dependencies?.includes(L.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Re=M.dependencies||[],je;ce?je=Re.filter(ht=>ht!==L.id):je=[...Re,L.id],We("dependencies",je);},className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",ce&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:p("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ce?"bg-blue-500 border-blue-500":A?"border-white/30":"border-gray-300"),children:ce&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:p("block truncate",A?"text-white":"text-gray-900"),children:L.name}),jsxRuntime.jsx("span",{className:p("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:L.id.slice(0,8)})]})]},L.id)}):jsxRuntime.jsx("div",{className:p("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),_e(!Ce);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:M.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:p("text-sm",A?"text-white":"text-gray-900"),children:Eo.find(L=>L.value===M.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>_e(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Eo.map(L=>{let ce=M.color===L.value;return jsxRuntime.jsx("button",{onClick:()=>{We("color",L.value),_e(false);},className:p("w-7 h-7 rounded-full flex items-center justify-center transition-all",ce&&"ring-2 ring-offset-2",A?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:L.value,outlineColor:ce?L.value:void 0},title:L.name,children:ce&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},L.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:M.isMilestone||false,onChange:L=>We("isMilestone",L.target.checked),className:p("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",M.isMilestone?"bg-purple-500 border-purple-500":A?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:p("text-sm",A?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:p("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:p("text-sm font-semibold",A?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:Q,value:le,onChange:L=>he(L.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:p("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",A?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:p("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",M.subtasks&&M.subtasks.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",M.subtasks.filter(L=>L.progress===100).length,"/",M.subtasks.length,")"]})]})}),M.subtasks&&M.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...M.subtasks].sort((L,ce)=>(L.position??0)-(ce.position??0)).map(L=>jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",A?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>pe(L.id),className:p("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",L.progress===100?"bg-green-500 border-green-500":A?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:L.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:p("text-sm flex-1",L.progress===100?"line-through text-[#6B7280]":A?"text-white":"text-gray-900"),children:L.name}),jsxRuntime.jsx("button",{onClick:()=>te(L.id),className:p("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",A?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},L.id))}),lt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:Bt,onChange:L=>Tt(L.target.value),onKeyDown:L=>{L.key==="Enter"&&Bt.trim()?se():L.key==="Escape"&&(ut(false),Tt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:p("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",A?"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")}),jsxRuntime.jsx("button",{onClick:se,disabled:!Bt.trim(),className:p("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Bt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":A?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{ut(false),Tt("");},className:p("p-2 rounded-lg transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>ut(true),className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:p("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold mb-3",A?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(L=>{let ce=$t(L.type),Re=L.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:p("flex items-center gap-3 p-2 rounded-lg group transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Re&&L.thumbnailUrl?jsxRuntime.jsx("img",{src:L.thumbnailUrl,alt:L.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:p("w-10 h-10 rounded flex items-center justify-center",A?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ce,{className:p("w-5 h-5",A?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:L.url,target:"_blank",rel:"noopener noreferrer",className:p("text-sm font-medium truncate block hover:underline",A?"text-white":"text-gray-900"),children:L.name}),jsxRuntime.jsx("p",{className:p("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:ve(L.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(L.id),className:p("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",A?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},L.id)})}),jsxRuntime.jsxs("div",{onDragOver:Me,onDragLeave:W,onDrop:jt,className:p("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",U?A?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":A?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",S&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:sa,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||S}),S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:p("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:p("w-6 h-6 mx-auto mb-2",U?"text-blue-500":A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:p("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:U?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!l&&jsxRuntime.jsx("p",{className:p("text-xs mt-1",A?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:p("w-96 border-l flex flex-col",A?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between h-[49px]",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",x.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",x.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:p("p-1.5 rounded transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=jc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=jc(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((g,x)=>{i[g]=d[x]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let l=o.get(u),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),l.cardIds.push(m.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function jc(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 Kc(e,t){switch(t){case "json":return vf(e);case "csv":return wf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Yc(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 al=react.createContext(null);function qc(){return react.useContext(al)}var Xc=react.createContext(null);function Jc({children:e,themeName:t}){return jsxRuntime.jsx(Xc.Provider,{value:{themeName:t},children:e})}function qo(){return react.useContext(Xc)}function Lt({children:e,container:t}){let[a,r]=react.useState(false),o=qc(),s=qo();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:d,themeName:c}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var au={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Ff="#BDC3C7",Pf=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function To({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),d=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,v=160,f=220,h=4,w=g.right-v;w<10&&(w=g.left),w+v>b-10&&(w=b-v-10);let y=x-g.bottom,k=g.top,C;y>=f+h?C=g.bottom+h:k>=f+h?C=g.top-f-h:C=y>=k?g.bottom+h:Math.max(10,g.top-f-h),n({top:C,left:w}),o(true);};react.useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&!c.current?.contains(x.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=x=>{x.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let u=g=>{t(g),o(false);},l=e?au[e]:null,m=l?.color||Ff;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,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?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsxs("div",{ref:d,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(au).map(([g,x])=>jsxRuntime.jsxs("button",{onClick:()=>u(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:x.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Pf,{color:x.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:x.label}),e===g&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Mf=[{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 En({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),m=(qo()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let w=i.current.getBoundingClientRect(),y=window.innerHeight,k=window.innerWidth,C=320,E=380,T=4,I=w.left;I+C>k-10&&(I=k-C-10),I<10&&(I=10);let O=y-w.bottom,F=w.top,$;O>=E+T?$=w.bottom+T:F>=E+T?$=w.top-E-T:$=O>=F?w.bottom+T:Math.max(10,w.top-E-T),d({top:$,left:I}),s(true);};react.useEffect(()=>{let w=y=>{c.current&&!c.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),react.useEffect(()=>{let w=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let x=w=>{let y=new Date,k=I=>{let O=I.getFullYear(),F=String(I.getMonth()+1).padStart(2,"0"),$=String(I.getDate()).padStart(2,"0");return `${O}-${F}-${$}`},C=k(y),E=new Date(y);E.setDate(E.getDate()+w);let T=k(E);a(C,T),s(false);},b=()=>{if(!e||!t)return "Set date";let w=E=>{if(E instanceof Date)return E;if(typeof E!="string"||!E.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=E.split("-").map(Number);if(T.length!==3||T.some($=>isNaN($)))return null;let I=T[0],O=T[1],F=T[2];return I===void 0||O===void 0||F===void 0?null:new Date(I,O-1,F)},y=w(e),k=w(t);if(!y||!k||isNaN(y.getTime())||isNaN(k.getTime()))return "Set date";let C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${C[y.getMonth()]} ${y.getDate()} \u2013 ${C[k.getMonth()]} ${k.getDate()}`},v=e&&t,h=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,y=new Date;return y.setHours(0,0,0,0),w<y})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.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:v?`${b()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:b()})]}),o&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:m?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Mf.map(w=>jsxRuntime.jsx("button",{onClick:()=>x(w.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",y.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:y=>{y.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",y.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Do({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[d,c]=react.useState(""),[i,u]=react.useState({top:0,left:0}),l=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),w=window.innerHeight,y=window.innerWidth,k=300,C=380,E=4,T=h.right-k;T<10&&(T=h.left),T+k>y-10&&(T=y-k-10);let I=w-h.bottom,O=h.top,F;I>=C+E?F=h.bottom+E:O>=C+E?F=h.top-C-E:F=I>=O?h.bottom+E:Math.max(10,h.top-C-E),u({top:F,left:T}),n(true);};react.useEffect(()=>{let h=w=>{l.current&&!l.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let x=h=>{let w=e.some(y=>y.id===h.id);a(w?e.filter(y=>y.id!==h.id):[...e,h]);},b=t.filter(h=>h.name.toLowerCase().includes(d.toLowerCase())),v=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,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?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[v.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:d,onChange:h=>c(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:b.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):b.map(h=>{let w=e.some(y=>y.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>x(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:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},h.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Ts(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let l=u;return l.taskId||l.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,d=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let u of i){if(!s.has(u)&&d(u))return true;if(n.has(u))return true}}return n.delete(c),false};return d(a)}function Pn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,c]=react.useState(false),[i,u]=react.useState(""),[l,m]=react.useState(t.length>0),[g,x]=react.useState({top:0,left:0}),[b,v]=react.useState(null),f=react.useRef(null),h=react.useRef(null),w=()=>{if(!h.current)return;let T=h.current.getBoundingClientRect(),I=window.innerHeight,O=window.innerWidth,F=300,$=l?380:120,z=4,de=T.right-F;de<10&&(de=T.left),de+F>O-10&&(de=O-F-10);let A=I-T.bottom,J=T.top,xe;A>=$+z?xe=T.bottom+z:J>=$+z?xe=T.top-$-z:xe=A>=J?T.bottom+z:Math.max(10,T.top-$-z),x({top:xe,left:de}),c(true);};react.useEffect(()=>{if(!d||!h.current)return;let T=h.current.getBoundingClientRect(),I=window.innerHeight,O=window.innerWidth,F=300,$=l?380:120,z=4,de=T.right-F;de<10&&(de=T.left),de+F>O-10&&(de=O-F-10);let A=I-T.bottom,J=T.top,xe;A>=$+z?xe=T.bottom+z:J>=$+z?xe=T.top-$-z:xe=A>=J?T.bottom+z:Math.max(10,T.top-$-z),x({top:xe,left:de});},[l,d]),react.useEffect(()=>{let T=I=>{f.current&&!f.current.contains(I.target)&&!h.current?.contains(I.target)&&(c(false),u(""));};if(d)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[d]),react.useEffect(()=>{let T=I=>{I.key==="Escape"&&(c(false),u(""));};if(d)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[d]);let y=T=>{let I=t.includes(T),O=a.find(F=>F.id===T);if(v(null),I){let F=t.filter($=>$!==T);r(F),F.length===0&&m(false);}else {if(s&&Ts(a,T,e)){let $=`Cannot add "${O?.title||T}" as dependency - would create circular reference`;v($),n?.(T,O?.title||T),setTimeout(()=>v(null),3e3);return}r([...t,T]),m(true);}},k=()=>{let T=!l;m(T),T||r([]);},C=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),E=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>d?c(false):w(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:E,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:E},children:t.length})]}),d&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsxs("div",{ref:f,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:[b&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:b})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:k,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:T=>u(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:C.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):C.map(T=>{let I=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>y(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:O=>{O.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:O=>{O.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:I?"#3b82f6":"transparent",borderColor:I?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:I&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var _r=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:l,transform:m,transition:g,isDragging:x}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:vs.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:l,style:b,...i,...u,onClick:()=>a?.(e),children:t(e)});let v=d.filter(y=>e.assignedUserIds?.includes(y.id)),f=e.progress===100,h=(e.attachments||[]).filter(y=>y.type.startsWith("image/")),w={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:w,className:p("asakaa-card",x&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:y=>{y.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:y=>{y.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:y=>{y.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((y,k)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:y.url,alt:y.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:C=>{C.currentTarget.style.display="none";}}),k===3&&h.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},y.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(To,{priority:e.priority,onChange:y=>n?.(e.id,{priority:y})})}),jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(En,{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:(y,k)=>n?.(e.id,{startDate:y,endDate:k})})}),d.length>0&&jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Do,{assignedUsers:v,availableUsers:d,onChange:y=>n?.(e.id,{assignedUserIds:y.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:y=>y.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Pn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(y=>typeof y=="string"?y:y.taskId):[],availableTasks:c,onChange:y=>n?.(e.id,{dependencies:y})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(y=>jsxRuntime.jsx("span",{className:"asakaa-label",children:y},y))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#2E94FF"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#2E94FF"}})})]})]})},(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&&e.render===t.render&&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)));_r.displayName="Card";var Ns={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"}},pu=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function mu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),u=[...Object.entries(Ns).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Ns).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let v=Ns[e];if(v)return {...v,id:e};let f=r.find(h=>h.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ns.todo,id:"todo"}},m=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),f=window.innerHeight,h=window.innerWidth,w=180,y=280,k=4,C=v.right-w;C<10&&(C=v.left),C+w>h-10&&(C=h-w-10);let E=f-v.bottom,T=v.top,I;E>=y+k?I=v.bottom+k:T>=y+k?I=v.top-y-k:I=E>=T?v.bottom+k:Math.max(10,v.top-y-k),d({top:I,left:C}),s(true);};react.useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},x=l(),b=x.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):m(),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:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:x.label,children:jsxRuntime.jsx(pu,{icon:x.icon,color:b})}),o&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:u.map(v=>jsxRuntime.jsxs("button",{onClick:()=>g(v.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:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(pu,{icon:v.icon,color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:v.label}),e===v.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}var gu={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function fu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=gu[s]||gu.en,[d,c]=react.useState(false),[i,u]=react.useState(false),[l,m]=react.useState(e),[g,x]=react.useState({top:0,left:0}),b=react.useRef(null),v=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(d&&v.current){let k=v.current.getBoundingClientRect();x({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[d]),react.useEffect(()=>{let k=C=>{b.current&&!b.current.contains(C.target)&&!v.current?.contains(C.target)&&(c(false),u(false));};if(d)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[d]),react.useEffect(()=>{let k=C=>{C.key==="Escape"&&(c(false),u(false),m(e));};if(d)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[d,e]),react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let h=()=>{u(true),m(e);},w=()=>{let k=l.trim();k&&k!==e&&t(k),u(false),c(false),m(e);},y=k=>{k.key==="Enter"?w():k.key==="Escape"&&(u(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>c(!d),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),d&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.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:i?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:l,onChange:k=>m(k.target.value),onKeyDown:y,onBlur:w,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:n.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:n.rename})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:n.delete})]})]})]})})})]})}var Qo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:l=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:x,onColumnDelete:b,isDeletable:v=false,className:f,renderMetrics:h,locale:w})=>{let{setNodeRef:y,isOver:k}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),C=react.useRef(null),E=u??zc(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>l,enabled:E});if(a)return jsxRuntime.jsx("div",{ref:y,className:f,children:a(e,t)});let O=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let z=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:z}:z>=80?{state:"warning",percentage:z}:z>=60?{state:"approaching",percentage:z}:{state:"ok",percentage:z}})(),F=O.state==="exceeded",$=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:y,className:p("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",F&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:p($()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&O.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${O.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[O.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),O.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),O.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),O.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(x||b)&&jsxRuntime.jsx(fu,{columnTitle:e.title,onRename:z=>x?.(e.id,z),onDelete:b?()=>b(e.id):void 0,isDeletable:v,locale:w}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!m&&jsxRuntime.jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:E?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(z=>z.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):E?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(z=>{let de=t[z.index];return de?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${z.start}px)`},children:jsxRuntime.jsx(_r,{card:de,render:r,onClick:n,onUpdate:d,availableUsers:c,allCards:i})},de.id):null})}):t.map(z=>jsxRuntime.jsx(_r,{card:z,render:r,onClick:n,onUpdate:d,availableUsers:c,allCards:i},z.id))})})]})});Qo.displayName="Column";function il({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),d=react.useRef(null);react.useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let c=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:d,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:c,onKeyDown:i,className:p("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:p("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Jf(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 wu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let c=d.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Qf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Zf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var eb=["\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 ku({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:l=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:x,maxFileSizeMB:b=10}){let v=d==="dark",[f,h]=react.useState(false),[w,y]=react.useState([]),[k,C]=react.useState(0),[E,T]=react.useState(null),[I,O]=react.useState(false),F=react.useRef(null),$=react.useRef(null),z=react.useRef(null),de=react.useRef(null),A=react.useCallback((H,X)=>{let Z=Jf(H,X);if(T(Z),Z){let ge=r.filter(Le=>Le.name.toLowerCase().includes(Z.query)||Le.email&&Le.email.toLowerCase().includes(Z.query)).slice(0,5);y(ge),h(ge.length>0),C(0);}else h(false),y([]);},[r]),J=H=>{let X=H.target.value;if(t(X),A(X,H.target.selectionStart||0),F.current){F.current.style.height="24px";let Z=F.current.scrollHeight,ge=280,Le=Math.min(Z,ge);F.current.style.height=`${Le}px`,F.current.style.overflowY=Z>ge?"auto":"hidden";}},xe=()=>{F.current&&A(e,F.current.selectionStart||0);},Ge=react.useCallback(H=>{if(!E||!F.current)return;let X=e.slice(0,E.start),Z=e.slice(E.end),ge=`@${H.name.replace(/\s+/g,"")} `,Le=X+ge+Z;t(Le),h(false),T(null),setTimeout(()=>{if(F.current){let Oe=E.start+ge.length;F.current.selectionStart=Oe,F.current.selectionEnd=Oe,F.current.focus();}},0);},[E,e,t]),M=H=>{if(f&&w.length>0)switch(H.key){case "ArrowDown":H.preventDefault(),C(X=>X<w.length-1?X+1:0);break;case "ArrowUp":H.preventDefault(),C(X=>X>0?X-1:w.length-1);break;case "Enter":{H.preventDefault();let X=w[k];X&&Ge(X);break}case "Tab":{H.preventDefault();let X=w[k];X&&Ge(X);break}case "Escape":H.preventDefault(),h(false);break}else H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),a());};react.useEffect(()=>{let H=X=>{$.current&&!$.current.contains(X.target)&&F.current&&!F.current.contains(X.target)&&h(false),de.current&&!de.current.contains(X.target)&&O(false);};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[]);let G=react.useCallback(H=>{if(!F.current)return;let X=F.current.selectionStart||e.length,Z=e.slice(0,X)+H+e.slice(X);t(Z),O(false),setTimeout(()=>{if(F.current){let ge=X+H.length;F.current.selectionStart=ge,F.current.selectionEnd=ge,F.current.focus();}},0);},[e,t]),ae=react.useCallback(H=>{if(!g||!H.target.files)return;let X=Array.from(H.target.files),Z=b*1024*1024,ge=X.filter(Le=>Le.size>Z?(console.warn(`File ${Le.name} exceeds max size of ${b}MB`),false):true);ge.length>0&&g(ge),H.target.value="";},[g,b]),we=react.useCallback(H=>H.type.startsWith("image/")?lucideReact.Image:H.type.includes("pdf")||H.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&$.current){let H=$.current.children[k];H&&H.scrollIntoView({block:"nearest"});}},[k,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:m.map(H=>{let X=we(H.file),Z=H.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:p("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[Z&&H.preview?jsxRuntime.jsx("img",{src:H.preview,alt:H.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(X,{className:p("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:p("text-xs truncate",v?"text-white":"text-gray-900"),children:H.file.name}),jsxRuntime.jsx("p",{className:p("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:Zf(H.file.size)})]}),x&&jsxRuntime.jsx("button",{onClick:()=>x(H.id),className:p("p-0.5 rounded-full transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},H.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:p("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:p("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O(!I),disabled:s||n,className:p("p-1 rounded transition-colors flex-shrink-0",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsx(framerMotion.motion.div,{ref:de,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:eb.map(H=>jsxRuntime.jsx("button",{type:"button",onClick:()=>G(H),className:p("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:H},H))})})})]}),l&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>z.current?.click(),disabled:s||n,className:p("p-1.5 rounded transition-colors",v?"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:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:z,type:"file",multiple:true,onChange:ae,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:F,value:e,onChange:J,onSelect:xe,onKeyDown:M,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:p("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"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"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:p("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&w.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:$,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((H,X)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ge(H),className:p("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",X===k?v?"bg-white/10":"bg-gray-100":v?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:H.color||"#8B5CF6"},children:Qf(H.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:p("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:H.name}),H.email&&jsxRuntime.jsx("p",{className:p("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:H.email})]})]},H.id))})})]})]})]})}function Cu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((d,c)=>d.type==="mention"?jsxRuntime.jsx("span",{className:p("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:d.value},c):jsxRuntime.jsx("span",{children:d.value},c))})}var Ps=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function no({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[d,c]=react.useState(false),[i,u]=react.useState(""),[l,m]=react.useState(false),[g,x]=react.useState(Ps[10]||"#2E94FF"),[b,v]=react.useState({top:0,left:0}),f=react.useRef(null),h=react.useRef(null),w=react.useRef(null),y=react.useRef(null),k=t.filter(F=>F.name.toLowerCase().includes(i.toLowerCase())),C=t.some(F=>F.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(d&&h.current){let F=h.current.getBoundingClientRect();v({top:F.bottom+6,left:F.left});}},[d]),react.useEffect(()=>{let F=$=>{let z=$.target,de=f.current?.contains(z),A=w.current?.contains(z);!de&&!A&&(c(false),u(""),m(false));};if(d)return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[d]),react.useEffect(()=>{d&&y.current&&y.current.focus();},[d]);let E=F=>{let $=e.some(z=>z.id===F.id);a($?e.filter(z=>z.id!==F.id):[...e,F]);},T=async()=>{if(!(!r||!i.trim())){m(true);try{let F=await r(i.trim(),g);F&&(a([...e,F]),u(""),x(Ps[Math.floor(Math.random()*Ps.length)]||"#2E94FF"));}finally{m(false);}}},I=(F,$)=>{$.stopPropagation(),a(e.filter(z=>z.id!==F));},O={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&c(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:O,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(F=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${F.color}20`,color:F.color},children:F.name},F.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:w,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:b.top,left:b.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:y,type:"text",value:i,onChange:F=>u(F.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:F=>{F.key==="Enter"&&i.trim()&&!C&&r&&T();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(F=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${F.color}20`,color:F.color},onClick:$=>I(F.id,$),children:[F.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},F.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(F=>{let $=e.some(z=>z.id===F.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>E(F),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:$?`${F.color}15`:"transparent",color:o.textPrimary},onMouseEnter:z=>{$||(z.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:z=>{$||(z.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:F.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:F.name}),$&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:F.color}})]},F.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!C&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Ps.map(F=>jsxRuntime.jsx("button",{type:"button",onClick:()=>x(F),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:F,outline:g===F?`2px solid ${F}`:"none",outlineOffset:"2px"}},F))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:l?.7:1},children:[l?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function dl({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Nu({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(dl,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Eo=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{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 Du(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 db(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 cb({className:e}){return jsxRuntime.jsxs("svg",{className:p("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function cl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=db(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"},d={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Du(e.loggedMinutes),i=e.estimateMinutes?Du(e.estimateMinutes):null,u=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:p("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:[jsxRuntime.jsx(cb,{className:d[t]}),jsxRuntime.jsx("span",{children:u})]})}function Eu(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*60)}function As(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 mb(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 gb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function fb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Fu({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function bb({className:e}){return jsxRuntime.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function ul({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:d,onStopTimer:c,onDiscardTimer:i,onClose:u,className:l}){let[m,g]=react.useState(""),[x,b]=react.useState(t.estimateMinutes?As(t.estimateMinutes):""),[v,f]=react.useState(""),[h,w]=react.useState(false),[y,k]=react.useState(false),C=react.useRef(null);react.useEffect(()=>{C.current?.focus();},[]);let E=async()=>{let O=Eu(m);if(!(O<=0||!s)){w(true);try{await s({durationMinutes:O,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},T=async()=>{if(!n)return;let O=x.trim()?Eu(x):null;await n(O),k(false);},I=O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),E()),O.key==="Escape"&&u?.();};return jsxRuntime.jsxs("div",{className:p("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",l),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Fu,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:r?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"relative flex h-2 w-2",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsxRuntime.jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:mb(o)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(fb,{className:"w-4 h-4"})}),jsxRuntime.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:jsxRuntime.jsx(Fu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:d,className:p("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:[jsxRuntime.jsx(gb,{className:"w-4 h-4"}),"Start Timer"]})}),jsxRuntime.jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"relative flex-1",children:[jsxRuntime.jsx(bb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:C,type:"text",value:m,onChange:O=>g(O.target.value),onKeyDown:I,placeholder:"8 (=8h), 2h 30m",className:p("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")})]}),jsxRuntime.jsx("button",{onClick:E,disabled:h||!m.trim(),className:p("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"})]}),jsxRuntime.jsx("input",{type:"text",value:v,onChange:O=>f(O.target.value),onKeyDown:I,placeholder:"Note (optional)",className:p("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")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:As(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),y?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:x,onChange:O=>b(O.target.value),onKeyDown:O=>{O.key==="Enter"&&T(),O.key==="Escape"&&k(false);},onBlur:T,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"})}):jsxRuntime.jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?As(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:p("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,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:p("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&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(O=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsxRuntime.jsx("span",{className:"truncate flex-1",children:O.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:As(O.durationMinutes)})]},O.id))})]})]})}function wb(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*60)}function kb(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 Ir({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[d,c]=react.useState(kb(r)),[i,u]=react.useState(""),[l,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let x=async()=>{m(true);let w=wb(d);await o(w&&w>0?w:null,i||void 0),m(false);},b=async()=>{m(true),await o(null),m(false);},v=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),x()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxRuntime.jsxs("div",{className:p("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:g,type:"text",value:d,onChange:w=>c(w.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 2:30"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>u(w.target.value),onKeyDown:v,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:l||!d.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:l?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:b,disabled:l,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function Cb(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 Tb(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 ml({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Cb(e.health),s=Tb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},d=e.progressPercent??0,c=Math.min(100,d),i=d>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:p("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:p("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:p("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:p("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:p("h-full transition-all duration-300",o),style:{width:`${c}%`}}),i&&jsxRuntime.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&&jsxRuntime.jsxs("span",{className:p("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[d,"%"]})]})}function Zo(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 Db(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 Sb(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 Eb(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 Fb({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",d=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-1",d),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:p("text-2xl font-bold",o),children:[r?"+":"",Zo(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:p("text-xs mt-1",d),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-2",d),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:p("text-sm font-medium mb-2",d),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:d,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:Zo(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:d,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:Zo(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:p("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:d,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:p("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Pb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",d=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:p("border-b",s,r&&p("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:p("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:p("text-xs mt-1",d),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Zo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Zo(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:p("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":d),children:[o,Zo(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:p("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":d),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:p("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Sb(e.status,a),Db(e.status,a)),children:Eb(e.status,t)})})]})}function gl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",d=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",u=n?"text-white/[0.92]":"text-gray-900",l=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((x,b)=>x.varianceMinutes===null?1:b.varianceMinutes===null?-1:b.varianceMinutes-x.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:p("p-8 text-center",l,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:p("p-8 text-center",l,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:p("space-y-6 p-6",d,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:p("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:p("text-sm mt-1",l),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Fb,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:p("rounded-lg border overflow-hidden",c,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:m,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:p("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:"%"}),jsxRuntime.jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:p("divide-y",i),children:g.map(x=>jsxRuntime.jsx(Pb,{task:x,locale:a,isDark:n,onClick:s},x.taskId))})]})})}),jsxRuntime.jsx("div",{className:p("text-xs text-center",l),children:a==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function en(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 Vb(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 Hu(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,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function _b(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 Kr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:l,onDeleteAttachment:m,availableTasks:g=[],comments:x=[],onAddComment:b,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:h,enableTimeTracking:w=false,timeTrackingSummary:y,timeEntries:k=[],isTimerRunning:C=false,timerElapsedSeconds:E=0,onTimeLog:T,onEstimateUpdate:I,onSoldEffortUpdate:O,onTimerStart:F,onTimerStop:$,onTimerDiscard:z,blurFinancials:de=false}){let A=s==="dark",J={textTertiary:A?"#6B7280":"#9CA3AF",textSecondary:A?"#9CA3AF":"#6B7280",textPrimary:A?"#FFFFFF":"#111827",borderLight:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:A?"#1A1D25":"#FFFFFF",bgSecondary:A?"#0A0A0A":"#F9FAFB",hoverBg:A?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},xe=e&&"title"in e&&!("name"in e),Ge=e,[M,G]=react.useState(e?Hu(e,d):null),[ae,we]=react.useState(false),[H,X]=react.useState(false),[Z,ge]=react.useState(false),[Le,Oe]=react.useState(null),[rt,at]=react.useState(new Date),[re,it]=react.useState(false),[Ie,bt]=react.useState(false),[pt,ct]=react.useState(""),[Ce,_e]=react.useState(false),[tt,Ke]=react.useState(false),[U,ne]=react.useState(false),[S,q]=react.useState(false),[le,fe]=react.useState(""),_=react.useRef(null),Q=react.useRef(null),[$e,ke]=react.useState(""),Be=react.useRef(null),[De,He]=react.useState(""),[st,ot]=react.useState(false),[nt,mt]=react.useState([]),[Bt,Tt]=react.useState(""),[lt,ut]=react.useState(false),Et=react.useRef(null);react.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 L=Hu(e,d);console.log("\u{1F4E5} After normalizeToTask:",{taskId:L?.id,taskName:L?.name,soldEffortMinutes:L?.soldEffortMinutes,quotedMinutes:L?.quotedMinutes,effortMinutes:L?.effortMinutes,timeLoggedMinutes:L?.timeLoggedMinutes}),G(L),fe(L.description||""),ke(L.name||"");}},[e?.id,e?.quotedMinutes,d,t]),react.useEffect(()=>{if(!t||!le)return;let L=setTimeout(()=>{let ce=Q.current;ce&&(ce.style.height="auto",ce.style.height=`${Math.max(100,ce.scrollHeight)}px`);},50);return ()=>clearTimeout(L)},[t,le]),react.useEffect(()=>()=>{_.current&&clearTimeout(_.current),Be.current&&clearTimeout(Be.current);},[]),react.useEffect(()=>{t&&Et.current&&x.length>0&&setTimeout(()=>{Et.current&&(Et.current.scrollTop=Et.current.scrollHeight);},100);},[t,x.length]);let Nt=react.useCallback(L=>{G(L),xe&&o&&Ge?o(_b(L,Ge)):r&&r(L);},[xe,Ge,o,r]),Fe=react.useCallback(()=>{we(false),X(false),ge(false),Oe(null),bt(false),ct(""),_e(false);},[]),ze=react.useCallback((L,ce)=>{if(!M)return;let Re={...M,[L]:ce};Nt(Re);},[M,Nt]),Y=react.useCallback(()=>{let L=Q.current;L&&(L.style.height="auto",L.style.height=`${Math.max(100,L.scrollHeight)}px`);},[]),he=react.useCallback(L=>{fe(L),setTimeout(Y,0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{if(M){let ce={...M,description:L};Nt(ce);}},800);},[M,Nt,Y]),N=react.useCallback(L=>{ke(L),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{if(M&&L.trim()){let ce={...M,name:L.trim()};Nt(ce);}},800);},[M,Nt]),D=react.useCallback(L=>{let ce=L.map(Re=>{let je={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Re};return Re.type.startsWith("image/")&&(je.preview=URL.createObjectURL(Re)),je});mt(Re=>[...Re,...ce]);},[]),B=react.useCallback(L=>{mt(ce=>{let Re=ce.find(je=>je.id===L);return Re?.preview&&URL.revokeObjectURL(Re.preview),ce.filter(je=>je.id!==L)});},[]),j=react.useCallback(async()=>{if(!(!M||!De.trim()&&nt.length===0||!b)){ot(true);try{let L=wu(De,f),ce=[];if(nt.length>0&&h){let Re=nt.map(je=>je.file);ce=await h(Re);}await b(M.id,De.trim(),L.length>0?L:void 0,ce.length>0?ce:void 0),He(""),nt.forEach(Re=>{Re.preview&&URL.revokeObjectURL(Re.preview);}),mt([]);}finally{ot(false);}}},[M,De,nt,b,f,h]),se=react.useCallback(()=>{if(!M||!Bt.trim())return;let L=M.subtasks||[],ce={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Bt.trim(),progress:0,startDate:new Date,endDate:new Date,position:L.length},Re=[...L,ce],je={...M,subtasks:Re};Nt(je),Tt(""),ut(false);},[M,Bt,Nt]),pe=react.useCallback(L=>{if(!M?.subtasks)return;let ce=M.subtasks.map(je=>je.id===L?{...je,progress:je.progress===100?0:100}:je),Re={...M,subtasks:ce};Nt(Re);},[M,Nt]),te=react.useCallback(L=>{if(!M?.subtasks)return;let ce=M.subtasks.filter(je=>je.id!==L),Re={...M,subtasks:ce};Nt(Re);},[M,Nt]),me=react.useCallback(L=>{let ce=typeof L=="string"?new Date(L):L,je=new Date().getTime()-ce.getTime(),ht=Math.floor(je/6e4),Ua=Math.floor(je/36e5),aa=Math.floor(je/864e5);return ht<1?n==="es"?"Ahora":"Just now":ht<60?n==="es"?`Hace ${ht} min`:`${ht}m ago`:Ua<24?n==="es"?`Hace ${Ua}h`:`${Ua}h ago`:aa<7?n==="es"?`Hace ${aa}d`:`${aa}d ago`:ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ye=react.useCallback(L=>{if(!M)return;let ce=M.progress||0;L==="completed"?ce=100:L==="in-progress"&&ce===0?ce=10:L==="todo"&&(ce=0);let Re={...M,status:L,progress:ce};Nt(Re),we(false);},[M,Nt]),qe=react.useCallback((L,ce)=>{if(!M)return;let Re={...M,startDate:L,endDate:ce};Nt(Re);},[M,Nt]),At=react.useCallback(()=>{let L=rt.getFullYear(),ce=rt.getMonth(),Re=new Date(L,ce,1),ht=new Date(L,ce+1,0).getDate(),Ua=Re.getDay(),aa=[],nr=new Date(L,ce,0).getDate();for(let la=Ua-1;la>=0;la--)aa.push({date:new Date(L,ce-1,nr-la),isCurrentMonth:false});for(let la=1;la<=ht;la++)aa.push({date:new Date(L,ce,la),isCurrentMonth:true});let ia=42-aa.length;for(let la=1;la<=ia;la++)aa.push({date:new Date(L,ce+1,la),isCurrentMonth:false});return aa},[rt]),Wt=react.useCallback(async L=>{if(L.preventDefault(),L.stopPropagation(),ne(false),!M||!l)return;let ce=Array.from(L.dataTransfer.files);if(ce.length!==0){q(true);try{await l(M.id,ce);}finally{q(false);}}},[M,l]),sa=react.useCallback(async L=>{if(!M||!l||!L.target.files)return;let ce=Array.from(L.target.files);if(ce.length!==0){q(true);try{await l(M.id,ce);}finally{q(false);}L.target.value="";}},[M,l]),Me=react.useCallback(L=>{L.preventDefault(),L.stopPropagation(),ne(true);},[]),W=react.useCallback(L=>{L.preventDefault(),L.stopPropagation(),ne(false);},[]),ve=react.useCallback(L=>L<1024?`${L} B`:L<1024*1024?`${(L/1024).toFixed(1)} KB`:`${(L/(1024*1024)).toFixed(1)} MB`,[]),$t=react.useCallback(L=>L.startsWith("image/")?lucideReact.Image:L.includes("pdf")||L.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!M?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:p("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",A?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:p("px-6 py-3 border-b flex items-center gap-3 h-[49px]",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:p("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:p("text-xs px-2 py-0.5 rounded",A?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:p("text-xs font-mono",A?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let L=M.progress===100?0:100,Re={...M,progress:L,status:L===100?"completed":"todo"};Nt(Re);},className:p("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",M.progress===100?"bg-green-500 border-green-500":A?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:M.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:$e,onChange:L=>N(L.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:p("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",M.progress===100?"line-through text-[#6B7280]":A?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Fe(),we(!ae);},className:p("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",M.progress===100||M.status==="completed"?"bg-green-500/20 text-green-400":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/20 text-blue-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.progress===100||M.status==="completed"?n==="es"?"COMPLETADO":"DONE":M.progress&&M.progress>0||M.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>we(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",A?"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(L=>jsxRuntime.jsxs("button",{onClick:()=>Ye(L.id),className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",M.status===L.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",L.color)}),jsxRuntime.jsx("span",{className:A?"text-white":"text-gray-900",children:L.label})]},L.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),ge(!Z);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[M.assignees&&M.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[M.assignees.slice(0,3).map((L,ce)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:L.color||"#8B5CF6"},title:L.name,children:L.initials||L.name.slice(0,2).toUpperCase()},ce)),M.assignees.length>3&&jsxRuntime.jsxs("span",{className:p("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:["+",M.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:p("text-sm",A?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ge(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:d.length>0?d.map(L=>{let ce=M.assignees?.some(Re=>Re.name===L.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Re=M.assignees||[],je;ce?je=Re.filter(ht=>ht.name!==L.name):je=[...Re,L],ze("assignees",je);},className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",ce&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:L.color||"#8B5CF6"},children:L.initials||L.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:p("flex-1",A?"text-white":"text-gray-900"),children:L.name}),ce&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},L.name)}):jsxRuntime.jsx("div",{className:p("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Oe(Le?null:"start"),at(M.startDate||new Date);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[M.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:p("mx-1",A?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),M.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Oe(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:p("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:p("w-44 py-2 border-r",A?"border-white/10":"border-gray-200"),children:[(()=>{let L=new Date,ce=new Date(L);ce.setDate(L.getDate()+1);let Re=new Date(L);Re.setDate(L.getDate()+((6-L.getDay()+7)%7||7));let je=new Date(L);je.setDate(L.getDate()+((1-L.getDay()+7)%7||7));let ht=new Date(L);ht.setDate(L.getDate()+(6-L.getDay()+7)%7+7);let Ua=new Date(L);Ua.setDate(L.getDate()+14);let aa=new Date(L);return aa.setDate(L.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:L,display:L.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ce,display:ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Re,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:je,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ht,display:ht.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Ua,display:Ua.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:aa,display:aa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ia,la)=>jsxRuntime.jsxs("button",{className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Le==="start"){let Wo=M.endDate&&ia.date>M.endDate?ia.date:M.endDate;qe(ia.date,Wo),Oe("end");}else {let Wo=M.startDate&&ia.date<M.startDate?ia.date:M.startDate;qe(Wo,ia.date),Oe(null);}},children:[jsxRuntime.jsx("span",{children:ia.label}),jsxRuntime.jsx("span",{className:p("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:ia.display})]},la))})(),jsxRuntime.jsx("div",{className:p("border-t mt-2 pt-2",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{qe(void 0,void 0),Oe(null);},className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:p("text-xs mb-3 px-2 py-1 rounded",A?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Le==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:p("font-medium",A?"text-white":"text-gray-900"),children:rt.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>at(new Date),className:p("p-1 rounded text-sm transition-colors",A?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>at(new Date(rt.getFullYear(),rt.getMonth()-1)),className:p("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>at(new Date(rt.getFullYear(),rt.getMonth()+1)),className:p("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(L=>jsxRuntime.jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",A?"text-[#6B7280]":"text-gray-400"),children:L},L))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:At().map((L,ce)=>{let Re=L.date.toDateString()===new Date().toDateString(),je=M.startDate?.toDateString()===L.date.toDateString(),ht=M.endDate?.toDateString()===L.date.toDateString(),Ua=je||ht,aa=M.startDate&&M.endDate&&L.date>=M.startDate&&L.date<=M.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let nr=new Date(L.date);if(Le==="start"){let ia=M.endDate&&nr>M.endDate?nr:M.endDate;qe(nr,ia),Oe("end");}else {let ia=M.startDate&&nr<M.startDate?nr:M.startDate;qe(ia,nr),Oe(null);}},className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!L.isCurrentMonth&&(A?"text-[#4B5563]":"text-gray-300"),L.isCurrentMonth&&(A?"text-white":"text-gray-900"),Re&&"ring-2 ring-[#2E94FF]",je&&"bg-[#2E94FF] text-white",ht&&!je&&"bg-[#7C3AED] text-white",aa&&!Ua&&(A?"bg-[#7C3AED]/20":"bg-purple-100"),!Ua&&(A?"hover:bg-white/10":"hover:bg-gray-100")),children:L.date.getDate()},ce)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Fe(),X(!H);},className:p("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",M.priority==="high"||M.priority==="urgent"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":M.priority==="low"?"bg-green-500/20 text-green-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.priority?M.priority==="high"||M.priority==="urgent"?n==="es"?"Alta":"High":M.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",A?"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(L=>jsxRuntime.jsxs("button",{onClick:()=>{ze("priority",L.id),X(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",M.priority===L.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",L.color)}),jsxRuntime.jsx("span",{className:A?"text-white":"text-gray-900",children:L.label})]},L.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:p("text-sm",A?"text-white":"text-gray-900"),children:M.startDate&&M.endDate?`${Math.ceil((M.endDate.getTime()-M.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:p("w-4 h-4 rounded-full border-2",A?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[re?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:M.progress||0,onChange:L=>{let ce=parseInt(L.target.value),Re=M.status;ce===100?Re="completed":ce>0?Re="in-progress":Re="todo";let je={...M,progress:ce,status:Re};Nt(je);},onBlur:()=>it(false),className:p("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",A?"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-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>it(true),className:p("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",A?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${M.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:p("text-sm font-medium min-w-[40px]",A?"text-white":"text-gray-900"),children:[M.progress||0,"%"]})]})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:M.status==="completed"||M.progress===100?jsxRuntime.jsx("span",{className:p("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:y?.estimateMinutes?en(y.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):y?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("estimate"),className:p("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:en(y.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("estimate"),className:p("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="estimate"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Ir,{mode:"estimate",locale:n,isDark:A,currentValue:y?.estimateMinutes||null,onSave:async L=>{await I?.(M.id,L),Ke(false);},onClose:()=>Ke(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:de?jsxRuntime.jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",A?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):M.status==="completed"||M.progress===100?jsxRuntime.jsx("span",{className:p("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:M.quotedMinutes?en(M.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):M.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("quoted"),className:p("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:en(M.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ke("quoted"),className:p("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="quoted"&&!de&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Ir,{mode:"quoted",locale:n,isDark:A,currentValue:M.quotedMinutes||null,onSave:async L=>{O?(await O(M.id,L),G(ce=>ce?{...ce,quotedMinutes:L}:null)):ze("quotedMinutes",L),Ke(false);},onClose:()=>Ke(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[M.status==="completed"||M.progress===100?jsxRuntime.jsx("div",{className:p("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",A?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):C?jsxRuntime.jsxs("button",{type:"button",onClick:()=>$?.(M.id),className:p("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:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),Vb(E||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>F?.(M.id),className:p("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",A?"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:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),M.status==="completed"||M.progress===100?jsxRuntime.jsxs("div",{className:p("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ke("log"),className:p("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",A?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),y&&y.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:p("text-sm font-medium",y.health==="over-budget"?"text-red-500":y.health==="at-risk"?"text-yellow-500":A?"text-white":"text-gray-900"),children:[en(y.loggedMinutes),y.estimateMinutes&&jsxRuntime.jsxs("span",{className:p("font-normal",A?"text-[#6B7280]":"text-gray-400"),children:[" / ",en(y.estimateMinutes)]})]}),y.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-all",y.health==="over-budget"?"bg-red-500":y.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,y.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt==="log"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Ir,{mode:"log",locale:n,isDark:A,currentValue:null,onSave:async(L,ce)=>{L&&await T?.(M.id,{durationMinutes:L,note:ce,source:"manual"}),Ke(false);},onClose:()=>Ke(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(no,{selectedTags:M.tags||[],availableTags:c,onChange:L=>{ze("tags",L);},onCreateTag:i,theme:J})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:p("w-4 h-4 mt-1.5",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0 mt-1",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[M.dependencies&&M.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:M.dependencies.map(L=>{let ce=g.find(Re=>Re.id===L);return jsxRuntime.jsxs("span",{className:p("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",A?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ce?.name||L.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Re=(M.dependencies||[]).filter(je=>je!==L);ze("dependencies",Re);},className:p("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},L)})}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),bt(!Ie);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:p("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{bt(false),ct("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("p-2 border-b",A?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:pt,onChange:L=>ct(L.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:p("w-full px-3 py-2 rounded-md text-sm outline-none",A?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(L=>L.id!==M.id).filter(L=>pt===""||L.name.toLowerCase().includes(pt.toLowerCase())).map(L=>{let ce=M.dependencies?.includes(L.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Re=M.dependencies||[],je;ce?je=Re.filter(ht=>ht!==L.id):je=[...Re,L.id],ze("dependencies",je);},className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",ce&&(A?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:p("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ce?"bg-blue-500 border-blue-500":A?"border-white/30":"border-gray-300"),children:ce&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:p("block truncate",A?"text-white":"text-gray-900"),children:L.name}),jsxRuntime.jsx("span",{className:p("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:L.id.slice(0,8)})]})]},L.id)}):jsxRuntime.jsx("div",{className:p("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),_e(!Ce);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:M.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:p("text-sm",A?"text-white":"text-gray-900"),children:Eo.find(L=>L.value===M.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>_e(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Eo.map(L=>{let ce=M.color===L.value;return jsxRuntime.jsx("button",{onClick:()=>{ze("color",L.value),_e(false);},className:p("w-7 h-7 rounded-full flex items-center justify-center transition-all",ce&&"ring-2 ring-offset-2",A?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:L.value,outlineColor:ce?L.value:void 0},title:L.name,children:ce&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},L.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:M.isMilestone||false,onChange:L=>ze("isMilestone",L.target.checked),className:p("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",M.isMilestone?"bg-purple-500 border-purple-500":A?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:p("text-sm",A?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:p("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:p("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:p("text-sm font-semibold",A?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:Q,value:le,onChange:L=>he(L.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:p("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",A?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:p("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",M.subtasks&&M.subtasks.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",M.subtasks.filter(L=>L.progress===100).length,"/",M.subtasks.length,")"]})]})}),M.subtasks&&M.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...M.subtasks].sort((L,ce)=>(L.position??0)-(ce.position??0)).map(L=>jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",A?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>pe(L.id),className:p("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",L.progress===100?"bg-green-500 border-green-500":A?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:L.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:p("text-sm flex-1",L.progress===100?"line-through text-[#6B7280]":A?"text-white":"text-gray-900"),children:L.name}),jsxRuntime.jsx("button",{onClick:()=>te(L.id),className:p("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",A?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},L.id))}),lt?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:Bt,onChange:L=>Tt(L.target.value),onKeyDown:L=>{L.key==="Enter"&&Bt.trim()?se():L.key==="Escape"&&(ut(false),Tt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:p("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",A?"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")}),jsxRuntime.jsx("button",{onClick:se,disabled:!Bt.trim(),className:p("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Bt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":A?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{ut(false),Tt("");},className:p("p-2 rounded-lg transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>ut(true),className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:p("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold mb-3",A?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(L=>{let ce=$t(L.type),Re=L.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:p("flex items-center gap-3 p-2 rounded-lg group transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Re&&L.thumbnailUrl?jsxRuntime.jsx("img",{src:L.thumbnailUrl,alt:L.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:p("w-10 h-10 rounded flex items-center justify-center",A?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ce,{className:p("w-5 h-5",A?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:L.url,target:"_blank",rel:"noopener noreferrer",className:p("text-sm font-medium truncate block hover:underline",A?"text-white":"text-gray-900"),children:L.name}),jsxRuntime.jsx("p",{className:p("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:ve(L.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(L.id),className:p("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",A?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},L.id)})}),jsxRuntime.jsxs("div",{onDragOver:Me,onDragLeave:W,onDrop:Wt,className:p("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",U?A?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":A?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",S&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:sa,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||S}),S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:p("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:p("w-6 h-6 mx-auto mb-2",U?"text-blue-500":A?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:p("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:U?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!l&&jsxRuntime.jsx("p",{className:p("text-xs mt-1",A?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:p("w-96 border-l flex flex-col",A?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between h-[49px]",A?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:p("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",x.length>0&&jsxRuntime.jsxs("span",{className:p("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",x.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:p("p-1.5 rounded transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -82,7 +82,7 @@
|
|
|
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=x=>{x.stopPropagation();let b=r<a.length-1?r+1:0;i(),o(b);},n.appendChild(l),n.appendChild(m),n.appendChild(g);}n.appendChild(d),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Fh(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 Ph(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 Pl(e){return e.startsWith("image/")}function Or({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=react.useState(false),[c,i]=react.useState(false),[u,l]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let x=react.useCallback((T,I)=>{I.preventDefault(),I.stopPropagation();let O=g.current.filter(z=>Pl(z.type)),F=O.findIndex(z=>z.id===T.id),$=z=>{let de=g.current.filter(J=>Pl(J.type)),A=de[z];A&&op(A.url,A.name,de,z,$);};op(T.url,T.name,O,F,$);},[]),b=react.useCallback(T=>{let I=[],O=[];return e.length+T.length>s?(O.push(`Maximum ${s} files allowed`),{valid:I,errors:O}):(T.forEach(F=>{if(F.size/1048576>r){O.push(`${F.name} is too large (max ${r}MB)`);return}if(o&&!o.some(z=>F.type.match(z))){O.push(`${F.name} has invalid file type`);return}I.push(F);}),{valid:I,errors:O})},[e.length,s,r,o]),v=react.useCallback(async T=>{let{valid:I,errors:O}=b(T);if(O.length>0){l(O.join(", ")),setTimeout(()=>l(null),5e3);return}if(I.length!==0){i(true),l(null);try{await t?.(I);}catch(F){l(F instanceof Error?F.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[b,t]),f=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(true);},[]),h=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);},[]),w=react.useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),y=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);let I=Array.from(T.dataTransfer.files);v(I);},[v]),k=react.useCallback(T=>{let I=T.target.files?Array.from(T.target.files):[];v(I),m.current&&(m.current.value="");},[v]),C=react.useCallback(()=>{m.current?.click();},[]),E=react.useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:h,onDragOver:w,onDrop:y,onClick:C,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:k,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(T=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Pl(T.type)&&T.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>x(T,I),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Ph(T.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Fh(T.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>E(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function Ml({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:c=[],attachments:i=[],onAddComment:u,onDeleteComment:l,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:x,onGenerateSubtasks:b,onEstimateEffort:v,currentUserId:f="user-1"}){let[h,w]=react.useState("details"),[y,k]=react.useState(false),[C,E]=react.useState({}),[T,I]=react.useState(""),[O,F]=react.useState(false),[$,z]=react.useState({});if(!t||!e)return null;let de=react.useCallback(()=>{k(false),E({}),w("details"),I(""),z({}),a();},[a]),A=react.useCallback(()=>{r&&Object.keys(C).length>0&&(r(e.id,C),E({}),k(false));},[e.id,C,r]),J=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),de());},[e.id,o,de]),xe=react.useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),I(""));},[e.id,T,u]),Ge=react.useCallback(async()=>{if(x){F(true);try{let H=await x(e);z(X=>({...X,assignees:H}));}catch(H){console.error("Failed to suggest assignee:",H);}finally{F(false);}}},[e,x]),M=react.useCallback(async()=>{if(b){F(true);try{let H=await b(e);z(X=>({...X,subtasks:H}));}catch(H){console.error("Failed to generate subtasks:",H);}finally{F(false);}}},[e,b]),G=react.useCallback(async()=>{if(v){F(true);try{let H=await v(e);z(X=>({...X,effort:H}));}catch(H){console.error("Failed to estimate effort:",H);}finally{F(false);}}},[e,v]),ae={...e,...C},we=s.filter(H=>ae.assignedUserIds?.includes(H.id));return jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:de,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:H=>H.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:ae.priority==="URGENT"?"#EF4444":ae.priority==="HIGH"?"#F59E0B":ae.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),y?jsxRuntime.jsx("input",{type:"text",value:C.title??ae.title,onChange:H=>E({...C,title:H.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:ae.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:A,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{k(false),E({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>k(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:J,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:de,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),y?jsxRuntime.jsx("textarea",{value:C.description??ae.description??"",onChange:H=>E({...C,description:H.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:ae.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),y?jsxRuntime.jsx("select",{multiple:true,value:C.assignedUserIds??ae.assignedUserIds??[],onChange:H=>{let X=Array.from(H.target.selectedOptions,Z=>Z.value);E({...C,assignedUserIds:X});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(H=>jsxRuntime.jsx("option",{value:H.id,children:H.name},H.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:we.length>0?we.map(H=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:H.color},children:H.initials}),jsxRuntime.jsx("span",{children:H.name})]},H.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),y?jsxRuntime.jsxs("select",{value:C.priority??ae.priority??"",onChange:H=>E({...C,priority:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:ae.priority==="URGENT"?"#EF4444":ae.priority==="HIGH"?"#F59E0B":ae.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:ae.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:ae.labels&&ae.labels.length>0?ae.labels.map(H=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:H},H)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),y?jsxRuntime.jsx("input",{type:"date",value:C.startDate?new Date(C.startDate).toISOString().split("T")[0]:ae.startDate?new Date(ae.startDate).toISOString().split("T")[0]:"",onChange:H=>E({...C,startDate:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ae.startDate?new Date(ae.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),y?jsxRuntime.jsx("input",{type:"date",value:C.endDate?new Date(C.endDate).toISOString().split("T")[0]:ae.endDate?new Date(ae.endDate).toISOString().split("T")[0]:"",onChange:H=>E({...C,endDate:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ae.endDate?new Date(ae.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),y?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:C.estimatedTime??ae.estimatedTime??"",onChange:H=>E({...C,estimatedTime:H.target.value?parseFloat(H.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ae.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:ae.dependencies&&ae.dependencies.length>0?ae.dependencies.map(H=>{let X=typeof H=="string"?H:H.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",X.slice(-4)]},X)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:ae.createdAt?new Date(ae.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:H=>I(H.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:xe,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(H=>{let X=s.find(Z=>Z.id===H.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[X&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:X?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(H.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(H.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:H.content})]},H.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:d.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:d.map(H=>{let X=s.find(Z=>Z.id===H.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[H.type.includes("CREATED")&&"\u2795",H.type.includes("UPDATED")&&"\u270F\uFE0F",H.type.includes("MOVED")&&"\u27A1\uFE0F",H.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",H.type.includes("COMMENT")&&"\u{1F4AC}",H.type.includes("ASSIGNED")&&"\u{1F464}",H.type.includes("PRIORITY")&&"\u{1F3AF}",H.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",H.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:X?.name||"Unknown"})," ",H.type.replace(/_/g," ").toLowerCase(),H.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:H.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(H.timestamp).toLocaleString()})]})]},H.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Or,{cardId:e.id,attachments:i,onUpload:m?H=>m(e.id,H):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ge,disabled:O||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:M,disabled:O||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:G,disabled:O||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),$.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),$.assignees.map((H,X)=>{let Z=s.find(ge=>ge.id===H.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[Z&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:Z?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:H.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(H.confidence*100).toFixed(0),"%"]})]})]},X)})]}),$.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),$.subtasks.map((H,X)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:H.title}),H.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:H.description}),H.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",H.estimatedTime,"h"]})]},X))]}),$.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[$.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",($.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(H=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${H.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:H.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:H.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:H.description}),H.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",H.suggestedAction]})]},H.id))]}),!$.assignees&&!$.subtasks&&!$.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Un({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,c]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,x=4,b=l.left;b+o>g-10&&(b=g-o-10),b<10&&(b=10);let v=m-l.bottom,f=l.top,h;return v>=s+x?h=l.bottom+x:f>=s+x?h=l.top-s-x:v>=f?h=l.bottom+x:h=Math.max(10,l.top-s-x),{top:h,left:b}},[e,o,s]);return react.useEffect(()=>{t&&c(u());},[t,u]),react.useEffect(()=>{if(!t)return;let l=g=>{let x=g.target;i.current&&!i.current.contains(x)&&e.current&&!e.current.contains(x)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Qe={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(46, 148, 255, 0.12)"},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:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",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:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(37, 99, 235, 0.28)"},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:"#A8A29E",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",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var $h=["LOW","MEDIUM","HIGH","URGENT"],Hh=["todo","in-progress","review","done"];function Il({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:c,onDeleteComment:i,currentUser:u,onAIGenerateDescription:l,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:x=[],availableLabels:b=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:h,unsplashAccessKey:w,theme:y,onSubtasksChange:k,attachments:C=[],onUploadAttachments:E,onDeleteAttachment:T}){let I=qo(),O=y||I?.themeName||"dark",[F,$]=react.useState(e),[z,de]=react.useState(false),[A,J]=react.useState(()=>[...e?.subtasks||[]].sort((B,j)=>(B.position??0)-(j.position??0))),[xe,Ge]=react.useState(false),[M,G]=react.useState(""),[ae,we]=react.useState(""),[H,X]=react.useState("all"),[Z,ge]=react.useState(false),[Le,Oe]=react.useState(false),[rt,at]=react.useState(false),[re,it]=react.useState(false),[Ie,bt]=react.useState(false),[pt,ct]=react.useState(false),Ce=react.useRef(null),_e=react.useRef(null),tt=react.useRef(null),Ke=react.useRef(null),U=react.useRef(null),ne=react.useRef(null),S=react.useRef(null),q=react.useRef(null),le=react.useRef(null),fe=react.useRef(null),_=react.useRef(null),Q=react.useRef(null);react.useEffect(()=>{if(e&&!F){$({...e});let D=[...e.subtasks||[]].sort((B,j)=>(B.position??0)-(j.position??0));J(D);}else if(e&&F&&e.id!==F.id){$({...e});let D=[...e.subtasks||[]].sort((B,j)=>(B.position??0)-(j.position??0));J(D);}},[e,F]),react.useEffect(()=>{let D=B=>{let j=B.target;Ke.current&&!Ke.current.contains(j)&&ge(false),U.current&&!U.current.contains(j)&&Oe(false),ne.current&&!ne.current.contains(j)&&at(false),S.current&&!S.current.contains(j)&&it(false);};if(Z||Le||rt||re)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[Z,Le,rt,re]),react.useEffect(()=>{if(!t)return;let D=B=>{let j=B.target,se=j.tagName==="INPUT"||j.tagName==="TEXTAREA"||j.isContentEditable;if(B.key==="Escape"){B.preventDefault(),Z||Le||rt||re||Ie||pt?(ge(false),Oe(false),at(false),it(false),bt(false),ct(false)):se||a();return}if(se&&B.key!=="Escape")return;let pe=B.metaKey||B.ctrlKey;switch(B.key.toLowerCase()){case "s":B.preventDefault(),ge(true);break;case "a":B.preventDefault(),at(true);break;case "p":B.preventDefault(),Oe(true);break;case "l":B.preventDefault(),it(true);break;case "d":pe||(B.preventDefault(),bt(true),setTimeout(()=>q.current?.focus(),0));break;case "e":pe||(B.preventDefault(),ct(true));break;case "i":B.preventDefault(),de(true),setTimeout(()=>_e.current?.focus(),0);break;case "t":B.preventDefault(),Ge(true);break;case "c":B.preventDefault(),tt.current?.focus();break}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[t,a,Z,Le,rt,re,Ie,pt]);let $e=react.useCallback(D=>{let B=D.currentTarget.textContent?.trim()||"";if(F&&B!==F.title){let j={...F,title:B};$(j),r?.(F.id,{title:B});}},[F,r]),ke=react.useCallback(D=>{D.key==="Enter"&&(D.preventDefault(),D.currentTarget.blur()),D.key==="Escape"&&(D.preventDefault(),D.currentTarget.textContent=F?.title||"",D.currentTarget.blur());},[F]),Be=react.useCallback(()=>{F&&e&&F.description!==e.description&&r?.(F.id,{description:F.description}),de(false);},[F,e,r]),De=react.useCallback(D=>{if(F){let B={...F,columnId:D};$(B),r?.(F.id,{columnId:D}),ge(false);}},[F,r]),He=react.useCallback(D=>{if(F){let B={...F,priority:D};$(B),r?.(F.id,{priority:D}),Oe(false);}},[F,r]),st=react.useCallback(D=>{if(F){let B=F.assignedUserIds||[],j=B.includes(D)?B.filter(pe=>pe!==D):[...B,D],se={...F,assignedUserIds:j};$(se),r?.(F.id,{assignedUserIds:j});}},[F,r]),ot=react.useCallback(D=>{if(F){let B=F.labels||[],j=B.includes(D)?B.filter(pe=>pe!==D):[...B,D],se={...F,labels:j};$(se),r?.(F.id,{labels:j});}},[F,r]),nt=react.useCallback(D=>{if(F){let B={...F,tags:D};$(B),r?.(F.id,{tags:D});}},[F,r]),mt=react.useCallback(D=>{if(F){let B=D.target.value,j={...F,endDate:B};$(j),r?.(F.id,{endDate:B}),bt(false);}},[F,r]),Bt=react.useCallback(D=>{if(F){let B={...F,estimatedTime:parseFloat(D)||0};$(B),r?.(F.id,{estimatedTime:parseFloat(D)||0});}},[F,r]),Tt=react.useCallback(()=>{if(M.trim()&&F){let D={id:`subtask-${Date.now()}`,title:M.trim(),completed:false,position:A.length,createdAt:new Date},B=[...A,D];J(B),G(""),Ge(false),k?.(F.id,B);}},[M,A,F,k]),lt=react.useCallback(D=>{let B=A.map(j=>j.id===D?{...j,completed:!j.completed,updatedAt:new Date}:j);J(B),F&&k?.(F.id,B);},[A,F,k]),ut=react.useCallback(D=>{let B=A.filter(j=>j.id!==D);J(B),F&&k?.(F.id,B);},[A,F,k]),Et=react.useCallback(()=>{ae.trim()&&F&&c&&(c(F.id,ae.trim()),we(""));},[ae,F,c]),Nt=react.useCallback(D=>{(D.metaKey||D.ctrlKey)&&D.key==="Enter"&&(D.preventDefault(),Et());},[Et]),Fe=D=>jsxRuntime.jsx(Bh__default.default,{remarkPlugins:[Rh__default.default],rehypePlugins:[Oh__default.default],components:{a:({node:B,...j})=>jsxRuntime.jsx("a",{...j,target:"_blank",rel:"noopener noreferrer"})},children:D}),We=d.filter(D=>H==="comments"?D.type.includes("COMMENT"):H==="history"?!D.type.includes("COMMENT"):true);if(!t||!e)return null;let Y=F||e,he=s.filter(D=>Y.assignedUserIds?.includes(D.id)),N=A.filter(D=>D.completed).length;return jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:D=>D.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":O,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ce,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:$e,onKeyDown:ke,children:Y.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ke,children:[jsxRuntime.jsxs("button",{ref:le,className:"modal-v2-field",onClick:()=>ge(!Z),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.columnId||"No status"})]}),jsxRuntime.jsx(Un,{triggerRef:le,isOpen:Z,onClose:()=>ge(false),width:250,estimatedHeight:200,children:(x.length>0?x:Hh.map(D=>({id:D,title:D}))).map(D=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Y.columnId===D.id?"active":""}`,onClick:()=>De(D.id),children:D.title},D.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ne,children:[jsxRuntime.jsxs("button",{ref:fe,className:"modal-v2-field",onClick:()=>at(!rt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:he.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:he.map(D=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:D.color},title:D.name,children:D.initials},D.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Un,{triggerRef:fe,isOpen:rt,onClose:()=>at(false),width:280,estimatedHeight:300,children:s.map(D=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Y.assignedUserIds?.includes(D.id)?"active":""}`,onClick:()=>st(D.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:D.color},children:D.initials}),D.name,Y.assignedUserIds?.includes(D.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},D.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:U,children:[jsxRuntime.jsxs("button",{ref:_,className:"modal-v2-field",onClick:()=>Oe(!Le),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.priority||"None"})]}),jsxRuntime.jsxs(Un,{triggerRef:_,isOpen:Le,onClose:()=>Oe(false),width:180,estimatedHeight:220,children:[$h.map(D=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${D.toLowerCase()} ${Y.priority===D?"active":""}`,onClick:()=>He(D),children:D},D)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>He(""),children:"None"})]})]}),v.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(no,{selectedTags:Y.tags||[],availableTags:v,onChange:nt,onCreateTag:f,theme:Qe[O]||Qe.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:S,children:[jsxRuntime.jsxs("button",{ref:Q,className:"modal-v2-field",onClick:()=>it(!re),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.labels&&Y.labels.length>0?jsxRuntime.jsx("span",{children:Y.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Un,{triggerRef:Q,isOpen:re,onClose:()=>it(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(D=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Y.labels?.includes(D)?"active":""}`,onClick:()=>ot(D),children:[D,Y.labels?.includes(D)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},D))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{bt(!Ie),setTimeout(()=>q.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.endDate?new Date(Y.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:q,type:"date",value:typeof Y.endDate=="string"?Y.endDate.split("T")[0]:Y.endDate?(()=>{let D=new Date(Y.endDate),B=D.getUTCFullYear(),j=String(D.getUTCMonth()+1).padStart(2,"0"),se=String(D.getUTCDate()).padStart(2,"0");return `${B}-${j}-${se}`})():"",onChange:mt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ct(!pt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.estimatedTime?`${Y.estimatedTime}h`:"Not set"})]}),pt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Y.estimatedTime||"",onChange:D=>Bt(D.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ct(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),z?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Y.description||"",onChange:D=>{if(F){let B={...F,description:D.target.value};$(B);}},onBlur:Be,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>de(true),children:Y.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Fe(Y.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),A.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[N,"/",A.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ge(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[A.map(D=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${D.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>lt(D.id),children:D.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:D.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>ut(D.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},D.id)),xe&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:M,onChange:D=>G(D.target.value),onKeyDown:D=>{D.key==="Enter"&&Tt(),D.key==="Escape"&&(Ge(false),G(""));},onBlur:Tt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(E||C.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),C.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:C.length})]}),jsxRuntime.jsx(Or,{cardId:Y.id,attachments:C,onUpload:E?D=>E(Y.id,D):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${H==="all"?"active":""}`,onClick:()=>X("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${H==="comments"?"active":""}`,onClick:()=>X("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${H==="history"?"active":""}`,onClick:()=>X("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:tt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ae,onChange:D=>we(D.target.value),onKeyDown:Nt,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:Et,disabled:!ae.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[We.map(D=>{let B=s.find(se=>se.id===D.userId);if(D.type.includes("COMMENT")){let se=n.find(pe=>pe.id===D.metadata?.commentId);return se?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[B&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:B.color},children:B.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:B?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(D.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:se.content})]})]},D.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[D.type.includes("CREATED")&&"\u2795",D.type.includes("UPDATED")&&"\u270F\uFE0F",D.type.includes("MOVED")&&"\u27A1\uFE0F",D.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",D.type.includes("ASSIGNED")&&"\u{1F464}",D.type.includes("PRIORITY")&&"\u{1F3AF}",D.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:B?.name||"Unknown"})," ",D.type.replace(/_/g," ").toLowerCase(),D.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:D.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(D.timestamp).toLocaleString()})]})]},D.id)}),We.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Yh({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function Rl({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((d,c)=>d+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Yh,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,d)=>n+d.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,d)=>n+d.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,d)=>n+(d.planned||0),0)})]})]})]})}function ry({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function Ol({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,d=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=d;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ry,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var py={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},mp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function my({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:d,y:c,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function gp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function $l({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,i)=>c+i.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||py[c.name]||mp[e.indexOf(c)%mp.length]})),d=n.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?my:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(gp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,l=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(gp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var Vs=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=react.useState(false),[c,i]=react.useState(false),[u,l]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let x=e.map(y=>y.id),b=y=>{r.onBulkUpdate?.(x,{priority:y}),d(false);},v=y=>{r.onBulkMove?.(x,y),i(false),a();},f=y=>{r.onBulkUpdate?.(x,{assignedUserIds:y}),l(false);},h=y=>{let k=new Set;e.forEach(E=>{E.labels?.forEach(T=>k.add(T));});let C=Array.from(new Set([...k,...y]));r.onBulkUpdate?.(x,{labels:C}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(y=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(y),children:[jsxRuntime.jsx("span",{className:p("asakaa-priority-dot",y==="LOW"&&"bg-asakaa-priority-low",y==="MEDIUM"&&"bg-asakaa-priority-medium",y==="HIGH"&&"bg-asakaa-priority-high",y==="URGENT"&&"bg-asakaa-priority-urgent")}),y]},y))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(y=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(y.id),children:y.title},y.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(y=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([y.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:y.color},children:y.initials}),y.name]},y.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(y=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([y]),children:y},y))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Vs.displayName="BulkOperationsToolbar";function yy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,c,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(g=>{let x=a?.find(b=>b.id===g);n=`assignee-${g}`,d=x?.name||`User ${g}`,c=x?.color,i=x?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];d=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:d,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,d=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Hl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),d=react.useMemo(()=>yy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{n(u=>{let l=new Set(u);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||d.length===0?jsxRuntime.jsx(lo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:p("asakaa-swimlane-view",o),children:[d.map(i=>{let u=s.has(i.id),l=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(lo,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),d.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var zl=[{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 Ul({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),d=zl.find(i=>i.value===e)||zl[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:p("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:d.icon}),jsxRuntime.jsx("span",{children:d.label}),jsxRuntime.jsx("svg",{className:p("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:zl.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:p("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Wn=[{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 wy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,d=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&d&&c}function xp(e={}){let{shortcuts:t=Wn,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),d=react.useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return react.useEffect(()=>{function c(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(wy(i,l)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function Cy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ty(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 Ny(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ty(e),r=t?Cy(t):"";return a?`${a} + ${r}`:r}function Dy(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 Wl({shortcuts:e=Wn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function d(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=Dy(e);return jsxRuntime.jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([d,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),d]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Ny(i)})]},i.action))})]},d))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Gl=[{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
|
+
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=x=>{x.stopPropagation();let b=r<a.length-1?r+1:0;i(),o(b);},n.appendChild(l),n.appendChild(m),n.appendChild(g);}n.appendChild(d),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Fh(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 Ph(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 Pl(e){return e.startsWith("image/")}function Or({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=react.useState(false),[c,i]=react.useState(false),[u,l]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let x=react.useCallback((T,I)=>{I.preventDefault(),I.stopPropagation();let O=g.current.filter(z=>Pl(z.type)),F=O.findIndex(z=>z.id===T.id),$=z=>{let de=g.current.filter(J=>Pl(J.type)),A=de[z];A&&op(A.url,A.name,de,z,$);};op(T.url,T.name,O,F,$);},[]),b=react.useCallback(T=>{let I=[],O=[];return e.length+T.length>s?(O.push(`Maximum ${s} files allowed`),{valid:I,errors:O}):(T.forEach(F=>{if(F.size/1048576>r){O.push(`${F.name} is too large (max ${r}MB)`);return}if(o&&!o.some(z=>F.type.match(z))){O.push(`${F.name} has invalid file type`);return}I.push(F);}),{valid:I,errors:O})},[e.length,s,r,o]),v=react.useCallback(async T=>{let{valid:I,errors:O}=b(T);if(O.length>0){l(O.join(", ")),setTimeout(()=>l(null),5e3);return}if(I.length!==0){i(true),l(null);try{await t?.(I);}catch(F){l(F instanceof Error?F.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[b,t]),f=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(true);},[]),h=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);},[]),w=react.useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),y=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);let I=Array.from(T.dataTransfer.files);v(I);},[v]),k=react.useCallback(T=>{let I=T.target.files?Array.from(T.target.files):[];v(I),m.current&&(m.current.value="");},[v]),C=react.useCallback(()=>{m.current?.click();},[]),E=react.useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:h,onDragOver:w,onDrop:y,onClick:C,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:k,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(T=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Pl(T.type)&&T.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>x(T,I),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Ph(T.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Fh(T.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>E(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function Ml({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:c=[],attachments:i=[],onAddComment:u,onDeleteComment:l,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:x,onGenerateSubtasks:b,onEstimateEffort:v,currentUserId:f="user-1"}){let[h,w]=react.useState("details"),[y,k]=react.useState(false),[C,E]=react.useState({}),[T,I]=react.useState(""),[O,F]=react.useState(false),[$,z]=react.useState({});if(!t||!e)return null;let de=react.useCallback(()=>{k(false),E({}),w("details"),I(""),z({}),a();},[a]),A=react.useCallback(()=>{r&&Object.keys(C).length>0&&(r(e.id,C),E({}),k(false));},[e.id,C,r]),J=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),de());},[e.id,o,de]),xe=react.useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),I(""));},[e.id,T,u]),Ge=react.useCallback(async()=>{if(x){F(true);try{let H=await x(e);z(X=>({...X,assignees:H}));}catch(H){console.error("Failed to suggest assignee:",H);}finally{F(false);}}},[e,x]),M=react.useCallback(async()=>{if(b){F(true);try{let H=await b(e);z(X=>({...X,subtasks:H}));}catch(H){console.error("Failed to generate subtasks:",H);}finally{F(false);}}},[e,b]),G=react.useCallback(async()=>{if(v){F(true);try{let H=await v(e);z(X=>({...X,effort:H}));}catch(H){console.error("Failed to estimate effort:",H);}finally{F(false);}}},[e,v]),ae={...e,...C},we=s.filter(H=>ae.assignedUserIds?.includes(H.id));return jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:de,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:H=>H.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:ae.priority==="URGENT"?"#EF4444":ae.priority==="HIGH"?"#F59E0B":ae.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),y?jsxRuntime.jsx("input",{type:"text",value:C.title??ae.title,onChange:H=>E({...C,title:H.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:ae.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:A,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{k(false),E({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>k(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:J,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:de,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),y?jsxRuntime.jsx("textarea",{value:C.description??ae.description??"",onChange:H=>E({...C,description:H.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:ae.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),y?jsxRuntime.jsx("select",{multiple:true,value:C.assignedUserIds??ae.assignedUserIds??[],onChange:H=>{let X=Array.from(H.target.selectedOptions,Z=>Z.value);E({...C,assignedUserIds:X});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(H=>jsxRuntime.jsx("option",{value:H.id,children:H.name},H.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:we.length>0?we.map(H=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:H.color},children:H.initials}),jsxRuntime.jsx("span",{children:H.name})]},H.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),y?jsxRuntime.jsxs("select",{value:C.priority??ae.priority??"",onChange:H=>E({...C,priority:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:ae.priority==="URGENT"?"#EF4444":ae.priority==="HIGH"?"#F59E0B":ae.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:ae.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:ae.labels&&ae.labels.length>0?ae.labels.map(H=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:H},H)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),y?jsxRuntime.jsx("input",{type:"date",value:C.startDate?new Date(C.startDate).toISOString().split("T")[0]:ae.startDate?new Date(ae.startDate).toISOString().split("T")[0]:"",onChange:H=>E({...C,startDate:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ae.startDate?new Date(ae.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),y?jsxRuntime.jsx("input",{type:"date",value:C.endDate?new Date(C.endDate).toISOString().split("T")[0]:ae.endDate?new Date(ae.endDate).toISOString().split("T")[0]:"",onChange:H=>E({...C,endDate:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ae.endDate?new Date(ae.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),y?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:C.estimatedTime??ae.estimatedTime??"",onChange:H=>E({...C,estimatedTime:H.target.value?parseFloat(H.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ae.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:ae.dependencies&&ae.dependencies.length>0?ae.dependencies.map(H=>{let X=typeof H=="string"?H:H.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",X.slice(-4)]},X)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:ae.createdAt?new Date(ae.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:H=>I(H.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:xe,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(H=>{let X=s.find(Z=>Z.id===H.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[X&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:X?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(H.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(H.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:H.content})]},H.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:d.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:d.map(H=>{let X=s.find(Z=>Z.id===H.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[H.type.includes("CREATED")&&"\u2795",H.type.includes("UPDATED")&&"\u270F\uFE0F",H.type.includes("MOVED")&&"\u27A1\uFE0F",H.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",H.type.includes("COMMENT")&&"\u{1F4AC}",H.type.includes("ASSIGNED")&&"\u{1F464}",H.type.includes("PRIORITY")&&"\u{1F3AF}",H.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",H.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:X?.name||"Unknown"})," ",H.type.replace(/_/g," ").toLowerCase(),H.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:H.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(H.timestamp).toLocaleString()})]})]},H.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Or,{cardId:e.id,attachments:i,onUpload:m?H=>m(e.id,H):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ge,disabled:O||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:M,disabled:O||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:G,disabled:O||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),$.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),$.assignees.map((H,X)=>{let Z=s.find(ge=>ge.id===H.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[Z&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:Z?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:H.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(H.confidence*100).toFixed(0),"%"]})]})]},X)})]}),$.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),$.subtasks.map((H,X)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:H.title}),H.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:H.description}),H.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",H.estimatedTime,"h"]})]},X))]}),$.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[$.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",($.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(H=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${H.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:H.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:H.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:H.description}),H.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",H.suggestedAction]})]},H.id))]}),!$.assignees&&!$.subtasks&&!$.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Un({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,c]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,x=4,b=l.left;b+o>g-10&&(b=g-o-10),b<10&&(b=10);let v=m-l.bottom,f=l.top,h;return v>=s+x?h=l.bottom+x:f>=s+x?h=l.top-s-x:v>=f?h=l.bottom+x:h=Math.max(10,l.top-s-x),{top:h,left:b}},[e,o,s]);return react.useEffect(()=>{t&&c(u());},[t,u]),react.useEffect(()=>{if(!t)return;let l=g=>{let x=g.target;i.current&&!i.current.contains(x)&&e.current&&!e.current.contains(x)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Qe={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(46, 148, 255, 0.12)"},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:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",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:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(37, 99, 235, 0.28)"},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:"#A8A29E",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",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var $h=["LOW","MEDIUM","HIGH","URGENT"],Hh=["todo","in-progress","review","done"];function Il({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:c,onDeleteComment:i,currentUser:u,onAIGenerateDescription:l,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:x=[],availableLabels:b=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:h,unsplashAccessKey:w,theme:y,onSubtasksChange:k,attachments:C=[],onUploadAttachments:E,onDeleteAttachment:T}){let I=qo(),O=y||I?.themeName||"dark",[F,$]=react.useState(e),[z,de]=react.useState(false),[A,J]=react.useState(()=>[...e?.subtasks||[]].sort((B,j)=>(B.position??0)-(j.position??0))),[xe,Ge]=react.useState(false),[M,G]=react.useState(""),[ae,we]=react.useState(""),[H,X]=react.useState("all"),[Z,ge]=react.useState(false),[Le,Oe]=react.useState(false),[rt,at]=react.useState(false),[re,it]=react.useState(false),[Ie,bt]=react.useState(false),[pt,ct]=react.useState(false),Ce=react.useRef(null),_e=react.useRef(null),tt=react.useRef(null),Ke=react.useRef(null),U=react.useRef(null),ne=react.useRef(null),S=react.useRef(null),q=react.useRef(null),le=react.useRef(null),fe=react.useRef(null),_=react.useRef(null),Q=react.useRef(null);react.useEffect(()=>{if(e&&!F){$({...e});let D=[...e.subtasks||[]].sort((B,j)=>(B.position??0)-(j.position??0));J(D);}else if(e&&F&&e.id!==F.id){$({...e});let D=[...e.subtasks||[]].sort((B,j)=>(B.position??0)-(j.position??0));J(D);}},[e,F]),react.useEffect(()=>{let D=B=>{let j=B.target;Ke.current&&!Ke.current.contains(j)&&ge(false),U.current&&!U.current.contains(j)&&Oe(false),ne.current&&!ne.current.contains(j)&&at(false),S.current&&!S.current.contains(j)&&it(false);};if(Z||Le||rt||re)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[Z,Le,rt,re]),react.useEffect(()=>{if(!t)return;let D=B=>{let j=B.target,se=j.tagName==="INPUT"||j.tagName==="TEXTAREA"||j.isContentEditable;if(B.key==="Escape"){B.preventDefault(),Z||Le||rt||re||Ie||pt?(ge(false),Oe(false),at(false),it(false),bt(false),ct(false)):se||a();return}if(se&&B.key!=="Escape")return;let pe=B.metaKey||B.ctrlKey;switch(B.key.toLowerCase()){case "s":B.preventDefault(),ge(true);break;case "a":B.preventDefault(),at(true);break;case "p":B.preventDefault(),Oe(true);break;case "l":B.preventDefault(),it(true);break;case "d":pe||(B.preventDefault(),bt(true),setTimeout(()=>q.current?.focus(),0));break;case "e":pe||(B.preventDefault(),ct(true));break;case "i":B.preventDefault(),de(true),setTimeout(()=>_e.current?.focus(),0);break;case "t":B.preventDefault(),Ge(true);break;case "c":B.preventDefault(),tt.current?.focus();break}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[t,a,Z,Le,rt,re,Ie,pt]);let $e=react.useCallback(D=>{let B=D.currentTarget.textContent?.trim()||"";if(F&&B!==F.title){let j={...F,title:B};$(j),r?.(F.id,{title:B});}},[F,r]),ke=react.useCallback(D=>{D.key==="Enter"&&(D.preventDefault(),D.currentTarget.blur()),D.key==="Escape"&&(D.preventDefault(),D.currentTarget.textContent=F?.title||"",D.currentTarget.blur());},[F]),Be=react.useCallback(()=>{F&&e&&F.description!==e.description&&r?.(F.id,{description:F.description}),de(false);},[F,e,r]),De=react.useCallback(D=>{if(F){let B={...F,columnId:D};$(B),r?.(F.id,{columnId:D}),ge(false);}},[F,r]),He=react.useCallback(D=>{if(F){let B={...F,priority:D};$(B),r?.(F.id,{priority:D}),Oe(false);}},[F,r]),st=react.useCallback(D=>{if(F){let B=F.assignedUserIds||[],j=B.includes(D)?B.filter(pe=>pe!==D):[...B,D],se={...F,assignedUserIds:j};$(se),r?.(F.id,{assignedUserIds:j});}},[F,r]),ot=react.useCallback(D=>{if(F){let B=F.labels||[],j=B.includes(D)?B.filter(pe=>pe!==D):[...B,D],se={...F,labels:j};$(se),r?.(F.id,{labels:j});}},[F,r]),nt=react.useCallback(D=>{if(F){let B={...F,tags:D};$(B),r?.(F.id,{tags:D});}},[F,r]),mt=react.useCallback(D=>{if(F){let B=D.target.value,j={...F,endDate:B};$(j),r?.(F.id,{endDate:B}),bt(false);}},[F,r]),Bt=react.useCallback(D=>{if(F){let B={...F,estimatedTime:parseFloat(D)||0};$(B),r?.(F.id,{estimatedTime:parseFloat(D)||0});}},[F,r]),Tt=react.useCallback(()=>{if(M.trim()&&F){let D={id:`subtask-${Date.now()}`,title:M.trim(),completed:false,position:A.length,createdAt:new Date},B=[...A,D];J(B),G(""),Ge(false),k?.(F.id,B);}},[M,A,F,k]),lt=react.useCallback(D=>{let B=A.map(j=>j.id===D?{...j,completed:!j.completed,updatedAt:new Date}:j);J(B),F&&k?.(F.id,B);},[A,F,k]),ut=react.useCallback(D=>{let B=A.filter(j=>j.id!==D);J(B),F&&k?.(F.id,B);},[A,F,k]),Et=react.useCallback(()=>{ae.trim()&&F&&c&&(c(F.id,ae.trim()),we(""));},[ae,F,c]),Nt=react.useCallback(D=>{(D.metaKey||D.ctrlKey)&&D.key==="Enter"&&(D.preventDefault(),Et());},[Et]),Fe=D=>jsxRuntime.jsx(Bh__default.default,{remarkPlugins:[Rh__default.default],rehypePlugins:[Oh__default.default],components:{a:({node:B,...j})=>jsxRuntime.jsx("a",{...j,target:"_blank",rel:"noopener noreferrer"})},children:D}),ze=d.filter(D=>H==="comments"?D.type.includes("COMMENT"):H==="history"?!D.type.includes("COMMENT"):true);if(!t||!e)return null;let Y=F||e,he=s.filter(D=>Y.assignedUserIds?.includes(D.id)),N=A.filter(D=>D.completed).length;return jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:D=>D.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":O,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ce,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:$e,onKeyDown:ke,children:Y.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ke,children:[jsxRuntime.jsxs("button",{ref:le,className:"modal-v2-field",onClick:()=>ge(!Z),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.columnId||"No status"})]}),jsxRuntime.jsx(Un,{triggerRef:le,isOpen:Z,onClose:()=>ge(false),width:250,estimatedHeight:200,children:(x.length>0?x:Hh.map(D=>({id:D,title:D}))).map(D=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Y.columnId===D.id?"active":""}`,onClick:()=>De(D.id),children:D.title},D.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ne,children:[jsxRuntime.jsxs("button",{ref:fe,className:"modal-v2-field",onClick:()=>at(!rt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:he.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:he.map(D=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:D.color},title:D.name,children:D.initials},D.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Un,{triggerRef:fe,isOpen:rt,onClose:()=>at(false),width:280,estimatedHeight:300,children:s.map(D=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Y.assignedUserIds?.includes(D.id)?"active":""}`,onClick:()=>st(D.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:D.color},children:D.initials}),D.name,Y.assignedUserIds?.includes(D.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},D.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:U,children:[jsxRuntime.jsxs("button",{ref:_,className:"modal-v2-field",onClick:()=>Oe(!Le),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.priority||"None"})]}),jsxRuntime.jsxs(Un,{triggerRef:_,isOpen:Le,onClose:()=>Oe(false),width:180,estimatedHeight:220,children:[$h.map(D=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${D.toLowerCase()} ${Y.priority===D?"active":""}`,onClick:()=>He(D),children:D},D)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>He(""),children:"None"})]})]}),v.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(no,{selectedTags:Y.tags||[],availableTags:v,onChange:nt,onCreateTag:f,theme:Qe[O]||Qe.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:S,children:[jsxRuntime.jsxs("button",{ref:Q,className:"modal-v2-field",onClick:()=>it(!re),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.labels&&Y.labels.length>0?jsxRuntime.jsx("span",{children:Y.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Un,{triggerRef:Q,isOpen:re,onClose:()=>it(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(D=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Y.labels?.includes(D)?"active":""}`,onClick:()=>ot(D),children:[D,Y.labels?.includes(D)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},D))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{bt(!Ie),setTimeout(()=>q.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.endDate?new Date(Y.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:q,type:"date",value:typeof Y.endDate=="string"?Y.endDate.split("T")[0]:Y.endDate?(()=>{let D=new Date(Y.endDate),B=D.getUTCFullYear(),j=String(D.getUTCMonth()+1).padStart(2,"0"),se=String(D.getUTCDate()).padStart(2,"0");return `${B}-${j}-${se}`})():"",onChange:mt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ct(!pt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.estimatedTime?`${Y.estimatedTime}h`:"Not set"})]}),pt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Y.estimatedTime||"",onChange:D=>Bt(D.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ct(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),z?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Y.description||"",onChange:D=>{if(F){let B={...F,description:D.target.value};$(B);}},onBlur:Be,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>de(true),children:Y.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Fe(Y.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),A.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[N,"/",A.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ge(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[A.map(D=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${D.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>lt(D.id),children:D.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:D.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>ut(D.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},D.id)),xe&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:M,onChange:D=>G(D.target.value),onKeyDown:D=>{D.key==="Enter"&&Tt(),D.key==="Escape"&&(Ge(false),G(""));},onBlur:Tt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(E||C.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),C.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:C.length})]}),jsxRuntime.jsx(Or,{cardId:Y.id,attachments:C,onUpload:E?D=>E(Y.id,D):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${H==="all"?"active":""}`,onClick:()=>X("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${H==="comments"?"active":""}`,onClick:()=>X("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${H==="history"?"active":""}`,onClick:()=>X("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:tt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ae,onChange:D=>we(D.target.value),onKeyDown:Nt,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:Et,disabled:!ae.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ze.map(D=>{let B=s.find(se=>se.id===D.userId);if(D.type.includes("COMMENT")){let se=n.find(pe=>pe.id===D.metadata?.commentId);return se?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[B&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:B.color},children:B.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:B?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(D.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:se.content})]})]},D.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[D.type.includes("CREATED")&&"\u2795",D.type.includes("UPDATED")&&"\u270F\uFE0F",D.type.includes("MOVED")&&"\u27A1\uFE0F",D.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",D.type.includes("ASSIGNED")&&"\u{1F464}",D.type.includes("PRIORITY")&&"\u{1F3AF}",D.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:B?.name||"Unknown"})," ",D.type.replace(/_/g," ").toLowerCase(),D.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:D.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(D.timestamp).toLocaleString()})]})]},D.id)}),ze.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Yh({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function Rl({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((d,c)=>d+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Yh,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,d)=>n+d.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,d)=>n+d.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,d)=>n+(d.planned||0),0)})]})]})]})}function ry({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function Ol({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,d=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=d;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ry,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var py={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},mp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function my({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:d,y:c,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function gp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function $l({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,i)=>c+i.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||py[c.name]||mp[e.indexOf(c)%mp.length]})),d=n.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?my:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(gp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,l=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(gp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var Vs=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=react.useState(false),[c,i]=react.useState(false),[u,l]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let x=e.map(y=>y.id),b=y=>{r.onBulkUpdate?.(x,{priority:y}),d(false);},v=y=>{r.onBulkMove?.(x,y),i(false),a();},f=y=>{r.onBulkUpdate?.(x,{assignedUserIds:y}),l(false);},h=y=>{let k=new Set;e.forEach(E=>{E.labels?.forEach(T=>k.add(T));});let C=Array.from(new Set([...k,...y]));r.onBulkUpdate?.(x,{labels:C}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(y=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(y),children:[jsxRuntime.jsx("span",{className:p("asakaa-priority-dot",y==="LOW"&&"bg-asakaa-priority-low",y==="MEDIUM"&&"bg-asakaa-priority-medium",y==="HIGH"&&"bg-asakaa-priority-high",y==="URGENT"&&"bg-asakaa-priority-urgent")}),y]},y))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(y=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(y.id),children:y.title},y.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(y=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([y.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:y.color},children:y.initials}),y.name]},y.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(y=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([y]),children:y},y))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Vs.displayName="BulkOperationsToolbar";function yy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,c,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(g=>{let x=a?.find(b=>b.id===g);n=`assignee-${g}`,d=x?.name||`User ${g}`,c=x?.color,i=x?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];d=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:d,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,d=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Hl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),d=react.useMemo(()=>yy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{n(u=>{let l=new Set(u);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||d.length===0?jsxRuntime.jsx(lo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:p("asakaa-swimlane-view",o),children:[d.map(i=>{let u=s.has(i.id),l=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(lo,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),d.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var zl=[{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 Ul({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),d=zl.find(i=>i.value===e)||zl[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:p("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:d.icon}),jsxRuntime.jsx("span",{children:d.label}),jsxRuntime.jsx("svg",{className:p("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:zl.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:p("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Wn=[{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 wy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,d=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&d&&c}function xp(e={}){let{shortcuts:t=Wn,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),d=react.useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return react.useEffect(()=>{function c(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(wy(i,l)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function Cy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ty(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 Ny(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ty(e),r=t?Cy(t):"";return a?`${a} + ${r}`:r}function Dy(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 Wl({shortcuts:e=Wn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function d(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=Dy(e);return jsxRuntime.jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([d,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),d]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Ny(i)})]},i.action))})]},d))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Gl=[{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,7 +122,7 @@
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},c=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxRuntime.jsxs("div",{className:p("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:p("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(l=>jsxRuntime.jsxs("button",{onClick:()=>d(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function jl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=react.useState("export"),[c,i]=react.useState("json"),[u,l]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let b=o?.current||void 0,v=await Vc(e,c,b);_c(v,c);},x=async b=>{let v=b.target.files?.[0];if(v){try{let f=await Yc(v),h=v.name.endsWith(".json")?"json":"csv",w=Kc(f,h);l(w),w.success&&r&&r(w,f);}catch(f){l({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>d("export"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>d("import"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(b=>jsxRuntime.jsxs("button",{onClick:()=>i(b),className:p("p-4 rounded-lg border-2 transition-all text-center",c===b?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick: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"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:m,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:p("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},v))})]})]})]})]})]})}var My=["URGENT","HIGH","MEDIUM","LOW"],Ay=[{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"}],Ly=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Kl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:m=false,groupBy:g="none",onGroupByChange:x}){let[b,v]=react.useState(true),f=react.useCallback(C=>{a({search:C.target.value});},[a]),h=react.useCallback(C=>{a({dateFilter:C.target.value});},[a]),w=react.useCallback(C=>{r({by:C.target.value});},[r]),y=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!b&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:C=>{let E=C.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),My.map(C=>jsxRuntime.jsx("option",{value:C,children:C},C))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:C=>{let E=C.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(C=>jsxRuntime.jsx("option",{value:C.id,children:C.name},C.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let E=C.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(C=>jsxRuntime.jsx("option",{value:C,children:C},C))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:w,className:"filter-bar__select filter-bar__select--sm",children:Ay.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:C=>x(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Ly.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))})}),k&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Yl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:c}){let[i,u]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let g=x=>{l.current&&!l.current.contains(x.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),u(false);};return jsxRuntime.jsxs("div",{className:p("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>m(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>m(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>m(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>m(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>m(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var ql={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:"#2E94FF",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"}},Xl={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:"#2E94FF",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"}},Jl={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"}},Ao={dark:ql,light:Xl,neutral:Jl},js="dark";var Ks=react.createContext(void 0),Gy="asakaa-theme";function kp({children:e,defaultTheme:t=js,storageKey:a=Gy}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=react.useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,c=Ao[r];Object.entries(c.colors).forEach(([u,l])=>{l&&d.style.setProperty(`--theme-${Vy(u)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,l])=>{let m=c.colors[u];m&&d.style.setProperty(l,m);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Ao};return jsxRuntime.jsx(Ks.Provider,{value:n,children:e})}function nn(){let e=react.useContext(Ks);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Vy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ql({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=nn();return e?jsxRuntime.jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ao).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:p("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Cp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Qe[e]||Qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Qe[e].bgSecondary),bgGrid:r("--theme-bg-card",Qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Qe[e].bgWeekend),border:r("--theme-border-primary",Qe[e].border),borderLight:r("--theme-border-subtle",Qe[e].borderLight),textPrimary:r("--theme-text-primary",Qe[e].textPrimary),textSecondary:r("--theme-text-secondary",Qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Qe[e].textTertiary),accent:r("--theme-accent-primary",Qe[e].accent),accentHover:r("--theme-accent-hover",Qe[e].accentHover),accentLight:r("--theme-accent-primary",Qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Qe[e].dependency),dependencyHover:r("--theme-border-secondary",Qe[e].dependencyHover),criticalPath:r("--theme-error",Qe[e].criticalPath),criticalPathLight:r("--theme-error",Qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Qe[e].today):e==="neutral"?r("--theme-text-primary",Qe[e].today):r("--theme-error",Qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Qe[e].todayLight):e==="neutral"?r("--theme-text-primary",Qe[e].todayLight):r("--theme-error",Qe[e].todayLight),milestone:r("--theme-warning",Qe[e].milestone),milestoneLight:r("--theme-warning",Qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Qe[e].statusInProgress),statusCompleted:r("--theme-success",Qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Qe[e].hoverBg),focusRing:r("--theme-accent-primary",Qe[e].focusRing),...Qe[e].dotGrid&&{dotGrid:Qe[e].dotGrid},...Qe[e].glassHeader&&{glassHeader:Qe[e].glassHeader},...Qe[e].glassToolbar&&{glassToolbar:Qe[e].glassToolbar},...Qe[e].forecastHud&&{forecastHud:Qe[e].forecastHud},...Qe[e].neonRedGlow&&{neonRedGlow:Qe[e].neonRedGlow},...Qe[e].executionBarBg&&{executionBarBg:Qe[e].executionBarBg}}}var Ys={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",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",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"}},Tp={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",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",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"}},Zl={en:Ys,es:Tp};function Np(e){return Zl[e]||Zl.en}function ed(e,t){let a=Np(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 ln=react.createContext(Ys);function Dr(){return react.useContext(ln)}function Js(e,t,a="left",r=208){let[o,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),d=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:d,left:c});},[t,a,e,r]),o}function Sp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,d]=react.useState(false),[c,i]=react.useState(null),[u,l]=react.useState(false),m=react.useRef(null),g=react.useRef(null),x=Dr(),b=Js(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=x.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let k=C=>{let E=C.target;m.current&&!m.current.contains(E)&&g.current&&!g.current.contains(E)&&d(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let h=[{id:"png",label:x.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:x.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:x.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:x.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(k=>k.handler),w=async(k,C)=>{if(C){i(k);try{await C();}catch(E){console.error(`Export ${k} failed:`,E);}finally{i(null),d(false);}}},y=()=>{s?.(),l(true),setTimeout(()=>l(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>d(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:x.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:h.map((k,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===k.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):k.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),h.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:y,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:u?x.toolbar.copied:x.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function bx({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function hx({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Ep({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),d=react.useRef(null),c=Dr(),i=Js(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let x=g.target;n.current&&!n.current.contains(x)&&d.current&&!d.current.contains(x)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],l=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${l}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:l})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,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:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:u.map((m,g)=>{let x=t===m.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:x?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:x?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:x?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:x?600:500},children:m.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Fp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),d=react.useRef(null),c=react.useRef(null),i=Dr(),u=Js(d,s,"left");react.useEffect(()=>{if(!s)return;let x=setTimeout(()=>{let b=f=>{let h=f.target;d.current&&!d.current.contains(h)&&c.current&&!c.current.contains(h)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(x),c._cleanup&&c._cleanup();}},[s]);let l=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:d,onClick:x=>{x.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:l.map(x=>{let b=t===x.value&&!r,v=()=>x.value==="all"?b?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):x.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(x.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?x.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:x.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},x.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function yx({value:e,onChange:t,theme:a}){let r=Dr(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let d=e===n.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:d?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:d?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function xx({theme:e,forecast:t}){let a=Dr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,d=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,l=t?.costAtCompletion,m=t?.currency||"$",g=l!=null?l>=1e6?`${m}${(l/1e6).toFixed(2)}M`:l>=1e3?`${m}${(l/1e3).toFixed(1)}K`:`${m}${l.toFixed(0)}`:"\u2014",x=t?.budgetVariancePercent,b=x!=null&&x!==0,v=x!=null?x>0?`+${x.toFixed(0)}% ${a.toolbar.budgetOver}`:`${x.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=x!=null&&x>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:x!=null&&x<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&d&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:d})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),b&&v&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function vx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:d,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u}){let[l,m]=react.useState(false),g=react.useRef(null),x=react.useRef(null),b=Dr(),v=Js(g,l,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!l)return;let y=k=>{let C=k.target;g.current&&!g.current.contains(C)&&x.current&&!x.current.contains(C)&&m(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]);let h=[{key:"criticalPath",label:b.toolbar.visibility==="Visibilidad"?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a},{key:"baselines",label:b.toolbar.visibility==="Visibilidad"?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:b.toolbar.visibility==="Visibilidad"?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:b.toolbar.visibility==="Visibilidad"?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:d,onChange:c}],w=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:g,onClick:()=>m(!l),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:l?e.accent:e.textTertiary,backgroundColor:l?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,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:"fixed w-52 rounded-xl overflow-hidden",style:{top:v.top,left:v.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${f?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:f?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:h.map((y,k)=>{let C=y.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>y.onChange?.(!y.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:y.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:y.label}),y.active&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),w.map((y,k)=>{let C=i===y.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(y.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(h.length+k)*.03},children:[jsxRuntime.jsx("span",{style:{color:C?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:y.label}),C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.value)})]})]})}),document.body)]})}function Qs({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:l,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:x,hideCompleted:b=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:h,onWbsLevelChange:w,maxWbsDepth:y=4,viewMode:k="execution",onViewModeChange:C,projectForecast:E,onExportPNG:T,onExportPDF:I,onExportExcel:O,onExportCSV:F,onExportJSON:$,onExportMSProject:z,showCriticalPath:de=true,onShowCriticalPathChange:A,showDependencies:J=true,onShowDependenciesChange:xe,highlightWeekends:Ge=true,onHighlightWeekendsChange:M,showBaseline:G=false,onShowBaselineChange:ae,onCopySnapshotLink:we}){let H=Dr(),X=T||I||O||F||$||z,Z=!!e.glassToolbar,[ge,Le]=react.useState(false),Oe=react.useRef(null);react.useEffect(()=>{ge&&Oe.current&&Oe.current.focus();},[ge]);let rt=[{value:"day",label:H.toolbar.day},{value:"week",label:H.toolbar.week},{value:"month",label:H.toolbar.month}],at=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],re=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Z){let it=re?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs(framerMotion.motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:re?"#1A1A1A":e.bgSecondary,border:`1px solid ${re?"rgba(255,255,255,0.08)":e.border}`},animate:{width:ge?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Le(!ge),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),ge&&jsxRuntime.jsx("input",{ref:Oe,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Le(false),onKeyDown:Ie=>{Ie.key==="Escape"&&Le(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:it}}),C&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:re?"#000000":e.bgSecondary,border:`1px solid ${re?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>C("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="execution"?re?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:k==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="execution"?{color:e.textSecondary}:{},children:H.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="oracle"?re?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:k==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="oracle"?{color:e.textSecondary}:{},children:H.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(yx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:it}}),w&&jsxRuntime.jsx(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsxRuntime.jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:it}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:it}}),jsxRuntime.jsx(vx,{theme:e,showCriticalPath:de,onShowCriticalPathChange:A,showBaseline:G,onShowBaselineChange:ae,highlightWeekends:Ge,onHighlightWeekendsChange:M,showDependencies:J,onShowDependenciesChange:xe,rowDensity:d,onRowDensityChange:c}),jsxRuntime.jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:I,onExportExcel:O,onExportMSProject:z,onCopySnapshotLink:we}),u&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${re?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${re?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||H.toolbar.createTask})]})]})]}),E&&jsxRuntime.jsx(xx,{theme:e,forecast:E})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(hx,{options:rt,value:t,onChange:it=>a(it),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsxRuntime.jsx(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||H.toolbar.createTask})]}),(X||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:I,onExportExcel:O,onExportMSProject:z,onCopySnapshotLink:we}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(bx,{options:at,value:s,onChange:it=>n(it),theme:e})]})]})}function Zs({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),d=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function un({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[d,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,l=r.length*36+8,m=8,g=window.innerWidth,x=window.innerHeight,b=t,v=a;t+u+m>g&&(b=t-u,b<m&&(b=m)),a+l+m>x&&(v=x-l-m,v<m&&(v=m)),c({x:b,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=m=>{n.current&&!n.current.contains(m.target)&&o();},l=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:l=>{u.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var Vt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Op({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:m=true}){let g=react.useRef(false),x=react.useCallback(w=>{g.current=w;},[]),b=react.useCallback(w=>{let y=[],k=C=>{for(let E of C)y.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&k(E.subtasks);};return k(w),y},[]),v=react.useCallback(()=>{let w=b(e);for(let y of w)if(t.has(y.id))return y;return null},[e,t,b]),f=react.useCallback((w,y)=>{let k=b(e);if(k.length===0)return;let C=v();if(!C){a(k[0].id,false);return}let E=k.findIndex(O=>O.id===C.id);if(E===-1)return;let T=w==="up"?E-1:E+1;if(T<0||T>=k.length)return;let I=k[T];a(I.id,y);},[e,v,b,a]),h=react.useCallback(w=>{if(!m)return;let y=w.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||g.current){w.key==="Escape"&&(y.blur(),g.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,T=Array.from(t),I=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(I&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!I.isExpanded||w.key==="ArrowLeft"&&I.isExpanded)&&u(I.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){T.length>0&&(w.preventDefault(),n(T,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){T.length>0&&(w.preventDefault(),d(T));return}if(w.key==="Tab"&&w.shiftKey){T.length>0&&(w.preventDefault(),c(T));return}if(w.key==="Enter"&&!w.shiftKey&&!E){I&&(w.preventDefault(),r(I.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!E){I&&(w.preventDefault(),r(I.id,"above"));return}if(w.key==="Enter"&&E){I&&(w.preventDefault(),l(I.id));return}if(w.key==="F2"){I&&(w.preventDefault(),i(I.id));return}if(w.key==="Delete"||w.key==="Backspace"&&E){T.length>0&&(w.preventDefault(),o(T));return}if(w.key==="d"&&E&&!w.shiftKey){T.length>0&&(w.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,d,c,i,u,l]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[m,h]),{setIsEditing:x}}function Hp(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(m=>{let g=new Set(m);return g.has(l)?g.delete(l):g.add(l),g}),r(l);},[]),n=react.useCallback((l,m)=>{if(!a){o(l);return}let g=m.indexOf(a),x=m.indexOf(l);if(g===-1||x===-1){o(l);return}let b=Math.min(g,x),v=Math.max(g,x),f=m.slice(b,v+1);t(new Set(f)),r(l);},[a,o]),d=react.useCallback((l,m,g,x)=>{x?n(l,m):g?s(l):o(l);},[o,s,n]),c=react.useCallback((l,m)=>{m?t(g=>{let x=new Set(g);return x.add(l),x}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function rd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?rd(t.subtasks):t.subtasks}))}function pn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((d,c)=>(d.position??0)-(c.position??0));for(let d=0;d<n.length;d++){let c={...n[d],parentId:o,level:s,position:n[d].position??d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function ei(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ei(a.subtasks,t);if(r)return r}}return null}function ad(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ad(a.subtasks,t);if(r)return r}return null}function od(e,t){if(t.length===0)return e;let a=pn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let x=[];return {tasks:m.filter(v=>{if(g.has(v.id))return x.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,x.push(...f.removed);}return true}),removed:x}},d=(m,g,x)=>m.map(b=>b.id===g?{...b,subtasks:[...b.subtasks||[],...x],isExpanded:true}:b.subtasks?{...b,subtasks:d(b.subtasks,g,x)}:b),c=new Set(t),{tasks:i,removed:u}=n(e,c),l=d(i,s.id,u);return rd(l)}function nd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ad(a,r);if(!o)continue;let s=ad(a,o.id),n=(i,u,l)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===u&&g.subtasks){let x=g.subtasks.findIndex(b=>b.id===l);if(x!==-1){let[b]=g.subtasks.splice(x,1);return b}}if(g.subtasks){let x=n(g.subtasks,u,l);if(x)return x}}return null},d=(i,u,l)=>{let m=i.findIndex(g=>g.id===u);if(m!==-1)return i.splice(m+1,0,l),i;for(let g of i)g.subtasks&&d(g.subtasks,u,l);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?d(s.subtasks,o.id,c):d(a,o.id,c));}return rd(a)}function sd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,c)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],n[i]={...n[i],position:i},n[u]={...n[u],position:u},true)};return s(r,o,a),r}function id(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 Vn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((u,l)=>({...u,id:`${u.id}-copy-${Date.now()}-${l}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${l}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let x=n(g.subtasks);if(x)return x}return null}let u=c[i],l=`${u.id}-copy-${Date.now()}`,m={...u,id:l,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,l):void 0};return c.splice(i+1,0,m),m},d=n(a);d&&r.push(d);}return {tasks:a,duplicatedTasks:r}}function zp(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:"#2E94FF"},d=c=>{let i=c.findIndex(l=>l.id===t);if(i===-1){for(let l of c)if(l.subtasks&&d(l.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,n),true};return d(r),{tasks:r,newTask:n}}function ld(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ld(r.subtasks,t,a)}:r)}function dd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:dd(a.subtasks,t)}:a)}function cd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let x=a(g.subtasks);if(x)return x}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let x=c(g.subtasks);if(x>=0)return x}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#2E94FF",position:i,parentId:t},l=m=>m.map(g=>{if(g.id===t){let x=g.subtasks||[];return {...g,subtasks:[...x,u],isExpanded:true}}return g.subtasks?{...g,subtasks:l(g.subtasks)}:g});return {tasks:l(e),newTask:u}}function Up(e,t,a,r){if(t===a)return e;let o=ei(e,t);if(!o)return e;if(a){let d=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||d(u,i))return true;return false};if(d(o,a))return e}let s=d=>{let c=d.filter(u=>u.id!==t),i=c.length<d.length;return c.map((u,l)=>{let m=i?{...u,position:l}:u;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let d=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],l=r!==void 0?r:u.length,m=[...u];m.splice(l,0,{...o,parentId:a});let g=m.map((x,b)=>({...x,position:b}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function br(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=br(t.subtasks),r=a.reduce((d,c)=>(c.startDate&&d.starts.push(new Date(c.startDate).getTime()),c.endDate&&d.ends.push(new Date(c.endDate).getTime()),d.progresses.push(c.progress??0),d),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((d,c)=>d+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ai({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:m,onTaskUpdate:g,onTaskIndent:x,onTaskOutdent:b,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:h,onTaskCreate:w,onTaskRename:y,onCreateSubtask:k,onOpenTaskModal:C,onDeleteRequest:E,onTaskReparent:T,scrollContainerRef:I}){let O=react.useContext(ln),[F,$]=react.useState(null),[z,de]=react.useState(null),[A,J]=react.useState(""),xe=react.useRef(null),[Ge,M]=react.useState(null),[G,ae]=react.useState(0),[we,H]=react.useState(0),[X,Z]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ge,Le]=react.useState(null),[Oe,rt]=react.useState(null),[at,re]=react.useState(null),it=react.useRef(0),Ie=5,bt=react.useRef(false),[pt,ct]=react.useState(null),[Ce,_e]=react.useState(false),tt=react.useRef(null),[Ke,U]=react.useState(null),[ne,S]=react.useState(false),q=react.useRef(null);react.useEffect(()=>{function Y(he){q.current&&!q.current.contains(he.target)&&S(false);}if(ne)return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[ne]),react.useEffect(()=>{z&&xe.current&&(xe.current.focus(),xe.current.select());},[z]),react.useEffect(()=>{if(!Ge)return;let Y=N=>{let D=N.clientX-G,B=we+D;m?.(Ge,B);},he=()=>{M(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",he),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",he),document.body.style.cursor="",document.body.style.userSelect="";}},[Ge,G,we,m]);let{selectedTaskIds:le,handleTaskClick:fe,isTaskSelected:_}=Hp(),{setIsEditing:Q}=Op({tasks:e,selectedTaskIds:le,onTaskSelect:(Y,he)=>{let D=pn(e).map(B=>B.id);fe(Y,D,he||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:Y=>{let he=pn(e).find(N=>N.id===Y);he&&st(he);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:Y=>{let he=pn(e).find(N=>N.id===Y);he&&C&&C(he);},enableKeyboard:true}),$e=(Y,he=0,N="")=>{let D=[],B=[...Y].sort((j,se)=>(j.position??0)-(se.position??0));for(let j=0;j<B.length;j++){let se=B[j],pe=j+1,te=N?`${N}.${pe}`:`${pe}.0`;if(se.wbsCode=te,D.push({task:se,level:he}),se.subtasks&&se.subtasks.length>0&&se.isExpanded){let me=N?`${N}.${pe}`:`${pe}`;D.push(...$e(se.subtasks,he+1,me));}}return D},ke=$e(e),Be=48,De=Math.max(ke.length*a,600-Be),He=Y=>!Y.startDate||!Y.endDate?"-":`${Math.ceil((Y.endDate.getTime()-Y.startDate.getTime())/(1e3*60*60*24))}d`,st=Y=>{de(Y.id),J(Y.name),Q(true);},ot=Y=>{A.trim()&&A!==e.find(he=>he.id===Y)?.name&&y?.(Y,A.trim()),de(null),J(""),Q(false);},nt=()=>{de(null),J(""),Q(false);},mt=(Y,he)=>{he.stopPropagation(),k?.(Y.id);},Bt=(Y,he)=>{he.preventDefault(),it.current=he.clientY,Le(Y),bt.current=false,_e(false),ct({x:he.clientX,y:he.clientY});},Tt=Y=>{if(!ge||(Math.abs(Y.clientY-it.current)>Ie&&!bt.current&&(bt.current=true,_e(true)),ct({x:Y.clientX,y:Y.clientY}),!bt.current))return;if(I?.current){let j=I.current,se=j.getBoundingClientRect(),pe=60,te=12;tt.current&&(cancelAnimationFrame(tt.current),tt.current=null);let me=Y.clientY-se.top,Ye=se.bottom-Y.clientY;if(me<pe&&j.scrollTop>0){let qe=Math.round(te*(1-me/pe)),At=()=>{j.scrollTop-=qe,bt.current&&j.scrollTop>0&&(tt.current=requestAnimationFrame(At));};tt.current=requestAnimationFrame(At);}else if(Ye<pe&&j.scrollTop<j.scrollHeight-j.clientHeight){let qe=Math.round(te*(1-Ye/pe)),At=()=>{j.scrollTop+=qe,bt.current&&j.scrollTop<j.scrollHeight-j.clientHeight&&(tt.current=requestAnimationFrame(At));};tt.current=requestAnimationFrame(At);}}let N=document.querySelectorAll("[data-task-row]"),D=null,B=null;N.forEach(j=>{let se=j.getBoundingClientRect(),pe=j.getAttribute("data-task-row");if(pe&&pe!==ge&&Y.clientY>=se.top&&Y.clientY<=se.bottom){D=pe;let te=Y.clientY-se.top,me=se.height;te<me*.25?B="above":te>me*.75?B="below":B="child";}}),rt(D),re(B);},lt=()=>{if(bt.current&&ge&&Oe&&at){if(at==="child")T?.(ge,Oe);else if(at==="above"||at==="below"){let Y=(B,j,se=null)=>{for(let pe of B){if(pe.id===j)return se;if(pe.subtasks){let te=Y(pe.subtasks,j,pe.id);if(te!==void 0)return te}}},he=Y(e,ge,null),N=Y(e,Oe,null),D=(B,j,se,pe)=>{let te=B.findIndex(qe=>qe.id===j),me=pe?B.findIndex(qe=>qe.id===se):-1,Ye=at==="below"?te+1:te;return pe&&me!==-1&&me<te&&(Ye-=1),Math.max(0,Ye)};if(N===null){let j=D(e,Oe,ge,he===null);T?.(ge,null,j);}else {let B=ke.find(j=>j.task.id===N)?.task;if(B?.subtasks){let j=he===N,se=D(B.subtasks,Oe,ge,j);T?.(ge,N,se);}}}}tt.current&&(cancelAnimationFrame(tt.current),tt.current=null),Le(null),rt(null),re(null),ct(null),bt.current=false,_e(false);};react.useEffect(()=>{if(ge)return document.addEventListener("mousemove",Tt),document.addEventListener("mouseup",lt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Tt),document.removeEventListener("mouseup",lt),document.body.style.cursor="",document.body.style.userSelect="";}},[ge,Oe,at]);let ut=(Y,he,N)=>{let D=he.subtasks&&he.subtasks.length>0;switch(Y.id){case "name":let B=z===he.id,j=F===he.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${N*20}px`},children:[T&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:j?1:.3},onMouseDown:Me=>Bt(he.id,Me),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),he.subtasks&&he.subtasks.length>0?jsxRuntime.jsx("button",{onClick:Me=>{Me.stopPropagation(),c?.(he.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:he.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),B?jsxRuntime.jsx("input",{ref:xe,type:"text",value:A,onChange:Me=>J(Me.target.value),onKeyDown:Me=>{Me.key==="Enter"?ot(he.id):Me.key==="Escape"&&nt();},onBlur:()=>ot(he.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:Me=>Me.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:he.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:he.parentId?"13px":"14px",fontWeight:he.isMilestone?600:he.parentId?400:600,letterSpacing:he.parentId?"0":"-0.01em"},title:he.name,children:[he.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:he.wbsCode}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:he.name})]}),j&&!B&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Me=>Me.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:Me=>mt(he,Me),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:Me=>{Me.stopPropagation(),st(he);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let pe=Y.id==="startDate"?"startDate":"endDate",te=he[pe],me=Ke?.taskId===he.id&&Ke?.field===pe,Ye=Me=>Me?(typeof Me=="string"?new Date(Me):Me).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Me=>Me.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:D?.5:1,cursor:D?"default":"pointer"},title:D?"Auto-calculated from subtasks":void 0,onClick:Me=>{if(!D)if(me)U(null);else {let W=Me.currentTarget.getBoundingClientRect();U({taskId:he.id,field:pe,month:te?typeof te=="string"?new Date(te):te:new Date,position:{top:W.bottom+4,left:W.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Ye(te)}),D&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),me&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>U(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:Ke?.position.top,left:Ke?.position.left},onClick:Me=>Me.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Me=new Date,W=new Date(Me);W.setDate(Me.getDate()+1);let ve=new Date(Me);ve.setDate(Me.getDate()+7);let $t=new Date(Me);return $t.setDate(Me.getDate()+14),[{label:"Hoy",date:Me},{label:"Ma\xF1ana",date:W},{label:"Pr\xF3xima semana",date:ve},{label:"2 semanas",date:$t}].map((ce,Re)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:je=>je.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:je=>je.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(he.id,{[pe]:ce.date}),U(null);},children:ce.label},Re))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:Me=>Me.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Me=>Me.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(he.id,{[pe]:void 0}),U(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>U(Me=>Me?{...Me,month:new Date(Me.month.getFullYear(),Me.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Ke?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>U(Me=>Me?{...Me,month:new Date(Me.month.getFullYear(),Me.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((Me,W)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Me},W))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Me=Ke?.month||new Date,W=Me.getFullYear(),ve=Me.getMonth(),$t=new Date(W,ve,1).getDay(),L=new Date(W,ve+1,0).getDate(),ce=new Date,Re=[];for(let ht=$t-1;ht>=0;ht--)Re.push({day:new Date(W,ve,-ht).getDate(),date:new Date(W,ve-1,new Date(W,ve,-ht).getDate()),isCurrentMonth:false});for(let ht=1;ht<=L;ht++)Re.push({day:ht,date:new Date(W,ve,ht),isCurrentMonth:true});let je=42-Re.length;for(let ht=1;ht<=je;ht++)Re.push({day:ht,date:new Date(W,ve+1,ht),isCurrentMonth:false});return Re.map((ht,Ua)=>{let aa=ht.date.toDateString()===ce.toDateString(),ia=(te?typeof te=="string"?new Date(te):te:null)?.toDateString()===ht.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:ht.isCurrentMonth?ia?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ia?"#2E94FF":"transparent",boxShadow:aa&&!ia?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(he.id,{[pe]:ht.date}),U(null);},children:ht.day},Ua)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:He(he)})});case "assignees":if(D)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let qe=r.filter(Me=>he.assignees?.some(W=>W.name===Me.name||W.initials===Me.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Me=>Me.stopPropagation(),children:jsxRuntime.jsx(Do,{assignedUsers:qe,availableUsers:r,onChange:Me=>{let W=Me.map(ve=>({id:ve.id,name:ve.name,initials:ve.initials,color:ve.color}));g?.(he.id,{assignees:W.length>0?W:void 0});}})});case "status":if(D){let Me=he.progress===100?"\u2713":he.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:Me})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Me=>Me.stopPropagation(),children:jsxRuntime.jsx(mu,{status:he.status||"todo",onChange:Me=>{g?.(he.id,{status:Me,progress:Me==="completed"?100:he.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:D?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${he.progress}%`,backgroundColor:he.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[he.progress,"%"]})]});case "priority":let At={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},jt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},sa=At[he.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Me=>Me.stopPropagation(),children:jsxRuntime.jsx(To,{priority:sa,onChange:Me=>{Me&&g?.(he.id,{priority:jt[Me]||"medium"});}})});default:return null}},Et=Y=>[{id:"hide",label:"Hide Column",icon:Vt.Hide,onClick:()=>l(Y),disabled:Y==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Vt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Vt.SortDesc,onClick:()=>{}}],Nt=Y=>Y.subtasks&&Y.subtasks.length>0?[{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{k?.(Y.id);}},{id:"duplicate",label:O?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{h?.([Y.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{E?E(Y.id,Y.name):f?.([Y.id]);}}]:[{id:"edit",label:O?.contextMenu?.editTask||"Edit Task",icon:Vt.Pencil,onClick:()=>{n?.(Y);}},{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{k?.(Y.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:O?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Vt.MarkIncomplete,onClick:()=>{g?.(Y.id,{status:"todo",progress:0});},disabled:Y.status==="todo"},{id:"setInProgress",label:O?.contextMenu?.setInProgress||"Set In Progress",icon:Vt.SetInProgress,onClick:()=>{g?.(Y.id,{status:"in-progress"});},disabled:Y.status==="in-progress"},{id:"markComplete",label:O?.contextMenu?.markComplete||"Mark Complete",icon:Vt.MarkComplete,onClick:()=>{g?.(Y.id,{status:"completed",progress:100});},disabled:Y.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:O?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{h?.([Y.id]);}},{id:"split",label:O?.contextMenu?.splitTask||"Split Task",icon:Vt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{E?E(Y.id,Y.name):f?.([Y.id]);}}],Fe=u.filter(Y=>Y.visible),We=Fe.reduce((Y,he)=>Y+he.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:We},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Be}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Fe.map((Y,he)=>{let N=he===Fe.length-1,D=Y.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${D?"":"justify-center"}`,style:{width:`${Y.width}px`,minWidth:`${Y.minWidth??(D?200:60)}px`,maxWidth:`${Y.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:N?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:B=>{B.preventDefault(),Z({isOpen:true,x:B.clientX,y:B.clientY,type:"header",columnId:Y.id});},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:Y.label,children:Y.label}),Y.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Ge===Y.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:B=>{B.preventDefault(),B.stopPropagation(),M(Y.id),ae(B.clientX),H(Y.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},Y.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsxRuntime.jsx(Zs,{columns:u,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>S(!ne),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),ne&&jsxRuntime.jsxs("div",{ref:q,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:Y=>Y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>S(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:De},children:ke.map(({task:Y,level:he},N)=>{let D=_(Y.id),B=Oe===Y.id,j=B&&at==="above",se=B&&at==="below",pe=B&&at==="child",te={};return pe&&(te.backgroundColor=`${t.accent}15`,te.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":Y.id,className:`flex items-center cursor-pointer group ${ge===Y.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:D?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:D?t.accentLight:pe?`${t.accent}15`:N%2===0?t.bgPrimary:t.bgGrid,...te},onMouseEnter:()=>$(Y.id),onMouseLeave:()=>$(null),onClick:me=>{let qe=pn(e).map(sa=>sa.id),jt=navigator.platform.toUpperCase().indexOf("MAC")>=0?me.metaKey:me.ctrlKey;fe(Y.id,qe,jt,me.shiftKey),s?.(Y);},onDoubleClick:me=>{me.stopPropagation(),n?.(Y);},onContextMenu:me=>{me.preventDefault(),Z({isOpen:true,x:me.clientX,y:me.clientY,type:"task",task:Y}),d?.(Y,me);},whileHover:{backgroundColor:D?t.accentLight:t.hoverBg},children:[j&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),se&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Fe.map((me,Ye)=>{let qe=Ye===Fe.length-1,At=me.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${At?"justify-start":"justify-center"}`,style:{width:`${me.width}px`,minWidth:`${me.minWidth??(At?200:60)}px`,maxWidth:`${me.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:qe?"none":`1px solid ${F===Y.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ut(me,Y,At?he:0)},`${Y.id}-${me.id}`)})]},Y.id)})}),jsxRuntime.jsx(un,{isOpen:X.isOpen,x:X.x,y:X.y,items:X.type==="header"&&X.columnId?Et(X.columnId):X.type==="task"&&X.task?Nt(X.task):[],onClose:()=>Z({...X,isOpen:false}),theme:t}),Ce&&pt&&ge&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:pt.x+12,top:pt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Y=ke.find(he=>he.task.id===ge)?.task;return Y?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:Y.name})}):null})()}),document.body)]})}function jp(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,d]=react.useState(e),[c,i]=react.useState(t),[u,l]=react.useState(null),[m,g]=react.useState(null),[x,b]=react.useState(null),[v,f]=react.useState(null),[h,w]=react.useState(0),[y,k]=react.useState(0),[C,E]=react.useState(null),[T,I]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:m,setHoveredTaskId:g,activeZone:x,setActiveZone:b,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:h,setDraggedSegmentStartX:w,segmentDragOffsetX:y,setSegmentDragOffsetX:k,hoveredSegmentIndex:C,setHoveredSegmentIndex:E,isHovered:T,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(de,A)=>{r("none"),l(null),g(null),d(de),i(A),k(0),f(null),w(0);}}}function ni({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:x,onHoverChange:b,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:h=true,readOnly:w=false}){let y=jp(t,r),k=react.useRef(null),C=react.useRef(false),E=react.useRef(null),T=react.useRef(null),{dragMode:I,setDragMode:O,dragOffset:F,setDragOffset:$,ghostX:z,setGhostX:de,ghostWidth:A,setGhostWidth:J,connectionLine:xe,setConnectionLine:Ge,hoveredTaskId:M,setHoveredTaskId:G,activeZone:ae,setActiveZone:we,draggedSegmentIndex:H,setDraggedSegmentIndex:X,draggedSegmentStartX:Z,setDraggedSegmentStartX:ge,segmentDragOffsetX:Le,setSegmentDragOffsetX:Oe,hoveredSegmentIndex:rt,setHoveredSegmentIndex:at,isHovered:re,setIsHovered:it,isDragging:Ie,isResizing:bt,isConnecting:pt,resetDragState:ct}=y,Ce=18,_e=!!o.executionBarBg,tt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Ke=_e?3:6,U=e.subtasks&&e.subtasks.length>0,ne=e.endDate&&(()=>{let N=new Date;N.setHours(0,0,0,0);let D=new Date(e.endDate);return D.setHours(0,0,0,0),D<N})()&&e.progress<100,S=h&&e.isCriticalPath,q=o.name==="neutral"||o.today==="#1C1917",le=e.status==="completed"||e.progress===100,fe={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Q=h&&e.isCriticalPath||ne?"#EF4444":e.color?e.color:e.priority&&fe[e.priority]?fe[e.priority]:o.taskBarPrimary,$e=w?"default":Ie?pt?"crosshair":bt?"ew-resize":"grabbing":"grab",ke=w?"default":"ew-resize",De=(N=>N>=80?20:N>=60?15:N>=50?12:10)(r),He=r<50,st=r<40;react.useEffect(()=>{b&&(!re||Ie||e.segments)&&b(null);},[re,Ie,e.segments,b]);let ot=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let N=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${N} day${N!==1?"s":""}`},mt=N=>Math.round(N/s)*s,Bt=N=>{let D=Math.round(N/s),B=new Date(n);return B.setDate(B.getDate()+D),B},Tt=(N,D)=>{for(let B of g){if(B.id===e.id)continue;let j=5;if(N>=B.x-j&&N<=B.x+B.width+j&&D>=B.y-j&&D<=B.y+B.height+j)return B.id}return null},lt=react.useCallback((N,D,B)=>{if(w)return;N.preventDefault(),N.stopPropagation();let j=k.current?.ownerSVGElement;if(!j)return;let se=j.createSVGPoint();se.x=N.clientX,se.y=N.clientY;let pe=se.matrixTransform(j.getScreenCTM()?.inverse()),te=B!==void 0?B:t,me=D;if(!me){let Ye=pe.x-te;N.shiftKey?(me="connect",Ge({x:t+r,y:a+Ce/2})):N.ctrlKey||N.metaKey?me="move":N.altKey?me=Ye<r/2?"resize-start":"resize-end":st?Ye<r/2?me="move":me="resize-end":He?Ye<=De/2?me="resize-start":Ye>=r-De/2?me="resize-end":me="move":Ye<=De?me="resize-start":Ye>=r-De?me="resize-end":me="move";}C.current=false,O(me),it(false),we(null),me==="move"?$(pe.x-te):me==="connect"?Ge({x:t+r,y:a+Ce/2}):$(0),de(te),J(r);},[t,r,a,Ce,w]),ut=react.useCallback(N=>{let D=k.current?.ownerSVGElement;if(!D)return;let B=D.closest(".gantt-timeline-scroll");if(!B)return;let j=B.getBoundingClientRect(),se=60,pe=15,te=0;if(N.clientX<j.left+se){let me=j.left+se-N.clientX;te=-Math.min(pe,me/2);}else if(N.clientX>j.right-se){let me=N.clientX-(j.right-se);te=Math.min(pe,me/2);}return te!==0&&(B.scrollLeft+=te),te!==0},[]),Et=react.useCallback(N=>{if(I==="none")return;C.current=true,T.current=N;let D=k.current?.ownerSVGElement;if(!D)return;if(I==="move"||I==="resize-start"||I==="resize-end"){let se=ut(N);se&&!E.current?E.current=window.setInterval(()=>{T.current&&(ut(T.current),Et(T.current));},16):!se&&E.current&&(window.clearInterval(E.current),E.current=null);}let B=D.createSVGPoint();B.x=N.clientX,B.y=N.clientY;let j=B.matrixTransform(D.getScreenCTM()?.inverse());if(I==="connect"){Ge({x:j.x,y:j.y});let se=Tt(j.x,j.y);G(se);}else if(I==="move"){let se=j.x-F,pe=mt(se);de(pe),J(r);let te=Math.round((pe-t)/s);if(x?.(e.id,te,true),e.segments&&e.segments.length>0&&H!==null){let me=pe-Z;Oe(me);}}else if(I==="resize-start"){let se=j.x,pe=mt(se),te=t+r-pe;te>=s&&(de(pe),J(te));}else if(I==="resize-end"){let se=j.x,te=mt(se)-t;te>=s&&J(te);}},[I,t,r,s,F,e,mt,H,Z,Tt,G,Ge,de,J,Oe,x,ut]),Nt=react.useCallback(()=>{if(E.current&&(window.clearInterval(E.current),E.current=null),T.current=null,I!=="none"){if(I==="connect")M&&m&&m(e,M),Ge(null),G(null);else {let N=e.endDate.getTime()-e.startDate.getTime(),D,B,j=true;if(I==="move"){if(D=Bt(z),B=new Date(D.getTime()+N),e.segments&&e.segments.length>0&&H!==null){let se=Math.round(Le/s),pe=e.segments.map((qe,At)=>{if(At===H){let jt=new Date(qe.startDate),sa=new Date(qe.endDate);return jt.setDate(jt.getDate()+se),sa.setDate(sa.getDate()+se),{startDate:jt,endDate:sa}}return qe}),te=pe.flatMap(qe=>[qe.startDate,qe.endDate]),me=new Date(Math.min(...te.map(qe=>qe.getTime()))),Ye=new Date(Math.max(...te.map(qe=>qe.getTime())));l?.({...e,segments:pe},me,Ye),ct(t,r);return}}else I==="resize-start"?(D=Bt(z),B=e.endDate,D>B&&(console.warn("Invalid date range: start date must be before or equal to end date"),j=false)):I==="resize-end"?(D=e.startDate,B=Bt(z+A),B.setDate(B.getDate()-1),B<D&&(console.warn("Invalid date range: end date must be after or equal to start date"),j=false)):j=false;j&&D&&B&&(B.getTime()<D.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,D,B));}x?.(e.id,0,false),ct(t,r);}},[I,z,A,e,l,M,m,t,r,s,Bt,Le,H,ct,x]);react.useEffect(()=>{if(I==="none")return;let N=B=>{Et(B);},D=()=>{Nt();};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",D),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",D),E.current&&(window.clearInterval(E.current),E.current=null);}},[I,Et,Nt]);let Fe=Ie&&!pt?z:t,We=Ie&&!pt?A:r,Y=d.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,"data-task-bar":"true",onClick:()=>{!Ie&&!C.current&&c?.(e),C.current=false;},onDoubleClick:N=>{!Ie&&!C.current&&(N.stopPropagation(),i?.(e));},onContextMenu:N=>{N.preventDefault(),u?.(e,N);},onMouseEnter:()=>!Ie&&it(true),onMouseMove:N=>{b&&re&&!Ie&&!e.segments&&b({task:e,x:t,y:a,width:r,height:Ce,showBelow:false,mouseX:N.clientX,mouseY:N.clientY});},onMouseLeave:()=>{Ie||(it(false),we(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Ce,fill:"transparent",style:{pointerEvents:"all"}}),re&&!Ie&&!He&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:De,height:Ce,fill:ae==="resize-start"?o.accent:"transparent",opacity:ae==="resize-start"?.15:0,style:{cursor:ke,pointerEvents:"all"},onMouseEnter:()=>we("resize-start"),onMouseDown:N=>lt(N,"resize-start")}),jsxRuntime.jsx("rect",{x:t+De,y:a,width:r-De*2,height:Ce,fill:ae==="move"?o.accent:"transparent",opacity:ae==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>we("move"),onMouseDown:N=>lt(N,"move")}),jsxRuntime.jsx("rect",{x:t+r-De,y:a,width:De,height:Ce,fill:ae==="resize-end"?o.accent:"transparent",opacity:ae==="resize-end"?.15:0,style:{cursor:ke,pointerEvents:"all"},onMouseEnter:()=>we("resize-end"),onMouseDown:N=>lt(N,"resize-end")})]}),re&&!Ie&&st&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ce,fill:ae==="move"?o.accent:"transparent",opacity:ae==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>we("move"),onMouseDown:N=>lt(N,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ce,fill:ae==="resize-end"?o.accent:"transparent",opacity:ae==="resize-end"?.2:0,style:{cursor:ke,pointerEvents:"all"},onMouseEnter:()=>we("resize-end"),onMouseDown:N=>lt(N,"resize-end")}),re&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ce-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ie&&!pt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:z,y:a,width:A,height:Ce,rx:Ke,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!Ie&&(()=>{let N=e.baselineStartDate.getTime(),D=e.baselineEndDate.getTime(),B=n.getTime(),j=864e5,se=(N-B)/j,pe=(D-N)/j,te=se*s,me=Math.max(pe*s,s),Ye=Fe+We,qe=te+me,At=e.endDate?.getTime()??0,jt=Math.ceil((At-D)/j),sa=jt>0,Me=jt<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:te,y:a,width:me,height:Ce,rx:Ke,fill:"none",stroke:tt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),sa&&Ye>qe&&jsxRuntime.jsx("rect",{x:qe,y:a,width:Ye-qe,height:Ce,rx:0,fill:"#EF4444",opacity:.2}),sa&&jsxRuntime.jsxs("text",{x:Math.max(Ye,qe)+6,y:a+Ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",jt,"d"]}),Me&&jsxRuntime.jsxs("text",{x:Ye+6,y:a+Ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[jt,"d"]})]})})(),!e.segments&&_e&&U&&(()=>{let D=a+(Ce-6)/2,B=14,j=a+(Ce-B)/2,se=2;return jsxRuntime.jsxs("g",{"data-task-class":Y,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Fe,y:D,width:We,height:6,rx:1,fill:"rgba(255,255,255,0.12)"}),jsxRuntime.jsx("rect",{x:Fe,y:j,width:se,height:B,rx:.5,fill:"rgba(255,255,255,0.45)"}),jsxRuntime.jsx("rect",{x:Fe+We-se,y:j,width:se,height:B,rx:.5,fill:"rgba(255,255,255,0.45)"})]})})(),!e.segments&&_e&&!U&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe,y:a,width:We,height:Ce,rx:Ke,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Y,initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!pt?.15:e.parentId?.6:1,scale:re&&!Ie?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:N=>lt(N),style:{cursor:$e,pointerEvents:"all"}}),!e.segments&&!_e&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe,y:a,width:We,height:Ce,rx:Ke,fill:Q,"data-task-class":Y,initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!pt?.15:e.parentId?.6:re?.9:.8,scale:re&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:U?void 0:N=>lt(N),style:{cursor:U?"default":$e,pointerEvents:"all"}}),_e&&(ne||S)&&!e.segments&&jsxRuntime.jsx("rect",{x:Fe,y:a,width:We,height:Ce,rx:Ke,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&(_e&&U?null:jsxRuntime.jsx("rect",{x:Fe,y:a,width:Math.max(We*(e.progress/100),Ke*2),height:Ce,rx:Ke,fill:Q,opacity:1,style:{pointerEvents:"none"}})),!e.segments&&!U&&e.progress<100&&(()=>{let N=e.progress>0?We*(e.progress/100):0,D=Fe+N,B=We-N,j=e.progress===0?Ke:0,se=e.progress===0?Fe:D,pe=e.progress===0?We:B;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:se,y:a,width:pe,height:Ce,rx:j,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:se,y:a,width:pe,height:Ce,rx:j,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),_e&&!e.segments&&e.progress>0&&e.progress<100&&!U&&!Ie&&(()=>{let N=Fe+We*(e.progress/100),D=8,B=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:N,cy:a+Ce/2,r:D,fill:B?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:N,y:a+Ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:B?.initials||B?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((N,D)=>{let B=(N.startDate.getTime()-n.getTime())/864e5*s,se=(N.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-B+s,pe=Ie&&I==="move"&&H===D,te=rt===D,me=pe?B+Le:B;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Ie&&at(D),onMouseLeave:()=>!Ie&&at(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:me,y:a,width:se,height:Ce,rx:Ke,fill:Q,initial:{opacity:0,scale:.95},animate:{opacity:pe||e.parentId?.6:te?.9:.8,scale:te&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Ye=>{Ye.stopPropagation(),X(D),ge(B),lt(Ye,void 0,B);},style:{cursor:$e,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:me,y:a,width:se*(e.progress/100),height:Ce,rx:Ke,fill:Q,opacity:1,style:{pointerEvents:"none"}})]},`segment-${D}`)}),q&&(ne||S)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[S&&!ne&&jsxRuntime.jsx("rect",{x:Fe,y:a,width:We,height:Ce,rx:Ke,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ne&&jsxRuntime.jsx("rect",{x:Fe,y:a,width:We,height:Ce,rx:Ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&We>60&&!e.segments&&!(_e&&U)&&(()=>{let N=d.taskLabel(e),D=typeof N=="string"?N:e.name,B=D.length>Math.floor(We/8)?`${D.substring(0,Math.floor(We/8))}...`:D;return jsxRuntime.jsx("text",{x:Fe+8,y:a+Ce/2,dominantBaseline:"middle",fill:le?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:le?"line-through":"none"},children:B})})(),!Ie&&!e.segments&&!U&&e.progress>0&&e.progress<100&&(_e?jsxRuntime.jsxs("text",{x:Fe+We+6,y:a+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):We>100?jsxRuntime.jsxs("text",{x:Fe+We-12,y:a+Ce/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,"%"]}):null),e.status&&We>80&&!Ie&&!e.segments&&!(_e&&U)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Fe+We-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Fe+We-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(re||bt)&&!pt&&!e.segments&&!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Fe-2,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:ke},onMouseEnter:()=>we("resize-start"),onMouseLeave:()=>we(null),onMouseDown:N=>{N.stopPropagation(),lt(N,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe+4,y:a+8,width:3,height:Ce-16,rx:1.5,fill:ae==="resize-start"||I==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Fe+We-14,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:ke},onMouseEnter:()=>we("resize-end"),onMouseLeave:()=>we(null),onMouseDown:N=>{N.stopPropagation(),lt(N,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe+We-7,y:a+8,width:3,height:Ce-16,rx:1.5,fill:ae==="resize-end"||I==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re&&!Ie&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>we("connect"),onMouseLeave:()=>we(null),onMouseDown:N=>{N.stopPropagation(),lt(N,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ce/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ae==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),pt&&xe&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ce/2,x2:xe.x,y2:xe.y,stroke:M?o.statusCompleted:o.accent,strokeWidth:M?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:M?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:xe.x,cy:xe.y,r:M?8:6,fill:M?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),M&&jsxRuntime.jsx(framerMotion.motion.text,{x:xe.x+15,y:xe.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:xe.x+10},animate:{opacity:1,x:xe.x+15},transition:{duration:.2},children:"Connect"})]}),(re||Ie)&&!pt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe-1,y:a-1,width:We+2,height:Ce+2,rx:Ke+1,fill:"none",stroke:Ie?o.accent:_e?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:_e?1:2,opacity:Ie||_e?.6:.4,initial:{opacity:0},animate:{opacity:Ie||_e?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),bt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:z,y1:0,x2:z,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:z+A,y1:0,x2:z+A,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re&&!Ie&&!e.segments&&!b&&(()=>{let B=a<100,j=B?a+Ce+13:a-82-13,se=B?`M ${Fe+We/2-6} ${a+Ce+3} L ${Fe+We/2} ${a+Ce+13} L ${Fe+We/2+6} ${a+Ce+3}`:`M ${Fe+We/2-6} ${a-13} L ${Fe+We/2} ${a-3} L ${Fe+We/2+6} ${a-13}`,pe=j+22,te=j+40,me=j+55,Ye=j+70,qe=B?j+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:B?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:B?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:se,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Fe+We/2-120,y:j,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Fe+We/2,y:pe,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Fe+We/2-110,y:te,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Fe+We/2-70,y:te,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ot(e.startDate)}),jsxRuntime.jsx("text",{x:Fe+We/2-110,y:me,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Fe+We/2-70,y:me,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ot(e.endDate)}),jsxRuntime.jsx("text",{x:Fe+We/2+10,y:te,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Fe+We/2+65,y:te,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsxRuntime.jsx("text",{x:Fe+We/2+10,y:me,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Fe+We/2+65,y:me,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Fe+We/2-110,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Fe+We/2-50,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(At=>At.name).join(", ").substring(0,30),e.assignees.map(At=>At.name).join(", ").length>30?"...":""]})]}),!B&&jsxRuntime.jsx("text",{x:Fe+We/2,y:qe,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:st?"Left: move \u2022 Right: resize":He?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var ud=260,mn=8,qp=16,iv=-12;function Xp({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:h,mouseX:w,mouseY:y}=e,C=h.effortMinutes!=null||h.timeLoggedMinutes!=null||h.soldEffortMinutes!=null?155:105,E=w+qp,T=y+iv-C;E+ud>window.innerWidth-mn&&(E=w-ud-qp),E<mn&&(E=mn);let I=T<mn;I&&(T=y+20),T+C>window.innerHeight-mn&&(T=window.innerHeight-mn-C),o({left:E,top:T,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,d={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"},c=h=>h.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let h=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${h} d\xEDa${h!==1?"s":""}`:`${h} day${h!==1?"s":""}`},u=h=>{if(h==null||h===0)return "N/A";let w=Math.floor(h/60),y=h%60;return w===0?`${y}m`:y===0?`${w}h`:`${w}h ${y}m`},l=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",x=t.accent||"#3B82F6",b=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:ud,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:b,border:`1px solid ${v}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(si,{label:d.start,value:s.startDate?c(s.startDate):"N/A",labelColor:l,valueColor:m}),jsxRuntime.jsx(si,{label:d.duration,value:i(),labelColor:l,valueColor:m}),jsxRuntime.jsx(si,{label:d.end,value:s.endDate?c(s.endDate):"N/A",labelColor:l,valueColor:m}),jsxRuntime.jsx(si,{label:d.progress,value:`${s.progress}%`,labelColor:l,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:l},children:[d.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(h=>h.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:l},children:[d.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:u(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:l},children:[d.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:x,fontWeight:600},children:u(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:l},children:[d.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:u(s.soldEffortMinutes)})]})]})]}),jsxRuntime.jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},c=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxRuntime.jsxs("div",{className:p("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:p("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(l=>jsxRuntime.jsxs("button",{onClick:()=>d(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function jl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=react.useState("export"),[c,i]=react.useState("json"),[u,l]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let b=o?.current||void 0,v=await Vc(e,c,b);_c(v,c);},x=async b=>{let v=b.target.files?.[0];if(v){try{let f=await Yc(v),h=v.name.endsWith(".json")?"json":"csv",w=Kc(f,h);l(w),w.success&&r&&r(w,f);}catch(f){l({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>d("export"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>d("import"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(b=>jsxRuntime.jsxs("button",{onClick:()=>i(b),className:p("p-4 rounded-lg border-2 transition-all text-center",c===b?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick: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"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:m,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:p("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:p("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},v))})]})]})]})]})]})}var My=["URGENT","HIGH","MEDIUM","LOW"],Ay=[{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"}],Ly=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Kl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:m=false,groupBy:g="none",onGroupByChange:x}){let[b,v]=react.useState(true),f=react.useCallback(C=>{a({search:C.target.value});},[a]),h=react.useCallback(C=>{a({dateFilter:C.target.value});},[a]),w=react.useCallback(C=>{r({by:C.target.value});},[r]),y=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!b&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:C=>{let E=C.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),My.map(C=>jsxRuntime.jsx("option",{value:C,children:C},C))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:C=>{let E=C.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(C=>jsxRuntime.jsx("option",{value:C.id,children:C.name},C.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let E=C.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(C=>jsxRuntime.jsx("option",{value:C,children:C},C))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:w,className:"filter-bar__select filter-bar__select--sm",children:Ay.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:C=>x(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Ly.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))})}),k&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Yl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:c}){let[i,u]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let g=x=>{l.current&&!l.current.contains(x.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),u(false);};return jsxRuntime.jsxs("div",{className:p("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>m(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>m(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>m(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>m(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>m(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var ql={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:"#2E94FF",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"}},Xl={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:"#2E94FF",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"}},Jl={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"}},Ao={dark:ql,light:Xl,neutral:Jl},js="dark";var Ks=react.createContext(void 0),Gy="asakaa-theme";function kp({children:e,defaultTheme:t=js,storageKey:a=Gy}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=react.useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,c=Ao[r];Object.entries(c.colors).forEach(([u,l])=>{l&&d.style.setProperty(`--theme-${Vy(u)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,l])=>{let m=c.colors[u];m&&d.style.setProperty(l,m);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Ao};return jsxRuntime.jsx(Ks.Provider,{value:n,children:e})}function nn(){let e=react.useContext(Ks);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Vy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ql({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=nn();return e?jsxRuntime.jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ao).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:p("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Cp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Qe[e]||Qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Qe[e].bgSecondary),bgGrid:r("--theme-bg-card",Qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Qe[e].bgWeekend),border:r("--theme-border-primary",Qe[e].border),borderLight:r("--theme-border-subtle",Qe[e].borderLight),textPrimary:r("--theme-text-primary",Qe[e].textPrimary),textSecondary:r("--theme-text-secondary",Qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Qe[e].textTertiary),accent:r("--theme-accent-primary",Qe[e].accent),accentHover:r("--theme-accent-hover",Qe[e].accentHover),accentLight:r("--theme-accent-primary",Qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Qe[e].dependency),dependencyHover:r("--theme-border-secondary",Qe[e].dependencyHover),criticalPath:r("--theme-error",Qe[e].criticalPath),criticalPathLight:r("--theme-error",Qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Qe[e].today):e==="neutral"?r("--theme-text-primary",Qe[e].today):r("--theme-error",Qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Qe[e].todayLight):e==="neutral"?r("--theme-text-primary",Qe[e].todayLight):r("--theme-error",Qe[e].todayLight),milestone:r("--theme-warning",Qe[e].milestone),milestoneLight:r("--theme-warning",Qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Qe[e].statusInProgress),statusCompleted:r("--theme-success",Qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Qe[e].hoverBg),focusRing:r("--theme-accent-primary",Qe[e].focusRing),...Qe[e].dotGrid&&{dotGrid:Qe[e].dotGrid},...Qe[e].glassHeader&&{glassHeader:Qe[e].glassHeader},...Qe[e].glassToolbar&&{glassToolbar:Qe[e].glassToolbar},...Qe[e].forecastHud&&{forecastHud:Qe[e].forecastHud},...Qe[e].neonRedGlow&&{neonRedGlow:Qe[e].neonRedGlow},...Qe[e].executionBarBg&&{executionBarBg:Qe[e].executionBarBg}}}var Ys={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",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",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"}},Tp={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",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",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"}},Zl={en:Ys,es:Tp};function Np(e){return Zl[e]||Zl.en}function ed(e,t){let a=Np(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 ln=react.createContext(Ys);function Dr(){return react.useContext(ln)}function Js(e,t,a="left",r=208){let[o,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),d=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:d,left:c});},[t,a,e,r]),o}function Sp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,d]=react.useState(false),[c,i]=react.useState(null),[u,l]=react.useState(false),m=react.useRef(null),g=react.useRef(null),x=Dr(),b=Js(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=x.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let k=C=>{let E=C.target;m.current&&!m.current.contains(E)&&g.current&&!g.current.contains(E)&&d(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let h=[{id:"png",label:x.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:x.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:x.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:x.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(k=>k.handler),w=async(k,C)=>{if(C){i(k);try{await C();}catch(E){console.error(`Export ${k} failed:`,E);}finally{i(null),d(false);}}},y=()=>{s?.(),l(true),setTimeout(()=>l(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>d(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:x.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:h.map((k,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===k.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):k.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),h.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:y,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:u?x.toolbar.copied:x.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function bx({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function hx({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Ep({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),d=react.useRef(null),c=Dr(),i=Js(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let x=g.target;n.current&&!n.current.contains(x)&&d.current&&!d.current.contains(x)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],l=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${l}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:l})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,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:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:u.map((m,g)=>{let x=t===m.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:x?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:x?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:x?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:x?600:500},children:m.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Fp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),d=react.useRef(null),c=react.useRef(null),i=Dr(),u=Js(d,s,"left");react.useEffect(()=>{if(!s)return;let x=setTimeout(()=>{let b=f=>{let h=f.target;d.current&&!d.current.contains(h)&&c.current&&!c.current.contains(h)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(x),c._cleanup&&c._cleanup();}},[s]);let l=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:d,onClick:x=>{x.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:l.map(x=>{let b=t===x.value&&!r,v=()=>x.value==="all"?b?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):x.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(x.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?x.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:x.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},x.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function yx({value:e,onChange:t,theme:a}){let r=Dr(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let d=e===n.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:d?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:d?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function xx({theme:e,forecast:t}){let a=Dr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,d=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,l=t?.costAtCompletion,m=t?.currency||"$",g=l!=null?l>=1e6?`${m}${(l/1e6).toFixed(2)}M`:l>=1e3?`${m}${(l/1e3).toFixed(1)}K`:`${m}${l.toFixed(0)}`:"\u2014",x=t?.budgetVariancePercent,b=x!=null&&x!==0,v=x!=null?x>0?`+${x.toFixed(0)}% ${a.toolbar.budgetOver}`:`${x.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=x!=null&&x>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:x!=null&&x<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&d&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:d})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),b&&v&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function vx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:d,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u}){let[l,m]=react.useState(false),g=react.useRef(null),x=react.useRef(null),b=Dr(),v=Js(g,l,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!l)return;let y=k=>{let C=k.target;g.current&&!g.current.contains(C)&&x.current&&!x.current.contains(C)&&m(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]);let h=[{key:"criticalPath",label:b.toolbar.visibility==="Visibilidad"?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a},{key:"baselines",label:b.toolbar.visibility==="Visibilidad"?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:b.toolbar.visibility==="Visibilidad"?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:b.toolbar.visibility==="Visibilidad"?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:d,onChange:c}],w=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:g,onClick:()=>m(!l),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:l?e.accent:e.textTertiary,backgroundColor:l?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,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:"fixed w-52 rounded-xl overflow-hidden",style:{top:v.top,left:v.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${f?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:f?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:h.map((y,k)=>{let C=y.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>y.onChange?.(!y.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:y.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:y.label}),y.active&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),w.map((y,k)=>{let C=i===y.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(y.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(h.length+k)*.03},children:[jsxRuntime.jsx("span",{style:{color:C?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:y.label}),C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.value)})]})]})}),document.body)]})}function Qs({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:l,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:x,hideCompleted:b=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:h,onWbsLevelChange:w,maxWbsDepth:y=4,viewMode:k="execution",onViewModeChange:C,projectForecast:E,onExportPNG:T,onExportPDF:I,onExportExcel:O,onExportCSV:F,onExportJSON:$,onExportMSProject:z,showCriticalPath:de=true,onShowCriticalPathChange:A,showDependencies:J=true,onShowDependenciesChange:xe,highlightWeekends:Ge=true,onHighlightWeekendsChange:M,showBaseline:G=false,onShowBaselineChange:ae,onCopySnapshotLink:we}){let H=Dr(),X=T||I||O||F||$||z,Z=!!e.glassToolbar,[ge,Le]=react.useState(false),Oe=react.useRef(null);react.useEffect(()=>{ge&&Oe.current&&Oe.current.focus();},[ge]);let rt=[{value:"day",label:H.toolbar.day},{value:"week",label:H.toolbar.week},{value:"month",label:H.toolbar.month}],at=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],re=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Z){let it=re?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs(framerMotion.motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:re?"#1A1A1A":e.bgSecondary,border:`1px solid ${re?"rgba(255,255,255,0.08)":e.border}`},animate:{width:ge?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Le(!ge),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),ge&&jsxRuntime.jsx("input",{ref:Oe,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Le(false),onKeyDown:Ie=>{Ie.key==="Escape"&&Le(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:it}}),C&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:re?"#000000":e.bgSecondary,border:`1px solid ${re?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>C("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="execution"?re?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:k==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="execution"?{color:e.textSecondary}:{},children:H.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="oracle"?re?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:k==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="oracle"?{color:e.textSecondary}:{},children:H.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(yx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:it}}),w&&jsxRuntime.jsx(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsxRuntime.jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:it}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:it}}),jsxRuntime.jsx(vx,{theme:e,showCriticalPath:de,onShowCriticalPathChange:A,showBaseline:G,onShowBaselineChange:ae,highlightWeekends:Ge,onHighlightWeekendsChange:M,showDependencies:J,onShowDependenciesChange:xe,rowDensity:d,onRowDensityChange:c}),jsxRuntime.jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:I,onExportExcel:O,onExportMSProject:z,onCopySnapshotLink:we}),u&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${re?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${re?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||H.toolbar.createTask})]})]})]}),E&&jsxRuntime.jsx(xx,{theme:e,forecast:E})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(hx,{options:rt,value:t,onChange:it=>a(it),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsxRuntime.jsx(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||H.toolbar.createTask})]}),(X||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:I,onExportExcel:O,onExportMSProject:z,onCopySnapshotLink:we}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(bx,{options:at,value:s,onChange:it=>n(it),theme:e})]})]})}function Zs({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),d=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Lt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function un({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[d,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,l=r.length*36+8,m=8,g=window.innerWidth,x=window.innerHeight,b=t,v=a;t+u+m>g&&(b=t-u,b<m&&(b=m)),a+l+m>x&&(v=x-l-m,v<m&&(v=m)),c({x:b,y:v});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=m=>{n.current&&!n.current.contains(m.target)&&o();},l=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:l=>{u.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var _t={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Op({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:m=true}){let g=react.useRef(false),x=react.useCallback(w=>{g.current=w;},[]),b=react.useCallback(w=>{let y=[],k=C=>{for(let E of C)y.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&k(E.subtasks);};return k(w),y},[]),v=react.useCallback(()=>{let w=b(e);for(let y of w)if(t.has(y.id))return y;return null},[e,t,b]),f=react.useCallback((w,y)=>{let k=b(e);if(k.length===0)return;let C=v();if(!C){a(k[0].id,false);return}let E=k.findIndex(O=>O.id===C.id);if(E===-1)return;let T=w==="up"?E-1:E+1;if(T<0||T>=k.length)return;let I=k[T];a(I.id,y);},[e,v,b,a]),h=react.useCallback(w=>{if(!m)return;let y=w.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||g.current){w.key==="Escape"&&(y.blur(),g.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,T=Array.from(t),I=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(I&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!I.isExpanded||w.key==="ArrowLeft"&&I.isExpanded)&&u(I.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){T.length>0&&(w.preventDefault(),n(T,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){T.length>0&&(w.preventDefault(),d(T));return}if(w.key==="Tab"&&w.shiftKey){T.length>0&&(w.preventDefault(),c(T));return}if(w.key==="Enter"&&!w.shiftKey&&!E){I&&(w.preventDefault(),r(I.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!E){I&&(w.preventDefault(),r(I.id,"above"));return}if(w.key==="Enter"&&E){I&&(w.preventDefault(),l(I.id));return}if(w.key==="F2"){I&&(w.preventDefault(),i(I.id));return}if(w.key==="Delete"||w.key==="Backspace"&&E){T.length>0&&(w.preventDefault(),o(T));return}if(w.key==="d"&&E&&!w.shiftKey){T.length>0&&(w.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,d,c,i,u,l]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[m,h]),{setIsEditing:x}}function Hp(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(m=>{let g=new Set(m);return g.has(l)?g.delete(l):g.add(l),g}),r(l);},[]),n=react.useCallback((l,m)=>{if(!a){o(l);return}let g=m.indexOf(a),x=m.indexOf(l);if(g===-1||x===-1){o(l);return}let b=Math.min(g,x),v=Math.max(g,x),f=m.slice(b,v+1);t(new Set(f)),r(l);},[a,o]),d=react.useCallback((l,m,g,x)=>{x?n(l,m):g?s(l):o(l);},[o,s,n]),c=react.useCallback((l,m)=>{m?t(g=>{let x=new Set(g);return x.add(l),x}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function rd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?rd(t.subtasks):t.subtasks}))}function pn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((d,c)=>(d.position??0)-(c.position??0));for(let d=0;d<n.length;d++){let c={...n[d],parentId:o,level:s,position:n[d].position??d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function ei(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ei(a.subtasks,t);if(r)return r}}return null}function ad(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ad(a.subtasks,t);if(r)return r}return null}function od(e,t){if(t.length===0)return e;let a=pn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let x=[];return {tasks:m.filter(v=>{if(g.has(v.id))return x.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,x.push(...f.removed);}return true}),removed:x}},d=(m,g,x)=>m.map(b=>b.id===g?{...b,subtasks:[...b.subtasks||[],...x],isExpanded:true}:b.subtasks?{...b,subtasks:d(b.subtasks,g,x)}:b),c=new Set(t),{tasks:i,removed:u}=n(e,c),l=d(i,s.id,u);return rd(l)}function nd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ad(a,r);if(!o)continue;let s=ad(a,o.id),n=(i,u,l)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===u&&g.subtasks){let x=g.subtasks.findIndex(b=>b.id===l);if(x!==-1){let[b]=g.subtasks.splice(x,1);return b}}if(g.subtasks){let x=n(g.subtasks,u,l);if(x)return x}}return null},d=(i,u,l)=>{let m=i.findIndex(g=>g.id===u);if(m!==-1)return i.splice(m+1,0,l),i;for(let g of i)g.subtasks&&d(g.subtasks,u,l);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?d(s.subtasks,o.id,c):d(a,o.id,c));}return rd(a)}function sd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,c)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],n[i]={...n[i],position:i},n[u]={...n[u],position:u},true)};return s(r,o,a),r}function id(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 Vn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((u,l)=>({...u,id:`${u.id}-copy-${Date.now()}-${l}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${l}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let x=n(g.subtasks);if(x)return x}return null}let u=c[i],l=`${u.id}-copy-${Date.now()}`,m={...u,id:l,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,l):void 0};return c.splice(i+1,0,m),m},d=n(a);d&&r.push(d);}return {tasks:a,duplicatedTasks:r}}function zp(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:"#2E94FF"},d=c=>{let i=c.findIndex(l=>l.id===t);if(i===-1){for(let l of c)if(l.subtasks&&d(l.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,n),true};return d(r),{tasks:r,newTask:n}}function ld(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ld(r.subtasks,t,a)}:r)}function dd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:dd(a.subtasks,t)}:a)}function cd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let x=a(g.subtasks);if(x)return x}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let x=c(g.subtasks);if(x>=0)return x}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#2E94FF",position:i,parentId:t},l=m=>m.map(g=>{if(g.id===t){let x=g.subtasks||[];return {...g,subtasks:[...x,u],isExpanded:true}}return g.subtasks?{...g,subtasks:l(g.subtasks)}:g});return {tasks:l(e),newTask:u}}function Up(e,t,a,r){if(t===a)return e;let o=ei(e,t);if(!o)return e;if(a){let d=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||d(u,i))return true;return false};if(d(o,a))return e}let s=d=>{let c=d.filter(u=>u.id!==t),i=c.length<d.length;return c.map((u,l)=>{let m=i?{...u,position:l}:u;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let d=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],l=r!==void 0?r:u.length,m=[...u];m.splice(l,0,{...o,parentId:a});let g=m.map((x,b)=>({...x,position:b}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function br(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=br(t.subtasks),r=a.reduce((d,c)=>(c.startDate&&d.starts.push(new Date(c.startDate).getTime()),c.endDate&&d.ends.push(new Date(c.endDate).getTime()),d.progresses.push(c.progress??0),d),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((d,c)=>d+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ai({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:m,onTaskUpdate:g,onTaskIndent:x,onTaskOutdent:b,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:h,onTaskCreate:w,onTaskRename:y,onCreateSubtask:k,onOpenTaskModal:C,onDeleteRequest:E,onTaskReparent:T,scrollContainerRef:I}){let O=react.useContext(ln),[F,$]=react.useState(null),[z,de]=react.useState(null),[A,J]=react.useState(""),xe=react.useRef(null),[Ge,M]=react.useState(null),[G,ae]=react.useState(0),[we,H]=react.useState(0),[X,Z]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ge,Le]=react.useState(null),[Oe,rt]=react.useState(null),[at,re]=react.useState(null),it=react.useRef(0),Ie=5,bt=react.useRef(false),[pt,ct]=react.useState(null),[Ce,_e]=react.useState(false),tt=react.useRef(null),[Ke,U]=react.useState(null),[ne,S]=react.useState(false),q=react.useRef(null);react.useEffect(()=>{function Y(he){q.current&&!q.current.contains(he.target)&&S(false);}if(ne)return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[ne]),react.useEffect(()=>{z&&xe.current&&(xe.current.focus(),xe.current.select());},[z]),react.useEffect(()=>{if(!Ge)return;let Y=N=>{let D=N.clientX-G,B=we+D;m?.(Ge,B);},he=()=>{M(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",he),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",he),document.body.style.cursor="",document.body.style.userSelect="";}},[Ge,G,we,m]);let{selectedTaskIds:le,handleTaskClick:fe,isTaskSelected:_}=Hp(),{setIsEditing:Q}=Op({tasks:e,selectedTaskIds:le,onTaskSelect:(Y,he)=>{let D=pn(e).map(B=>B.id);fe(Y,D,he||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:Y=>{let he=pn(e).find(N=>N.id===Y);he&&st(he);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:Y=>{let he=pn(e).find(N=>N.id===Y);he&&C&&C(he);},enableKeyboard:true}),$e=(Y,he=0,N="")=>{let D=[],B=[...Y].sort((j,se)=>(j.position??0)-(se.position??0));for(let j=0;j<B.length;j++){let se=B[j],pe=j+1,te=N?`${N}.${pe}`:`${pe}.0`;if(se.wbsCode=te,D.push({task:se,level:he}),se.subtasks&&se.subtasks.length>0&&se.isExpanded){let me=N?`${N}.${pe}`:`${pe}`;D.push(...$e(se.subtasks,he+1,me));}}return D},ke=$e(e),Be=48,De=Math.max(ke.length*a,600-Be),He=Y=>!Y.startDate||!Y.endDate?"-":`${Math.ceil((Y.endDate.getTime()-Y.startDate.getTime())/(1e3*60*60*24))}d`,st=Y=>{de(Y.id),J(Y.name),Q(true);},ot=Y=>{A.trim()&&A!==e.find(he=>he.id===Y)?.name&&y?.(Y,A.trim()),de(null),J(""),Q(false);},nt=()=>{de(null),J(""),Q(false);},mt=(Y,he)=>{he.stopPropagation(),k?.(Y.id);},Bt=(Y,he)=>{he.preventDefault(),it.current=he.clientY,Le(Y),bt.current=false,_e(false),ct({x:he.clientX,y:he.clientY});},Tt=Y=>{if(!ge||(Math.abs(Y.clientY-it.current)>Ie&&!bt.current&&(bt.current=true,_e(true)),ct({x:Y.clientX,y:Y.clientY}),!bt.current))return;if(I?.current){let j=I.current,se=j.getBoundingClientRect(),pe=60,te=12;tt.current&&(cancelAnimationFrame(tt.current),tt.current=null);let me=Y.clientY-se.top,Ye=se.bottom-Y.clientY;if(me<pe&&j.scrollTop>0){let qe=Math.round(te*(1-me/pe)),At=()=>{j.scrollTop-=qe,bt.current&&j.scrollTop>0&&(tt.current=requestAnimationFrame(At));};tt.current=requestAnimationFrame(At);}else if(Ye<pe&&j.scrollTop<j.scrollHeight-j.clientHeight){let qe=Math.round(te*(1-Ye/pe)),At=()=>{j.scrollTop+=qe,bt.current&&j.scrollTop<j.scrollHeight-j.clientHeight&&(tt.current=requestAnimationFrame(At));};tt.current=requestAnimationFrame(At);}}let N=document.querySelectorAll("[data-task-row]"),D=null,B=null;N.forEach(j=>{let se=j.getBoundingClientRect(),pe=j.getAttribute("data-task-row");if(pe&&pe!==ge&&Y.clientY>=se.top&&Y.clientY<=se.bottom){D=pe;let te=Y.clientY-se.top,me=se.height;te<me*.25?B="above":te>me*.75?B="below":B="child";}}),rt(D),re(B);},lt=()=>{if(bt.current&&ge&&Oe&&at){if(at==="child")T?.(ge,Oe);else if(at==="above"||at==="below"){let Y=(B,j,se=null)=>{for(let pe of B){if(pe.id===j)return se;if(pe.subtasks){let te=Y(pe.subtasks,j,pe.id);if(te!==void 0)return te}}},he=Y(e,ge,null),N=Y(e,Oe,null),D=(B,j,se,pe)=>{let te=B.findIndex(qe=>qe.id===j),me=pe?B.findIndex(qe=>qe.id===se):-1,Ye=at==="below"?te+1:te;return pe&&me!==-1&&me<te&&(Ye-=1),Math.max(0,Ye)};if(N===null){let j=D(e,Oe,ge,he===null);T?.(ge,null,j);}else {let B=ke.find(j=>j.task.id===N)?.task;if(B?.subtasks){let j=he===N,se=D(B.subtasks,Oe,ge,j);T?.(ge,N,se);}}}}tt.current&&(cancelAnimationFrame(tt.current),tt.current=null),Le(null),rt(null),re(null),ct(null),bt.current=false,_e(false);};react.useEffect(()=>{if(ge)return document.addEventListener("mousemove",Tt),document.addEventListener("mouseup",lt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Tt),document.removeEventListener("mouseup",lt),document.body.style.cursor="",document.body.style.userSelect="";}},[ge,Oe,at]);let ut=(Y,he,N)=>{let D=he.subtasks&&he.subtasks.length>0;switch(Y.id){case "name":let B=z===he.id,j=F===he.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${N*20}px`},children:[T&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:j?1:.3},onMouseDown:Me=>Bt(he.id,Me),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),he.subtasks&&he.subtasks.length>0?jsxRuntime.jsx("button",{onClick:Me=>{Me.stopPropagation(),c?.(he.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:he.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),B?jsxRuntime.jsx("input",{ref:xe,type:"text",value:A,onChange:Me=>J(Me.target.value),onKeyDown:Me=>{Me.key==="Enter"?ot(he.id):Me.key==="Escape"&&nt();},onBlur:()=>ot(he.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:Me=>Me.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:he.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:he.parentId?"13px":"14px",fontWeight:he.isMilestone?600:he.parentId?400:600,letterSpacing:he.parentId?"0":"-0.01em"},title:he.name,children:[he.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:he.wbsCode}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:he.name})]}),j&&!B&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Me=>Me.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:Me=>mt(he,Me),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:Me=>{Me.stopPropagation(),st(he);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let pe=Y.id==="startDate"?"startDate":"endDate",te=he[pe],me=Ke?.taskId===he.id&&Ke?.field===pe,Ye=Me=>Me?(typeof Me=="string"?new Date(Me):Me).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Me=>Me.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:D?.5:1,cursor:D?"default":"pointer"},title:D?"Auto-calculated from subtasks":void 0,onClick:Me=>{if(!D)if(me)U(null);else {let W=Me.currentTarget.getBoundingClientRect();U({taskId:he.id,field:pe,month:te?typeof te=="string"?new Date(te):te:new Date,position:{top:W.bottom+4,left:W.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Ye(te)}),D&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),me&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>U(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:Ke?.position.top,left:Ke?.position.left},onClick:Me=>Me.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Me=new Date,W=new Date(Me);W.setDate(Me.getDate()+1);let ve=new Date(Me);ve.setDate(Me.getDate()+7);let $t=new Date(Me);return $t.setDate(Me.getDate()+14),[{label:"Hoy",date:Me},{label:"Ma\xF1ana",date:W},{label:"Pr\xF3xima semana",date:ve},{label:"2 semanas",date:$t}].map((ce,Re)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:je=>je.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:je=>je.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(he.id,{[pe]:ce.date}),U(null);},children:ce.label},Re))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:Me=>Me.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Me=>Me.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(he.id,{[pe]:void 0}),U(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>U(Me=>Me?{...Me,month:new Date(Me.month.getFullYear(),Me.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Ke?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>U(Me=>Me?{...Me,month:new Date(Me.month.getFullYear(),Me.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((Me,W)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Me},W))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Me=Ke?.month||new Date,W=Me.getFullYear(),ve=Me.getMonth(),$t=new Date(W,ve,1).getDay(),L=new Date(W,ve+1,0).getDate(),ce=new Date,Re=[];for(let ht=$t-1;ht>=0;ht--)Re.push({day:new Date(W,ve,-ht).getDate(),date:new Date(W,ve-1,new Date(W,ve,-ht).getDate()),isCurrentMonth:false});for(let ht=1;ht<=L;ht++)Re.push({day:ht,date:new Date(W,ve,ht),isCurrentMonth:true});let je=42-Re.length;for(let ht=1;ht<=je;ht++)Re.push({day:ht,date:new Date(W,ve+1,ht),isCurrentMonth:false});return Re.map((ht,Ua)=>{let aa=ht.date.toDateString()===ce.toDateString(),ia=(te?typeof te=="string"?new Date(te):te:null)?.toDateString()===ht.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:ht.isCurrentMonth?ia?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ia?"#2E94FF":"transparent",boxShadow:aa&&!ia?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(he.id,{[pe]:ht.date}),U(null);},children:ht.day},Ua)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:He(he)})});case "assignees":if(D)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let qe=r.filter(Me=>he.assignees?.some(W=>W.name===Me.name||W.initials===Me.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Me=>Me.stopPropagation(),children:jsxRuntime.jsx(Do,{assignedUsers:qe,availableUsers:r,onChange:Me=>{let W=Me.map(ve=>({id:ve.id,name:ve.name,initials:ve.initials,color:ve.color}));g?.(he.id,{assignees:W.length>0?W:void 0});}})});case "status":if(D){let Me=he.progress===100?"\u2713":he.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:Me})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Me=>Me.stopPropagation(),children:jsxRuntime.jsx(mu,{status:he.status||"todo",onChange:Me=>{g?.(he.id,{status:Me,progress:Me==="completed"?100:he.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:D?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${he.progress}%`,backgroundColor:he.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[he.progress,"%"]})]});case "priority":let At={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Wt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},sa=At[he.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Me=>Me.stopPropagation(),children:jsxRuntime.jsx(To,{priority:sa,onChange:Me=>{Me&&g?.(he.id,{priority:Wt[Me]||"medium"});}})});default:return null}},Et=Y=>[{id:"hide",label:"Hide Column",icon:_t.Hide,onClick:()=>l(Y),disabled:Y==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:_t.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:_t.SortDesc,onClick:()=>{}}],Nt=Y=>Y.subtasks&&Y.subtasks.length>0?[{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{k?.(Y.id);}},{id:"duplicate",label:O?.contextMenu?.duplicateTask||"Duplicate Task",icon:_t.Duplicate,onClick:()=>{h?.([Y.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{E?E(Y.id,Y.name):f?.([Y.id]);}}]:[{id:"edit",label:O?.contextMenu?.editTask||"Edit Task",icon:_t.Pencil,onClick:()=>{n?.(Y);}},{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{k?.(Y.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:O?.contextMenu?.markIncomplete||"Mark Incomplete",icon:_t.MarkIncomplete,onClick:()=>{g?.(Y.id,{status:"todo",progress:0});},disabled:Y.status==="todo"},{id:"setInProgress",label:O?.contextMenu?.setInProgress||"Set In Progress",icon:_t.SetInProgress,onClick:()=>{g?.(Y.id,{status:"in-progress"});},disabled:Y.status==="in-progress"},{id:"markComplete",label:O?.contextMenu?.markComplete||"Mark Complete",icon:_t.MarkComplete,onClick:()=>{g?.(Y.id,{status:"completed",progress:100});},disabled:Y.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:O?.contextMenu?.duplicateTask||"Duplicate Task",icon:_t.Duplicate,onClick:()=>{h?.([Y.id]);}},{id:"split",label:O?.contextMenu?.splitTask||"Split Task",icon:_t.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{E?E(Y.id,Y.name):f?.([Y.id]);}}],Fe=u.filter(Y=>Y.visible),ze=Fe.reduce((Y,he)=>Y+he.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ze},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Be}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Fe.map((Y,he)=>{let N=he===Fe.length-1,D=Y.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${D?"":"justify-center"}`,style:{width:`${Y.width}px`,minWidth:`${Y.minWidth??(D?200:60)}px`,maxWidth:`${Y.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:N?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:B=>{B.preventDefault(),Z({isOpen:true,x:B.clientX,y:B.clientY,type:"header",columnId:Y.id});},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:Y.label,children:Y.label}),Y.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Ge===Y.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:B=>{B.preventDefault(),B.stopPropagation(),M(Y.id),ae(B.clientX),H(Y.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},Y.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsxRuntime.jsx(Zs,{columns:u,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>S(!ne),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),ne&&jsxRuntime.jsxs("div",{ref:q,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:Y=>Y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>S(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:De},children:ke.map(({task:Y,level:he},N)=>{let D=_(Y.id),B=Oe===Y.id,j=B&&at==="above",se=B&&at==="below",pe=B&&at==="child",te={};return pe&&(te.backgroundColor=`${t.accent}15`,te.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":Y.id,className:`flex items-center cursor-pointer group ${ge===Y.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:D?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:D?t.accentLight:pe?`${t.accent}15`:N%2===0?t.bgPrimary:t.bgGrid,...te},onMouseEnter:()=>$(Y.id),onMouseLeave:()=>$(null),onClick:me=>{let qe=pn(e).map(sa=>sa.id),Wt=navigator.platform.toUpperCase().indexOf("MAC")>=0?me.metaKey:me.ctrlKey;fe(Y.id,qe,Wt,me.shiftKey),s?.(Y);},onDoubleClick:me=>{me.stopPropagation(),n?.(Y);},onContextMenu:me=>{me.preventDefault(),Z({isOpen:true,x:me.clientX,y:me.clientY,type:"task",task:Y}),d?.(Y,me);},whileHover:{backgroundColor:D?t.accentLight:t.hoverBg},children:[j&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),se&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Fe.map((me,Ye)=>{let qe=Ye===Fe.length-1,At=me.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${At?"justify-start":"justify-center"}`,style:{width:`${me.width}px`,minWidth:`${me.minWidth??(At?200:60)}px`,maxWidth:`${me.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:qe?"none":`1px solid ${F===Y.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ut(me,Y,At?he:0)},`${Y.id}-${me.id}`)})]},Y.id)})}),jsxRuntime.jsx(un,{isOpen:X.isOpen,x:X.x,y:X.y,items:X.type==="header"&&X.columnId?Et(X.columnId):X.type==="task"&&X.task?Nt(X.task):[],onClose:()=>Z({...X,isOpen:false}),theme:t}),Ce&&pt&&ge&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:pt.x+12,top:pt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Y=ke.find(he=>he.task.id===ge)?.task;return Y?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:Y.name})}):null})()}),document.body)]})}function jp(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,d]=react.useState(e),[c,i]=react.useState(t),[u,l]=react.useState(null),[m,g]=react.useState(null),[x,b]=react.useState(null),[v,f]=react.useState(null),[h,w]=react.useState(0),[y,k]=react.useState(0),[C,E]=react.useState(null),[T,I]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:m,setHoveredTaskId:g,activeZone:x,setActiveZone:b,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:h,setDraggedSegmentStartX:w,segmentDragOffsetX:y,setSegmentDragOffsetX:k,hoveredSegmentIndex:C,setHoveredSegmentIndex:E,isHovered:T,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(de,A)=>{r("none"),l(null),g(null),d(de),i(A),k(0),f(null),w(0);}}}function ni({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:x,onHoverChange:b,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:h=true,readOnly:w=false}){let y=jp(t,r),k=react.useRef(null),C=react.useRef(false),E=react.useRef(null),T=react.useRef(null),{dragMode:I,setDragMode:O,dragOffset:F,setDragOffset:$,ghostX:z,setGhostX:de,ghostWidth:A,setGhostWidth:J,connectionLine:xe,setConnectionLine:Ge,hoveredTaskId:M,setHoveredTaskId:G,activeZone:ae,setActiveZone:we,draggedSegmentIndex:H,setDraggedSegmentIndex:X,draggedSegmentStartX:Z,setDraggedSegmentStartX:ge,segmentDragOffsetX:Le,setSegmentDragOffsetX:Oe,hoveredSegmentIndex:rt,setHoveredSegmentIndex:at,isHovered:re,setIsHovered:it,isDragging:Ie,isResizing:bt,isConnecting:pt,resetDragState:ct}=y,Ce=18,_e=!!o.executionBarBg,tt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Ke=_e?3:6,U=e.subtasks&&e.subtasks.length>0,ne=e.endDate&&(()=>{let N=new Date;N.setHours(0,0,0,0);let D=new Date(e.endDate);return D.setHours(0,0,0,0),D<N})()&&e.progress<100,S=h&&e.isCriticalPath,q=o.name==="neutral"||o.today==="#1C1917",le=e.status==="completed"||e.progress===100,fe={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Q=h&&e.isCriticalPath||ne?"#EF4444":e.color?e.color:e.priority&&fe[e.priority]?fe[e.priority]:o.taskBarPrimary,$e=w?"default":Ie?pt?"crosshair":bt?"ew-resize":"grabbing":"grab",ke=w?"default":"ew-resize",De=(N=>N>=80?20:N>=60?15:N>=50?12:10)(r),He=r<50,st=r<40;react.useEffect(()=>{b&&(!re||Ie||e.segments)&&b(null);},[re,Ie,e.segments,b]);let ot=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let N=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${N} day${N!==1?"s":""}`},mt=N=>Math.round(N/s)*s,Bt=N=>{let D=Math.round(N/s),B=new Date(n);return B.setDate(B.getDate()+D),B},Tt=(N,D)=>{for(let B of g){if(B.id===e.id)continue;let j=5;if(N>=B.x-j&&N<=B.x+B.width+j&&D>=B.y-j&&D<=B.y+B.height+j)return B.id}return null},lt=react.useCallback((N,D,B)=>{if(w)return;N.preventDefault(),N.stopPropagation();let j=k.current?.ownerSVGElement;if(!j)return;let se=j.createSVGPoint();se.x=N.clientX,se.y=N.clientY;let pe=se.matrixTransform(j.getScreenCTM()?.inverse()),te=B!==void 0?B:t,me=D;if(!me){let Ye=pe.x-te;N.shiftKey?(me="connect",Ge({x:t+r,y:a+Ce/2})):N.ctrlKey||N.metaKey?me="move":N.altKey?me=Ye<r/2?"resize-start":"resize-end":st?Ye<r/2?me="move":me="resize-end":He?Ye<=De/2?me="resize-start":Ye>=r-De/2?me="resize-end":me="move":Ye<=De?me="resize-start":Ye>=r-De?me="resize-end":me="move";}C.current=false,O(me),it(false),we(null),me==="move"?$(pe.x-te):me==="connect"?Ge({x:t+r,y:a+Ce/2}):$(0),de(te),J(r);},[t,r,a,Ce,w]),ut=react.useCallback(N=>{let D=k.current?.ownerSVGElement;if(!D)return;let B=D.closest(".gantt-timeline-scroll");if(!B)return;let j=B.getBoundingClientRect(),se=60,pe=15,te=0;if(N.clientX<j.left+se){let me=j.left+se-N.clientX;te=-Math.min(pe,me/2);}else if(N.clientX>j.right-se){let me=N.clientX-(j.right-se);te=Math.min(pe,me/2);}return te!==0&&(B.scrollLeft+=te),te!==0},[]),Et=react.useCallback(N=>{if(I==="none")return;C.current=true,T.current=N;let D=k.current?.ownerSVGElement;if(!D)return;if(I==="move"||I==="resize-start"||I==="resize-end"){let se=ut(N);se&&!E.current?E.current=window.setInterval(()=>{T.current&&(ut(T.current),Et(T.current));},16):!se&&E.current&&(window.clearInterval(E.current),E.current=null);}let B=D.createSVGPoint();B.x=N.clientX,B.y=N.clientY;let j=B.matrixTransform(D.getScreenCTM()?.inverse());if(I==="connect"){Ge({x:j.x,y:j.y});let se=Tt(j.x,j.y);G(se);}else if(I==="move"){let se=j.x-F,pe=mt(se);de(pe),J(r);let te=Math.round((pe-t)/s);if(x?.(e.id,te,true),e.segments&&e.segments.length>0&&H!==null){let me=pe-Z;Oe(me);}}else if(I==="resize-start"){let se=j.x,pe=mt(se),te=t+r-pe;te>=s&&(de(pe),J(te));}else if(I==="resize-end"){let se=j.x,te=mt(se)-t;te>=s&&J(te);}},[I,t,r,s,F,e,mt,H,Z,Tt,G,Ge,de,J,Oe,x,ut]),Nt=react.useCallback(()=>{if(E.current&&(window.clearInterval(E.current),E.current=null),T.current=null,I!=="none"){if(I==="connect")M&&m&&m(e,M),Ge(null),G(null);else {let N=e.endDate.getTime()-e.startDate.getTime(),D,B,j=true;if(I==="move"){if(D=Bt(z),B=new Date(D.getTime()+N),e.segments&&e.segments.length>0&&H!==null){let se=Math.round(Le/s),pe=e.segments.map((qe,At)=>{if(At===H){let Wt=new Date(qe.startDate),sa=new Date(qe.endDate);return Wt.setDate(Wt.getDate()+se),sa.setDate(sa.getDate()+se),{startDate:Wt,endDate:sa}}return qe}),te=pe.flatMap(qe=>[qe.startDate,qe.endDate]),me=new Date(Math.min(...te.map(qe=>qe.getTime()))),Ye=new Date(Math.max(...te.map(qe=>qe.getTime())));l?.({...e,segments:pe},me,Ye),ct(t,r);return}}else I==="resize-start"?(D=Bt(z),B=e.endDate,D>B&&(console.warn("Invalid date range: start date must be before or equal to end date"),j=false)):I==="resize-end"?(D=e.startDate,B=Bt(z+A),B.setDate(B.getDate()-1),B<D&&(console.warn("Invalid date range: end date must be after or equal to start date"),j=false)):j=false;j&&D&&B&&(B.getTime()<D.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,D,B));}x?.(e.id,0,false),ct(t,r);}},[I,z,A,e,l,M,m,t,r,s,Bt,Le,H,ct,x]);react.useEffect(()=>{if(I==="none")return;let N=B=>{Et(B);},D=()=>{Nt();};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",D),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",D),E.current&&(window.clearInterval(E.current),E.current=null);}},[I,Et,Nt]);let Fe=Ie&&!pt?z:t,ze=Ie&&!pt?A:r,Y=d.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,"data-task-bar":"true",onClick:()=>{!Ie&&!C.current&&c?.(e),C.current=false;},onDoubleClick:N=>{!Ie&&!C.current&&(N.stopPropagation(),i?.(e));},onContextMenu:N=>{N.preventDefault(),u?.(e,N);},onMouseEnter:()=>!Ie&&it(true),onMouseMove:N=>{b&&re&&!Ie&&!e.segments&&b({task:e,x:t,y:a,width:r,height:Ce,showBelow:false,mouseX:N.clientX,mouseY:N.clientY});},onMouseLeave:()=>{Ie||(it(false),we(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Ce,fill:"transparent",style:{pointerEvents:"all"}}),re&&!Ie&&!He&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:De,height:Ce,fill:ae==="resize-start"?o.accent:"transparent",opacity:ae==="resize-start"?.15:0,style:{cursor:ke,pointerEvents:"all"},onMouseEnter:()=>we("resize-start"),onMouseDown:N=>lt(N,"resize-start")}),jsxRuntime.jsx("rect",{x:t+De,y:a,width:r-De*2,height:Ce,fill:ae==="move"?o.accent:"transparent",opacity:ae==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>we("move"),onMouseDown:N=>lt(N,"move")}),jsxRuntime.jsx("rect",{x:t+r-De,y:a,width:De,height:Ce,fill:ae==="resize-end"?o.accent:"transparent",opacity:ae==="resize-end"?.15:0,style:{cursor:ke,pointerEvents:"all"},onMouseEnter:()=>we("resize-end"),onMouseDown:N=>lt(N,"resize-end")})]}),re&&!Ie&&st&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ce,fill:ae==="move"?o.accent:"transparent",opacity:ae==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>we("move"),onMouseDown:N=>lt(N,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ce,fill:ae==="resize-end"?o.accent:"transparent",opacity:ae==="resize-end"?.2:0,style:{cursor:ke,pointerEvents:"all"},onMouseEnter:()=>we("resize-end"),onMouseDown:N=>lt(N,"resize-end")}),re&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ce-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ie&&!pt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:z,y:a,width:A,height:Ce,rx:Ke,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!Ie&&(()=>{let N=e.baselineStartDate.getTime(),D=e.baselineEndDate.getTime(),B=n.getTime(),j=864e5,se=(N-B)/j,pe=(D-N)/j,te=se*s,me=Math.max(pe*s,s),Ye=Fe+ze,qe=te+me,At=e.endDate?.getTime()??0,Wt=Math.ceil((At-D)/j),sa=Wt>0,Me=Wt<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:te,y:a,width:me,height:Ce,rx:Ke,fill:"none",stroke:tt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),sa&&Ye>qe&&jsxRuntime.jsx("rect",{x:qe,y:a,width:Ye-qe,height:Ce,rx:0,fill:"#EF4444",opacity:.2}),sa&&jsxRuntime.jsxs("text",{x:Math.max(Ye,qe)+6,y:a+Ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Wt,"d"]}),Me&&jsxRuntime.jsxs("text",{x:Ye+6,y:a+Ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Wt,"d"]})]})})(),!e.segments&&_e&&U&&(()=>{let D=a+(Ce-6)/2,B=14,j=a+(Ce-B)/2,se=2;return jsxRuntime.jsxs("g",{"data-task-class":Y,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Fe,y:D,width:ze,height:6,rx:1,fill:"rgba(255,255,255,0.12)"}),jsxRuntime.jsx("rect",{x:Fe,y:j,width:se,height:B,rx:.5,fill:"rgba(255,255,255,0.45)"}),jsxRuntime.jsx("rect",{x:Fe+ze-se,y:j,width:se,height:B,rx:.5,fill:"rgba(255,255,255,0.45)"})]})})(),!e.segments&&_e&&!U&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe,y:a,width:ze,height:Ce,rx:Ke,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Y,initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!pt?.15:e.parentId?.6:1,scale:re&&!Ie?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:N=>lt(N),style:{cursor:$e,pointerEvents:"all"}}),!e.segments&&!_e&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe,y:a,width:ze,height:Ce,rx:Ke,fill:Q,"data-task-class":Y,initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!pt?.15:e.parentId?.6:re?.9:.8,scale:re&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:U?void 0:N=>lt(N),style:{cursor:U?"default":$e,pointerEvents:"all"}}),_e&&(ne||S)&&!e.segments&&jsxRuntime.jsx("rect",{x:Fe,y:a,width:ze,height:Ce,rx:Ke,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&(_e&&U?null:jsxRuntime.jsx("rect",{x:Fe,y:a,width:Math.max(ze*(e.progress/100),Ke*2),height:Ce,rx:Ke,fill:Q,opacity:1,style:{pointerEvents:"none"}})),!e.segments&&!U&&e.progress<100&&(()=>{let N=e.progress>0?ze*(e.progress/100):0,D=Fe+N,B=ze-N,j=e.progress===0?Ke:0,se=e.progress===0?Fe:D,pe=e.progress===0?ze:B;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:se,y:a,width:pe,height:Ce,rx:j,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:se,y:a,width:pe,height:Ce,rx:j,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),_e&&!e.segments&&e.progress>0&&e.progress<100&&!U&&!Ie&&(()=>{let N=Fe+ze*(e.progress/100),D=8,B=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:N,cy:a+Ce/2,r:D,fill:B?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:N,y:a+Ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:B?.initials||B?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((N,D)=>{let B=(N.startDate.getTime()-n.getTime())/864e5*s,se=(N.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-B+s,pe=Ie&&I==="move"&&H===D,te=rt===D,me=pe?B+Le:B;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Ie&&at(D),onMouseLeave:()=>!Ie&&at(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:me,y:a,width:se,height:Ce,rx:Ke,fill:Q,initial:{opacity:0,scale:.95},animate:{opacity:pe||e.parentId?.6:te?.9:.8,scale:te&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Ye=>{Ye.stopPropagation(),X(D),ge(B),lt(Ye,void 0,B);},style:{cursor:$e,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:me,y:a,width:se*(e.progress/100),height:Ce,rx:Ke,fill:Q,opacity:1,style:{pointerEvents:"none"}})]},`segment-${D}`)}),q&&(ne||S)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[S&&!ne&&jsxRuntime.jsx("rect",{x:Fe,y:a,width:ze,height:Ce,rx:Ke,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ne&&jsxRuntime.jsx("rect",{x:Fe,y:a,width:ze,height:Ce,rx:Ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&ze>60&&!e.segments&&!(_e&&U)&&(()=>{let N=d.taskLabel(e),D=typeof N=="string"?N:e.name,B=D.length>Math.floor(ze/8)?`${D.substring(0,Math.floor(ze/8))}...`:D;return jsxRuntime.jsx("text",{x:Fe+8,y:a+Ce/2,dominantBaseline:"middle",fill:le?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:le?"line-through":"none"},children:B})})(),!Ie&&!e.segments&&!U&&e.progress>0&&e.progress<100&&(_e?jsxRuntime.jsxs("text",{x:Fe+ze+6,y:a+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):ze>100?jsxRuntime.jsxs("text",{x:Fe+ze-12,y:a+Ce/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,"%"]}):null),e.status&&ze>80&&!Ie&&!e.segments&&!(_e&&U)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Fe+ze-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Fe+ze-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(re||bt)&&!pt&&!e.segments&&!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Fe-2,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:ke},onMouseEnter:()=>we("resize-start"),onMouseLeave:()=>we(null),onMouseDown:N=>{N.stopPropagation(),lt(N,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe+4,y:a+8,width:3,height:Ce-16,rx:1.5,fill:ae==="resize-start"||I==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Fe+ze-14,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:ke},onMouseEnter:()=>we("resize-end"),onMouseLeave:()=>we(null),onMouseDown:N=>{N.stopPropagation(),lt(N,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe+ze-7,y:a+8,width:3,height:Ce-16,rx:1.5,fill:ae==="resize-end"||I==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re&&!Ie&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>we("connect"),onMouseLeave:()=>we(null),onMouseDown:N=>{N.stopPropagation(),lt(N,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ce/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ae==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),pt&&xe&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ce/2,x2:xe.x,y2:xe.y,stroke:M?o.statusCompleted:o.accent,strokeWidth:M?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:M?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:xe.x,cy:xe.y,r:M?8:6,fill:M?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),M&&jsxRuntime.jsx(framerMotion.motion.text,{x:xe.x+15,y:xe.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:xe.x+10},animate:{opacity:1,x:xe.x+15},transition:{duration:.2},children:"Connect"})]}),(re||Ie)&&!pt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Fe-1,y:a-1,width:ze+2,height:Ce+2,rx:Ke+1,fill:"none",stroke:Ie?o.accent:_e?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:_e?1:2,opacity:Ie||_e?.6:.4,initial:{opacity:0},animate:{opacity:Ie||_e?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),bt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:z,y1:0,x2:z,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:z+A,y1:0,x2:z+A,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re&&!Ie&&!e.segments&&!b&&(()=>{let B=a<100,j=B?a+Ce+13:a-82-13,se=B?`M ${Fe+ze/2-6} ${a+Ce+3} L ${Fe+ze/2} ${a+Ce+13} L ${Fe+ze/2+6} ${a+Ce+3}`:`M ${Fe+ze/2-6} ${a-13} L ${Fe+ze/2} ${a-3} L ${Fe+ze/2+6} ${a-13}`,pe=j+22,te=j+40,me=j+55,Ye=j+70,qe=B?j+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:B?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:B?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:se,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Fe+ze/2-120,y:j,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Fe+ze/2,y:pe,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Fe+ze/2-110,y:te,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Fe+ze/2-70,y:te,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ot(e.startDate)}),jsxRuntime.jsx("text",{x:Fe+ze/2-110,y:me,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Fe+ze/2-70,y:me,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ot(e.endDate)}),jsxRuntime.jsx("text",{x:Fe+ze/2+10,y:te,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Fe+ze/2+65,y:te,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsxRuntime.jsx("text",{x:Fe+ze/2+10,y:me,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Fe+ze/2+65,y:me,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Fe+ze/2-110,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Fe+ze/2-50,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(At=>At.name).join(", ").substring(0,30),e.assignees.map(At=>At.name).join(", ").length>30?"...":""]})]}),!B&&jsxRuntime.jsx("text",{x:Fe+ze/2,y:qe,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:st?"Left: move \u2022 Right: resize":He?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var ud=260,mn=8,qp=16,iv=-12;function Xp({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:h,mouseX:w,mouseY:y}=e,C=h.effortMinutes!=null||h.timeLoggedMinutes!=null||h.soldEffortMinutes!=null?155:105,E=w+qp,T=y+iv-C;E+ud>window.innerWidth-mn&&(E=w-ud-qp),E<mn&&(E=mn);let I=T<mn;I&&(T=y+20),T+C>window.innerHeight-mn&&(T=window.innerHeight-mn-C),o({left:E,top:T,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,d={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"},c=h=>h.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let h=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${h} d\xEDa${h!==1?"s":""}`:`${h} day${h!==1?"s":""}`},u=h=>{if(h==null||h===0)return "N/A";let w=Math.floor(h/60),y=h%60;return w===0?`${y}m`:y===0?`${w}h`:`${w}h ${y}m`},l=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",x=t.accent||"#3B82F6",b=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:ud,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:b,border:`1px solid ${v}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(si,{label:d.start,value:s.startDate?c(s.startDate):"N/A",labelColor:l,valueColor:m}),jsxRuntime.jsx(si,{label:d.duration,value:i(),labelColor:l,valueColor:m}),jsxRuntime.jsx(si,{label:d.end,value:s.endDate?c(s.endDate):"N/A",labelColor:l,valueColor:m}),jsxRuntime.jsx(si,{label:d.progress,value:`${s.progress}%`,labelColor:l,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:l},children:[d.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(h=>h.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:l},children:[d.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:u(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:l},children:[d.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:x,fontWeight:600},children:u(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:l},children:[d.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:u(s.soldEffortMinutes)})]})]})]}),jsxRuntime.jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -358,14 +358,14 @@
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${c}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(u),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=Pe.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 u=i.startDate&&i.endDate?Pe.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let x=t.find(b=>b.id===g);if(x){o(x);let b=r.get(g)?.ef||0;l=Math.max(l,b);}}let m=l+u;r.set(i.id,{es:l,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,d=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?Pe.calculateDuration(i.startDate,i.endDate):0,l=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),m=s;if(l.length>0)for(let x of l){d(x);let b=n.get(x.id)?.ls||0;m=Math.min(m,b);}let g=m-u;n.set(i.id,{ls:g,lf:m});};a.forEach(d);let c=[];for(let i of a){let u=r.get(i.id),l=n.get(i.id);if(u&&l){let m=l.ls-u.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateSlack:(e,t)=>{let a=Pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Pe.calculateCriticalPath(e).includes(t))return 0;let o=Pe.getDependentTasks(e,t);if(o.length===0){let d=Pe.getLatestEndDate(e);if(!d)return null;let c=Pe.calculateDuration(a.endDate,d);return Math.max(0,c)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,c)=>d-c)[0];if(!s)return null;let n=Pe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Pe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Pe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Pe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let d=Pe.calculateDuration(n.startDate,n.endDate),c;a!==void 0?(c=new Date(n.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let i=Pe.calculateEndDate(c,d),u=l=>l.map(m=>m.id===n.id?{...m,startDate:c,endDate:i}:m.subtasks?{...m,subtasks:u(m.subtasks)}:m);s=u(s),s=Pe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let c=[],i=o.getTime(),u=1e3*60*60*24,l=Pe.findTaskById(e,t);if(!l||!l.endDate)return [];let m=(g,x,b=new Set)=>{if(b.has(g))return;b.add(g);let v=Pe.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let h=r.findIndex(F=>F.id===f.id);if(h===-1)continue;let w=f.startDate.getTime(),k=(f.endDate.getTime()-w)/u,E=(w-i)/u*s,T=E+x*s,I=Math.max(k*s,s),O=d+h*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:E,previewX:T,width:I,y:O,rowIndex:h,daysDelta:x,color:f.color}),m(f.id,x,b);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Pe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],i=u=>u.map(l=>l.id===o.id?{...l,endDate:d,segments:c}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function pi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:l,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:x,onDependencyCreate:b,onDependencyDelete:v,showBaseline:f,showCriticalPath:h=true,showDependencies:w=true,highlightWeekends:y=true,canEditTask:k}){let E=Dr(),T=react.useRef(null),[I,O]=react.useState([]),[F,$]=react.useState(null),[z,de]=react.useState(null),[A,J]=react.useState(null),xe=react.useRef(false),[Ge,M]=react.useState(new Set),[G,ae]=react.useState(null),we=react.useCallback(U=>{if(A&&!xe.current){let ne=U.target,S=false;for(;ne&&ne!==U.currentTarget;){if(ne.getAttribute?.("data-dependency-line")==="true"||ne.getAttribute?.("data-dependency-hover-overlay")==="true"){S=true;break}ne=ne.parentElement;}S||J(null);}},[A]),H=react.useCallback(U=>{de(U);},[]),X=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),Z=r==="day"?60:r==="week"?20:8,ge=X*Z*n,Le=U=>{let ne=new Date(Date.UTC(U.getFullYear(),U.getMonth(),U.getDate())),S=ne.getUTCDay()||7;ne.setUTCDate(ne.getUTCDate()+4-S);let q=new Date(Date.UTC(ne.getUTCFullYear(),0,1));return Math.ceil(((ne.getTime()-q.getTime())/864e5+1)/7)},Oe=U=>{let ne=U.getDay();return ne===0||ne===6},rt=react.useCallback(U=>{let ne=Math.round(U/(Z*n)),S=new Date(o);return S.setDate(S.getDate()+ne),S},[o,Z,n]),at=react.useCallback((U,ne)=>{if(ne.startDate&&ne.endDate)return;let S=U.currentTarget.ownerSVGElement;if(!S)return;let q=S.createSVGPoint();q.x=U.clientX,q.y=U.clientY;let le=q.matrixTransform(S.getScreenCTM()?.inverse()),fe=rt(le.x),_=new Date(fe);_.setDate(_.getDate()+1),ae(null),x?.(ne,fe,_);},[rt,x]),re=react.useCallback((U,ne,S)=>{let q=U.currentTarget.ownerSVGElement;if(!q)return;let le=q.createSVGPoint();le.x=U.clientX,le.y=U.clientY;let fe=le.matrixTransform(q.getScreenCTM()?.inverse()),_=rt(fe.x),$e=Math.round(fe.x/(Z*n))*Z*n;ae({taskId:ne.id,x:$e,y:S*a+a/2,date:_});},[rt,Z,n,a]),it=react.useCallback(()=>{ae(null);},[]),Ie=react.useMemo(()=>{let U=le=>le.map(fe=>{if(fe.subtasks&&fe.subtasks.length>0){let _=U(fe.subtasks),Q=_.filter($e=>$e.startDate&&$e.endDate);if(Q.length>0){let $e=Q.map(He=>He.startDate.getTime()),ke=Q.map(He=>He.endDate.getTime()),Be=new Date(Math.min(...$e)),De=new Date(Math.max(...ke));return {...fe,subtasks:_,startDate:Be,endDate:De}}return {...fe,subtasks:_}}return fe}),ne=(le,fe=[])=>{let _=[...le].sort((Q,$e)=>(Q.position??0)-($e.position??0));for(let Q of _)fe.push(Q),Q.subtasks&&Q.subtasks.length>0&&(Q.isExpanded===void 0||Q.isExpanded)&&ne(Q.subtasks,fe);return fe},S=U(e);return ne(S)},[e]),bt=react.useCallback(U=>{if(!U.startDate||!U.endDate)return {x:0,width:0};let ne=U.startDate.getTime(),S=U.endDate.getTime(),q=o.getTime(),le=(ne-q)/(1e3*60*60*24),fe=(S-ne)/(1e3*60*60*24)+1,_=le*Z*n,Q=Math.max(Z*n,40),$e=Math.max(fe*Z*n,Q);return {x:_,width:$e}},[o,Z,n]),pt=react.useMemo(()=>Ie.filter(U=>U.startDate&&U.endDate).map(U=>{let{x:ne,width:S}=bt(U),le=Ie.findIndex(fe=>fe.id===U.id)*a+(a-18)/2;return {id:U.id,x:ne,y:le,width:S,height:18}}),[Ie,bt]),ct=react.useCallback((U,ne,S)=>{if(!S){O([]),$(null);return}if($({taskId:U,daysDelta:ne}),ne===0){O([]);return}let q=Pe.calculateCascadePreview(e,U,ne,Ie,o,Z*n,a,48);O(q);},[e,Ie,o,Z,n,a,48]),Ce=react.useCallback((U,ne)=>{if(!F)return ne;let S=Z*n,q=F.daysDelta*S;if(U===F.taskId)return {x:ne.x+q,width:ne.width};let le=I.find(fe=>fe.taskId===U);return le?{x:le.previewX,width:le.width}:ne},[F,I,Z,n]),_e=react.useMemo(()=>{let U=[],ne=new Date(o);for(;ne<=s;){let le=(ne.getTime()-o.getTime())/864e5*Z*n;if(r==="day")U.push({date:new Date(ne),label:ne.toLocaleDateString(d,{day:"numeric",month:"short"}),x:le}),ne.setDate(ne.getDate()+1);else if(r==="week"){let fe=Le(ne);U.push({date:new Date(ne),label:`${E.labels.week} ${fe}`,x:le}),ne.setDate(ne.getDate()+7);}else U.push({date:new Date(ne),label:ne.toLocaleDateString(d,{month:"short",year:"numeric"}),x:le}),ne.setMonth(ne.getMonth()+1);}return U},[o,s,r,Z,n,d,E.labels.week]),tt=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*Z*n,[o,Z,n]),Ke=Math.max(Ie.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(ge,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(ge,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),_e.map((U,ne)=>jsxRuntime.jsxs("g",{children:[ne>0&&jsxRuntime.jsx("line",{x1:U.x,y1:0,x2:U.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:U.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:U.label})]},`header-${ne}`)),tt>=0&&tt<=ge&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:tt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:tt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${tt-18}, 2)`,children:[jsxRuntime.jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsxRuntime.jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:E.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:T,width:Math.max(ge,1e3),height:Ke,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:we,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(ge,1e3),height:Ke,fill:t.bgPrimary}),Ie.map((U,ne)=>jsxRuntime.jsx("rect",{x:0,y:ne*a,width:Math.max(ge,1e3),height:a,fill:ne%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${U.id}`)),_e.map((U,ne)=>ne>0?jsxRuntime.jsx("line",{x1:U.x,y1:0,x2:U.x,y2:Ie.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${ne}`):null),y&&_e.map((U,ne)=>{let S=_e[ne+1]?.x||ge;return Oe(U.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:U.x,y:0,width:S-U.x,height:Ie.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:U.x,y:0,width:S-U.x,height:Ie.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${ne}`):null}),Ie.map((U,ne)=>{let S=U.startDate&&U.endDate;return jsxRuntime.jsx("g",{children:!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:ne*a,width:ge,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:q=>at(q,U),onMouseMove:q=>re(q,U,ne),onMouseLeave:()=>{it();}},`clickable-${U.id}`),G&&G.taskId===U.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:G.x,y1:ne*a+4,x2:G.x,y2:ne*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:G.x,cy:G.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:G.x,cy:G.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${G.x}, ${ne*a-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:G.date.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!G||G.taskId!==U.id)&&jsxRuntime.jsx("text",{x:tt>0?tt:100,y:ne*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:E.labels.clickToSetDates},`placeholder-${U.id}`)]})},`row-group-${U.id}`)}),Ie.map((U,ne)=>{if(!U.startDate||!U.endDate)return null;let{x:S,width:q}=bt(U),le=ne*a+(a-18)/2,fe=U.subtasks&&U.subtasks.length>0&&!U.isMilestone;if(U.isMilestone)return jsxRuntime.jsx(ci,{task:U,x:S+q/2,y:le+12,theme:t,onClick:l},U.id);if(fe){let Q=le+(a-18)/2+8,$e=1.5,ke=6,Be="rgba(255,255,255,0.25)";return jsxRuntime.jsxs("g",{onClick:()=>l?.(U),onContextMenu:De=>{De.preventDefault(),De.stopPropagation(),g?.(U,De);},onMouseMove:De=>{H({task:U,x:S,y:Q,width:q,height:2,showBelow:Q<100,mouseX:De.clientX,mouseY:De.clientY});},onMouseLeave:()=>H(null),style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:le,width:q,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:S,y:Q,width:q,height:2,fill:Be}),jsxRuntime.jsx("rect",{x:S,y:Q,width:$e,height:2+ke,fill:Be}),jsxRuntime.jsx("rect",{x:S+q-$e,y:Q,width:$e,height:2+ke,fill:Be})]},U.id)}return jsxRuntime.jsx(ni,{task:U,x:S,y:le,width:q,theme:t,dayWidth:Z*n,startDate:o,templates:c,onClick:l,onDoubleClick:m,onContextMenu:g,onDateChange:x,onDependencyCreate:b,allTaskPositions:pt,onDragMove:ct,onHoverChange:H,showBaseline:f,showTaskBarLabels:u,showCriticalPath:h,readOnly:k?!k(U):false},U.id)}),w&&Ie.map((U,ne)=>!U.dependencies||U.dependencies.length===0||!U.startDate||!U.endDate?null:U.dependencies.map(S=>{let q=Ie.find(He=>He.id===S);if(!q||!q.startDate||!q.endDate)return null;let le=Ie.findIndex(He=>He.id===S),fe=Ce(q.id,bt(q)),_=Ce(U.id,bt(U)),Q=fe.x+fe.width,$e=le*a+26,ke=_.x,Be=ne*a+26,De=`dep-${S}-${U.id}`;return Ge.has(De)?null:jsxRuntime.jsx(jn,{x1:Q,y1:$e,x2:ke,y2:Be,theme:t,lineStyle:i,onDelete:()=>v?.(U.id,S),onHoverChange:He=>{xe.current=He,He&&J({key:De,fromId:S,toId:U.id,exitX:Q,exitY:$e,enterX:ke,enterY:Be});}},De)})),I.map(U=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:U.previewX,y:U.y-48,width:U.width,height:18,rx:6,fill:U.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(U.daysDelta)>0&&jsxRuntime.jsx("text",{x:U.previewX+U.width/2,y:U.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:U.daysDelta>0?`+${U.daysDelta}d`:`${U.daysDelta}d`})]},`cascade-preview-${U.taskId}`)),w&&A&&jsxRuntime.jsx(jn,{x1:A.exitX,y1:A.exitY,x2:A.enterX,y2:A.enterY,theme:t,lineStyle:i,onDelete:()=>{let U=A.key;J(null),xe.current=false,M(ne=>new Set(ne).add(U)),v?.(A.toId,A.fromId);},hoverOverlayOnly:true,onHoverChange:U=>{xe.current=U,U||J(null);}},`${A.key}-hover-overlay`),tt>=0&&tt<=ge&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:tt,y1:0,x2:tt,y2:Ke,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:tt,y1:0,x2:tt,y2:Ke,stroke:t.today,strokeWidth:1,opacity:1})]})]}),z&&jsxRuntime.jsx(Xp,{tooltipData:z,theme:t,locale:d==="es"?"es":"en"})]})}var uv=['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"'],Zp=({size:e=16})=>jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),pv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),mv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),gv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),fv=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function fi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:c}){let[i,u]=react.useState(false),[l,m]=react.useState(false),[g,x]=react.useState([]),[b,v]=react.useState(""),[f,h]=react.useState(false),[w,y]=react.useState(true),[k,C]=react.useState(""),[E,T]=react.useState(-1),[I,O]=react.useState(false),[F,$]=react.useState(0),z=react.useRef(null),de=react.useRef(null),A=react.useRef(null),J=react.useRef(null),{enabled:xe=true,placeholder:Ge='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:G,suggestions:ae=uv,maxHistory:we=50,persistHistory:H,mentionableUsers:X=[]}=a,Z=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",ge=Z?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Le=Z?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Oe=Z?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",rt=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",at=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",re=Z?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",it=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",Ie=Z?"rgba(46, 148, 255, 0.9)":"#2E94FF",bt=Z?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",pt=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",ct=Z?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",Ce=Z?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",_e=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",tt=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Ke=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",U=Z?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ne=Z?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",S=Z?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",q=Z?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",le=Z?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",fe="rgba(46, 148, 255, 0.04)",_=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",Q=Z?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",$e=Z?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",ke=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Be=Z?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",De=Z?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",He=Z?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",st=Z?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ot="rgba(46, 148, 255, 0.06)",nt=Z?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",mt=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Bt=Z?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Tt=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",lt=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",ut=Z?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Et=Z?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Nt=Z?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Fe=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",We=Z?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",Y=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",he=Z?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",N=Z?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",D=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",B=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",j=H?.storageKey||"gantt-ai-history",se=H?.maxMessages??5,pe=X.filter(W=>{if(!k)return true;let ve=k.toLowerCase();return W.name.toLowerCase().includes(ve)||W.email&&W.email.toLowerCase().includes(ve)}).slice(0,5),te=react.useCallback(W=>{if(v(W),X.length===0)return;let ve=z.current;if(!ve)return;let $t=ve.selectionStart||W.length,L=W.slice(0,$t),ce=L.lastIndexOf("@");if(ce>=0&&((ce>0?L[ce-1]:" ")===" "||ce===0)){let je=L.slice(ce+1);if(je.length<=40){C(je),T(ce),O(true),$(0);return}}O(false),C(""),T(-1);},[X.length]),me=react.useCallback(W=>{let ve=b.slice(0,E),$t=b.slice(E+1+k.length),L=`${ve}@${W.name} ${$t}`;v(L),O(false),C(""),T(-1),setTimeout(()=>z.current?.focus(),0);},[b,E,k]),Ye=react.useCallback(W=>{if(!I||pe.length===0)return false;if(W.key==="ArrowDown")return W.preventDefault(),$(ve=>ve<pe.length-1?ve+1:0),true;if(W.key==="ArrowUp")return W.preventDefault(),$(ve=>ve>0?ve-1:pe.length-1),true;if(W.key==="Enter"||W.key==="Tab"){W.preventDefault();let ve=pe[F];return ve&&me(ve),true}return W.key==="Escape"?(O(false),true):false},[I,pe,F,me]);react.useEffect(()=>{if(H?.enabled)try{let W=localStorage.getItem(j);if(W){let $t=JSON.parse(W).map(L=>({...L,timestamp:new Date(L.timestamp)}));x($t.slice(-se));}}catch(W){console.warn("[GanttAIAssistant] Failed to load persisted history:",W);}},[H?.enabled,j,se]),react.useEffect(()=>{if(H?.enabled&&g.length>0)try{let W=g.filter(ve=>!ve.isLoading).slice(-se);localStorage.setItem(j,JSON.stringify(W));}catch(W){console.warn("[GanttAIAssistant] Failed to persist history:",W);}},[g,H?.enabled,j,se]),react.useEffect(()=>{de.current&&de.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!l&&z.current&&setTimeout(()=>z.current?.focus(),100);},[i,l]);let qe=react.useCallback(W=>{if(W.success)switch(W.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":W.taskId&&W.updates&&o?.(W.taskId,W.updates);break;case "create_task":W.newTask&&s?.(W.newTask);break;case "delete_task":W.taskId&&n?.(W.taskId);break;case "link_tasks":W.dependencyFrom&&W.dependencyTo&&d?.(W.dependencyFrom,W.dependencyTo);break;case "unlink_tasks":W.taskId&&W.dependencyFrom&&c?.(W.taskId,W.dependencyFrom);break}},[o,s,n,d,c]),At=react.useCallback(async W=>{if(!W.trim()||f)return;let ve={id:`user-${Date.now()}`,role:"user",content:W,timestamp:new Date};x(L=>[...L.slice(-(we-1)),ve]),v(""),y(false),h(true);let $t={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(L=>[...L,$t]);try{if(G){let L=await G(W,e);x(ce=>{let Re=ce.filter(ht=>!ht.isLoading),je={id:`assistant-${Date.now()}`,role:"assistant",content:L.message,timestamp:new Date,command:L};return [...Re,je]}),qe(L);}else x(L=>[...L.filter(Re=>!Re.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(L){x(ce=>[...ce.filter(je=>!je.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${L instanceof Error?L.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[f,we,G,e,qe]),jt=W=>{W.preventDefault(),At(b);},sa=W=>{v(W),z.current?.focus();};if(react.useEffect(()=>{let W=ve=>{(ve.metaKey||ve.ctrlKey)&&ve.key==="k"&&(ve.preventDefault(),u($t=>!$t),i||m(false)),ve.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[i]),react.useEffect(()=>{if(!i)return;let W=$t=>{let L=$t.target;A.current&&!A.current.contains(L)&&u(false);},ve=setTimeout(()=>{document.addEventListener("mousedown",W);},100);return ()=>{clearTimeout(ve),document.removeEventListener("mousedown",W);}},[i]),!xe)return null;let Me={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Me[M]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ge,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Le}`,color:"#2E94FF",cursor:"pointer",boxShadow:Oe,overflow:"visible"},onClick:()=>u(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${rt}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${at}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Zp,{size:18}),jsxRuntime.jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:Ie,background:re,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${it}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
|
|
361
|
+
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(u),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=Pe.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 u=i.startDate&&i.endDate?Pe.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let x=t.find(b=>b.id===g);if(x){o(x);let b=r.get(g)?.ef||0;l=Math.max(l,b);}}let m=l+u;r.set(i.id,{es:l,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,d=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?Pe.calculateDuration(i.startDate,i.endDate):0,l=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),m=s;if(l.length>0)for(let x of l){d(x);let b=n.get(x.id)?.ls||0;m=Math.min(m,b);}let g=m-u;n.set(i.id,{ls:g,lf:m});};a.forEach(d);let c=[];for(let i of a){let u=r.get(i.id),l=n.get(i.id);if(u&&l){let m=l.ls-u.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateSlack:(e,t)=>{let a=Pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Pe.calculateCriticalPath(e).includes(t))return 0;let o=Pe.getDependentTasks(e,t);if(o.length===0){let d=Pe.getLatestEndDate(e);if(!d)return null;let c=Pe.calculateDuration(a.endDate,d);return Math.max(0,c)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,c)=>d-c)[0];if(!s)return null;let n=Pe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Pe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Pe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Pe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let d=Pe.calculateDuration(n.startDate,n.endDate),c;a!==void 0?(c=new Date(n.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let i=Pe.calculateEndDate(c,d),u=l=>l.map(m=>m.id===n.id?{...m,startDate:c,endDate:i}:m.subtasks?{...m,subtasks:u(m.subtasks)}:m);s=u(s),s=Pe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let c=[],i=o.getTime(),u=1e3*60*60*24,l=Pe.findTaskById(e,t);if(!l||!l.endDate)return [];let m=(g,x,b=new Set)=>{if(b.has(g))return;b.add(g);let v=Pe.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let h=r.findIndex(F=>F.id===f.id);if(h===-1)continue;let w=f.startDate.getTime(),k=(f.endDate.getTime()-w)/u,E=(w-i)/u*s,T=E+x*s,I=Math.max(k*s,s),O=d+h*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:E,previewX:T,width:I,y:O,rowIndex:h,daysDelta:x,color:f.color}),m(f.id,x,b);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Pe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],i=u=>u.map(l=>l.id===o.id?{...l,endDate:d,segments:c}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function pi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:l,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:x,onDependencyCreate:b,onDependencyDelete:v,showBaseline:f,showCriticalPath:h=true,showDependencies:w=true,highlightWeekends:y=true,canEditTask:k}){let E=Dr(),T=react.useRef(null),[I,O]=react.useState([]),[F,$]=react.useState(null),[z,de]=react.useState(null),[A,J]=react.useState(null),xe=react.useRef(false),[Ge,M]=react.useState(new Set),[G,ae]=react.useState(null),we=react.useCallback(U=>{if(A&&!xe.current){let ne=U.target,S=false;for(;ne&&ne!==U.currentTarget;){if(ne.getAttribute?.("data-dependency-line")==="true"||ne.getAttribute?.("data-dependency-hover-overlay")==="true"){S=true;break}ne=ne.parentElement;}S||J(null);}},[A]),H=react.useCallback(U=>{de(U);},[]),X=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),Z=r==="day"?60:r==="week"?20:8,ge=X*Z*n,Le=U=>{let ne=new Date(Date.UTC(U.getFullYear(),U.getMonth(),U.getDate())),S=ne.getUTCDay()||7;ne.setUTCDate(ne.getUTCDate()+4-S);let q=new Date(Date.UTC(ne.getUTCFullYear(),0,1));return Math.ceil(((ne.getTime()-q.getTime())/864e5+1)/7)},Oe=U=>{let ne=U.getDay();return ne===0||ne===6},rt=react.useCallback(U=>{let ne=Math.round(U/(Z*n)),S=new Date(o);return S.setDate(S.getDate()+ne),S},[o,Z,n]),at=react.useCallback((U,ne)=>{if(ne.startDate&&ne.endDate)return;let S=U.currentTarget.ownerSVGElement;if(!S)return;let q=S.createSVGPoint();q.x=U.clientX,q.y=U.clientY;let le=q.matrixTransform(S.getScreenCTM()?.inverse()),fe=rt(le.x),_=new Date(fe);_.setDate(_.getDate()+1),ae(null),x?.(ne,fe,_);},[rt,x]),re=react.useCallback((U,ne,S)=>{let q=U.currentTarget.ownerSVGElement;if(!q)return;let le=q.createSVGPoint();le.x=U.clientX,le.y=U.clientY;let fe=le.matrixTransform(q.getScreenCTM()?.inverse()),_=rt(fe.x),$e=Math.round(fe.x/(Z*n))*Z*n;ae({taskId:ne.id,x:$e,y:S*a+a/2,date:_});},[rt,Z,n,a]),it=react.useCallback(()=>{ae(null);},[]),Ie=react.useMemo(()=>{let U=le=>le.map(fe=>{if(fe.subtasks&&fe.subtasks.length>0){let _=U(fe.subtasks),Q=_.filter($e=>$e.startDate&&$e.endDate);if(Q.length>0){let $e=Q.map(He=>He.startDate.getTime()),ke=Q.map(He=>He.endDate.getTime()),Be=new Date(Math.min(...$e)),De=new Date(Math.max(...ke));return {...fe,subtasks:_,startDate:Be,endDate:De}}return {...fe,subtasks:_}}return fe}),ne=(le,fe=[])=>{let _=[...le].sort((Q,$e)=>(Q.position??0)-($e.position??0));for(let Q of _)fe.push(Q),Q.subtasks&&Q.subtasks.length>0&&(Q.isExpanded===void 0||Q.isExpanded)&&ne(Q.subtasks,fe);return fe},S=U(e);return ne(S)},[e]),bt=react.useCallback(U=>{if(!U.startDate||!U.endDate)return {x:0,width:0};let ne=U.startDate.getTime(),S=U.endDate.getTime(),q=o.getTime(),le=(ne-q)/(1e3*60*60*24),fe=(S-ne)/(1e3*60*60*24)+1,_=le*Z*n,Q=Math.max(Z*n,40),$e=Math.max(fe*Z*n,Q);return {x:_,width:$e}},[o,Z,n]),pt=react.useMemo(()=>Ie.filter(U=>U.startDate&&U.endDate).map(U=>{let{x:ne,width:S}=bt(U),le=Ie.findIndex(fe=>fe.id===U.id)*a+(a-18)/2;return {id:U.id,x:ne,y:le,width:S,height:18}}),[Ie,bt]),ct=react.useCallback((U,ne,S)=>{if(!S){O([]),$(null);return}if($({taskId:U,daysDelta:ne}),ne===0){O([]);return}let q=Pe.calculateCascadePreview(e,U,ne,Ie,o,Z*n,a,48);O(q);},[e,Ie,o,Z,n,a,48]),Ce=react.useCallback((U,ne)=>{if(!F)return ne;let S=Z*n,q=F.daysDelta*S;if(U===F.taskId)return {x:ne.x+q,width:ne.width};let le=I.find(fe=>fe.taskId===U);return le?{x:le.previewX,width:le.width}:ne},[F,I,Z,n]),_e=react.useMemo(()=>{let U=[],ne=new Date(o);for(;ne<=s;){let le=(ne.getTime()-o.getTime())/864e5*Z*n;if(r==="day")U.push({date:new Date(ne),label:ne.toLocaleDateString(d,{day:"numeric",month:"short"}),x:le}),ne.setDate(ne.getDate()+1);else if(r==="week"){let fe=Le(ne);U.push({date:new Date(ne),label:`${E.labels.week} ${fe}`,x:le}),ne.setDate(ne.getDate()+7);}else U.push({date:new Date(ne),label:ne.toLocaleDateString(d,{month:"short",year:"numeric"}),x:le}),ne.setMonth(ne.getMonth()+1);}return U},[o,s,r,Z,n,d,E.labels.week]),tt=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*Z*n,[o,Z,n]),Ke=Math.max(Ie.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(ge,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(ge,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),_e.map((U,ne)=>jsxRuntime.jsxs("g",{children:[ne>0&&jsxRuntime.jsx("line",{x1:U.x,y1:0,x2:U.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:U.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:U.label})]},`header-${ne}`)),tt>=0&&tt<=ge&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:tt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:tt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${tt-18}, 2)`,children:[jsxRuntime.jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsxRuntime.jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:E.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:T,width:Math.max(ge,1e3),height:Ke,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:we,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(ge,1e3),height:Ke,fill:t.bgPrimary}),Ie.map((U,ne)=>jsxRuntime.jsx("rect",{x:0,y:ne*a,width:Math.max(ge,1e3),height:a,fill:ne%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${U.id}`)),_e.map((U,ne)=>ne>0?jsxRuntime.jsx("line",{x1:U.x,y1:0,x2:U.x,y2:Ie.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${ne}`):null),y&&_e.map((U,ne)=>{let S=_e[ne+1]?.x||ge;return Oe(U.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:U.x,y:0,width:S-U.x,height:Ie.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:U.x,y:0,width:S-U.x,height:Ie.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${ne}`):null}),Ie.map((U,ne)=>{let S=U.startDate&&U.endDate;return jsxRuntime.jsx("g",{children:!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:ne*a,width:ge,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:q=>at(q,U),onMouseMove:q=>re(q,U,ne),onMouseLeave:()=>{it();}},`clickable-${U.id}`),G&&G.taskId===U.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:G.x,y1:ne*a+4,x2:G.x,y2:ne*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:G.x,cy:G.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:G.x,cy:G.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${G.x}, ${ne*a-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:G.date.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!G||G.taskId!==U.id)&&jsxRuntime.jsx("text",{x:tt>0?tt:100,y:ne*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:E.labels.clickToSetDates},`placeholder-${U.id}`)]})},`row-group-${U.id}`)}),Ie.map((U,ne)=>{if(!U.startDate||!U.endDate)return null;let{x:S,width:q}=bt(U),le=ne*a+(a-18)/2,fe=U.subtasks&&U.subtasks.length>0&&!U.isMilestone;if(U.isMilestone)return jsxRuntime.jsx(ci,{task:U,x:S+q/2,y:le+12,theme:t,onClick:l},U.id);if(fe){let Q=le+(a-18)/2+8,$e=1.5,ke=6,Be="rgba(255,255,255,0.25)";return jsxRuntime.jsxs("g",{onClick:()=>l?.(U),onContextMenu:De=>{De.preventDefault(),De.stopPropagation(),g?.(U,De);},onMouseMove:De=>{H({task:U,x:S,y:Q,width:q,height:2,showBelow:Q<100,mouseX:De.clientX,mouseY:De.clientY});},onMouseLeave:()=>H(null),style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:le,width:q,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:S,y:Q,width:q,height:2,fill:Be}),jsxRuntime.jsx("rect",{x:S,y:Q,width:$e,height:2+ke,fill:Be}),jsxRuntime.jsx("rect",{x:S+q-$e,y:Q,width:$e,height:2+ke,fill:Be})]},U.id)}return jsxRuntime.jsx(ni,{task:U,x:S,y:le,width:q,theme:t,dayWidth:Z*n,startDate:o,templates:c,onClick:l,onDoubleClick:m,onContextMenu:g,onDateChange:x,onDependencyCreate:b,allTaskPositions:pt,onDragMove:ct,onHoverChange:H,showBaseline:f,showTaskBarLabels:u,showCriticalPath:h,readOnly:k?!k(U):false},U.id)}),w&&Ie.map((U,ne)=>!U.dependencies||U.dependencies.length===0||!U.startDate||!U.endDate?null:U.dependencies.map(S=>{let q=Ie.find(He=>He.id===S);if(!q||!q.startDate||!q.endDate)return null;let le=Ie.findIndex(He=>He.id===S),fe=Ce(q.id,bt(q)),_=Ce(U.id,bt(U)),Q=fe.x+fe.width,$e=le*a+26,ke=_.x,Be=ne*a+26,De=`dep-${S}-${U.id}`;return Ge.has(De)?null:jsxRuntime.jsx(jn,{x1:Q,y1:$e,x2:ke,y2:Be,theme:t,lineStyle:i,onDelete:()=>v?.(U.id,S),onHoverChange:He=>{xe.current=He,He&&J({key:De,fromId:S,toId:U.id,exitX:Q,exitY:$e,enterX:ke,enterY:Be});}},De)})),I.map(U=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:U.previewX,y:U.y-48,width:U.width,height:18,rx:6,fill:U.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(U.daysDelta)>0&&jsxRuntime.jsx("text",{x:U.previewX+U.width/2,y:U.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:U.daysDelta>0?`+${U.daysDelta}d`:`${U.daysDelta}d`})]},`cascade-preview-${U.taskId}`)),w&&A&&jsxRuntime.jsx(jn,{x1:A.exitX,y1:A.exitY,x2:A.enterX,y2:A.enterY,theme:t,lineStyle:i,onDelete:()=>{let U=A.key;J(null),xe.current=false,M(ne=>new Set(ne).add(U)),v?.(A.toId,A.fromId);},hoverOverlayOnly:true,onHoverChange:U=>{xe.current=U,U||J(null);}},`${A.key}-hover-overlay`),tt>=0&&tt<=ge&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:tt,y1:0,x2:tt,y2:Ke,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:tt,y1:0,x2:tt,y2:Ke,stroke:t.today,strokeWidth:1,opacity:1})]})]}),z&&jsxRuntime.jsx(Xp,{tooltipData:z,theme:t,locale:d==="es"?"es":"en"})]})}var uv=['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"'],Zp=({size:e=16})=>jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),pv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),mv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),gv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),fv=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function fi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:c}){let[i,u]=react.useState(false),[l,m]=react.useState(false),[g,x]=react.useState([]),[b,v]=react.useState(""),[f,h]=react.useState(false),[w,y]=react.useState(true),[k,C]=react.useState(""),[E,T]=react.useState(-1),[I,O]=react.useState(false),[F,$]=react.useState(0),z=react.useRef(null),de=react.useRef(null),A=react.useRef(null),J=react.useRef(null),{enabled:xe=true,placeholder:Ge='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:G,suggestions:ae=uv,maxHistory:we=50,persistHistory:H,mentionableUsers:X=[]}=a,Z=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",ge=Z?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Le=Z?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Oe=Z?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",rt=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",at=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",re=Z?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",it=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",Ie=Z?"rgba(46, 148, 255, 0.9)":"#2E94FF",bt=Z?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",pt=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",ct=Z?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",Ce=Z?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",_e=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",tt=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Ke=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",U=Z?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ne=Z?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",S=Z?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",q=Z?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",le=Z?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",fe="rgba(46, 148, 255, 0.04)",_=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",Q=Z?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",$e=Z?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",ke=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Be=Z?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",De=Z?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",He=Z?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",st=Z?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ot="rgba(46, 148, 255, 0.06)",nt=Z?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",mt=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Bt=Z?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Tt=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",lt=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",ut=Z?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Et=Z?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Nt=Z?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Fe=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",ze=Z?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",Y=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",he=Z?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",N=Z?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",D=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",B=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",j=H?.storageKey||"gantt-ai-history",se=H?.maxMessages??5,pe=X.filter(W=>{if(!k)return true;let ve=k.toLowerCase();return W.name.toLowerCase().includes(ve)||W.email&&W.email.toLowerCase().includes(ve)}).slice(0,5),te=react.useCallback(W=>{if(v(W),X.length===0)return;let ve=z.current;if(!ve)return;let $t=ve.selectionStart||W.length,L=W.slice(0,$t),ce=L.lastIndexOf("@");if(ce>=0&&((ce>0?L[ce-1]:" ")===" "||ce===0)){let je=L.slice(ce+1);if(je.length<=40){C(je),T(ce),O(true),$(0);return}}O(false),C(""),T(-1);},[X.length]),me=react.useCallback(W=>{let ve=b.slice(0,E),$t=b.slice(E+1+k.length),L=`${ve}@${W.name} ${$t}`;v(L),O(false),C(""),T(-1),setTimeout(()=>z.current?.focus(),0);},[b,E,k]),Ye=react.useCallback(W=>{if(!I||pe.length===0)return false;if(W.key==="ArrowDown")return W.preventDefault(),$(ve=>ve<pe.length-1?ve+1:0),true;if(W.key==="ArrowUp")return W.preventDefault(),$(ve=>ve>0?ve-1:pe.length-1),true;if(W.key==="Enter"||W.key==="Tab"){W.preventDefault();let ve=pe[F];return ve&&me(ve),true}return W.key==="Escape"?(O(false),true):false},[I,pe,F,me]);react.useEffect(()=>{if(H?.enabled)try{let W=localStorage.getItem(j);if(W){let $t=JSON.parse(W).map(L=>({...L,timestamp:new Date(L.timestamp)}));x($t.slice(-se));}}catch(W){console.warn("[GanttAIAssistant] Failed to load persisted history:",W);}},[H?.enabled,j,se]),react.useEffect(()=>{if(H?.enabled&&g.length>0)try{let W=g.filter(ve=>!ve.isLoading).slice(-se);localStorage.setItem(j,JSON.stringify(W));}catch(W){console.warn("[GanttAIAssistant] Failed to persist history:",W);}},[g,H?.enabled,j,se]),react.useEffect(()=>{de.current&&de.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!l&&z.current&&setTimeout(()=>z.current?.focus(),100);},[i,l]);let qe=react.useCallback(W=>{if(W.success)switch(W.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":W.taskId&&W.updates&&o?.(W.taskId,W.updates);break;case "create_task":W.newTask&&s?.(W.newTask);break;case "delete_task":W.taskId&&n?.(W.taskId);break;case "link_tasks":W.dependencyFrom&&W.dependencyTo&&d?.(W.dependencyFrom,W.dependencyTo);break;case "unlink_tasks":W.taskId&&W.dependencyFrom&&c?.(W.taskId,W.dependencyFrom);break}},[o,s,n,d,c]),At=react.useCallback(async W=>{if(!W.trim()||f)return;let ve={id:`user-${Date.now()}`,role:"user",content:W,timestamp:new Date};x(L=>[...L.slice(-(we-1)),ve]),v(""),y(false),h(true);let $t={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(L=>[...L,$t]);try{if(G){let L=await G(W,e);x(ce=>{let Re=ce.filter(ht=>!ht.isLoading),je={id:`assistant-${Date.now()}`,role:"assistant",content:L.message,timestamp:new Date,command:L};return [...Re,je]}),qe(L);}else x(L=>[...L.filter(Re=>!Re.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(L){x(ce=>[...ce.filter(je=>!je.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${L instanceof Error?L.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[f,we,G,e,qe]),Wt=W=>{W.preventDefault(),At(b);},sa=W=>{v(W),z.current?.focus();};if(react.useEffect(()=>{let W=ve=>{(ve.metaKey||ve.ctrlKey)&&ve.key==="k"&&(ve.preventDefault(),u($t=>!$t),i||m(false)),ve.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[i]),react.useEffect(()=>{if(!i)return;let W=$t=>{let L=$t.target;A.current&&!A.current.contains(L)&&u(false);},ve=setTimeout(()=>{document.addEventListener("mousedown",W);},100);return ()=>{clearTimeout(ve),document.removeEventListener("mousedown",W);}},[i]),!xe)return null;let Me={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Me[M]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ge,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Le}`,color:"#2E94FF",cursor:"pointer",boxShadow:Oe,overflow:"visible"},onClick:()=>u(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${rt}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${at}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Zp,{size:18}),jsxRuntime.jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:Ie,background:re,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${it}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Me[M]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:bt,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${pt}`,boxShadow:ct},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${_e}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:tt,border:`1px solid ${Ke}`,color:"#2E94FF"},children:jsxRuntime.jsx(Zp,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:U},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(W=>!W),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:W=>{W.currentTarget.style.background=q,W.currentTarget.style.color=S;},onMouseLeave:W=>{W.currentTarget.style.background="transparent",W.currentTarget.style.color=ne;},children:jsxRuntime.jsx(gv,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:W=>{W.currentTarget.style.background=q,W.currentTarget.style.color=S;},onMouseLeave:W=>{W.currentTarget.style.background="transparent",W.currentTarget.style.color=ne;},children:jsxRuntime.jsx(mv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:le,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:ae.slice(0,4).map((W,ve)=>jsxRuntime.jsx("button",{onClick:()=>sa(W),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:fe,color:Q,border:`1px solid ${_}`},onMouseEnter:$t=>{$t.currentTarget.style.borderColor=$e,$t.currentTarget.style.color="#2E94FF";},onMouseLeave:$t=>{$t.currentTarget.style.borderColor=_,$t.currentTarget.style.color=Q;},children:W.length>30?W.slice(0,30)+"...":W},ve))})]}),g.map(W=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${W.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${W.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:W.role==="user"?ke:De,color:W.role==="user"?"#2E94FF":st,border:W.role==="user"?`1px solid ${Be}`:`1px solid ${He}`},children:[W.isLoading?jsxRuntime.jsx(fv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:W.content}),W.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:W.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:W.command.success?"#10B981":"#EF4444",border:`1px solid ${W.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[W.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:W.command.type.replace(/_/g," ")})]})]})},W.id)),jsxRuntime.jsx("div",{ref:de})]}),jsxRuntime.jsxs("form",{onSubmit:W=>{if(I&&pe.length>0){W.preventDefault();return}jt(W);},className:"p-3 relative",style:{borderTop:`1px solid ${ot}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&pe.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:J,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Nt,border:`1px solid ${Fe}`,boxShadow:We,backdropFilter:"blur(12px)"},children:pe.map((W,ve)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>me(W),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ve===F?Y:"transparent",color:he},onMouseEnter:()=>$(ve),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:D,border:`1px solid ${B}`,color:"#2E94FF"},children:W.name.split(" ").map($t=>$t[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:W.name}),W.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:N},children:W.email})]})]},W.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:nt,border:`1px solid ${mt}`},children:[jsxRuntime.jsx("input",{ref:z,type:"text",value:b,onChange:W=>te(W.target.value),onKeyDown:W=>{Ye(W);},placeholder:Ge,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Bt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!b.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:b.trim()?Tt:"transparent",color:b.trim()?"#2E94FF":ut,border:b.trim()?`1px solid ${lt}`:"1px solid transparent"},children:jsxRuntime.jsx(pv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Et,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function em(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(l=>{let m=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:m};if(!u)return {...l,present:m};let g=[...l.past,l.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:u,future:[i.present,...i.future]}});},[]),d=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:l}});},[]),c=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function tm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=d?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&c&&n.key==="y"){n.preventDefault(),t();return}if(d&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var xv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Pe.formatDate(e.startDate)} - ${Pe.formatDate(e.endDate)}`);let a=Pe.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=>Pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function am(e){return {...xv,...e}}var Sv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},nm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:c=true,showExportButton:i=true,projectName:u,availableUsers:l=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:x,persistFilter:b,clearFiltersKey:v,aiAssistant:f,locale:h="en",customTranslations:w,showCreateTaskButton:y=false,createTaskLabel:k,onCreateTask:C,taskFilter:E,onTaskFilterChange:T,toolbarRightContent:I,showBaseline:O,viewMode:F,onViewModeChange:$,projectForecast:z,onThemeChange:de,onTaskClick:A,onTaskDblClick:J,onTaskContextMenu:xe,onTaskUpdate:Ge,onProgressChange:M,onTaskEdit:G,onTaskAddSubtask:ae,onTaskMarkIncomplete:we,onTaskSetInProgress:H,onDependencyCreate:X,onDependencyDelete:Z,onBeforeTaskAdd:ge,onAfterTaskAdd:Le,onBeforeTaskUpdate:Oe,onAfterTaskUpdate:rt,onBeforeTaskDelete:at,onAfterTaskDelete:re,permissions:it,onCopySnapshotLink:Ie}=a,pt=react.useContext(Ks)?.theme,[ct,Ce]=react.useState(pt||s||"dark"),[_e,tt]=react.useState(n),[Ke,U]=react.useState(d),[ne,S]=react.useState(1),[q,le]=react.useState("all"),[fe,_]=react.useState(F||"execution"),Q=F??fe,$e=react.useCallback(P=>{_(P),$?.(P);},[$]),ke=O??Q==="oracle",[Be,De]=react.useState(a.showCriticalPath!==false),[He,st]=react.useState(a.showDependencies!==false),[ot,nt]=react.useState(a.highlightWeekends!==false),mt=react.useCallback(P=>{De(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),Bt=react.useCallback(P=>{st(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),Tt=react.useCallback(P=>{nt(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(_e);},[_e]),react.useEffect(()=>{a.onZoomChange?.(ne);},[ne]);let lt=react.useRef(a.onDateRangeChange);lt.current=a.onDateRangeChange;let ut=react.useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Et,Nt]=react.useState(()=>{if(!b)return "all";try{let P=typeof b=="string"?b:"gantt-filter-state",R=localStorage.getItem(P);if(R){let K=JSON.parse(R);if(K.taskFilter)return K.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),Fe=E??Et,We=T??Nt,[Y,he]=react.useState(()=>{if(!b)return false;try{let P=typeof b=="string"?b:"gantt-filter-state",R=localStorage.getItem(P);if(R){let K=JSON.parse(R);if(typeof K.hideCompleted=="boolean")return K.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});react.useEffect(()=>{let P=ut();if(P)try{let R={taskFilter:Fe,hideCompleted:Y};localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Fe,Y,ut]);let N=react.useRef(v);react.useEffect(()=>{if(N.current!==v&&v!==void 0){Nt("all"),he(false);let P=ut();if(P)try{localStorage.removeItem(P);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}N.current=v;},[v,ut]);let[D,B]=react.useState(0),[j,se]=react.useState(false),[pe,te]=react.useState(null),[me,Ye]=react.useState({isOpen:false,x:0,y:0,task:null}),[qe,At]=react.useState(null),[jt,sa]=react.useState(null);react.useEffect(()=>{pt&&pt!==ct&&Ce(pt);},[pt]),react.useEffect(()=>{s&&s!==ct&&Ce(s);},[s]);let Me=react.useCallback(P=>{Ce(P),de?.(P);},[de]),{state:W,setState:ve,undo:$t,redo:L,canUndo:ce,canRedo:Re,clearHistory:je}=em(t,50),ht=react.useMemo(()=>{let P=(R,K=0)=>{let ee=K;for(let ye of R)ye.subtasks?.length&&(ee=Math.max(ee,P(ye.subtasks,K+1)));return ee};return P(W)+1},[W]),Ua=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),aa=react.useRef(new Map),nr=react.useRef(false);if(!nr.current&&x){nr.current=true;let P=typeof x=="string"?x:"gantt-expanded-tasks";try{let R=localStorage.getItem(P);if(R){let K=JSON.parse(R);Array.isArray(K)&&(aa.current=new Map(K));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let ia=react.useCallback(()=>{let P=Ua();if(P)try{let R=Array.from(aa.current.entries());localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[Ua]),la=react.useRef(0),Wo=react.useRef(W);react.useEffect(()=>{Wo.current=W;},[W]);let Go=react.useRef(false),Cc=react.useCallback(P=>{le(P),la.current+=1,ve(R=>{let K=(ye,Ee=0)=>ye.map(kt=>{let Je=P==="all"||Ee<P-1;return kt.subtasks?.length&&aa.current.set(kt.id,Je),{...kt,isExpanded:Je,subtasks:kt.subtasks?K(kt.subtasks,Ee+1):void 0}}),ee=K(R);return ia(),ee});},[ve,ia]);react.useEffect(()=>{if(la.current>0){la.current-=1;return}let P=K=>{let ee=new Map;for(let ye of K){let Ee=ye.id;ee.get(Ee)||ee.set(Ee,ye);}return Array.from(ee.values())},R=K=>K.map(ee=>{let ye=aa.current.get(ee.id),Ee=ye!==void 0?{...ee,isExpanded:ye}:ee;if(Ee.subtasks?.length){let kt=P(Ee.subtasks);return {...Ee,subtasks:R(kt)}}return Ee});if(aa.current.size>0)ve(br(R(t)));else {let K=ee=>ee.map(ye=>ye.subtasks?.length?{...ye,subtasks:P(K(ye.subtasks))}:ye);ve(br(K(t)));}},[t,ve]);let us=react.useRef(t),Tc=react.useRef(true);react.useEffect(()=>{if(Tc.current){Tc.current=false,us.current=W;return}if(Go.current){Go.current=false,us.current=W;return}if(!r)return;let P=JSON.stringify(us.current),R=JSON.stringify(W);P!==R&&(us.current=W,r(W));},[W,r]);let Wa=react.useMemo(()=>ed(h,w),[h,w]),R0=react.useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Vo,Gi]=react.useState(()=>R0(Wa));react.useEffect(()=>{Gi(P=>P.map(R=>({...R,label:Wa.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Wa]);let ps=react.useMemo(()=>Vo.filter(R=>R.visible).reduce((R,K)=>R+K.width,0),[Vo]),Nc=react.useRef(Vo.filter(P=>P.visible).map(P=>P.id).join(","));react.useEffect(()=>{let P=Vo.filter(ee=>ee.visible),R=P.map(ee=>ee.id).join(","),K=Nc.current;if(R!==K){let ee=P.some(Ee=>Ee.id!=="name"),ye=K.includes(",");ee?!ye&&ee&&te(null):te(null),Nc.current=R;}},[Vo]);let Dc=60,Sc=.6,O0=react.useMemo(()=>{let R=ps+Dc,K=typeof window<"u"?window.innerWidth*Sc:800,ee=Math.max(R,K);return pe!==null?Math.max(200,Math.min(pe,ee)):Math.max(200,R)},[pe,ps]),eo=react.useRef(null),ms=react.useRef(null),Ar=react.useRef(null),Tn=react.useRef(null),Xt=react.useMemo(()=>Cp(ct),[ct]),$0=react.useMemo(()=>({theme:Xt,themeName:ct}),[Xt,ct]),Ec=react.useMemo(()=>am(m),[m]),Vi=react.useMemo(()=>{if(!g)return W;let P=Pe.calculateCriticalPath(W),R=K=>K.map(ee=>({...ee,isCriticalPath:P.includes(ee.id),subtasks:ee.subtasks?R(ee.subtasks):void 0}));return R(W)},[W,g]),Fc=react.useMemo(()=>{if(Fe==="all"&&!Y)return Vi;let P=R=>{let K=[];for(let ee of R){let ye=ee.subtasks?.length?P(ee.subtasks):void 0,Ee=false;if(Y)Ee=ee.progress<100;else switch(Fe){case "all":Ee=true;break;case "incomplete":Ee=ee.progress<100;break;case "in_progress":Ee=ee.progress>0&&ee.progress<100;break;case "completed":Ee=ee.progress===100;break}(Ee||ye&&ye.length>0)&&K.push({...ee,subtasks:ye});}return K};return P(Vi)},[Vi,Fe,Y]),gs=Sv(Ke);tm({undo:$t,redo:L,canUndo:ce,canRedo:Re,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>Pe.findTaskById(W,P),addTask:(P,R)=>{ve(K=>{if(!R)return [...K,{...P,level:0}];let ee=ye=>ye.map(Ee=>Ee.id===R?{...Ee,subtasks:[...Ee.subtasks||[],{...P,parentId:R,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:ee(Ee.subtasks)}:Ee);return ee(K)});},updateTask:(P,R)=>{ve(K=>{let ee=ye=>ye.map(Ee=>Ee.id===P?{...Ee,...R}:Ee.subtasks?{...Ee,subtasks:ee(Ee.subtasks)}:Ee);return ee(K)});},deleteTask:P=>{ve(R=>{let K=ee=>ee.filter(ye=>ye.id===P?false:(ye.subtasks&&(ye.subtasks=K(ye.subtasks)),true));return K(R)});},deleteTasks:P=>{ve(R=>id(R,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let R=Pe.findTaskById(W,P);R&&a.onTaskDuplicate(R);}else ve(R=>Vn(R,[P]).tasks);},splitTask:(P,R,K=3)=>{ve(ee=>Pe.splitTask(ee,P,R,K));},calculateEndDate:Pe.calculateEndDate,calculateDuration:Pe.calculateDuration,validateDependency:(P,R)=>!Pe.validateDependencies(W,P,R),getAllTasks:()=>Pe.flattenTasks(W),getTasksByStatus:P=>Pe.flattenTasks(W).filter(R=>R.status===P),getTasksByParent:P=>P?Pe.findTaskById(W,P)?.subtasks||[]:W.filter(K=>!K.parentId),getCriticalPath:()=>Pe.flattenTasks(W).filter(P=>P.isCriticalPath),indentTask:P=>{ve(R=>br(od(R,[P])));},outdentTask:P=>{ve(R=>br(nd(R,[P])));},moveTask:(P,R)=>{ve(K=>sd(K,[P],R));},createSubtask:async P=>{let{tasks:R,newTask:K}=cd(W,P);if(ge){let ee=ge({...K,parentId:P});if((ee instanceof Promise?await ee:ee)===false)return}ve(br(R)),Le&&Le({...K,parentId:P});},scrollToTask:P=>{let K=Pe.flattenTasks(W).findIndex(ee=>ee.id===P);if(K!==-1&&eo.current){let ee=K*gs;eo.current.scrollTo({top:ee,behavior:"smooth"}),Ar.current&&Ar.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(P,R=2e3)=>{},expandTask:P=>{ve(R=>{let K=ee=>ee.map(ye=>ye.id===P?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye);return K(R)});},collapseTask:P=>{ve(R=>{let K=ee=>ee.map(ye=>ye.id===P?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye);return K(R)});},expandAll:()=>{ve(P=>{let R=K=>K.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?R(ee.subtasks):void 0}));return R(P)});},collapseAll:()=>{ve(P=>{let R=K=>K.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?R(ee.subtasks):void 0}));return R(P)});},collapseToLevel:P=>{Cc(P);},undo:$t,redo:L,canUndo:()=>ce,canRedo:()=>Re,clearHistory:je,exportToPNG:async()=>{if(!Tn.current||!eo.current||!Ar.current)throw new Error("Gantt container not found");let P=Tn.current,R=eo.current,K=ms.current||R.querySelector(".gantt-grid-scroll"),ee=Ar.current,ye=K?.scrollTop||0,Ee=ee.scrollTop,kt=P.style.overflow,Je=P.style.height,Ea=R.style.overflow;try{let Mt=K?.querySelector(".gantt-taskgrid-content"),Fa=ee.querySelector("svg"),sr=Mt?.scrollHeight||K?.scrollHeight||600,ko=Fa?.getBoundingClientRect().height||ee.scrollHeight,Dn=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(sr,ko)+20;K&&(K.scrollTop=0),ee.scrollTop=0,P.style.overflow="visible",P.style.height=`${Dn}px`,R.style.overflow="visible",await new Promise(Yo=>setTimeout(Yo,100));let to=await htmlToImage.toPng(P,{backgroundColor:Xt.bgPrimary,pixelRatio:2,filter:Yo=>{if(!(Yo instanceof Element))return !0;let hs=window.getComputedStyle(Yo),Sn=parseInt(hs.zIndex,10);return (isNaN(Sn)||Sn<50)&&hs.position!=="fixed"}});return await(await fetch(to)).blob()}finally{P.style.overflow=kt,P.style.height=Je,R.style.overflow=Ea,K&&(K.scrollTop=ye),ee.scrollTop=Ee;}},exportToPDF:async P=>{await Pe.exportToPDF(W,P);},exportToExcel:async P=>{await Pe.exportToExcel(W,P);},exportToJSON:()=>Pe.exportToJSON(W),exportToCSV:()=>Pe.exportToCSV(W),importFromJSON:P=>{let R=Pe.importFromJSON(P);ve(R);},getTasks:()=>W,refresh:()=>{ve(P=>[...P]);},clearAll:()=>{ve([]);}}),[W,$t,L,ce,Re,je,Xt,gs]);let H0=react.useCallback(P=>{Gi(R=>R.map(K=>K.id===P?{...K,visible:!K.visible}:K));},[]),z0=react.useCallback((P,R)=>{Gi(K=>K.map(ee=>{if(ee.id!==P)return ee;let ye=ee.minWidth??100,Ee=ee.maxWidth??800,kt=Math.max(ye,Math.min(Ee,R));return {...ee,width:kt}}));},[]),U0=react.useCallback(P=>{ve(R=>{let K=dd(R,P),ee=ye=>{for(let Ee of ye){if(Ee.id===P){aa.current.set(P,Ee.isExpanded??true);return}Ee.subtasks?.length&&ee(Ee.subtasks);}};return ee(K),ia(),K}),a.onTaskToggleExpand?.(P);},[a,ia]),_o=react.useCallback((P,R)=>{if(Oe&&Oe(P,R)===false)return;let ee=Pe.findTaskById(W,P)?.progress,ye=kt=>kt.map(Je=>Je.id===P?{...Je,...R}:Je.subtasks?{...Je,subtasks:ye(Je.subtasks)}:Je);ve(ye(W));let Ee=Pe.findTaskById(ye(W),P);Ee&&(Ge?.(Ee),rt?.(Ee),R.progress!==void 0&&ee!==void 0&&R.progress!==ee&&M?.(P,ee,R.progress));},[W,Ge,Oe,rt,M]),W0=react.useCallback(P=>{P.length!==0&&(la.current+=1,Go.current=true,ve(R=>br(od(R,P))),a.onTaskIndent?.(P[0]));},[a]),G0=react.useCallback(P=>{P.length!==0&&(la.current+=1,Go.current=true,ve(R=>br(nd(R,P))),a.onTaskOutdent?.(P[0]));},[a]),V0=react.useCallback((P,R,K)=>{la.current+=1,Go.current=true,ve(ee=>br(Up(ee,P,R,K))),a.onTaskReparent?.(P,R,K);},[a]),_0=react.useCallback((P,R)=>{P.length!==0&&(la.current+=1,Go.current=true,ve(K=>sd(K,P,R)),a.onTaskMove?.(P[0],R));},[a]),_i=react.useCallback(async P=>{let R=[];for(let K of P)at&&await Promise.resolve(at(K))===false||R.push(K);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(ve(K=>br(id(K,R))),R.forEach(K=>a.onTaskDelete?.(K))),re&&R.forEach(K=>re(K)));},[a,at,re]),j0=react.useCallback(P=>{a.onTaskDuplicate?P.forEach(R=>{let K=Pe.findTaskById(W,R);K&&a.onTaskDuplicate(K);}):ve(R=>Vn(R,P).tasks);},[a,W]),K0=react.useCallback((P,R)=>{ve(K=>{let{tasks:ee,newTask:ye}=zp(K,P,R);return ge&&ge(ye)===false?K:(a.onTaskCreate?.(ye.parentId,ye.position||0),Le?.(ye),ee)});},[a,ge,Le]),Y0=react.useCallback((P,R)=>{ve(K=>ld(K,P,R)),a.onTaskRename?.(P,R);},[a]),ji=react.useCallback(P=>{let{onTaskAddSubtask:R}=a;if(R){let K=ei(W,P);if(K){R(K);return}}ve(K=>{let{tasks:ee}=cd(K,P);return a.onTaskCreate?.(P,0),ee});},[a,W]),q0=react.useCallback((P,R,K)=>{let ee=!P.startDate&&!P.endDate,ye=P.startDate?Math.round((R.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,Ee=Ea=>Ea.map(Mt=>Mt.id===P.id?{...Mt,startDate:R,endDate:K,...P.segments&&{segments:P.segments}}:Mt.subtasks?{...Mt,subtasks:Ee(Mt.subtasks)}:Mt),kt=Ee(W);kt=Pe.autoScheduleDependents(kt,P.id,ye),kt=br(kt),ve(kt);let Je={...P,startDate:R,endDate:K};ee&&a?.onTaskDateChange?a.onTaskDateChange(P,R,K):Ge?.(Je);},[W,Ge,a]),X0=react.useCallback((P,R)=>{xe?.(P,R),Ye({isOpen:true,x:R.clientX,y:R.clientY,task:P});},[xe]),J0=react.useCallback((P,R)=>{let K=Pe.splitTask(W,P.id,R);ve(K),Ye({isOpen:false,x:0,y:0,task:null});},[W]),Pc=react.useCallback(P=>{let R=Pe.findTaskById(W,P.id)||P;J?.(R),G||At(R);},[W,J,G]),Mc=react.useCallback((P,R,K)=>{let ee=new Map,ye=Mt=>{Mt.forEach(Fa=>{Fa.dependencies&&ee.set(Fa.id,Fa.dependencies),Fa.subtasks&&ye(Fa.subtasks);});};ye(K);let Ee=ee.get(R)||[];ee.set(R,[...Ee,P]);let kt=new Set,Je=new Set,Ea=Mt=>{if(!kt.has(Mt)){kt.add(Mt),Je.add(Mt);let Fa=ee.get(Mt)||[];for(let sr of Fa){if(!kt.has(sr)&&Ea(sr))return true;if(Je.has(sr))return true}}return Je.delete(Mt),false};return Ea(R)},[]),Ac=react.useCallback((P,R)=>{if(Mc(P.id,R,Wo.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Me[M]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:bt,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${pt}`,boxShadow:ct},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${_e}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:tt,border:`1px solid ${Ke}`,color:"#2E94FF"},children:jsxRuntime.jsx(Zp,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:U},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(W=>!W),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:W=>{W.currentTarget.style.background=q,W.currentTarget.style.color=S;},onMouseLeave:W=>{W.currentTarget.style.background="transparent",W.currentTarget.style.color=ne;},children:jsxRuntime.jsx(gv,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:W=>{W.currentTarget.style.background=q,W.currentTarget.style.color=S;},onMouseLeave:W=>{W.currentTarget.style.background="transparent",W.currentTarget.style.color=ne;},children:jsxRuntime.jsx(mv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:le,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:ae.slice(0,4).map((W,ve)=>jsxRuntime.jsx("button",{onClick:()=>sa(W),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:fe,color:Q,border:`1px solid ${_}`},onMouseEnter:$t=>{$t.currentTarget.style.borderColor=$e,$t.currentTarget.style.color="#2E94FF";},onMouseLeave:$t=>{$t.currentTarget.style.borderColor=_,$t.currentTarget.style.color=Q;},children:W.length>30?W.slice(0,30)+"...":W},ve))})]}),g.map(W=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${W.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${W.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:W.role==="user"?ke:De,color:W.role==="user"?"#2E94FF":st,border:W.role==="user"?`1px solid ${Be}`:`1px solid ${He}`},children:[W.isLoading?jsxRuntime.jsx(fv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:W.content}),W.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:W.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:W.command.success?"#10B981":"#EF4444",border:`1px solid ${W.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[W.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:W.command.type.replace(/_/g," ")})]})]})},W.id)),jsxRuntime.jsx("div",{ref:de})]}),jsxRuntime.jsxs("form",{onSubmit:W=>{if(I&&pe.length>0){W.preventDefault();return}Wt(W);},className:"p-3 relative",style:{borderTop:`1px solid ${ot}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&pe.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:J,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Nt,border:`1px solid ${Fe}`,boxShadow:ze,backdropFilter:"blur(12px)"},children:pe.map((W,ve)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>me(W),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ve===F?Y:"transparent",color:he},onMouseEnter:()=>$(ve),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:D,border:`1px solid ${B}`,color:"#2E94FF"},children:W.name.split(" ").map($t=>$t[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:W.name}),W.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:N},children:W.email})]})]},W.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:nt,border:`1px solid ${mt}`},children:[jsxRuntime.jsx("input",{ref:z,type:"text",value:b,onChange:W=>te(W.target.value),onKeyDown:W=>{Ye(W);},placeholder:Ge,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Bt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!b.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:b.trim()?Tt:"transparent",color:b.trim()?"#2E94FF":ut,border:b.trim()?`1px solid ${lt}`:"1px solid transparent"},children:jsxRuntime.jsx(pv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Et,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function em(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(l=>{let m=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:m};if(!u)return {...l,present:m};let g=[...l.past,l.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:u,future:[i.present,...i.future]}});},[]),d=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:l}});},[]),c=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function tm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=d?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&c&&n.key==="y"){n.preventDefault(),t();return}if(d&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var xv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Pe.formatDate(e.startDate)} - ${Pe.formatDate(e.endDate)}`);let a=Pe.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=>Pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function am(e){return {...xv,...e}}var Sv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},nm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:c=true,showExportButton:i=true,projectName:u,availableUsers:l=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:x,persistFilter:b,clearFiltersKey:v,aiAssistant:f,locale:h="en",customTranslations:w,showCreateTaskButton:y=false,createTaskLabel:k,onCreateTask:C,taskFilter:E,onTaskFilterChange:T,toolbarRightContent:I,showBaseline:O,viewMode:F,onViewModeChange:$,projectForecast:z,onThemeChange:de,onTaskClick:A,onTaskDblClick:J,onTaskContextMenu:xe,onTaskUpdate:Ge,onProgressChange:M,onTaskEdit:G,onTaskAddSubtask:ae,onTaskMarkIncomplete:we,onTaskSetInProgress:H,onDependencyCreate:X,onDependencyDelete:Z,onBeforeTaskAdd:ge,onAfterTaskAdd:Le,onBeforeTaskUpdate:Oe,onAfterTaskUpdate:rt,onBeforeTaskDelete:at,onAfterTaskDelete:re,permissions:it,onCopySnapshotLink:Ie}=a,pt=react.useContext(Ks)?.theme,[ct,Ce]=react.useState(pt||s||"dark"),[_e,tt]=react.useState(n),[Ke,U]=react.useState(d),[ne,S]=react.useState(1),[q,le]=react.useState("all"),[fe,_]=react.useState(F||"execution"),Q=F??fe,$e=react.useCallback(P=>{_(P),$?.(P);},[$]),ke=O??Q==="oracle",[Be,De]=react.useState(a.showCriticalPath!==false),[He,st]=react.useState(a.showDependencies!==false),[ot,nt]=react.useState(a.highlightWeekends!==false),mt=react.useCallback(P=>{De(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),Bt=react.useCallback(P=>{st(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),Tt=react.useCallback(P=>{nt(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(_e);},[_e]),react.useEffect(()=>{a.onZoomChange?.(ne);},[ne]);let lt=react.useRef(a.onDateRangeChange);lt.current=a.onDateRangeChange;let ut=react.useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Et,Nt]=react.useState(()=>{if(!b)return "all";try{let P=typeof b=="string"?b:"gantt-filter-state",R=localStorage.getItem(P);if(R){let K=JSON.parse(R);if(K.taskFilter)return K.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),Fe=E??Et,ze=T??Nt,[Y,he]=react.useState(()=>{if(!b)return false;try{let P=typeof b=="string"?b:"gantt-filter-state",R=localStorage.getItem(P);if(R){let K=JSON.parse(R);if(typeof K.hideCompleted=="boolean")return K.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});react.useEffect(()=>{let P=ut();if(P)try{let R={taskFilter:Fe,hideCompleted:Y};localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Fe,Y,ut]);let N=react.useRef(v);react.useEffect(()=>{if(N.current!==v&&v!==void 0){Nt("all"),he(false);let P=ut();if(P)try{localStorage.removeItem(P);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}N.current=v;},[v,ut]);let[D,B]=react.useState(0),[j,se]=react.useState(false),[pe,te]=react.useState(null),[me,Ye]=react.useState({isOpen:false,x:0,y:0,task:null}),[qe,At]=react.useState(null),[Wt,sa]=react.useState(null);react.useEffect(()=>{pt&&pt!==ct&&Ce(pt);},[pt]),react.useEffect(()=>{s&&s!==ct&&Ce(s);},[s]);let Me=react.useCallback(P=>{Ce(P),de?.(P);},[de]),{state:W,setState:ve,undo:$t,redo:L,canUndo:ce,canRedo:Re,clearHistory:je}=em(t,50),ht=react.useMemo(()=>{let P=(R,K=0)=>{let ee=K;for(let ye of R)ye.subtasks?.length&&(ee=Math.max(ee,P(ye.subtasks,K+1)));return ee};return P(W)+1},[W]),Ua=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),aa=react.useRef(new Map),nr=react.useRef(false);if(!nr.current&&x){nr.current=true;let P=typeof x=="string"?x:"gantt-expanded-tasks";try{let R=localStorage.getItem(P);if(R){let K=JSON.parse(R);Array.isArray(K)&&(aa.current=new Map(K));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let ia=react.useCallback(()=>{let P=Ua();if(P)try{let R=Array.from(aa.current.entries());localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[Ua]),la=react.useRef(0),Wo=react.useRef(W);react.useEffect(()=>{Wo.current=W;},[W]);let Go=react.useRef(false),Cc=react.useCallback(P=>{le(P),la.current+=1,ve(R=>{let K=(ye,Ee=0)=>ye.map(kt=>{let Je=P==="all"||Ee<P-1;return kt.subtasks?.length&&aa.current.set(kt.id,Je),{...kt,isExpanded:Je,subtasks:kt.subtasks?K(kt.subtasks,Ee+1):void 0}}),ee=K(R);return ia(),ee});},[ve,ia]);react.useEffect(()=>{if(la.current>0){la.current-=1;return}let P=K=>{let ee=new Map;for(let ye of K){let Ee=ye.id;ee.get(Ee)||ee.set(Ee,ye);}return Array.from(ee.values())},R=K=>K.map(ee=>{let ye=aa.current.get(ee.id),Ee=ye!==void 0?{...ee,isExpanded:ye}:ee;if(Ee.subtasks?.length){let kt=P(Ee.subtasks);return {...Ee,subtasks:R(kt)}}return Ee});if(aa.current.size>0)ve(br(R(t)));else {let K=ee=>ee.map(ye=>ye.subtasks?.length?{...ye,subtasks:P(K(ye.subtasks))}:ye);ve(br(K(t)));}},[t,ve]);let us=react.useRef(t),Tc=react.useRef(true);react.useEffect(()=>{if(Tc.current){Tc.current=false,us.current=W;return}if(Go.current){Go.current=false,us.current=W;return}if(!r)return;let P=JSON.stringify(us.current),R=JSON.stringify(W);P!==R&&(us.current=W,r(W));},[W,r]);let Wa=react.useMemo(()=>ed(h,w),[h,w]),R0=react.useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Vo,Gi]=react.useState(()=>R0(Wa));react.useEffect(()=>{Gi(P=>P.map(R=>({...R,label:Wa.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Wa]);let ps=react.useMemo(()=>Vo.filter(R=>R.visible).reduce((R,K)=>R+K.width,0),[Vo]),Nc=react.useRef(Vo.filter(P=>P.visible).map(P=>P.id).join(","));react.useEffect(()=>{let P=Vo.filter(ee=>ee.visible),R=P.map(ee=>ee.id).join(","),K=Nc.current;if(R!==K){let ee=P.some(Ee=>Ee.id!=="name"),ye=K.includes(",");ee?!ye&&ee&&te(null):te(null),Nc.current=R;}},[Vo]);let Dc=60,Sc=.6,O0=react.useMemo(()=>{let R=ps+Dc,K=typeof window<"u"?window.innerWidth*Sc:800,ee=Math.max(R,K);return pe!==null?Math.max(200,Math.min(pe,ee)):Math.max(200,R)},[pe,ps]),eo=react.useRef(null),ms=react.useRef(null),Ar=react.useRef(null),Tn=react.useRef(null),Xt=react.useMemo(()=>Cp(ct),[ct]),$0=react.useMemo(()=>({theme:Xt,themeName:ct}),[Xt,ct]),Ec=react.useMemo(()=>am(m),[m]),Vi=react.useMemo(()=>{if(!g)return W;let P=Pe.calculateCriticalPath(W),R=K=>K.map(ee=>({...ee,isCriticalPath:P.includes(ee.id),subtasks:ee.subtasks?R(ee.subtasks):void 0}));return R(W)},[W,g]),Fc=react.useMemo(()=>{if(Fe==="all"&&!Y)return Vi;let P=R=>{let K=[];for(let ee of R){let ye=ee.subtasks?.length?P(ee.subtasks):void 0,Ee=false;if(Y)Ee=ee.progress<100;else switch(Fe){case "all":Ee=true;break;case "incomplete":Ee=ee.progress<100;break;case "in_progress":Ee=ee.progress>0&&ee.progress<100;break;case "completed":Ee=ee.progress===100;break}(Ee||ye&&ye.length>0)&&K.push({...ee,subtasks:ye});}return K};return P(Vi)},[Vi,Fe,Y]),gs=Sv(Ke);tm({undo:$t,redo:L,canUndo:ce,canRedo:Re,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>Pe.findTaskById(W,P),addTask:(P,R)=>{ve(K=>{if(!R)return [...K,{...P,level:0}];let ee=ye=>ye.map(Ee=>Ee.id===R?{...Ee,subtasks:[...Ee.subtasks||[],{...P,parentId:R,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:ee(Ee.subtasks)}:Ee);return ee(K)});},updateTask:(P,R)=>{ve(K=>{let ee=ye=>ye.map(Ee=>Ee.id===P?{...Ee,...R}:Ee.subtasks?{...Ee,subtasks:ee(Ee.subtasks)}:Ee);return ee(K)});},deleteTask:P=>{ve(R=>{let K=ee=>ee.filter(ye=>ye.id===P?false:(ye.subtasks&&(ye.subtasks=K(ye.subtasks)),true));return K(R)});},deleteTasks:P=>{ve(R=>id(R,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let R=Pe.findTaskById(W,P);R&&a.onTaskDuplicate(R);}else ve(R=>Vn(R,[P]).tasks);},splitTask:(P,R,K=3)=>{ve(ee=>Pe.splitTask(ee,P,R,K));},calculateEndDate:Pe.calculateEndDate,calculateDuration:Pe.calculateDuration,validateDependency:(P,R)=>!Pe.validateDependencies(W,P,R),getAllTasks:()=>Pe.flattenTasks(W),getTasksByStatus:P=>Pe.flattenTasks(W).filter(R=>R.status===P),getTasksByParent:P=>P?Pe.findTaskById(W,P)?.subtasks||[]:W.filter(K=>!K.parentId),getCriticalPath:()=>Pe.flattenTasks(W).filter(P=>P.isCriticalPath),indentTask:P=>{ve(R=>br(od(R,[P])));},outdentTask:P=>{ve(R=>br(nd(R,[P])));},moveTask:(P,R)=>{ve(K=>sd(K,[P],R));},createSubtask:async P=>{let{tasks:R,newTask:K}=cd(W,P);if(ge){let ee=ge({...K,parentId:P});if((ee instanceof Promise?await ee:ee)===false)return}ve(br(R)),Le&&Le({...K,parentId:P});},scrollToTask:P=>{let K=Pe.flattenTasks(W).findIndex(ee=>ee.id===P);if(K!==-1&&eo.current){let ee=K*gs;eo.current.scrollTo({top:ee,behavior:"smooth"}),Ar.current&&Ar.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(P,R=2e3)=>{},expandTask:P=>{ve(R=>{let K=ee=>ee.map(ye=>ye.id===P?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye);return K(R)});},collapseTask:P=>{ve(R=>{let K=ee=>ee.map(ye=>ye.id===P?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye);return K(R)});},expandAll:()=>{ve(P=>{let R=K=>K.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?R(ee.subtasks):void 0}));return R(P)});},collapseAll:()=>{ve(P=>{let R=K=>K.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?R(ee.subtasks):void 0}));return R(P)});},collapseToLevel:P=>{Cc(P);},undo:$t,redo:L,canUndo:()=>ce,canRedo:()=>Re,clearHistory:je,exportToPNG:async()=>{if(!Tn.current||!eo.current||!Ar.current)throw new Error("Gantt container not found");let P=Tn.current,R=eo.current,K=ms.current||R.querySelector(".gantt-grid-scroll"),ee=Ar.current,ye=K?.scrollTop||0,Ee=ee.scrollTop,kt=P.style.overflow,Je=P.style.height,Ea=R.style.overflow;try{let Mt=K?.querySelector(".gantt-taskgrid-content"),Fa=ee.querySelector("svg"),sr=Mt?.scrollHeight||K?.scrollHeight||600,ko=Fa?.getBoundingClientRect().height||ee.scrollHeight,Dn=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(sr,ko)+20;K&&(K.scrollTop=0),ee.scrollTop=0,P.style.overflow="visible",P.style.height=`${Dn}px`,R.style.overflow="visible",await new Promise(Yo=>setTimeout(Yo,100));let to=await htmlToImage.toPng(P,{backgroundColor:Xt.bgPrimary,pixelRatio:2,filter:Yo=>{if(!(Yo instanceof Element))return !0;let hs=window.getComputedStyle(Yo),Sn=parseInt(hs.zIndex,10);return (isNaN(Sn)||Sn<50)&&hs.position!=="fixed"}});return await(await fetch(to)).blob()}finally{P.style.overflow=kt,P.style.height=Je,R.style.overflow=Ea,K&&(K.scrollTop=ye),ee.scrollTop=Ee;}},exportToPDF:async P=>{await Pe.exportToPDF(W,P);},exportToExcel:async P=>{await Pe.exportToExcel(W,P);},exportToJSON:()=>Pe.exportToJSON(W),exportToCSV:()=>Pe.exportToCSV(W),importFromJSON:P=>{let R=Pe.importFromJSON(P);ve(R);},getTasks:()=>W,refresh:()=>{ve(P=>[...P]);},clearAll:()=>{ve([]);}}),[W,$t,L,ce,Re,je,Xt,gs]);let H0=react.useCallback(P=>{Gi(R=>R.map(K=>K.id===P?{...K,visible:!K.visible}:K));},[]),z0=react.useCallback((P,R)=>{Gi(K=>K.map(ee=>{if(ee.id!==P)return ee;let ye=ee.minWidth??100,Ee=ee.maxWidth??800,kt=Math.max(ye,Math.min(Ee,R));return {...ee,width:kt}}));},[]),U0=react.useCallback(P=>{ve(R=>{let K=dd(R,P),ee=ye=>{for(let Ee of ye){if(Ee.id===P){aa.current.set(P,Ee.isExpanded??true);return}Ee.subtasks?.length&&ee(Ee.subtasks);}};return ee(K),ia(),K}),a.onTaskToggleExpand?.(P);},[a,ia]),_o=react.useCallback((P,R)=>{if(Oe&&Oe(P,R)===false)return;let ee=Pe.findTaskById(W,P)?.progress,ye=kt=>kt.map(Je=>Je.id===P?{...Je,...R}:Je.subtasks?{...Je,subtasks:ye(Je.subtasks)}:Je);ve(ye(W));let Ee=Pe.findTaskById(ye(W),P);Ee&&(Ge?.(Ee),rt?.(Ee),R.progress!==void 0&&ee!==void 0&&R.progress!==ee&&M?.(P,ee,R.progress));},[W,Ge,Oe,rt,M]),W0=react.useCallback(P=>{P.length!==0&&(la.current+=1,Go.current=true,ve(R=>br(od(R,P))),a.onTaskIndent?.(P[0]));},[a]),G0=react.useCallback(P=>{P.length!==0&&(la.current+=1,Go.current=true,ve(R=>br(nd(R,P))),a.onTaskOutdent?.(P[0]));},[a]),V0=react.useCallback((P,R,K)=>{la.current+=1,Go.current=true,ve(ee=>br(Up(ee,P,R,K))),a.onTaskReparent?.(P,R,K);},[a]),_0=react.useCallback((P,R)=>{P.length!==0&&(la.current+=1,Go.current=true,ve(K=>sd(K,P,R)),a.onTaskMove?.(P[0],R));},[a]),_i=react.useCallback(async P=>{let R=[];for(let K of P)at&&await Promise.resolve(at(K))===false||R.push(K);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(ve(K=>br(id(K,R))),R.forEach(K=>a.onTaskDelete?.(K))),re&&R.forEach(K=>re(K)));},[a,at,re]),j0=react.useCallback(P=>{a.onTaskDuplicate?P.forEach(R=>{let K=Pe.findTaskById(W,R);K&&a.onTaskDuplicate(K);}):ve(R=>Vn(R,P).tasks);},[a,W]),K0=react.useCallback((P,R)=>{ve(K=>{let{tasks:ee,newTask:ye}=zp(K,P,R);return ge&&ge(ye)===false?K:(a.onTaskCreate?.(ye.parentId,ye.position||0),Le?.(ye),ee)});},[a,ge,Le]),Y0=react.useCallback((P,R)=>{ve(K=>ld(K,P,R)),a.onTaskRename?.(P,R);},[a]),ji=react.useCallback(P=>{let{onTaskAddSubtask:R}=a;if(R){let K=ei(W,P);if(K){R(K);return}}ve(K=>{let{tasks:ee}=cd(K,P);return a.onTaskCreate?.(P,0),ee});},[a,W]),q0=react.useCallback((P,R,K)=>{let ee=!P.startDate&&!P.endDate,ye=P.startDate?Math.round((R.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,Ee=Ea=>Ea.map(Mt=>Mt.id===P.id?{...Mt,startDate:R,endDate:K,...P.segments&&{segments:P.segments}}:Mt.subtasks?{...Mt,subtasks:Ee(Mt.subtasks)}:Mt),kt=Ee(W);kt=Pe.autoScheduleDependents(kt,P.id,ye),kt=br(kt),ve(kt);let Je={...P,startDate:R,endDate:K};ee&&a?.onTaskDateChange?a.onTaskDateChange(P,R,K):Ge?.(Je);},[W,Ge,a]),X0=react.useCallback((P,R)=>{xe?.(P,R),Ye({isOpen:true,x:R.clientX,y:R.clientY,task:P});},[xe]),J0=react.useCallback((P,R)=>{let K=Pe.splitTask(W,P.id,R);ve(K),Ye({isOpen:false,x:0,y:0,task:null});},[W]),Pc=react.useCallback(P=>{let R=Pe.findTaskById(W,P.id)||P;J?.(R),G||At(R);},[W,J,G]),Mc=react.useCallback((P,R,K)=>{let ee=new Map,ye=Mt=>{Mt.forEach(Fa=>{Fa.dependencies&&ee.set(Fa.id,Fa.dependencies),Fa.subtasks&&ye(Fa.subtasks);});};ye(K);let Ee=ee.get(R)||[];ee.set(R,[...Ee,P]);let kt=new Set,Je=new Set,Ea=Mt=>{if(!kt.has(Mt)){kt.add(Mt),Je.add(Mt);let Fa=ee.get(Mt)||[];for(let sr of Fa){if(!kt.has(sr)&&Ea(sr))return true;if(Je.has(sr))return true}}return Je.delete(Mt),false};return Ea(R)},[]),Ac=react.useCallback((P,R)=>{if(Mc(P.id,R,Wo.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let K=ee=>ee.map(ye=>{if(ye.id===R){let Ee=ye.dependencies||[];if(!Ee.includes(P.id))return {...ye,dependencies:[...Ee,P.id]}}return ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye});la.current+=1,ve(ee=>K(ee)),X?.(P.id,R);},[X,Mc]),Lc=react.useCallback((P,R)=>{let K=ee=>ee.map(ye=>{if(ye.id===P&&ye.dependencies){let Ee=ye.dependencies.filter(kt=>kt!==R);return {...ye,dependencies:Ee}}return ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye});la.current+=1,ve(ee=>K(ee)),Z?.(P,R);},[Z]),{startDate:jo,endDate:Ki}=react.useMemo(()=>{let P=W.filter(Ee=>Ee.startDate&&Ee.endDate);if(P.length===0){let Ee=new Date,kt=new Date(Ee);kt.setDate(kt.getDate()-30);let Je=new Date(Ee);return Je.setDate(Je.getDate()+60),{startDate:kt,endDate:Je}}let R=P.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),K=new Date(Math.min(...R.map(Ee=>Ee.getTime()))),ee=new Date(Math.max(...R.map(Ee=>Ee.getTime()))),ye=_e==="day"?7:_e==="week"?14:30;return K.setDate(K.getDate()-ye),ee.setDate(ee.getDate()+ye),{startDate:K,endDate:ee}},[W,_e]);react.useEffect(()=>{lt.current?.(jo,Ki);},[jo,Ki]);let Q0=react.useCallback(async()=>{if(!Tn.current||!eo.current||!Ar.current)return;await new Promise(Dn=>setTimeout(Dn,200));let P=Tn.current,R=eo.current,K=ms.current||R.querySelector(".gantt-grid-scroll"),ee=Ar.current,ye=K?.scrollTop||0,Ee=K?.scrollLeft||0,kt=ee.scrollTop,Je=ee.scrollLeft,Ea=P.style.overflow,Mt=P.style.height,Fa=K?.style.overflow||"",sr=ee.style.overflow,ko=R.style.overflow,fs=P.style.width,bs=ee.style.width;try{let Dn=K?.querySelector(".gantt-taskgrid-content"),to=ee.querySelector("svg"),qi=to?.getAttribute("height")?parseInt(to.getAttribute("height"),10):to?.getBoundingClientRect().height||0,Yo=Dn?.scrollHeight||K?.scrollHeight||600,hs=Math.max(qi,ee.scrollHeight),Sn=to?.getAttribute("width")?parseInt(to.getAttribute("width"),10):to?.getBoundingClientRect().width||ee.scrollWidth,sf=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Xi=Math.max(Yo,hs,qi),Rc=sf+Xi+50,Oc=(K?.offsetWidth||R.offsetWidth||300)+Sn+10;K&&(K.scrollTop=0,K.scrollLeft=0),ee.scrollTop=0,ee.scrollLeft=0,P.style.overflow="visible",P.style.height=`${Rc}px`,P.style.width=`${Oc}px`,R.style.overflow="visible",K&&(K.style.overflow="visible",K.style.height=`${Xi+50}px`),ee.style.overflow="visible",ee.style.height=`${Xi+50}px`,ee.style.width=`${Sn+10}px`,await new Promise(ys=>setTimeout(ys,150));let lf=await htmlToImage.toPng(P,{backgroundColor:Xt.bgPrimary,pixelRatio:2,width:Oc,height:Rc,skipFonts:!1,filter:ys=>{if(!(ys instanceof Element))return !0;let $c=window.getComputedStyle(ys),Hc=parseInt($c.zIndex,10);return !(!isNaN(Hc)&&Hc>=50||$c.position==="fixed")}}),Ji=document.createElement("a");Ji.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Ji.href=lf,Ji.click();}finally{P.style.overflow=Ea,P.style.height=Mt,P.style.width=fs,R.style.overflow=ko,K&&(K.style.overflow=Fa,K.style.height="",K.scrollTop=ye,K.scrollLeft=Ee),ee.style.overflow=sr,ee.style.height="",ee.style.width=bs,ee.scrollTop=kt,ee.scrollLeft=Je;}},[Xt]),Z0=react.useCallback(async()=>{await Pe.exportToPDF(W);},[W]),ef=react.useCallback(async()=>{let P=new Date,R=ye=>String(ye).padStart(2,"0"),K=`${P.getFullYear()}-${R(P.getMonth()+1)}-${R(P.getDate())}_${R(P.getHours())}${R(P.getMinutes())}`,ee=u?u.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Pe.exportToExcel(W,`${ee}_${K}.xlsx`);},[W,u]),tf=react.useCallback(()=>{let P=Pe.exportToCSV(W),R=new Blob([P],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(R),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[W]),af=react.useCallback(()=>{let P=Pe.exportToJSON(W),R=new Blob([P],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(R),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[W]),rf=react.useCallback(()=>{Pe.exportToMSProject(W,"Gantt Project","project.xml");},[W]),of=P=>{P.preventDefault(),se(true);},Ko=react.useRef(false),[Yi,Ic]=react.useState(false),Nn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let P=Ar.current,R=eo.current?.querySelector(".gantt-grid-scroll");if(!P||!R)return;let K=()=>{if(Ko.current)return;Ko.current=true;let Je=P.scrollTop;B(Je),R.scrollTop=Je,requestAnimationFrame(()=>{Ko.current=false;});},ee=()=>{if(Ko.current)return;Ko.current=true;let Je=R.scrollTop;B(Je),P.scrollTop=Je,requestAnimationFrame(()=>{Ko.current=false;});},ye=Je=>{if(j&&R){let Mt=R.parentElement?.getBoundingClientRect()?.left||0,Fa=Je.clientX-Mt,sr=200,ko=ps+Dc,fs=window.innerWidth*Sc,bs=Math.max(ko,fs);Fa>=sr&&Fa<=bs&&te(Fa);}if(Yi&&P){let Ea=Je.clientX-Nn.current.x,Mt=Je.clientY-Nn.current.y;P.scrollLeft=Nn.current.scrollLeft-Ea,P.scrollTop=Nn.current.scrollTop-Mt;}},Ee=()=>{se(false),Ic(false);},kt=Je=>{if(Je.button!==0)return;let Ea=Je.target;Ea.closest("[data-task-bar]")||Ea.closest("[data-dependency-line]")||Ea.closest("button")||Ea.closest('[role="button"]')||Ea.tagName==="rect"&&Ea.getAttribute("data-clickable")==="true"||(Ic(true),Nn.current={x:Je.clientX,y:Je.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},Je.preventDefault());};return P.addEventListener("scroll",K),R.addEventListener("scroll",ee),P.addEventListener("mousedown",kt),document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Ee),()=>{P.removeEventListener("scroll",K),R.removeEventListener("scroll",ee),P.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Ee);}},[j,Yi,ps]);let Bc=react.useRef(false),nf=react.useRef(null);return react.useLayoutEffect(()=>{if(Bc.current||W.length===0||!Ar.current)return;Bc.current=true,nf.current=jo;let P=Ar.current,R=new Date,K=_e==="day"?60:_e==="week"?20:8,ee=(R.getTime()-jo.getTime())/(1e3*60*60*24),ye=P.clientWidth,kt=ee*K*ne-ye/2;ee>=0&&ye>0&&(P.scrollLeft=Math.max(0,kt));},[W.length,jo,_e,ne]),jsxRuntime.jsx(ln.Provider,{value:Wa,children:jsxRuntime.jsx(al.Provider,{value:$0,children:jsxRuntime.jsxs("div",{ref:Tn,className:"flex flex-col h-full w-full",style:{backgroundColor:Xt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Xt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Xt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(Qs,{theme:Xt,timeScale:_e,onTimeScaleChange:tt,zoom:ne,onZoomChange:S,currentTheme:ct,onThemeChange:Me,rowDensity:Ke,onRowDensityChange:U,showThemeSelector:c,showCreateTaskButton:y&&it?.canCreateTask!==false&&!it?.canCreateSubtaskOnly,createTaskLabel:k,onCreateTask:C,taskFilter:Fe,onTaskFilterChange:We,hideCompleted:Y,onHideCompletedChange:he,toolbarRightContent:I,wbsLevel:q,onWbsLevelChange:Cc,maxWbsDepth:ht,viewMode:Q,onViewModeChange:$e,projectForecast:z,onExportPNG:i?Q0:void 0,onExportPDF:i?Z0:void 0,onExportExcel:i?ef:void 0,onExportCSV:i?tf:void 0,onExportJSON:i?af:void 0,onExportMSProject:i?rf:void 0,showCriticalPath:Be,onShowCriticalPathChange:mt,showDependencies:He,onShowDependenciesChange:Bt,highlightWeekends:ot,onHighlightWeekendsChange:Tt,showBaseline:ke,onShowBaselineChange:P=>{P&&Q!=="oracle"&&$e("oracle"),!P&&Q==="oracle"&&$e("execution");},onCopySnapshotLink:Ie})}),jsxRuntime.jsxs("div",{ref:eo,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:ms,className:"gantt-grid-scroll flex-shrink-0",style:{width:O0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ai,{tasks:Fc,theme:Xt,rowHeight:gs,availableUsers:l,templates:Ec,onTaskClick:A,onTaskDblClick:Pc,onTaskContextMenu:xe,onTaskToggle:U0,scrollTop:D,columns:Vo,onToggleColumn:H0,onColumnResize:z0,onTaskUpdate:_o,onTaskIndent:W0,onTaskOutdent:G0,onTaskMove:_0,onMultiTaskDelete:_i,onTaskDuplicate:j0,onTaskCreate:K0,onTaskRename:Y0,onCreateSubtask:ji,onOpenTaskModal:A?P=>A(P):void 0,onDeleteRequest:(P,R)=>sa({taskId:P,taskName:R}),onTaskReparent:V0,scrollContainerRef:ms})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Xt.border,zIndex:15},onMouseDown:of}),jsxRuntime.jsx("div",{ref:Ar,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Yi?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(pi,{tasks:Fc,theme:Xt,rowHeight:gs,timeScale:_e,startDate:jo,endDate:Ki,zoom:ne,locale:h,templates:Ec,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:A,onTaskDblClick:Pc,onTaskContextMenu:X0,onTaskDateChange:q0,onDependencyCreate:Ac,onDependencyDelete:Lc,showBaseline:ke,showCriticalPath:Be,showDependencies:He,highlightWeekends:ot,canEditTask:it?.canEditTask})})]}),me.task&&jsxRuntime.jsx(un,{isOpen:me.isOpen,x:me.x,y:me.y,theme:Xt,onClose:()=>Ye({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=me.task;if(!P)return [];let R=Pe.findTaskById(W,P.id)||P,K=R.subtasks&&R.subtasks.length>0,ee=it?.canCreateTask!==false,ye=it?.canDeleteTask!==false;if(K){let Mt=[],Fa=it?.canDuplicateTask!==false;return ee&&Mt.push({id:"addSubtask",label:Wa.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{ae?ae(R):ji(R.id);}}),Fa&&Mt.push({id:"duplicate",label:Wa.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ve(sr=>Vn(sr,[R.id]).tasks),Ye({isOpen:false,x:0,y:0,task:null});}}),ye&&(Mt.length>0&&Mt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Mt.push({id:"delete",label:Wa.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{sa({taskId:R.id,taskName:R.name});}})),Mt}let Ee=it?.canUpdateTask!==false,kt=it?.canDuplicateTask!==false,Je=[];return Ee&&Je.push({id:"edit",label:Wa.contextMenu?.editTask||"Edit Task",icon:Vt.Pencil,onClick:()=>{G?G(R):At(R);}}),ee&&Je.push({id:"addSubtask",label:Wa.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{ae?ae(R):ji(R.id);}}),Je.length>0&&Ee&&Je.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ee&&(Je.push({id:"markIncomplete",label:Wa.contextMenu?.markIncomplete||"Mark Incomplete",icon:Vt.MarkIncomplete,onClick:()=>{we?we(R):_o(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),Je.push({id:"setInProgress",label:Wa.contextMenu?.setInProgress||"Set In Progress",icon:Vt.SetInProgress,onClick:()=>{H?H(R):_o(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),Je.push({id:"markComplete",label:Wa.contextMenu?.markComplete||"Mark Complete",icon:Vt.MarkComplete,onClick:()=>{_o(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(kt||Ee&&R.startDate&&R.endDate)&&Je.length>0&&Je.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),kt&&Je.push({id:"duplicate",label:Wa.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ve(Mt=>Vn(Mt,[R.id]).tasks),Ye({isOpen:false,x:0,y:0,task:null});}}),Ee&&R.startDate&&R.endDate&&Je.push({id:"split",label:Wa.contextMenu?.splitTask||"Split Task",icon:Vt.Split,onClick:()=>{let Mt=R.startDate.getTime(),Fa=R.endDate.getTime(),sr=Mt+(Fa-Mt)/2,ko=new Date(sr);J0(R,ko);}}),ye&&(Je.length>0&&Je.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Je.push({id:"delete",label:Wa.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{sa({taskId:R.id,taskName:R.name});}})),Je})()}),jsxRuntime.jsx(Kr,{task:qe,isOpen:!!qe,onClose:()=>At(null),onTaskUpdate:P=>{qe&&(_o(qe.id,P),At(null));},theme:ct==="light"?"light":"dark",locale:h==="es"?"es":"en",availableUsers:l,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jt&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>sa(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Xt.bgSecondary,border:`1px solid ${Xt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Xt.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:Xt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Wa.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Xt.textSecondary,fontFamily:"Inter, sans-serif"},children:h==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:Xt.textSecondary,fontFamily:"Inter, sans-serif"},children:[h==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Xt.textPrimary},children:['"',jt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Xt.bgPrimary,borderTop:`1px solid ${Xt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>sa(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Xt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Xt.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:h==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{_i([jt.taskId]),sa(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:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),h==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(fi,{tasks:W,theme:Xt,config:f,onTasksUpdate:ve,onTaskUpdate:_o,onTaskCreate:P=>{ve(R=>[...R,P]);},onTaskDelete:P=>{_i([P]);},onDependencyCreate:(P,R)=>{let K=Pe.findTaskById(W,P);K&&Ac(K,R);},onDependencyDelete:Lc})]})})})});function $v(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 Hv(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 d=parseInt(a[1],10),c=parseInt(a[2],10);return d*60+c}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)*60:null}var md=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],gd=[{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 dm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:l,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:x,defaultStatus:b}){let v=[...md,...i.filter(S=>!md.some(q=>q.id===S.id))],f=Qe[c]||Qe.dark,[h,w]=react.useState(false),[y,k]=react.useState(false),[C,E]=react.useState(false),[T,I]=react.useState(false),[O,F]=react.useState({top:0,left:0}),[$,z]=react.useState(null),[de,A]=react.useState(new Date),[J,xe]=react.useState({top:0,left:0}),[Ge,M]=react.useState(false),[G,ae]=react.useState([]),[we,H]=react.useState(false),[X,Z]=react.useState(""),ge=react.useRef(null),Le=react.useRef(null),Oe=react.useRef(null),rt=react.useRef(null),at=react.useRef(null),[re,it]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[Ie,bt]=react.useState({});react.useEffect(()=>{a?(it({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||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&M(true)):(it({name:"",description:"",progress:0,status:b||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),M(false),ae([]));},[a,e,b]),react.useEffect(()=>{let S=q=>{ge.current&&!ge.current.contains(q.target)&&w(false),Le.current&&!Le.current.contains(q.target)&&k(false),Oe.current&&!Oe.current.contains(q.target)&&E(false),rt.current&&!rt.current.contains(q.target)&&I(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let pt=()=>{let S={};return re.name.trim()||(S.name="El nombre es requerido"),re.startDate&&re.endDate&&re.startDate>re.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),bt(S),Object.keys(S).length===0},ct=async S=>{if(S.preventDefault(),!!pt())try{let q=d==="create"&&G.length>0?{...re,pendingFiles:G}:re;await s(q),ae([]),t();}catch(q){console.error("Error submitting task:",q);}},Ce=(S,q)=>{it(le=>{let fe={...le,[S]:q};if(S==="status"){let _=q;_==="todo"?fe.progress=0:_==="in-progress"?(le.progress===0||le.progress===100)&&(fe.progress=50):_==="completed"||_==="closed"?fe.progress=100:(_==="in-review"||_==="review")&&(fe.progress=75);}if(S==="progress"){let _=typeof q=="number"?q:parseInt(q,10);_===100&&le.status!=="completed"?fe.status="completed":_>0&&_<100&&le.status==="todo"?fe.status="in-progress":_===0&&le.status!=="todo"&&(fe.status="todo");}return fe}),Ie[S]&&bt(le=>{let fe={...le};return delete fe[S],fe});},_e=v.find(S=>S.id===re.status)??md[0],tt=gd.find(S=>S.id===re.priority)??gd[1],Ke=Eo.find(S=>S.value===re.color)??Eo[0],U=c==="dark",ne={backgroundColor:U?"#141414":f.bgSecondary,border:`1px solid ${U?"#262626":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:U?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,WebkitBackdropFilter:U?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:U?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:_e.color||f.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=f.hoverBg,S.currentTarget.style.color=f.textPrimary;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:ct,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:re.name,onChange:S=>Ce("name",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:re.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Ie.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Ie.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:re.description||"",onChange:S=>Ce("description",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:ge,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ne,borderColor:_e.color,backgroundColor:`${_e.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:_e.color}}),jsxRuntime.jsx("span",{style:{color:_e.color},children:_e.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:_e.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(S=>jsxRuntime.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:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",S.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,re.status===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),jsxRuntime.jsxs("div",{ref:Le,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:tt.color}}),jsxRuntime.jsx("span",{children:tt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:gd.map(S=>jsxRuntime.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:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",S.id),k(false);},children:[jsxRuntime.jsx("span",{children:S.icon}),S.label,re.priority===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Oe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&E(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[re.assignees&&re.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:re.assignees.slice(0,3).map((S,q)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:S.color||f.accent,borderColor:f.bgSecondary},children:S.initials},q))}),re.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",re.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(S=>{let q=re.assignees?.some(le=>le.name===S.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{let le=q?(re.assignees||[]).filter(fe=>fe.name!==S.name):[...re.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(fe=>fe[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("assignees",le);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:S.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},S.id)})})})]}),jsxRuntime.jsxs("div",{ref:rt,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)I(false);else {if(rt.current){let S=rt.current.getBoundingClientRect(),q=window.innerHeight,le=120,_=q-S.bottom<le?S.top-le-8:S.bottom+8;F({top:_,left:S.left});}I(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:re.color}}),jsxRuntime.jsx("span",{children:Ke.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${O.top}px`,left:`${O.left}px`,zIndex:99999,backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Eo.slice(0,18).map(S=>{let q=re.color===S.value;return jsxRuntime.jsx("button",{type:"button",onClick:le=>{le.preventDefault(),le.stopPropagation(),Ce("color",S.value),I(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:q?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),u.length>0||l?jsxRuntime.jsx(no,{selectedTags:re.tags||[],availableTags:u,onChange:S=>Ce("tags",S),onCreateTag:l,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{ref:at,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if($==="start")z(null);else {if(at.current){let S=at.current.getBoundingClientRect(),q=window.innerHeight,le=320,_=q-S.bottom<le?S.top-le-8:S.bottom+8;xe({top:_,left:S.left});}z("start"),A(re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.startDate?re.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if($==="end")z(null);else {if(at.current){let S=at.current.getBoundingClientRect(),q=window.innerHeight,le=320,_=q-S.bottom<le?S.top-le-8:S.bottom+8;xe({top:_,left:S.left});}z("end"),A(re.endDate||re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.endDate?re.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>z(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${J.top}px`,left:`${J.left}px`,zIndex:99999,backgroundColor:U?"#0a0a0a":f.bgPrimary,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${U?"#262626":f.border}`},children:[(()=>{let S=new Date,q=new Date(S);q.setDate(S.getDate()+1);let le=new Date(S);le.setDate(S.getDate()+7);let fe=new Date(S);return fe.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:le},{label:"2 semanas",date:fe}].map((Q,$e)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:ke=>ke.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ke=>ke.currentTarget.style.backgroundColor="transparent",onClick:()=>{$==="start"?(Ce("startDate",Q.date),(!re.endDate||Q.date>re.endDate)&&Ce("endDate",Q.date),z("end")):(Ce("endDate",Q.date),(!re.startDate||Q.date<re.startDate)&&Ce("startDate",Q.date),z(null));},children:Q.label},$e))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("endDate",void 0),z(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(de.getFullYear(),de.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:de.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(de.getFullYear(),de.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((S,q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:S},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=de.getFullYear(),q=de.getMonth(),le=new Date(S,q,1).getDay(),fe=new Date(S,q+1,0).getDate(),_=new Date,Q=[];for(let ke=le-1;ke>=0;ke--)Q.push({day:new Date(S,q,-ke).getDate(),date:new Date(S,q-1,new Date(S,q,-ke).getDate()),isCurrentMonth:false});for(let ke=1;ke<=fe;ke++)Q.push({day:ke,date:new Date(S,q,ke),isCurrentMonth:true});let $e=42-Q.length;for(let ke=1;ke<=$e;ke++)Q.push({day:ke,date:new Date(S,q+1,ke),isCurrentMonth:false});return Q.map((ke,Be)=>{let De=ke.date.toDateString()===_.toDateString(),He=re.startDate?.toDateString()===ke.date.toDateString(),st=re.endDate?.toDateString()===ke.date.toDateString(),ot=re.startDate&&re.endDate&&ke.date>=re.startDate&&ke.date<=re.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ke.isCurrentMonth?He||st?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:He?f.accent:st?"#7C3AED":ot?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:De&&!He&&!st?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{$==="start"?(Ce("startDate",ke.date),re.endDate&&ke.date>re.endDate&&Ce("endDate",ke.date),z("end")):(Ce("endDate",ke.date),re.startDate&&ke.date<re.startDate&&Ce("startDate",ke.date),z(null));},children:ke.day},Be)})})()})]})]})]})})]}),Ie.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Ie.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:re.progress,onChange:S=>Ce("progress",parseInt(S.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"}20`,color:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[re.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>M(!Ge),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Ge?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:re.effortMinutes?$v(re.effortMinutes):"",onChange:S=>{let q=Hv(S.target.value);Ce("effortMinutes",q);},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}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||d==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",d==="create"?G.length>0&&`(${G.length})`:m.length>0&&`(${m.length})`]})]}),d==="create"?jsxRuntime.jsx(Or,{cardId:"pending",attachments:G.map((S,q)=>({id:`pending-${q}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>ae(q=>[...q,...S]),onDelete:S=>{let q=parseInt(S.replace("pending-",""),10);ae(le=>le.filter((fe,_)=>_!==q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Or,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:x,maxSizeMB:10,maxFiles:20}),d==="create"&&G.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[G.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:re.isMilestone,onChange:S=>Ce("isMilestone",S.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),re.dependencies&&re.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:re.dependencies.map(S=>{let q=r.find(le=>le.id===S);return jsxRuntime.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:[q?.name||S.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let le=(re.dependencies||[]).filter(fe=>fe!==S);Ce("dependencies",le);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{H(!we),Z("");},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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{H(false),Z("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:X,onChange:S=>Z(S.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})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>X===""||S.name.toLowerCase().includes(X.toLowerCase())).map(S=>{let q=re.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let le=re.dependencies||[],fe;q?fe=le.filter(_=>_!==S.id):fe=[...le,S.id],Ce("dependencies",fe);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:q?`${f.accent}10`:"transparent"},onMouseEnter:le=>{q||(le.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:le=>{le.currentTarget.style.backgroundColor=q?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:q?f.accent:"transparent",borderColor:q?f.accent:f.borderLight},children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:S.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:S=>!n&&(S.currentTarget.style.opacity="0.9"),onMouseLeave:S=>!n&&(S.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var cm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
368
|
+
Task dependencies must flow in one direction only.`);return}let K=ee=>ee.map(ye=>{if(ye.id===R){let Ee=ye.dependencies||[];if(!Ee.includes(P.id))return {...ye,dependencies:[...Ee,P.id]}}return ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye});la.current+=1,ve(ee=>K(ee)),X?.(P.id,R);},[X,Mc]),Lc=react.useCallback((P,R)=>{let K=ee=>ee.map(ye=>{if(ye.id===P&&ye.dependencies){let Ee=ye.dependencies.filter(kt=>kt!==R);return {...ye,dependencies:Ee}}return ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye});la.current+=1,ve(ee=>K(ee)),Z?.(P,R);},[Z]),{startDate:jo,endDate:Ki}=react.useMemo(()=>{let P=W.filter(Ee=>Ee.startDate&&Ee.endDate);if(P.length===0){let Ee=new Date,kt=new Date(Ee);kt.setDate(kt.getDate()-30);let Je=new Date(Ee);return Je.setDate(Je.getDate()+60),{startDate:kt,endDate:Je}}let R=P.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),K=new Date(Math.min(...R.map(Ee=>Ee.getTime()))),ee=new Date(Math.max(...R.map(Ee=>Ee.getTime()))),ye=_e==="day"?7:_e==="week"?14:30;return K.setDate(K.getDate()-ye),ee.setDate(ee.getDate()+ye),{startDate:K,endDate:ee}},[W,_e]);react.useEffect(()=>{lt.current?.(jo,Ki);},[jo,Ki]);let Q0=react.useCallback(async()=>{if(!Tn.current||!eo.current||!Ar.current)return;await new Promise(Dn=>setTimeout(Dn,200));let P=Tn.current,R=eo.current,K=ms.current||R.querySelector(".gantt-grid-scroll"),ee=Ar.current,ye=K?.scrollTop||0,Ee=K?.scrollLeft||0,kt=ee.scrollTop,Je=ee.scrollLeft,Ea=P.style.overflow,Mt=P.style.height,Fa=K?.style.overflow||"",sr=ee.style.overflow,ko=R.style.overflow,fs=P.style.width,bs=ee.style.width;try{let Dn=K?.querySelector(".gantt-taskgrid-content"),to=ee.querySelector("svg"),qi=to?.getAttribute("height")?parseInt(to.getAttribute("height"),10):to?.getBoundingClientRect().height||0,Yo=Dn?.scrollHeight||K?.scrollHeight||600,hs=Math.max(qi,ee.scrollHeight),Sn=to?.getAttribute("width")?parseInt(to.getAttribute("width"),10):to?.getBoundingClientRect().width||ee.scrollWidth,sf=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Xi=Math.max(Yo,hs,qi),Rc=sf+Xi+50,Oc=(K?.offsetWidth||R.offsetWidth||300)+Sn+10;K&&(K.scrollTop=0,K.scrollLeft=0),ee.scrollTop=0,ee.scrollLeft=0,P.style.overflow="visible",P.style.height=`${Rc}px`,P.style.width=`${Oc}px`,R.style.overflow="visible",K&&(K.style.overflow="visible",K.style.height=`${Xi+50}px`),ee.style.overflow="visible",ee.style.height=`${Xi+50}px`,ee.style.width=`${Sn+10}px`,await new Promise(ys=>setTimeout(ys,150));let lf=await htmlToImage.toPng(P,{backgroundColor:Xt.bgPrimary,pixelRatio:2,width:Oc,height:Rc,skipFonts:!1,filter:ys=>{if(!(ys instanceof Element))return !0;let $c=window.getComputedStyle(ys),Hc=parseInt($c.zIndex,10);return !(!isNaN(Hc)&&Hc>=50||$c.position==="fixed")}}),Ji=document.createElement("a");Ji.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Ji.href=lf,Ji.click();}finally{P.style.overflow=Ea,P.style.height=Mt,P.style.width=fs,R.style.overflow=ko,K&&(K.style.overflow=Fa,K.style.height="",K.scrollTop=ye,K.scrollLeft=Ee),ee.style.overflow=sr,ee.style.height="",ee.style.width=bs,ee.scrollTop=kt,ee.scrollLeft=Je;}},[Xt]),Z0=react.useCallback(async()=>{await Pe.exportToPDF(W);},[W]),ef=react.useCallback(async()=>{let P=new Date,R=ye=>String(ye).padStart(2,"0"),K=`${P.getFullYear()}-${R(P.getMonth()+1)}-${R(P.getDate())}_${R(P.getHours())}${R(P.getMinutes())}`,ee=u?u.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Pe.exportToExcel(W,`${ee}_${K}.xlsx`);},[W,u]),tf=react.useCallback(()=>{let P=Pe.exportToCSV(W),R=new Blob([P],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(R),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[W]),af=react.useCallback(()=>{let P=Pe.exportToJSON(W),R=new Blob([P],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(R),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[W]),rf=react.useCallback(()=>{Pe.exportToMSProject(W,"Gantt Project","project.xml");},[W]),of=P=>{P.preventDefault(),se(true);},Ko=react.useRef(false),[Yi,Ic]=react.useState(false),Nn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let P=Ar.current,R=eo.current?.querySelector(".gantt-grid-scroll");if(!P||!R)return;let K=()=>{if(Ko.current)return;Ko.current=true;let Je=P.scrollTop;B(Je),R.scrollTop=Je,requestAnimationFrame(()=>{Ko.current=false;});},ee=()=>{if(Ko.current)return;Ko.current=true;let Je=R.scrollTop;B(Je),P.scrollTop=Je,requestAnimationFrame(()=>{Ko.current=false;});},ye=Je=>{if(j&&R){let Mt=R.parentElement?.getBoundingClientRect()?.left||0,Fa=Je.clientX-Mt,sr=200,ko=ps+Dc,fs=window.innerWidth*Sc,bs=Math.max(ko,fs);Fa>=sr&&Fa<=bs&&te(Fa);}if(Yi&&P){let Ea=Je.clientX-Nn.current.x,Mt=Je.clientY-Nn.current.y;P.scrollLeft=Nn.current.scrollLeft-Ea,P.scrollTop=Nn.current.scrollTop-Mt;}},Ee=()=>{se(false),Ic(false);},kt=Je=>{if(Je.button!==0)return;let Ea=Je.target;Ea.closest("[data-task-bar]")||Ea.closest("[data-dependency-line]")||Ea.closest("button")||Ea.closest('[role="button"]')||Ea.tagName==="rect"&&Ea.getAttribute("data-clickable")==="true"||(Ic(true),Nn.current={x:Je.clientX,y:Je.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},Je.preventDefault());};return P.addEventListener("scroll",K),R.addEventListener("scroll",ee),P.addEventListener("mousedown",kt),document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Ee),()=>{P.removeEventListener("scroll",K),R.removeEventListener("scroll",ee),P.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Ee);}},[j,Yi,ps]);let Bc=react.useRef(false),nf=react.useRef(null);return react.useLayoutEffect(()=>{if(Bc.current||W.length===0||!Ar.current)return;Bc.current=true,nf.current=jo;let P=Ar.current,R=new Date,K=_e==="day"?60:_e==="week"?20:8,ee=(R.getTime()-jo.getTime())/(1e3*60*60*24),ye=P.clientWidth,kt=ee*K*ne-ye/2;ee>=0&&ye>0&&(P.scrollLeft=Math.max(0,kt));},[W.length,jo,_e,ne]),jsxRuntime.jsx(ln.Provider,{value:Wa,children:jsxRuntime.jsx(al.Provider,{value:$0,children:jsxRuntime.jsxs("div",{ref:Tn,className:"flex flex-col h-full w-full",style:{backgroundColor:Xt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Xt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Xt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(Qs,{theme:Xt,timeScale:_e,onTimeScaleChange:tt,zoom:ne,onZoomChange:S,currentTheme:ct,onThemeChange:Me,rowDensity:Ke,onRowDensityChange:U,showThemeSelector:c,showCreateTaskButton:y&&it?.canCreateTask!==false&&!it?.canCreateSubtaskOnly,createTaskLabel:k,onCreateTask:C,taskFilter:Fe,onTaskFilterChange:ze,hideCompleted:Y,onHideCompletedChange:he,toolbarRightContent:I,wbsLevel:q,onWbsLevelChange:Cc,maxWbsDepth:ht,viewMode:Q,onViewModeChange:$e,projectForecast:z,onExportPNG:i?Q0:void 0,onExportPDF:i?Z0:void 0,onExportExcel:i?ef:void 0,onExportCSV:i?tf:void 0,onExportJSON:i?af:void 0,onExportMSProject:i?rf:void 0,showCriticalPath:Be,onShowCriticalPathChange:mt,showDependencies:He,onShowDependenciesChange:Bt,highlightWeekends:ot,onHighlightWeekendsChange:Tt,showBaseline:ke,onShowBaselineChange:P=>{P&&Q!=="oracle"&&$e("oracle"),!P&&Q==="oracle"&&$e("execution");},onCopySnapshotLink:Ie})}),jsxRuntime.jsxs("div",{ref:eo,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:ms,className:"gantt-grid-scroll flex-shrink-0",style:{width:O0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ai,{tasks:Fc,theme:Xt,rowHeight:gs,availableUsers:l,templates:Ec,onTaskClick:A,onTaskDblClick:Pc,onTaskContextMenu:xe,onTaskToggle:U0,scrollTop:D,columns:Vo,onToggleColumn:H0,onColumnResize:z0,onTaskUpdate:_o,onTaskIndent:W0,onTaskOutdent:G0,onTaskMove:_0,onMultiTaskDelete:_i,onTaskDuplicate:j0,onTaskCreate:K0,onTaskRename:Y0,onCreateSubtask:ji,onOpenTaskModal:A?P=>A(P):void 0,onDeleteRequest:(P,R)=>sa({taskId:P,taskName:R}),onTaskReparent:V0,scrollContainerRef:ms})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Xt.border,zIndex:15},onMouseDown:of}),jsxRuntime.jsx("div",{ref:Ar,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Yi?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(pi,{tasks:Fc,theme:Xt,rowHeight:gs,timeScale:_e,startDate:jo,endDate:Ki,zoom:ne,locale:h,templates:Ec,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:A,onTaskDblClick:Pc,onTaskContextMenu:X0,onTaskDateChange:q0,onDependencyCreate:Ac,onDependencyDelete:Lc,showBaseline:ke,showCriticalPath:Be,showDependencies:He,highlightWeekends:ot,canEditTask:it?.canEditTask})})]}),me.task&&jsxRuntime.jsx(un,{isOpen:me.isOpen,x:me.x,y:me.y,theme:Xt,onClose:()=>Ye({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=me.task;if(!P)return [];let R=Pe.findTaskById(W,P.id)||P,K=R.subtasks&&R.subtasks.length>0,ee=it?.canCreateTask!==false,ye=it?.canDeleteTask!==false;if(K){let Mt=[],Fa=it?.canDuplicateTask!==false;return ee&&Mt.push({id:"addSubtask",label:Wa.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{ae?ae(R):ji(R.id);}}),Fa&&Mt.push({id:"duplicate",label:Wa.contextMenu?.duplicateTask||"Duplicate Task",icon:_t.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ve(sr=>Vn(sr,[R.id]).tasks),Ye({isOpen:false,x:0,y:0,task:null});}}),ye&&(Mt.length>0&&Mt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Mt.push({id:"delete",label:Wa.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{sa({taskId:R.id,taskName:R.name});}})),Mt}let Ee=it?.canUpdateTask!==false,kt=it?.canDuplicateTask!==false,Je=[];return Ee&&Je.push({id:"edit",label:Wa.contextMenu?.editTask||"Edit Task",icon:_t.Pencil,onClick:()=>{G?G(R):At(R);}}),ee&&Je.push({id:"addSubtask",label:Wa.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{ae?ae(R):ji(R.id);}}),Je.length>0&&Ee&&Je.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ee&&(Je.push({id:"markIncomplete",label:Wa.contextMenu?.markIncomplete||"Mark Incomplete",icon:_t.MarkIncomplete,onClick:()=>{we?we(R):_o(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),Je.push({id:"setInProgress",label:Wa.contextMenu?.setInProgress||"Set In Progress",icon:_t.SetInProgress,onClick:()=>{H?H(R):_o(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),Je.push({id:"markComplete",label:Wa.contextMenu?.markComplete||"Mark Complete",icon:_t.MarkComplete,onClick:()=>{_o(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(kt||Ee&&R.startDate&&R.endDate)&&Je.length>0&&Je.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),kt&&Je.push({id:"duplicate",label:Wa.contextMenu?.duplicateTask||"Duplicate Task",icon:_t.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ve(Mt=>Vn(Mt,[R.id]).tasks),Ye({isOpen:false,x:0,y:0,task:null});}}),Ee&&R.startDate&&R.endDate&&Je.push({id:"split",label:Wa.contextMenu?.splitTask||"Split Task",icon:_t.Split,onClick:()=>{let Mt=R.startDate.getTime(),Fa=R.endDate.getTime(),sr=Mt+(Fa-Mt)/2,ko=new Date(sr);J0(R,ko);}}),ye&&(Je.length>0&&Je.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Je.push({id:"delete",label:Wa.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{sa({taskId:R.id,taskName:R.name});}})),Je})()}),jsxRuntime.jsx(Kr,{task:qe,isOpen:!!qe,onClose:()=>At(null),onTaskUpdate:P=>{qe&&(_o(qe.id,P),At(null));},theme:ct==="light"?"light":"dark",locale:h==="es"?"es":"en",availableUsers:l,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Wt&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>sa(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Xt.bgSecondary,border:`1px solid ${Xt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Xt.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:Xt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Wa.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Xt.textSecondary,fontFamily:"Inter, sans-serif"},children:h==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:Xt.textSecondary,fontFamily:"Inter, sans-serif"},children:[h==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Xt.textPrimary},children:['"',Wt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Xt.bgPrimary,borderTop:`1px solid ${Xt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>sa(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Xt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Xt.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:h==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{_i([Wt.taskId]),sa(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:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),h==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(fi,{tasks:W,theme:Xt,config:f,onTasksUpdate:ve,onTaskUpdate:_o,onTaskCreate:P=>{ve(R=>[...R,P]);},onTaskDelete:P=>{_i([P]);},onDependencyCreate:(P,R)=>{let K=Pe.findTaskById(W,P);K&&Ac(K,R);},onDependencyDelete:Lc})]})})})});function $v(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 Hv(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 d=parseInt(a[1],10),c=parseInt(a[2],10);return d*60+c}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)*60:null}var md=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],gd=[{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 dm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:l,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:x,defaultStatus:b}){let v=[...md,...i.filter(S=>!md.some(q=>q.id===S.id))],f=Qe[c]||Qe.dark,[h,w]=react.useState(false),[y,k]=react.useState(false),[C,E]=react.useState(false),[T,I]=react.useState(false),[O,F]=react.useState({top:0,left:0}),[$,z]=react.useState(null),[de,A]=react.useState(new Date),[J,xe]=react.useState({top:0,left:0}),[Ge,M]=react.useState(false),[G,ae]=react.useState([]),[we,H]=react.useState(false),[X,Z]=react.useState(""),ge=react.useRef(null),Le=react.useRef(null),Oe=react.useRef(null),rt=react.useRef(null),at=react.useRef(null),[re,it]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[Ie,bt]=react.useState({});react.useEffect(()=>{a?(it({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||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&M(true)):(it({name:"",description:"",progress:0,status:b||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),M(false),ae([]));},[a,e,b]),react.useEffect(()=>{let S=q=>{ge.current&&!ge.current.contains(q.target)&&w(false),Le.current&&!Le.current.contains(q.target)&&k(false),Oe.current&&!Oe.current.contains(q.target)&&E(false),rt.current&&!rt.current.contains(q.target)&&I(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let pt=()=>{let S={};return re.name.trim()||(S.name="El nombre es requerido"),re.startDate&&re.endDate&&re.startDate>re.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),bt(S),Object.keys(S).length===0},ct=async S=>{if(S.preventDefault(),!!pt())try{let q=d==="create"&&G.length>0?{...re,pendingFiles:G}:re;await s(q),ae([]),t();}catch(q){console.error("Error submitting task:",q);}},Ce=(S,q)=>{it(le=>{let fe={...le,[S]:q};if(S==="status"){let _=q;_==="todo"?fe.progress=0:_==="in-progress"?(le.progress===0||le.progress===100)&&(fe.progress=50):_==="completed"||_==="closed"?fe.progress=100:(_==="in-review"||_==="review")&&(fe.progress=75);}if(S==="progress"){let _=typeof q=="number"?q:parseInt(q,10);_===100&&le.status!=="completed"?fe.status="completed":_>0&&_<100&&le.status==="todo"?fe.status="in-progress":_===0&&le.status!=="todo"&&(fe.status="todo");}return fe}),Ie[S]&&bt(le=>{let fe={...le};return delete fe[S],fe});},_e=v.find(S=>S.id===re.status)??md[0],tt=gd.find(S=>S.id===re.priority)??gd[1],Ke=Eo.find(S=>S.value===re.color)??Eo[0],U=c==="dark",ne={backgroundColor:U?"#141414":f.bgSecondary,border:`1px solid ${U?"#262626":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:U?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,WebkitBackdropFilter:U?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:U?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:_e.color||f.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=f.hoverBg,S.currentTarget.style.color=f.textPrimary;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:ct,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:re.name,onChange:S=>Ce("name",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:re.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Ie.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Ie.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:re.description||"",onChange:S=>Ce("description",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:ge,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ne,borderColor:_e.color,backgroundColor:`${_e.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:_e.color}}),jsxRuntime.jsx("span",{style:{color:_e.color},children:_e.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:_e.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(S=>jsxRuntime.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:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",S.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,re.status===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),jsxRuntime.jsxs("div",{ref:Le,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:tt.color}}),jsxRuntime.jsx("span",{children:tt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:gd.map(S=>jsxRuntime.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:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",S.id),k(false);},children:[jsxRuntime.jsx("span",{children:S.icon}),S.label,re.priority===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Oe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&E(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[re.assignees&&re.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:re.assignees.slice(0,3).map((S,q)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:S.color||f.accent,borderColor:f.bgSecondary},children:S.initials},q))}),re.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",re.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(S=>{let q=re.assignees?.some(le=>le.name===S.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{let le=q?(re.assignees||[]).filter(fe=>fe.name!==S.name):[...re.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(fe=>fe[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("assignees",le);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:S.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},S.id)})})})]}),jsxRuntime.jsxs("div",{ref:rt,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)I(false);else {if(rt.current){let S=rt.current.getBoundingClientRect(),q=window.innerHeight,le=120,_=q-S.bottom<le?S.top-le-8:S.bottom+8;F({top:_,left:S.left});}I(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:re.color}}),jsxRuntime.jsx("span",{children:Ke.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${O.top}px`,left:`${O.left}px`,zIndex:99999,backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Eo.slice(0,18).map(S=>{let q=re.color===S.value;return jsxRuntime.jsx("button",{type:"button",onClick:le=>{le.preventDefault(),le.stopPropagation(),Ce("color",S.value),I(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:q?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),u.length>0||l?jsxRuntime.jsx(no,{selectedTags:re.tags||[],availableTags:u,onChange:S=>Ce("tags",S),onCreateTag:l,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{ref:at,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if($==="start")z(null);else {if(at.current){let S=at.current.getBoundingClientRect(),q=window.innerHeight,le=320,_=q-S.bottom<le?S.top-le-8:S.bottom+8;xe({top:_,left:S.left});}z("start"),A(re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.startDate?re.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if($==="end")z(null);else {if(at.current){let S=at.current.getBoundingClientRect(),q=window.innerHeight,le=320,_=q-S.bottom<le?S.top-le-8:S.bottom+8;xe({top:_,left:S.left});}z("end"),A(re.endDate||re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.endDate?re.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>z(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${J.top}px`,left:`${J.left}px`,zIndex:99999,backgroundColor:U?"#0a0a0a":f.bgPrimary,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${U?"#262626":f.border}`},children:[(()=>{let S=new Date,q=new Date(S);q.setDate(S.getDate()+1);let le=new Date(S);le.setDate(S.getDate()+7);let fe=new Date(S);return fe.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:le},{label:"2 semanas",date:fe}].map((Q,$e)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:ke=>ke.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ke=>ke.currentTarget.style.backgroundColor="transparent",onClick:()=>{$==="start"?(Ce("startDate",Q.date),(!re.endDate||Q.date>re.endDate)&&Ce("endDate",Q.date),z("end")):(Ce("endDate",Q.date),(!re.startDate||Q.date<re.startDate)&&Ce("startDate",Q.date),z(null));},children:Q.label},$e))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("endDate",void 0),z(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(de.getFullYear(),de.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:de.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(de.getFullYear(),de.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((S,q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:S},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=de.getFullYear(),q=de.getMonth(),le=new Date(S,q,1).getDay(),fe=new Date(S,q+1,0).getDate(),_=new Date,Q=[];for(let ke=le-1;ke>=0;ke--)Q.push({day:new Date(S,q,-ke).getDate(),date:new Date(S,q-1,new Date(S,q,-ke).getDate()),isCurrentMonth:false});for(let ke=1;ke<=fe;ke++)Q.push({day:ke,date:new Date(S,q,ke),isCurrentMonth:true});let $e=42-Q.length;for(let ke=1;ke<=$e;ke++)Q.push({day:ke,date:new Date(S,q+1,ke),isCurrentMonth:false});return Q.map((ke,Be)=>{let De=ke.date.toDateString()===_.toDateString(),He=re.startDate?.toDateString()===ke.date.toDateString(),st=re.endDate?.toDateString()===ke.date.toDateString(),ot=re.startDate&&re.endDate&&ke.date>=re.startDate&&ke.date<=re.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ke.isCurrentMonth?He||st?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:He?f.accent:st?"#7C3AED":ot?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:De&&!He&&!st?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{$==="start"?(Ce("startDate",ke.date),re.endDate&&ke.date>re.endDate&&Ce("endDate",ke.date),z("end")):(Ce("endDate",ke.date),re.startDate&&ke.date<re.startDate&&Ce("startDate",ke.date),z(null));},children:ke.day},Be)})})()})]})]})]})})]}),Ie.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Ie.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:re.progress,onChange:S=>Ce("progress",parseInt(S.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"}20`,color:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[re.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>M(!Ge),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Ge?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:re.effortMinutes?$v(re.effortMinutes):"",onChange:S=>{let q=Hv(S.target.value);Ce("effortMinutes",q);},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}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||d==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",d==="create"?G.length>0&&`(${G.length})`:m.length>0&&`(${m.length})`]})]}),d==="create"?jsxRuntime.jsx(Or,{cardId:"pending",attachments:G.map((S,q)=>({id:`pending-${q}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>ae(q=>[...q,...S]),onDelete:S=>{let q=parseInt(S.replace("pending-",""),10);ae(le=>le.filter((fe,_)=>_!==q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Or,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:x,maxSizeMB:10,maxFiles:20}),d==="create"&&G.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[G.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:re.isMilestone,onChange:S=>Ce("isMilestone",S.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),re.dependencies&&re.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:re.dependencies.map(S=>{let q=r.find(le=>le.id===S);return jsxRuntime.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:[q?.name||S.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let le=(re.dependencies||[]).filter(fe=>fe!==S);Ce("dependencies",le);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{H(!we),Z("");},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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{H(false),Z("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:U?"#0a0a0a":f.bgPrimary,backdropFilter:U?"blur(16px)":void 0,border:`1px solid ${U?"#262626":f.border}`,boxShadow:U?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:X,onChange:S=>Z(S.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})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>X===""||S.name.toLowerCase().includes(X.toLowerCase())).map(S=>{let q=re.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let le=re.dependencies||[],fe;q?fe=le.filter(_=>_!==S.id):fe=[...le,S.id],Ce("dependencies",fe);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:q?`${f.accent}10`:"transparent"},onMouseEnter:le=>{q||(le.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:le=>{le.currentTarget.style.backgroundColor=q?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:q?f.accent:"transparent",borderColor:q?f.accent:f.borderLight},children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:S.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:S=>!n&&(S.currentTarget.style.opacity="0.9"),onMouseLeave:S=>!n&&(S.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var cm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|
|
@@ -410,7 +410,7 @@ If ambiguous, ask for clarification in the message field.`;function um(e){return
|
|
|
410
410
|
${pm(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(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function pm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Zr(e,t){let a=pm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let c=d.name.toLowerCase();return n.every(i=>c.includes(i))})}function fd(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 m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}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 x=new Date(r),b=x.getDay(),v=g-b;return v<=0&&(v+=7),x.setDate(x.getDate()+v),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 m=parseInt(s[1],10),g=s[2].toLowerCase(),x=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?x.setDate(x.getDate()+m):g==="week"||g==="semana"||g==="semanas"?x.setDate(x.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&x.setMonth(x.getMonth()+m),x}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let m=parseInt(d[1],10),g=parseInt(d[2],10)-1,x=parseInt(d[3],10);return new Date(x,g,m)}let c={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 m=parseInt(i[1],10),g=c[i[2].toLowerCase()],x=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(x,g,m)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=u[l[1].toLowerCase()],g=parseInt(l[2],10),x=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(x,m,g)}return null}function bd(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 hd(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 mm(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 gm(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(),u=r[2].trim(),l=Zr(t,i),m=fd(u);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(m);return x.setDate(x.getDate()+g),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:m,endDate:x},message:`Moved "${l.name}" to ${m.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(),u=o[2].trim(),l=Zr(t,i),m=bd(u);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(l.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:g},message:`Extended "${l.name}" by ${m} 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(),u=s[2].trim(),l=Zr(t,i),m=hd(u);return l?m===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:m},message:`Set "${l.name}" progress to ${m}%.`,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(),u=n[2].trim(),l=Zr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:u},message:`Renamed "${l.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),u=d[2].trim(),l=Zr(t,i),m=Zr(t,u);return l?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:l.id,dependencyTo:m.id,message:`Linked "${l.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,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 c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=Zr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.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 fm(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 zv(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 Uv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function yi(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let l=a.find(m=>m.id===u);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>yi(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},d=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||d&&c&&Math.abs(c.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:c,progress:e.progress||0,status:zv(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 bm(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:Uv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function hm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>yi(r,e,t))}var yd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers"},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"}},xd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Carga Equipo",blockers:"Bloqueantes"},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"}},xi={en:yd,es:xd};function vd(e){return xi[e]||xi.en}function vi(e,t){let a=vd(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 wd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function ym(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 xm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=ym(e),i=wd[0],u=wd.find(g=>g.value===c)??i,l=u.icon,m=g=>{switch(ym(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:wd.map(g=>{let x=g.icon;return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),t(g.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(x,{className:p("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var kd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function wm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let c=kd.find(u=>u.value===e)??kd[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:kd.map(u=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(u.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:p("w-2 h-2 rounded-full",u.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function Xn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Cd(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 Nm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=react.useState(false),[c,i]=react.useState(""),u=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{let b=v=>{u.current&&!u.current.contains(v.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),react.useEffect(()=>{n&&l.current&&l.current.focus();},[n]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),g=b=>e.some(v=>v.name===b),x=b=>{if(a){if(g(b.name))a(e.filter(v=>v.name!==b.name));else {let v={name:b.name,initials:Xn(b.name),color:b.color||Cd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,v]);}d(false),i("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:p("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,v)=>jsxRuntime.jsx("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Cd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Xn(b.name)},`${b.name}-${v}`)),e.length>3&&jsxRuntime.jsxs("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),d(!n);},className:p("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:p("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:p("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,v)=>jsxRuntime.jsx("div",{className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Cd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Xn(b.name)},`${b.name}-${v}`)),e.length>2&&jsxRuntime.jsxs("span",{className:p("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:l,type:"text",value:c,onChange:b=>i(b.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,v)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Xn(b.name)}),b.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(h=>h.name!==b.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${b.name}-${v}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let v=g(b.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),x(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsxRuntime.jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):Xn(b.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),v&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}function Em({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:d=false,placeholder:c}){let[i,u]=react.useState(false),[l,m]=react.useState(o),[g,x]=react.useState(()=>{let E=o==="start"?e:t;if(E){let T=E instanceof Date?E:new Date(E);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=react.useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let E=T=>{b.current&&!b.current.contains(T.target)&&u(false);};return i&&document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let h=E=>E?E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let E=g.getFullYear(),T=g.getMonth(),I=new Date(E,T,1),F=new Date(E,T+1,0).getDate(),$=I.getDay(),z=[],A=new Date(E,T,0).getDate();for(let xe=$-1;xe>=0;xe--)z.push({date:new Date(E,T-1,A-xe),isCurrentMonth:false});for(let xe=1;xe<=F;xe++)z.push({date:new Date(E,T,xe),isCurrentMonth:true});let J=42-z.length;for(let xe=1;xe<=J;xe++)z.push({date:new Date(E,T+1,xe),isCurrentMonth:false});return z},[g]),y=E=>{if(r)o==="start"?a(E,f||void 0):a(v||void 0,E),u(false);else if(l==="start"){let T=f&&E>f?E:f;a(E,T||void 0),m("end");}else {let T=v&&E<v?E:v;a(T||void 0,E),u(false);}},k=()=>{let E=new Date,T=new Date(E);T.setDate(E.getDate()+1);let I=new Date(E);I.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let O=new Date(E);O.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let F=new Date(E);F.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let $=new Date(E);$.setDate(E.getDate()+14);let z=new Date(E);return z.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:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:I,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:O,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:F,display:F.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:$,display:$.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:z,display:z.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(d){let E=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:h(E)})]})}let C=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:E=>{E.stopPropagation(),u(!i);let T=o==="start"?v:f;T&&x(new Date(T.getFullYear(),T.getMonth(),1));},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:h(C)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(false)}),jsxRuntime.jsxs("div",{className:p("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:p("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[k().map((E,T)=>jsxRuntime.jsxs("button",{className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>y(E.date),children:[jsxRuntime.jsx("span",{children:E.label}),jsxRuntime.jsx("span",{className:p("text-xs",s?"text-white/30":"text-gray-400"),children:E.display})]},T)),jsxRuntime.jsx("div",{className:p("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),u(false);},className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:p("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:l==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:p("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>x(new Date),className:p("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>x(new Date(g.getFullYear(),g.getMonth()-1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>x(new Date(g.getFullYear(),g.getMonth()+1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((E,T)=>{let I=E.date.toDateString()===new Date().toDateString(),O=v?.toDateString()===E.date.toDateString(),F=f?.toDateString()===E.date.toDateString(),$=O||F,z=!r&&v&&f&&E.date>=v&&E.date<=f;return jsxRuntime.jsx("button",{onClick:()=>y(new Date(E.date)),className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),E.isCurrentMonth&&(s?"text-white":"text-gray-900"),I&&"ring-2 ring-[#007BFF]",O&&"bg-[#007BFF] text-white",F&&!O&&"bg-[#7C3AED] text-white",z&&!$&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!$&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:E.date.getDate()},T)})})]})]})]})]})}function Ci({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:d}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Em,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:d||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function yn(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ti(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[d,c]=react.useState(false),i=react.useRef(e),u=react.useRef([]);return react.useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let l=i.current??0,m=e,g=m-l,x=r/o;c(true);for(let b=1;b<=o;b++){let v=setTimeout(()=>{let f=b/o,h=1-Math.pow(1-f,3),w=Math.round(l+g*h);n(w),b===o&&(c(false),n(m));},x*b);u.current.push(v);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:d}}function Fm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,d]=react.useState(0),c=react.useRef(null),i=react.useRef(null),u=react.useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),d(0);let x=Date.now();i.current=setInterval(()=>{let b=Date.now()-x,v=Math.min(b/a*100,100);d(v);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),d(0);},a);},[a,e]),l=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),d(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:u,cancelChange:l}}function Am({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:d}=yn(),{displayValue:c,isAnimating:i}=Ti(e,{enabled:o,duration:300,steps:6}),u=m=>{if(r||!t)return;m.stopPropagation();let g=m.currentTarget.getBoundingClientRect(),x=m.clientX-g.left,b=Math.round(x/g.width*100),v=Math.max(0,Math.min(100,b));v!==e&&(t(v),s&&d());},l=c??e;return jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",n&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsxRuntime.jsx("div",{onClick:u,className:p("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-[width]",l===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",i&&"transition-none"),style:{width:`${l}%`}})}),jsxRuntime.jsxs("span",{className:p("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[l,"%"]})]})}function Bm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[d,c]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let u=()=>{d!==e&&t?.(d),n(false);},l=m=>{m.key==="Enter"?u():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:p("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:d,onChange:m=>c(m.target.value),onBlur:u,onKeyDown:l,onClick:m=>m.stopPropagation(),className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:p("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function $m({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:d=true,enableSaveFlash:c=true}){let[i,u]=react.useState(false),[l,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:x,triggerFlash:b}=yn(),{displayValue:v,isAnimating:f}=Ti(e,{enabled:d&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let h=()=>{let y=parseFloat(l);if(!isNaN(y)){let k=y;o!==void 0&&(k=Math.max(o,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&b());}u(false);},w=y=>{y.key==="Enter"?h():y.key==="Escape"&&(m(e?.toString()||""),u(false));};return n||!t?jsxRuntime.jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:l,onChange:y=>m(y.target.value),onBlur:h,onKeyDown:w,onClick:y=>y.stopPropagation(),min:o,max:s,className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),u(true);},className:p("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),x&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Hm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:p("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:p("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:p("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-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:p("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),d(false);},className:p("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function Um({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:d,progress:c,startChange:i,cancelChange:u}=Fm(t,{delay:s}),l=g=>{g.stopPropagation(),!r&&t&&(o?d?u():i(!e):t(!e));},m=d?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:l,disabled:r||!t,className:p("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",d&&"ring-2 ring-offset-1",d&&m&&"ring-green-500/50",d&&!m&&"ring-red-500/50",d&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[d&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),d?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),d&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),u();},className:p("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:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Vm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:p("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:p("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function C2(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 T2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),c=parseInt(a[2],10);return d*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let d=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(d*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function ur({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:d=false,lens:c="hours",hourlyRate:i=0}){let[u,l]=react.useState(false),[m,g]=react.useState(""),x=react.useRef(null),{isFlashing:b,triggerFlash:v}=yn(),f=c==="financial"&&i>0,h=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:C2(e,r);react.useEffect(()=>{u&&x.current&&(x.current.focus(),x.current.select());},[u]),react.useEffect(()=>{if(e){let C=Math.floor(e/60),E=e%60;C>0&&E>0?g(`${C}h ${E}m`):C>0?g(`${C}h`):g(`${E}m`);}else g("");},[e,u]);let w=()=>{let C=T2(m);C!==e&&(t?.(C),n&&v()),l(false);},y=C=>{C.key==="Enter"?w():C.key==="Escape"&&l(false);};if(d)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let k=f?lucideReact.DollarSign:lucideReact.Clock;return s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(k,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:h})]}):u?jsxRuntime.jsx("input",{ref:x,type:"text",value:m,onChange:C=>g(C.target.value),onBlur:w,onKeyDown:y,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),l(true);},className:p("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(k,{className:p("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:h})]})}function Ym({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let d=o==="es";return a===0?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:d?"En Tiempo":"On Track"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?s(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?s(t):"\u2014"]}),n()]})}function Xm({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:d,lens:c="hours",hourlyRate:i=0}){let u=a==="es",l=c==="financial"&&i>0,m=M=>l?`$${Math.round(M*i).toLocaleString("en-US")}`:`${M}h`,[g,x]=react.useState(false),[b,v]=react.useState(false),[f,h]=react.useState(null),w=react.useRef(null),y=e.timeLoggedMinutes||0,k=e.effortMinutes||0,C=e.soldEffortMinutes||0,E=Math.round(y/60*10)/10,T=Math.round(k/60*10)/10,I=Math.round(C/60*10)/10,O=k>0?y/k*100:0,F=O>100?Math.round((y-k)/60*10)/10:0,$=O>100?"#FF2D20":O>=80?"#FFD60A":"#3BF06E";react.useEffect(()=>{if(!b&&!f)return;let M=G=>{w.current&&!w.current.contains(G.target)&&(v(false),h(null));};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[b,f]);let z=M=>{if(M.stopPropagation(),r&&!o&&!s){h("log");return}if(r||o||s){v(G=>!G),h(null);return}d&&d(e);},de=M=>{v(false),h(M);},A=async(M,G)=>{f==="log"&&r&&M?r(e,M,G):f==="estimate"&&o?o(e,M):f==="quoted"&&s&&s(e,M),h(null);},J=r||o||s||d,xe=[{mode:"log",icon:lucideReact.Clock,label:u?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:u?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:u?"T. Ofertado":"Quoted time",show:!!s}].filter(M=>M.show),Ge=f==="estimate"?k:f==="quoted"?C:void 0;return k===0&&y===0&&C===0?jsxRuntime.jsxs("div",{ref:w,className:"relative flex items-center gap-2",onClick:M=>M.stopPropagation(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),children:[jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&J&&jsxRuntime.jsx("button",{onClick:z,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",M.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",M.currentTarget.style.backgroundColor="transparent";},title:u?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:xe.map(M=>jsxRuntime.jsxs("button",{onClick:G=>{G.stopPropagation(),de(M.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:G=>{G.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.target.style.background="transparent";},children:[jsxRuntime.jsx(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:Ge||void 0,onSave:A,onClose:()=>h(null)})})})})]}):jsxRuntime.jsxs("div",{ref:w,className:"relative flex items-center gap-2 w-full",onClick:M=>M.stopPropagation(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:m(E)}),k>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(T)]}),F>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF2D20"},children:["+",m(F)," ",u?"Exceso":"Over"]})]}),k>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(O,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})}),C>0&&(s||n)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1",style:{marginTop:1},children:[jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:9,color:t?"rgba(255,255,255,0.25)":"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:[u?"Ofertado":"Quoted",":"]}),jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:10,color:t?"rgba(255,255,255,0.4)":"#6B7280"},children:m(I)})]})]}),J&&jsxRuntime.jsx("button",{onClick:z,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:g?1:0,pointerEvents:g?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",M.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",M.currentTarget.style.backgroundColor="transparent";},title:u?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:xe.map(M=>jsxRuntime.jsxs("button",{onClick:G=>{G.stopPropagation(),de(M.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:G=>{G.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.target.style.background="transparent";},children:[jsxRuntime.jsx(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:Ge||void 0,onSave:A,onClose:()=>h(null)})})})})]})}function Jm({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF2D20]/15 text-[#FF2D20]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#3BF06E]/15 text-[#3BF06E]";return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[a&&(a.avatar?jsxRuntime.jsx("img",{src:a.avatar,alt:a.name,className:p("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:p("w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold text-white ring-1",t?"ring-white/10":"ring-gray-200"),style:{backgroundColor:a.color||"#6B7280"},children:a.initials||a.name?.charAt(0)?.toUpperCase()||"?"})),jsxRuntime.jsx("span",{className:p("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxRuntime.jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var P2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Zm({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:p("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",P2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function Y2(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function q2(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 rg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:l,onReportBlocker:m,onCopyTaskLink:g}){let x=react.useRef(null),b=r==="es"?tg.es:tg.en;if(react.useEffect(()=>{let y=C=>{x.current&&!x.current.contains(C.target)&&t();},k=C=>{C.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",k);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),d&&(y.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),u.length>0&&y.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(k=>({id:`assign-${k.id}`,label:k.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:k.name.charAt(0).toUpperCase()}),onClick:()=>{let C=e.task.assignees||[],T=C.some(I=>I.name===k.name)?C.filter(I=>I.name!==k.name):[...C,{name:k.name,initials:Y2(k.name),color:k.color||q2(k.name),avatar:k.avatarUrl}];d({...e.task,assignees:T}),t();}}))})),l&&y.push({id:"log-time",label:b.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{l(e.task),t();}}),m&&y.push({id:"report-blocker",label:b.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&y.push({id:"copy-link",label:b.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},f=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),y},h=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:x,style:w,className:p("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:h.map(y=>y.separator?jsxRuntime.jsx("div",{className:p("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},y.id):y.submenu?jsxRuntime.jsx(X2,{item:y,isDark:a},y.id):jsxRuntime.jsxs("button",{onClick:y.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:p(y.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function X2({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:p("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxRuntime.jsxs("button",{onClick:d.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var tg={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",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},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",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var ug={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},m1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function mg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[c,i]=react.useState(""),[u,l]=react.useState(null),m=react.useRef(null),g=d==="es"?pg.es:pg.en;if(react.useLayoutEffect(()=>{if(!e||!m.current)return;let y=()=>{if(!m.current)return;let k=m.current.getBoundingClientRect(),E=window.innerHeight-k.top-20;l(Math.max(300,E));};return requestAnimationFrame(y),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[e]),react.useEffect(()=>{if(!e)return;let y=setTimeout(()=>{let k=E=>{m.current&&!m.current.contains(E.target)&&t();},C=E=>{E.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",C),m._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(y),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let x=y=>g.columns[y]||y,b=y=>{if(y==="name")return;let k=a.map(C=>C.id===y?{...C,visible:!C.visible}:C);o(k);},v=(y,k)=>{let C=a.find(T=>T.type===y&&(!k||T.customFieldId===k));if(C){b(C.id);return}let E={id:k||y,type:y,label:k?r.find(T=>T.id===k)?.name||y:x(y),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};o([...a,E]);},f=m1.filter(y=>x(y).toLowerCase().includes(c.toLowerCase())),h=r.filter(y=>y.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:m,style:{...u?{maxHeight:`${u}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",y.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:y=>i(y.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:y=>{y&&y.style.setProperty("--focus-border",w);},onFocus:y=>{y.currentTarget.style.borderColor=w,y.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:y=>{y.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",y.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:f.map(y=>{let k=a.find(T=>T.type===y&&!T.customFieldId),C=k?.visible??false,E=y==="name";return jsxRuntime.jsxs("button",{onClick:()=>{E||(k?b(k.id):v(y));},disabled:E,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:E?.4:1,cursor:E?"not-allowed":"pointer"},onMouseEnter:T=>{E||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:ug[y]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:x(y)})]},y)})})]}),h.length>0&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:h.map(y=>{let C=a.find(E=>E.customFieldId===y.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(y.type,y.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:E=>{E.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:ug[y.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:y.name})]},y.id)})})]})]})]})}var pg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",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",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var k1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function bg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[d,c]=react.useState("text"),[i,u]=react.useState([""]),l=o==="es"?fg.es:fg.en;react.useEffect(()=>{e&&(n(""),c("text"),u([""]));},[e]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:d};d==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{u([...i,""]);},x=(v,f)=>{let h=[...i];h[v]=f,u(h);},b=v=>{i.length>1&&u(i.filter((f,h)=>h!==v));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:p("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:p("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:p("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:p("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:l.fieldNamePlaceholder,className:p("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:k1.map(v=>jsxRuntime.jsxs("button",{onClick:()=>c(v.type),className:p("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsxRuntime.jsx("span",{className:p("text-xs",d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:l.types[v.type]})]},v.type))})]}),d==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((v,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:v,onChange:h=>x(f,h.target.value),placeholder:`${l.option} ${f+1}`,className:p("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>b(f),className:p("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:p("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:p("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var fg={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 xg={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 vg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=react.useState(false),c=react.useRef(null),i=react.useRef(0),u=s==="es"?xg.es:xg.en;react.useEffect(()=>{if(!n)return;let g=b=>{Date.now()-i.current<100||c.current&&!c.current.contains(b.target)&&d(false);},x=b=>{b.key==="Escape"&&d(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",x);}},[n]);let l=[{value:"all",label:u.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:u.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),d(x=>!x);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),u.filters,m&&jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:p("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:p("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:l.map(g=>{let x=e===g.value&&!t,b=()=>g.value==="all"?x?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),d(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",x&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p(x?g.color:"text-gray-400","flex-shrink-0"),children:b()}),jsxRuntime.jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:p("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),d(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:p("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function wg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function kg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxRuntime.jsxs("div",{className:p("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:p("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:p("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,d=n>0?Math.min(Math.round(s/n*100),100):0,c=s>n&&n>0,i=c?"#FF2D20":d>=80?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:p("text-[11px] font-mono font-bold",c?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:wg(s)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:wg(n)})]}),n>0&&jsxRuntime.jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:i}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:p("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,d=s<0,c=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:p("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#FF2D20]/15 text-[#FF2D20]",!n&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:c})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let d=s.utilizationPercent>=100?"#FF2D20":s.utilizationPercent>=80?"#FFD60A":s.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(s.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${s.name}-${n}`)})})]})]})}var $1=[{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 Eg(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(...Eg(r.subtasks,t+1));return a}function H1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let u=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(u<=0)continue;let l=(s.progress||0)/u;r+=l,o++;}return o>0?r/o:null}function z1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function wn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=wn(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function $d(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Fg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:c=[],toolbarRightContent:i}){let{theme:u="dark",locale:l="en",customTranslations:m,showSearch:g=true,showHierarchy:x=true,tableColumns:b,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:h=true,showCreateTaskButton:w=false,onCreateTask:y,persistFilter:k=false,financialBlur:C,healthSidebar:E,lens:T="hours",hourlyRate:I=0,aggregateParentHours:O=false}=t,F=vi(l,m),$=u==="dark",z=react.useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let N=localStorage.getItem(k);if(N){let D=JSON.parse(N);return {statusFilter:D.statusFilter||"all",hideCompleted:D.hideCompleted||!1}}}catch(N){console.error("Error loading persisted filter:",N);}return {statusFilter:"all",hideCompleted:false}},[k]),de=react.useMemo(()=>{function N(D){let B=0,j=0;for(let se of D)if(se.subtasks&&se.subtasks.length>0){let pe=N(se.subtasks);B+=pe.spent,j+=pe.allocated;}else B+=se.timeLoggedMinutes??0,j+=se.effortMinutes??0;return {spent:B,allocated:j}}return N(e)},[e]),A=react.useMemo(()=>!E?.enabled||!E.data?E:{...E,data:{...E.data,totalHoursSpentMinutes:de.spent,totalHoursAllocatedMinutes:de.allocated}},[E,de]),[J,xe]=react.useState(true),[Ge,M]=react.useState("position"),[G,ae]=react.useState("asc"),[we,H]=react.useState(""),[X,Z]=react.useState(()=>z().statusFilter),[ge,Le]=react.useState(()=>z().hideCompleted),[Oe,rt]=react.useState(b||$1),[at,re]=react.useState(false),[it,Ie]=react.useState(false),[bt,pt]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[ct,Ce]=react.useState(null),[_e,tt]=react.useState(0),[Ke,U]=react.useState(0),ne=react.useRef(null),[S,q]=react.useState(null),[le,fe]=react.useState(null);react.useEffect(()=>{b&&rt(b);},[b]),react.useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:X,hideCompleted:ge}));}catch(N){console.error("Error persisting filter state:",N);}},[k,X,ge]);let _=react.useMemo(()=>{let N=new Set;function D(B){for(let j of B)j.subtasks?.length&&(j.isExpanded!==false&&N.add(j.id),D(j.subtasks));}return D(e),N},[e]),Q=react.useMemo(()=>Oe.filter(N=>N.visible),[Oe]),$e=react.useCallback(N=>{a.onTaskToggleExpand?.(N);},[a]),ke=react.useCallback(N=>{Ge===N?ae(D=>D==="asc"?"desc":"asc"):(M(N),ae("asc")),a.onSortChange?.({column:N,direction:G==="asc"?"desc":"asc"});},[Ge,G,a]),Be=react.useCallback(N=>{rt(N),a.onColumnsChange?.(N);},[a]),De=react.useCallback(N=>{let D=Oe.map(B=>B.id===N?{...B,visible:false}:B);Be(D);},[Oe,Be]),He=react.useCallback((N,D)=>{M(N),ae(D);},[]),st=react.useCallback((N,D,B)=>{h&&(N.preventDefault(),pt({isOpen:true,x:N.clientX,y:N.clientY,type:D?"task":"header",task:D,columnId:B}));},[h]),ot=react.useCallback(()=>{pt(N=>({...N,isOpen:false}));},[]),nt=react.useCallback((N,D)=>{if(!f)return;N.preventDefault(),N.stopPropagation();let B=Oe.find(j=>j.id===D);B&&(Ce(D),tt(N.clientX),U(B.width));},[Oe,f]);react.useEffect(()=>{if(!ct)return;let N=B=>{let j=B.clientX-_e,se=Math.max(50,Ke+j),pe=Oe.map(te=>te.id===ct?{...te,width:se}:te);rt(pe);},D=()=>{ct&&a.onColumnsChange?.(Oe),Ce(null);};return document.addEventListener("mousemove",N),document.addEventListener("mouseup",D),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",D);}},[ct,_e,Ke,Oe,a]);let mt=react.useCallback((N,D)=>{if(D==="name"){N.preventDefault();return}q(D),N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",D),N.currentTarget instanceof HTMLElement&&(N.currentTarget.style.opacity="0.5");},[]),Bt=react.useCallback(N=>{N.currentTarget instanceof HTMLElement&&(N.currentTarget.style.opacity="1"),q(null),fe(null);},[]),Tt=react.useCallback((N,D)=>{N.preventDefault(),D!=="name"&&(N.dataTransfer.dropEffect="move",fe(D));},[]),lt=react.useCallback(()=>{fe(null);},[]),ut=react.useCallback((N,D)=>{if(N.preventDefault(),!S||S===D||D==="name")return;let B=[...Oe],j=B.findIndex(te=>te.id===S),se=B.findIndex(te=>te.id===D);if(j===-1||se===-1)return;let pe=B.splice(j,1);pe[0]&&(B.splice(se,0,pe[0]),Be(B),q(null),fe(null));},[S,Oe,Be]),Et=react.useCallback(async N=>{if(a.onCreateCustomField){let D={...N,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(D);}Ie(false);},[a]),Nt=react.useCallback(N=>N.progress===100||N.status==="completed"?"completed":N.progress&&N.progress>0||N.status==="in-progress"?"in-progress":"todo",[]),Fe=react.useMemo(()=>{let N=Eg(e);if(we.trim()){let D=we.toLowerCase();N=N.filter(B=>B.name.toLowerCase().includes(D));}return X!=="all"&&(N=N.filter(D=>Nt(D)===X)),ge&&(N=N.filter(D=>Nt(D)!=="completed")),N.sort((D,B)=>{let j,se;switch(Ge){case "name":j=D.name.toLowerCase(),se=B.name.toLowerCase();break;case "startDate":j=D.startDate?.getTime()||0,se=B.startDate?.getTime()||0;break;case "endDate":j=D.endDate?.getTime()||0,se=B.endDate?.getTime()||0;break;case "progress":j=D.progress||0,se=B.progress||0;break;case "status":j=D.status||"todo",se=B.status||"todo";break;case "priority":let pe={urgent:0,high:1,medium:2,low:3,none:4};j=pe[D.priority]??4,se=pe[B.priority]??4;break;case "position":return 0;default:return 0}return j<se?G==="asc"?-1:1:j>se?G==="asc"?1:-1:0}),N},[e,we,X,ge,Ge,G,Nt]),We=react.useCallback((N,D)=>{let B=pe=>{a.onTaskUpdate?.({...N,...pe});},j=pe=>pe?N.customFields?.find(me=>me.fieldId===pe)?.value:void 0,se=(pe,te)=>{if(!pe)return;let Ye=[...N.customFields||[]],qe=Ye.findIndex(At=>At.fieldId===pe);qe>=0?Ye[qe]={fieldId:pe,value:te}:Ye.push({fieldId:pe,value:te}),B({customFields:Ye});};switch(D.type){case "name":return null;case "status":return jsxRuntime.jsx(xm,{value:N.status||(N.progress===100?"completed":N.progress&&N.progress>0?"in-progress":"todo"),onChange:te=>{B({status:te,progress:te==="completed"?100:te==="in-progress"?50:0});},isDark:$,locale:l,translations:F.status});case "priority":return jsxRuntime.jsx(wm,{value:N.priority,onChange:te=>B({priority:te}),isDark:$,locale:l});case "assignees":return jsxRuntime.jsx(Nm,{value:N.assignees||[],availableUsers:d,onChange:te=>B({assignees:te}),isDark:$,locale:l});case "startDate":return jsxRuntime.jsx(Ci,{value:N.startDate,onChange:te=>B({startDate:te}),isDark:$,locale:l,dateField:"start",startDate:N.startDate,endDate:N.endDate});case "endDate":return jsxRuntime.jsx(Ci,{value:N.endDate,onChange:te=>B({endDate:te}),isDark:$,locale:l,dateField:"end",startDate:N.startDate,endDate:N.endDate});case "progress":return jsxRuntime.jsx(Am,{value:N.progress||0,onChange:te=>{let me=te===100?"completed":te>0?"in-progress":"todo";B({progress:te,status:me});},isDark:$});case "tags":return jsxRuntime.jsx(Vm,{value:N.tags||[],isDark:$});case "text":return jsxRuntime.jsx(Bm,{value:j(D.customFieldId)||"",onChange:te=>se(D.customFieldId,te),isDark:$});case "number":return jsxRuntime.jsx($m,{value:j(D.customFieldId)||0,onChange:te=>se(D.customFieldId,te),isDark:$});case "date":let pe=j(D.customFieldId);return jsxRuntime.jsx(Ci,{value:pe?new Date(pe):void 0,onChange:te=>se(D.customFieldId,te),isDark:$,locale:l});case "dropdown":return jsxRuntime.jsx(Hm,{value:j(D.customFieldId)||"",options:D.options||[],onChange:te=>se(D.customFieldId,te),isDark:$});case "checkbox":return jsxRuntime.jsx(Um,{value:j(D.customFieldId)||false,onChange:te=>se(D.customFieldId,te),isDark:$});case "estimatedTime":{let te=N.status==="completed"||N.progress===100;return jsxRuntime.jsx(ur,{value:N.estimatedTime,onChange:me=>B({estimatedTime:me}),isDark:$,locale:l,disabled:te,lens:T,hourlyRate:I})}case "quotedTime":{let te=N.status==="completed"||N.progress===100,me=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsxRuntime.jsx(ur,{value:N.quotedTime,onChange:Ye=>B({quotedTime:Ye}),isDark:$,locale:l,disabled:te,isBlurred:me,lens:T,hourlyRate:I})}case "elapsedTime":{let te=N.status==="completed"||N.progress===100;return jsxRuntime.jsx(ur,{value:N.elapsedTime,onChange:me=>B({elapsedTime:me}),isDark:$,locale:l,disabled:te,lens:T,hourlyRate:I})}case "effortMinutes":{if(O&&N.subtasks&&N.subtasks.length>0){let{allocated:me}=wn(N);return jsxRuntime.jsx(ur,{value:me>0?me:void 0,isDark:$,locale:l,disabled:true,lens:T,hourlyRate:I})}let te=N.status==="completed"||N.progress===100;return jsxRuntime.jsx(ur,{value:N.effortMinutes,onChange:me=>B({effortMinutes:me}),isDark:$,locale:l,disabled:te,lens:T,hourlyRate:I})}case "timeLoggedMinutes":{if(O&&N.subtasks&&N.subtasks.length>0){let{spent:me}=wn(N);return jsxRuntime.jsx(ur,{value:me>0?me:void 0,isDark:$,locale:l,disabled:true,lens:T,hourlyRate:I})}let te=N.status==="completed"||N.progress===100;return jsxRuntime.jsx(ur,{value:N.timeLoggedMinutes,onChange:a.onLogTime?me=>{a.onLogTime?.(N,me);}:void 0,isDark:$,locale:l,placeholder:l==="es"?"Agregar":"Add",disabled:te,lens:T,hourlyRate:I})}case "soldEffortMinutes":{if(O&&N.subtasks&&N.subtasks.length>0){let{quoted:Ye}=wn(N),qe=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(ur,{value:Ye>0?Ye:void 0,isDark:$,locale:l,disabled:true,isBlurred:qe,lens:T,hourlyRate:I})}let te=N.status==="completed"||N.progress===100,me=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(ur,{value:N.soldEffortMinutes,onChange:Ye=>B({soldEffortMinutes:Ye}),isDark:$,locale:l,disabled:te,isBlurred:me,lens:T,hourlyRate:I})}case "scheduleVariance":return jsxRuntime.jsx(Ym,{startDate:N.startDate,endDate:N.endDate,scheduleVariance:N.scheduleVariance,isDark:$,locale:l});case "hoursBar":{if(O&&N.hasChildren){let{spent:te,allocated:me,quoted:Ye}=wn(N),qe=te>me&&me>0;return jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono flex items-center gap-1.5",$?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:p("font-bold",qe?"text-[#FF453A]":$?"text-white/80":"text-gray-800"),children:$d(te)}),me>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:$?"text-white/60":"text-gray-600",children:$d(me)})]}),Ye>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:$?"text-amber-400/70":"text-amber-600",children:$d(Ye)})]})]})}return jsxRuntime.jsx(Xm,{task:N,isDark:$,locale:l,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:I})}case "teamLoad":return jsxRuntime.jsx(Jm,{task:N,isDark:$});case "blockers":return jsxRuntime.jsx(Zm,{blockers:N.blockers,isDark:$,locale:l});default:return jsxRuntime.jsx("span",{className:p("text-sm",$?"text-white/60":"text-gray-500"),children:"-"})}},[a,$,l,d,F,O]),Y=react.useCallback(N=>{let B={name:F.columns.name,status:F.columns.status,priority:F.columns.priority,assignees:F.columns.assignees,startDate:F.columns.startDate,endDate:F.columns.endDate,progress:F.columns.progress,tags:F.columns.tags||(l==="es"?"Etiquetas":"Tags"),estimatedTime:F.columns.estimatedTime||(l==="es"?"Estimado":"Estimated"),quotedTime:F.columns.quotedTime||(l==="es"?"Ofertado":"Quoted"),elapsedTime:F.columns.elapsedTime||(l==="es"?"Ejecutado":"Executed"),soldEffortMinutes:F.columns.soldEffortMinutes||(l==="es"?"Ofertado":"Quoted"),effortMinutes:F.columns.effortMinutes||(l==="es"?"Estimado":"Estimated"),timeLoggedMinutes:F.columns.timeLoggedMinutes||(l==="es"?"Ejecutado":"Executed"),scheduleVariance:F.columns.scheduleVariance||(l==="es"?"Prog / Var":"Sched / Var"),hoursBar:F.columns.hoursBar||(l==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:F.columns.teamLoad||(l==="es"?"Carga Equipo":"Team Load"),blockers:F.columns.blockers||(l==="es"?"Bloqueantes":"Blockers")}[N.type]||N.label;return typeof B=="string"?B:String(B||N.type)},[F,l]),he=react.useMemo(()=>{let B=Q.reduce((se,pe)=>se+pe.width,0)+(v?48:0),j={};for(let se of Q)j[se.id]=`${se.width/B*100}%`;return j},[Q,v]);return r?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxRuntime.jsxs("p",{className:p("text-sm",$?"text-white/60":"text-gray-600"),children:[F.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",$?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:p("text-sm",$?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",$?"text-white":"text-gray-900"),children:F.empty.noTasks}),jsxRuntime.jsx("p",{className:p("text-sm",$?"text-white/60":"text-gray-600"),children:F.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:ne,className:p($?"bg-[#0D0D0D]":"bg-white",ct&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:p("flex-shrink-0 px-6 py-4 border-b",$?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:p("text-sm",$?"text-white/60":"text-gray-600"),children:[Fe.length," ",F.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:p("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",$?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:we,onChange:N=>H(N.target.value),placeholder:F.toolbar.searchPlaceholder,className:p("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",$?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),jsxRuntime.jsx(vg,{value:X,hideCompleted:ge,onChange:Z,onHideCompletedChange:Le,isDark:$,locale:l}),A?.enabled&&A.data&&!J&&jsxRuntime.jsx("button",{onClick:()=>xe(true),className:p("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",$?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:l==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),w&&y&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:y,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:F.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:p("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",$?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Q.map(N=>{let D=N.id!=="name",B=le===N.id&&S!==N.id;return jsxRuntime.jsxs("div",{className:p("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",$?"text-white/60":"text-gray-500",D&&"cursor-grab",S===N.id&&"opacity-50",B&&($?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:he[N.id],minWidth:N.minWidth},draggable:D,onDragStart:D?j=>mt(j,N.id):void 0,onDragEnd:D?Bt:void 0,onDragOver:D?j=>Tt(j,N.id):void 0,onDragLeave:D?lt:void 0,onDrop:D?j=>ut(j,N.id):void 0,onContextMenu:j=>st(j,void 0,N.id),children:[D&&jsxRuntime.jsx(lucideReact.GripVertical,{className:p("w-3 h-3 flex-shrink-0 transition-opacity",$?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),N.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>ke(N.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Y(N),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:p("w-3 h-3",Ge===N.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:Y(N)}),f&&N.resizable&&jsxRuntime.jsx("div",{className:p("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",ct===N.id&&"bg-[#007BFF]"),onMouseDown:j=>nt(j,N.id)})]},N.id)}),v&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:N=>{N.stopPropagation(),re(D=>!D);},className:p("p-0.5 rounded transition-colors",$?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",at&&($?"bg-white/[0.05]":"bg-gray-200")),title:l==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(mg,{isOpen:at,onClose:()=>re(false),columns:Oe,customFields:c,onColumnsChange:Be,onCreateCustomField:()=>{re(false),Ie(true);},isDark:$,locale:l})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Fe.map((N,D)=>{let B=_.has(N.id),j=Math.min(D*.01,.2),se=N.hasChildren&&N.level===0,pe=N.subtasks?.length||0;if(se){let{spent:te,allocated:me,quoted:Ye}=wn(N),qe=H1(N),At=z1(N);return jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:j},className:p("flex items-center border-y cursor-pointer",$?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>$e(N.id),children:Q.map(jt=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:he[jt.id],minWidth:jt.minWidth},children:jt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:sa=>{sa.stopPropagation(),$e(N.id);},className:p("p-0.5 rounded flex-shrink-0",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:B?jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-4 h-4",$?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",$?"text-white/40":"text-gray-500")})}),B?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:$?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:$?"#FFD60A":"#B45309"}}),N.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:$?"#FFD60A":"#B45309"},children:N.wbsCode}),jsxRuntime.jsx("span",{title:N.name,className:p("text-[11px] font-semibold uppercase tracking-wide truncate",$?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:N.name}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",$?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",pe," ",l==="es"?pe===1?"Tarea":"Tareas":pe===1?"Item":"Items",")"]}),qe!==null&&jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono flex-shrink-0",qe>=1?"text-[#32D74B]":qe>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",qe.toFixed(2)]}),At>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[l==="es"?"Conflicto":"Conflict",": ",At]})]}):jt.type==="timeLoggedMinutes"?jsxRuntime.jsx(ur,{value:te>0?te:void 0,isDark:$,locale:l,disabled:true,lens:T,hourlyRate:I}):jt.type==="soldEffortMinutes"?jsxRuntime.jsx(ur,{value:Ye>0?Ye:void 0,isDark:$,locale:l,disabled:true,lens:T,hourlyRate:I}):jt.type==="effortMinutes"?jsxRuntime.jsx(ur,{value:me>0?me:void 0,isDark:$,locale:l,disabled:true,lens:T,hourlyRate:I}):null},jt.id))},N.id)}return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:j},className:p("flex items-center border-b transition-colors",$?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(N),onDoubleClick:()=>a.onTaskDoubleClick?.(N),onContextMenu:te=>st(te,N),children:[Q.map(te=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:he[te.id],minWidth:te.minWidth},children:te.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[x&&N.level>0&&jsxRuntime.jsx("div",{style:{width:`${N.level*24}px`},className:"flex-shrink-0"}),x&&N.hasChildren&&jsxRuntime.jsx("button",{onClick:me=>{me.stopPropagation(),$e(N.id);},className:p("p-0.5 rounded flex-shrink-0",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:B?jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-4 h-4",$?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",$?"text-white/60":"text-gray-400")})}),x&&!N.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(N.wbsCode||N.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[N.wbsCode&&jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",$?"text-[#007BFF]":"text-blue-600"),children:N.wbsCode}),N.taskCode&&jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",$?"text-white/40":"text-gray-400"),children:N.taskCode})]}),jsxRuntime.jsx("span",{className:p("truncate font-bold text-[13px]",$?"text-white":"text-gray-900",N.progress===100&&($?"line-through text-white/30":"line-through text-gray-400")),children:N.name}),N.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${N.tags[0].color}20`,color:N.tags[0].color},children:N.tags[0].name})]})]}):We(N,te)},te.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},N.id)})}),Fe.length===0&&we&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:p("w-12 h-12 mx-auto mb-4",$?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:p($?"text-white/60":"text-gray-600"),children:F.empty.noResults})]})})]})}),A?.enabled&&A.data&&J&&jsxRuntime.jsx(kg,{data:A.data,isDark:$,locale:l,onClose:()=>xe(false)})]}),jsxRuntime.jsx(rg,{state:bt,onClose:ot,isDark:$,locale:l,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:De,onColumnSort:He,availableUsers:d,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsxRuntime.jsx(bg,{isOpen:it,onClose:()=>Ie(false),onSave:Et,isDark:$,locale:l})]})}var Pg=[{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:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true}],Mg=[{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"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"}],Ag=[{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 Hd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},zd={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",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Ud={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",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Pi={dark:Hd,light:zd,neutral:Ud};function Lg(e){return Pi[e]||Pi.dark}var Wd={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",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Gd={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",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Mi={en:Wd,es:Gd};function es(e){return Mi[e]||Mi.en}function Ai(e,t){let a=es(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 Ig(e){let t=es(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 Bg(e,t=0,a=true){let r=es(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 as(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 _d(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 $g({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:p("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Ug=26,Y1=22,q1=10;function Hg(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function jd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function Wg(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function zg(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function X1({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:d=0}){let{task:c,spanCols:i,lane:u,isStart:l,isEnd:m}=e,g=c.progress===100||c.status==="completed",x=c.isCriticalPath,b=l&&m?"rounded":l?"rounded-l":m?"rounded-r":"",v=m?jd(c.effortMinutes,n,d):null,f=m?Wg(c,n,d):null,h=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:p("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",b,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":x?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${u*Ug}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${Y1}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:x?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:l?"3px":void 0,borderLeftColor:l?x?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[x&&l&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(v||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:p(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),h&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",h.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function Gg({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:c=[],onCreateTag:i,attachmentsByTask:u,comments:l,onAddComment:m,currentUser:g,mentionableUsers:x,onUploadCommentAttachments:b,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:h,timeEntries:w,timerState:y,onLogTime:k,onUpdateEstimate:C,onUpdateSoldEffort:E,onStartTimer:T,onStopTimer:I,onDiscardTimer:O,blurFinancials:F=false,suppressDetailModal:$=false,lens:z="hours",hourlyRate:de=0}){let{theme:A="dark",locale:J="en",customTranslations:xe,showBacklog:Ge=true}=t,M=Ai(J,xe),G=A==="dark"||A==="neutral",[ae,we]=react.useState(r||new Date),[H,X]=react.useState(null),[Z,ge]=react.useState(null),[Le,Oe]=react.useState(null),[rt,at]=react.useState({}),re=3,it=3,Ie=react.useCallback(_=>{ge(_.id),$||X(_),v?.(_.id);},[$,v]),[bt,pt]=react.useState(null),ct=react.useCallback(()=>{we(new Date(ae.getFullYear(),ae.getMonth()-1,1));},[ae]),Ce=react.useCallback(()=>{we(new Date(ae.getFullYear(),ae.getMonth()+1,1));},[ae]),_e=react.useCallback(()=>{we(new Date);},[]),tt=react.useMemo(()=>{let _=ae.getFullYear(),Q=ae.getMonth(),$e=new Date(_,Q,1),ke=new Date(_,Q+1,0),Be=$e.getDay(),De=ke.getDate(),He=as(e),st=new Date;st.setHours(0,0,0,0);let ot=[],nt=Be,mt=new Date(_,Q,0).getDate();for(let Tt=nt-1;Tt>=0;Tt--){let lt=new Date(_,Q-1,mt-Tt);ot.push({date:lt,isCurrentMonth:false,isToday:false,isWeekend:lt.getDay()===0||lt.getDay()===6,events:He.filter(ut=>_d(lt,ut)).map(ut=>({id:ut.id,title:ut.name,start:ut.startDate,end:ut.endDate,task:ut}))});}for(let Tt=1;Tt<=De;Tt++){let lt=new Date(_,Q,Tt),ut=lt.getTime()===st.getTime();ot.push({date:lt,isCurrentMonth:true,isToday:ut,isWeekend:lt.getDay()===0||lt.getDay()===6,events:He.filter(Et=>_d(lt,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}let Bt=42-ot.length;for(let Tt=1;Tt<=Bt;Tt++){let lt=new Date(_,Q+1,Tt);ot.push({date:lt,isCurrentMonth:false,isToday:false,isWeekend:lt.getDay()===0||lt.getDay()===6,events:He.filter(ut=>_d(lt,ut)).map(ut=>({id:ut.id,title:ut.name,start:ut.startDate,end:ut.endDate,task:ut}))});}return ot},[ae,e]),Ke=react.useMemo(()=>as(e).filter(_=>!_.startDate||!_.endDate),[e]),U=react.useMemo(()=>{let _=as(e),Q=0,$e=0,ke=0,Be=0,De=0;_.forEach(mt=>{mt.effortMinutes&&(Q+=mt.effortMinutes),mt.soldEffortMinutes&&($e+=mt.soldEffortMinutes),mt.scheduleVariance!=null&&(ke+=mt.scheduleVariance,Be++),mt.soldEffortMinutes&&mt.effortMinutes&&(De+=mt.soldEffortMinutes-mt.effortMinutes);});let He=$e>0?Math.min(100,Math.round(Q/$e*100)):0,st=Be>0?Math.round(ke/Be):0,nt=`${De<0?"-":"+"}${zg(De,z,de)}`;return {budgetUtil:He,avgVariance:st,costDisplay:nt,hasCostData:$e>0}},[e,z,de]),ne=react.useMemo(()=>{let _=[0,0,0,0,0,0];return tt.forEach((Q,$e)=>{let ke=Math.floor($e/7);Q.events.forEach(Be=>{if(Be.task.startDate&&Be.task.soldEffortMinutes){let De=new Date(Be.task.startDate),He=Q.date;De.getFullYear()===He.getFullYear()&&De.getMonth()===He.getMonth()&&De.getDate()===He.getDate()&&ke<_.length&&(_[ke]-=Be.task.soldEffortMinutes);}});}),_},[tt]),S=react.useMemo(()=>{let _=as(e),Q=new Map,$e=new Set,ke=[0,0,0,0,0,0];if(tt.length===0)return {segmentsByCell:Q,multiDayTaskIds:$e,maxLanesPerRow:ke};let Be=nt=>new Date(nt.getFullYear(),nt.getMonth(),nt.getDate()),De=Be(tt[0].date),He=Be(tt[tt.length-1].date),st=[];for(let nt of _){if(!nt.startDate||!nt.endDate)continue;let mt=Be(nt.startDate),Bt=Be(nt.endDate);if(mt.getTime()===Bt.getTime()||Bt<De||mt>He)continue;let Tt=mt<De?De:mt,lt=Bt>He?He:Bt,ut=Hg(Tt,De),Et=Hg(lt,De);ut<0||ut>41||Et<0||Et>41||ut!==Et&&($e.add(nt.id),st.push({task:nt,startIdx:ut,endIdx:Et}));}st.sort((nt,mt)=>nt.startIdx!==mt.startIdx?nt.startIdx-mt.startIdx:mt.endIdx-mt.startIdx-(nt.endIdx-nt.startIdx));let ot=[[],[],[],[],[],[]];for(let{task:nt,startIdx:mt,endIdx:Bt}of st){let Tt=Math.floor(mt/7),lt=Math.floor(Bt/7),ut=Be(nt.startDate),Et=Be(nt.endDate),Nt=false;for(let Fe=Tt;Fe<=lt;Fe++){let We=Fe===Tt?mt%7:0,Y=Fe===lt?Bt%7:6,he=Y-We+1,N=0,D=ot[Fe]??[];for(ot[Fe]||(ot[Fe]=D);N<D.length&&(D[N]??-1)>=We;)N++;if(N>=q1){Nt=true;break}N>=D.length?D.push(Y):D[N]=Y,ke[Fe]=Math.max(ke[Fe]??0,N+1);let B=Fe===Tt&&ut>=De,j=Fe===lt&&Et<=He,se=Fe*7+We,pe={taskId:nt.id,task:nt,rowIndex:Fe,startCol:We,endCol:Y,spanCols:he,lane:N,isStart:B,isEnd:j};Q.has(se)||Q.set(se,[]),Q.get(se).push(pe);}Nt&&($e.delete(nt.id),Q.forEach((Fe,We)=>{let Y=Fe.filter(he=>he.taskId!==nt.id);Y.length===0?Q.delete(We):Q.set(We,Y);}));}return {segmentsByCell:Q,multiDayTaskIds:$e,maxLanesPerRow:ke}},[tt,e]),q=J==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],le=ae.toLocaleDateString(J==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),fe=le.charAt(0).toUpperCase()+le.slice(1);return o?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",G?"bg-[#050505]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:p("text-sm font-mono",G?"text-white/30":"text-gray-600"),children:[M.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",G?"bg-[#050505]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:p("w-12 h-12 rounded-full flex items-center justify-center",G?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",G?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:p("text-sm",G?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",G?"bg-[#050505]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:p("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",G?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-8 h-8",G?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",G?"text-white/90":"text-gray-900"),children:M.labels.noEvents}),jsxRuntime.jsx("p",{className:p("text-sm",G?"text-white/30":"text-gray-600"),children:M.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:p("flex-1 flex flex-col w-full h-full overflow-hidden",G?"bg-[#050505]":"bg-white",n),style:d,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:p("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",G?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:p("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",G?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-3.5 h-3.5",G?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:p("font-medium",G?"text-white":"text-gray-900"),children:J==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:p("h-4 w-px",G?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:ct,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",G?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:p("text-sm font-semibold tracking-tight min-w-[150px] text-center",G?"text-white":"text-gray-900"),children:fe}),jsxRuntime.jsx("button",{onClick:Ce,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",G?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:p("h-4 w-px",G?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:_e,className:p("px-2.5 py-1 text-xs rounded-md transition-all font-medium",G?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:M.navigation.today})]})]}),jsxRuntime.jsx("div",{className:p("grid grid-cols-7 sticky top-0 z-10",G?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:q.map(_=>jsxRuntime.jsx("div",{className:p("py-2 text-center text-[10px] font-bold uppercase tracking-widest",G?"text-white/60 font-mono":"text-gray-500"),children:_},_))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:p("grid grid-cols-7 min-h-[800px]",G?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>ge(null),children:tt.map((_,Q)=>{let $e=Q%7===6,ke=Q>=35;return jsxRuntime.jsxs("div",{className:p("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!$e&&(G?"border-r border-[#222]":"border-r border-gray-200"),!ke&&(G?"border-b border-[#222]":"border-b border-gray-200"),G?_.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":_.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",_.isToday&&G&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",_.isToday&&!G&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:p("text-xs font-mono select-none relative z-20",_.isToday?G?"text-[#007FFF] font-bold":"text-blue-600 font-bold":_.isCurrentMonth?G?"text-white/60":"text-gray-900":G?"text-white/20":"text-gray-400"),children:String(_.date.getDate()).padStart(2,"0")}),(()=>{let Be=Math.floor(Q/7),De=(S.maxLanesPerRow[Be]??0)*Ug,He=S.segmentsByCell.get(Q);return De===0&&!He?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${De}px`,zIndex:5},children:He?.map(st=>jsxRuntime.jsx(X1,{segment:st,isDark:G,blurFinancials:F,isSelected:Z===st.taskId,t:M,lens:z,hourlyRate:de,onClick:()=>{Ie(st.task),a.onEventClick?.({id:st.task.id,title:st.task.name,start:st.task.startDate,end:st.task.endDate,task:st.task});}},st.taskId))})})(),(()=>{let Be=_.events.filter(De=>De.task.isMilestone&&!S.multiDayTaskIds.has(De.id));return Be.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Be.slice(0,4).map(De=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:De.title,onClick:He=>{He.stopPropagation(),Ie(De.task);}},De.id)),Be.length>4&&jsxRuntime.jsxs("span",{className:p("text-[8px] font-mono",G?"text-white/30":"text-gray-400"),children:["+",Be.length-4]})]})})(),(()=>{let Be=[];_.events.forEach(He=>{He.task.blockers?.forEach(st=>{(st.severity==="warning"||st.severity==="critical")&&Be.push({taskId:He.id,type:st.type,severity:st.severity,variance:He.task.scheduleVariance});});});let De=Be[0];return De?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:p("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",De.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[M.labels.risk,": ",De.type,De.variance?` (+${Math.abs(De.variance)}d ${M.labels.delay})`:""]})]})}):null})(),(()=>{let Be=_.events.filter(ot=>!S.multiDayTaskIds.has(ot.id)),De=rt[Q]||re,He=Be.slice(0,De),st=Be.length-De;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[He.map(ot=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{Ie(ot.task),a.onEventClick?.(ot);},whileHover:{scale:1.01},className:p("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",ot.task.progress===100||ot.task.status==="completed"?G?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":G?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:G?ot.task.progress===100||ot.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:ot.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:p("flex-shrink-0 text-[9px]",ot.task.isMilestone?G?"text-amber-400":"text-amber-600":ot.task.isCriticalPath?"text-red-400":G?"text-[#1264FF]":"text-gray-400"),children:ot.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:ot.title})]},ot.id)),st>0&&jsxRuntime.jsxs("button",{onClick:ot=>{ot.stopPropagation(),at(nt=>({...nt,[Q]:De+it}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",G?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",st," ",J==="es"?"m\xE1s":"more"]}),De>re&&Be.length>re&&jsxRuntime.jsx("button",{onClick:ot=>{ot.stopPropagation(),at(nt=>({...nt,[Q]:re}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",G?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:J==="es"?"menos":"less"})]})})(),_.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Be=Q>=28,De=Q%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:He=>{He.stopPropagation(),pt(bt===Q?null:Q);},className:p("w-5 h-5 rounded flex items-center justify-center transition-all",bt===Q?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",G?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:p("w-3.5 h-3.5 transition-transform",bt===Q&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:bt===Q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>pt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:Be?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Be?-5:5,scale:.95},transition:{duration:.12},className:p("absolute w-[320px] rounded-lg shadow-2xl z-50",Be?"bottom-full mb-1":"top-full mt-1",De?"right-0":"left-0",G?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Fo,{onSubmit:He=>{a.onTaskCreate?.({name:He.name,startDate:He.startDate||_.date,endDate:He.endDate||_.date,priority:He.priority,assignees:He.assignee?[He.assignee]:void 0}),pt(null);},onCancel:()=>pt(null),availableUsers:t.availableUsers,isDark:G,locale:J==="es"?"es":"en",defaultDate:_.date,dropdownDirection:Be?"up":"down"})})]})})]})})()}),Q%7===6&&(()=>{let Be=Math.floor(Q/7),De=ne[Be];if(!De||De===0)return null;let He=zg(De,z,de);return jsxRuntime.jsxs("div",{className:p("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",De<0?"text-red-400":"text-emerald-400",F&&"blur-sm select-none"),children:[M.labels.cashOut,": ",De<0?"-":"+",He]})})()]},Q)})})})]}),Ge&&jsxRuntime.jsxs("aside",{className:p("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",G?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("flex-shrink-0 h-14 flex items-center justify-between px-4",G?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",G?"text-white/40":"text-gray-500"),children:M.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:p("text-[10px] font-mono tabular-nums",G?"text-white/20":"text-gray-400"),children:Ke.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Ke.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:p("w-10 h-10 rounded-xl flex items-center justify-center mb-3",G?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-5 h-5",G?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:p("text-xs font-mono",G?"text-white/20":"text-gray-400"),children:J==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Ke.map(_=>jsxRuntime.jsxs("button",{onClick:()=>{Ie(_);},className:p("w-full text-left rounded-md p-3 transition-all group/card",G?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:p("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",G?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:p("text-sm font-medium leading-snug line-clamp-2",G?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:_.name})]}),_.tags&&_.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[_.tags.slice(0,3).map(Q=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${Q.color}15`,color:Q.color,border:`1px solid ${Q.color}30`},children:Q.name},Q.id)),_.tags.length>3&&jsxRuntime.jsxs("span",{className:p("text-[9px] font-mono px-1 py-0.5",G?"text-white/20":"text-gray-400"),children:["+",_.tags.length-3]})]}),(_.effortMinutes||_.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",G?"text-white/25":"text-gray-400",F&&"blur-sm select-none"),children:[jd(_.effortMinutes,z,de)&&jsxRuntime.jsxs("span",{children:[M.labels.estimate,": ",jd(_.effortMinutes,z,de)]}),(()=>{let Q=Wg(_,z,de);return Q?jsxRuntime.jsx("span",{className:Q.isNegative?"text-red-400":"text-emerald-400",children:Q.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[_.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:p("w-3 h-3",_.priority==="urgent"||_.priority==="high"?"text-red-400":_.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx($g,{task:_,isDark:G})]}),_.assignees&&_.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:_.assignees.slice(0,2).map((Q,$e)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:Q.color||"#007FFF"},title:Q.name,children:Q.initials||Q.name?.slice(0,2).toUpperCase()},$e))})]})]},_.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:p("flex-shrink-0 px-3 py-2.5 border-t",G?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:M.labels.typeToAdd,className:p("w-full text-[11px] font-mono bg-transparent outline-none",G?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:_=>{_.key==="Enter"&&_.target.value.trim()&&(a.onTaskCreate?.({name:_.target.value.trim()}),_.target.value="");}})}),U.hasCostData&&jsxRuntime.jsxs("div",{className:p("flex-shrink-0 px-4 py-3 border-t space-y-2.5",G?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",G?"text-white/40":"text-gray-500"),children:["\u25C8 ",M.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",G?"text-white/40":"text-gray-500"),children:M.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono font-bold tabular-nums",G?"text-white/60":"text-gray-700",F&&"blur-sm select-none"),children:[U.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:p("h-1.5 rounded-full overflow-hidden",G?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${U.budgetUtil}%`,background:U.budgetUtil>90?"#EF4444":U.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",G?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",G?"text-white/25":"text-gray-400"),children:M.labels.variance}),jsxRuntime.jsxs("div",{className:p("text-[11px] font-mono font-bold tabular-nums",U.avgVariance>0?"text-emerald-400":U.avgVariance<0?"text-red-400":G?"text-white/50":"text-gray-600"),children:[U.avgVariance>0?"+":"",U.avgVariance," ",M.labels.days]})]}),jsxRuntime.jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",G?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",G?"text-white/25":"text-gray-400"),children:M.labels.cost}),jsxRuntime.jsx("div",{className:p("text-[11px] font-mono font-bold tabular-nums",U.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",F&&"blur-sm select-none"),children:U.costDisplay})]})]})]})]})]}),!$&&jsxRuntime.jsx(Kr,{task:H,isOpen:!!H,onClose:()=>X(null),onTaskUpdate:_=>{a.onTaskUpdate?.(_),X(_);},theme:A==="dark"?"dark":"light",locale:J,availableUsers:t.availableUsers?.map(_=>({id:_.id,name:_.name,avatar:_.avatar,initials:_.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:H?u?.get(H.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:as(e).filter(_=>_.id!==H?.id),comments:l?.filter(_=>_.taskId===H?.id).map(_=>({..._,createdAt:_.createdAt instanceof Date?_.createdAt:new Date(_.createdAt),updatedAt:_.updatedAt instanceof Date?_.updatedAt:_.updatedAt?new Date(_.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:x,onUploadCommentAttachments:b,enableTimeTracking:f,timeTrackingSummary:h,timeEntries:w,isTimerRunning:y?.isRunning,timerElapsedSeconds:y?.elapsedSeconds,onTimeLog:k,onEstimateUpdate:C,onSoldEffortUpdate:E,onTimerStart:T,onTimerStop:I,onTimerDiscard:O,blurFinancials:F}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Oe(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:p("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",G?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between",G?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:p("font-medium text-sm",G?"text-white/90":"text-gray-900"),children:Le.date.toLocaleDateString(J==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Oe(null),className:p("p-1 rounded",G?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:Le.events.map(_=>jsxRuntime.jsxs("button",{onClick:()=>{Oe(null),Ie(_.task);},className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",G?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx($g,{task:_.task,isDark:G}),jsxRuntime.jsx("span",{className:p("text-sm truncate flex-1",G?"text-white/80":"text-gray-900"),children:_.title}),(_.task.priority==="high"||_.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},_.id))})]})]})})]})}var Kd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Yd={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",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},qd={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",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Bi={dark:Kd,light:Yd,neutral:qd};function Vg(e){return Bi[e]||Bi.dark}function Q1({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[c,i]=react.useState(false),u=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),l=react.useMemo(()=>{let g=u.length,x=new Set(u.flatMap(f=>f.assignedUserIds||[])).size,b=u.map(f=>f.priority).filter(Boolean),v=new Set(u.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:x,priorities:b,labels:v}},[u]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:p("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:p("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var jg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function os(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 ns(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 Kg(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 Yg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let c=react.useMemo(()=>({...jg,...n}),[n]),[i,u]=react.useState(new Set),l=react.useRef(null),m=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(w=>{let y=w.timestamp.toISOString().split("T")[0],k=h.get(y);k?k.push(w):h.set(y,[w]);}),Array.from(h.entries()).sort((w,y)=>y[0].localeCompare(w[0])).map(([w,y])=>({date:new Date(w),events:y.sort((k,C)=>C.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:x}=react.useMemo(()=>{let h=new Set,w=new Set;return e.forEach(y=>{h.add(y.userId),w.add(y.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(w)}},[e]),b=h=>{u(w=>{let y=new Set(w);return y.has(h)?y.delete(h):y.add(h),y});},v=h=>{let y=new Date().getTime()-h.getTime(),k=Math.floor(y/6e4),C=Math.floor(y/36e5),E=Math.floor(y/864e5);return k<1?"just now":k<60?`${k}m ago`:C<24?`${C}h ago`:E<7?`${E}d ago`:h.toLocaleDateString()},f=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:p("history-timeline-empty",d),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:p("history-timeline",c.compact&&"compact",d),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let w=h.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),x.map(h=>jsxRuntime.jsxs("option",{value:h,children:[ns(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let w=h.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:m.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((w,y)=>{let k=i.has(w.id),C=s===w.id,E=Kg(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:p("history-timeline-event",k&&"expanded",C&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:E},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ns(w.type)})}),y<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:E}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:os(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(w.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([T,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},T)),w.metadata&&Object.keys(w.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([T,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},T))]})]})]})]},w.id)})})]},h.date?.toISOString()||"all"))})]})}function Xg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:p("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:p("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&ns(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&os(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>d(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,x)=>jsxRuntime.jsx("div",{className:p("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>d(x),title:os(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:u.map(g=>jsxRuntime.jsxs("button",{className:p("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:p("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Xd(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 Jd(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 Jg(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 Qg(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function ow(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),d=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(u=>{let l=a/2,m=r/2;u.vx+=(l-u.x)*o.centerForce*i,u.vy+=(m-u.y)*o.centerForce*i,n.forEach(g=>{if(u.id===g.id)return;let x=u.x-g.x,b=u.y-g.y,v=Math.sqrt(x*x+b*b)||1,f=o.chargeStrength*i/(v*v);u.vx+=x/v*f,u.vy+=b/v*f;});}),t.forEach(u=>{let l=d.get(typeof u.source=="string"?u.source:u.source.id),m=d.get(typeof u.target=="string"?u.target:u.target.id);if(!l||!m)return;let g=m.x-l.x,x=m.y-l.y,b=Math.sqrt(g*g+x*x)||1,v=(b-o.linkDistance)/b*o.forceStrength*i;l.vx+=g*v,l.vy+=x*v,m.vx-=g*v,m.vy-=x*v;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function Zg({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:c}){let i=react.useRef(null),[u,l]=react.useState([]),[m,g]=react.useState(null),[x,b]=react.useState(null),[v,f]=react.useState(null),[h,w]=react.useState(1),[y,k]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let z=ow(e,t,a.width,a.height,a,150);l(z);},[e,t,a]);let C=react.useCallback((z,de)=>{a.enableDragging&&(de.stopPropagation(),g(z));},[a.enableDragging]),E=react.useCallback(z=>{if(!m||!i.current)return;let A=i.current.getBoundingClientRect(),J=(z.clientX-A.left-y.x)/h,xe=(z.clientY-A.top-y.y)/h;l(Ge=>Ge.map(M=>M.id===m?{...M,x:J,y:xe,fx:J,fy:xe}:M));},[m,h,y]),T=react.useCallback(()=>{g(null);},[]),I=react.useCallback((z,de)=>{de.stopPropagation(),d?.({type:"node-click",node:z,position:{x:de.clientX,y:de.clientY}});},[d]),O=react.useCallback((z,de)=>{de.stopPropagation(),d?.({type:"edge-click",edge:z,position:{x:de.clientX,y:de.clientY}});},[d]),F=react.useCallback(z=>{let de=u.find(A=>A.id===z);return de?{x:de.x,y:de.y}:{x:0,y:0}},[u]),$=react.useCallback(z=>{if(z.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return z.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let de=z.card.priority;return de==="URGENT"?"#ef4444":de==="HIGH"?"#f59e0b":de==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return z.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:p("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:p("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(z=>Math.min(z+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(z=>Math.max(z-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(z=>z.type))).map(z=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Xd(z)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Jg(z)," ",Jd(z)]})]},z))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:E,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(z=>{let de=F(typeof z.source=="string"?z.source:z.source.id),A=F(typeof z.target=="string"?z.target:z.target.id),J=Qg(z.type),xe=v===z.id,Ge=z.onCriticalPath;return jsxRuntime.jsxs("g",{className:p("relationships-graph-edge",xe&&"hovered",Ge&&"critical"),onMouseEnter:()=>f(z.id),onMouseLeave:()=>f(null),onClick:M=>O(z,M),children:[jsxRuntime.jsx("line",{x1:de.x,y1:de.y,x2:A.x,y2:A.y,stroke:Xd(z.type),strokeWidth:Ge?a.edgeWidth*2:a.edgeWidth,strokeOpacity:xe?1:.6,markerEnd:J?"url(#arrowhead)":void 0}),a.showEdgeLabels&&xe&&jsxRuntime.jsx("text",{x:(de.x+A.x)/2,y:(de.y+A.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Jd(z.type)})]},z.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(z=>{let de=x===z.id,A=z.onCriticalPath;return jsxRuntime.jsxs("g",{className:p("relationships-graph-node",de&&"hovered",A&&"critical"),transform:`translate(${z.x}, ${z.y})`,onMouseDown:J=>C(z.id,J),onMouseEnter:()=>b(z.id),onMouseLeave:()=>b(null),onClick:J=>I(z,J),children:[jsxRuntime.jsx("circle",{r:A?a.nodeSize*1.2:a.nodeSize,fill:$(z),stroke:A?"#fbbf24":"#ffffff",strokeWidth:A?3:2,opacity:de?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:z.card.title.length>20?z.card.title.substring(0,20)+"...":z.card.title})]},z.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function a0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[d,c]=react.useState(false),[i,u]=react.useState(null),[l,m]=react.useState(null),g=react.useRef(null),x=d||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let h=w=>{w.key==="Escape"&&!x&&b();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,x]);let b=()=>{x||(n(""),u(null),m(null),t());},v=async()=>{if(!(!s.trim()||x)){c(true),u(null),m(null);try{let h=await r(s.trim());m(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{l&&(a(l),b());};return e?jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:b,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,w)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,w)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},w)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref: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:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,w)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,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"}),l?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,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, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Qd={"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 sw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},iw={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 lw(e,t,a){let r=Qd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ss(e){return `$${e.toFixed(4)}`}var Zd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=lw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,m)=>l+m.cost,0),s=a.reduce((l,m)=>l+m.inputTokens,0),n=a.reduce((l,m)=>l+m.outputTokens,0),d=a.filter(l=>l.success),c=a.reduce((l,m)=>l+m.duration,0),i={},u={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,u[l.feature]=(u[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(u=>u.timestamp>=n).length,c=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:c,percentUsed:i,isExceeded:d>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$o=new Zd;function n0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState($o.getStats()),[s,n]=react.useState($o.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o($o.getStats()),n($o.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let d=$o.getRecentOperations(5);return jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ss(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let u=r.costsByFeature[c]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ss(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:d.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ss(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function l0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=react.useState(""),[c,i]=react.useState(""),[u,l]=react.useState(""),[m,g]=react.useState(false),[x,b]=react.useState(null),[v,f]=react.useState(null),[h,w]=react.useState(null),y=react.useRef(null),k=m||o;react.useEffect(()=>{e&&y.current&&y.current.focus();},[e]),react.useEffect(()=>{let O=F=>{F.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[e,k]);let C=()=>{k||(d(""),i(""),l(""),b(null),f(null),w(null),t());},E=async()=>{if(!(!n.trim()||k)){g(true),b(null),f(null),w(null);try{let O=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});f(O.tasks.tasks),w({from_cache:O.from_cache,tokens_used:O.tokens_used,mock_mode:O.mock_mode,similarity:O.similarity,tokens_saved:O.tokens_saved});}catch(O){b(O instanceof Error?O.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),C());};if(!e)return null;let I=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:C,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",I,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((O,F)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",F+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:O.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),O.start," \u2192 ",O.end]}),jsxRuntime.jsxs("span",{children:[O.duration," days"]}),O.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",O.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${O.priority==="high"?"bg-red-500/20 text-red-400":O.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:O.priority})]})},O.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:y,value:n,onChange:O=>d(O.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:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:O=>i(O.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:k})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:O=>l(O.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:k})]})]}),x&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((O,F)=>jsxRuntime.jsx("button",{onClick:()=>d(O),disabled:k,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:O},F))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:C,disabled:k,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"}),v?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:E,disabled:!n.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function $i({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&ks(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,h,w)=>{console.warn(`Retry attempt ${h} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(v,f,h)=>{r(w=>{let y=w.cards.find(O=>O.id===v);if(!y)return w;let k=y.columnId,C={...y,columnId:f,position:h},E=w.cards.map(O=>O.id===v?C:O),T=w.columns.map(O=>{if(O.id===k)return {...O,cardIds:O.cardIds.filter(F=>F!==v)};if(O.id===f){let F=E.filter($=>$.columnId===f).sort(($,z)=>$.position-z.position);return {...O,cardIds:F.map($=>$.id)}}return O}),I={...w,cards:E,columns:T};return o(I),I});},[o]),n=react.useCallback(async(v,f)=>{r(h=>{let w=h.cards.map(k=>k.id===v?{...k,...f}:k),y={...h,cards:w};return o(y),y});},[o]),d=react.useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let w={...v,id:f},y=h.columns.map(C=>C.id===v.columnId?{...C,cardIds:[...C.cardIds,f]}:C),k={...h,cards:[...h.cards,w],columns:y};return o(k),k});},[o]),c=react.useCallback(async v=>{r(f=>{let h=f.cards.find(C=>C.id===v);if(!h)return f;let w=f.cards.filter(C=>C.id!==v),y=f.columns.map(C=>C.id===h.columnId?{...C,cardIds:C.cardIds.filter(E=>E!==v)}:C),k={...f,cards:w,columns:y};return o(k),k});},[o]),i=react.useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let w={...v,id:f,cardIds:[]},y={...h,columns:[...h.columns,w]};return o(y),y});},[o]),u=react.useCallback(async(v,f)=>{r(h=>{let w=h.columns.map(k=>k.id===v?{...k,...f}:k),y={...h,columns:w};return o(y),y});},[o]),l=react.useCallback(async v=>{r(f=>{let h=f.cards.filter(k=>k.columnId!==v),w=f.columns.filter(k=>k.id!==v),y={...f,cards:h,columns:w};return o(y),y});},[o]),m=react.useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(v),f},[d]),g=react.useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),x=react.useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:l},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:l,clearBoard:x}}}function c0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=$i({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(l=>l.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:c,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var is={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},p0={by:"none",order:"asc"};function m0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...is,...e}),[s,n]=react.useState({...p0,...t}),d=react.useCallback(b=>{o(v=>({...v,...b}));},[]),c=react.useCallback(b=>{n(v=>({...v,...b}));},[]),i=react.useCallback(()=>{o(is),n(p0);},[]),u=react.useCallback(()=>{a&&o({...is,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...is,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...is,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),x=react.useCallback(b=>{let v=[...b];if(r.search){let f=r.search.toLowerCase();v=v.filter(h=>h.title.toLowerCase().includes(f)||h.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,h=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),y=String(f.getDate()).padStart(2,"0"),k=`${h}-${w}-${y}`;v=v.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let E=C.endDate||C.dueDate;if(!E)return false;let T;if(typeof E=="string")T=E.split("T")[0]||E;else {let I=E.getUTCFullYear(),O=String(E.getUTCMonth()+1).padStart(2,"0"),F=String(E.getUTCDate()).padStart(2,"0");T=`${I}-${O}-${F}`;}switch(r.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let I=new Date(k+"T00:00:00"),O=new Date(T+"T00:00:00"),F=new Date(I);return F.setDate(F.getDate()+7),O>=I&&O<=F;case "custom":if(r.dateRange){let $=typeof E=="string"?new Date(E):E;return $>=r.dateRange.start&&$<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,h)=>{let w=0;switch(s.by){case "created":let y=f.createdAt?new Date(f.createdAt).getTime():0,k=h.createdAt?new Date(h.createdAt).getTime():0;w=y-k;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},E=C[f.priority||"LOW"],T=C[h.priority||"LOW"];w=E-T;break;case "dueDate":let I=f.endDate||f.dueDate,O=h.endDate||h.dueDate;if(!I)return 1;if(!O)return -1;let F=typeof I=="string"?new Date(I).getTime():I.getTime(),$=typeof O=="string"?new Date(O).getTime():O.getTime();w=F-$;break;case "title":w=f.title.localeCompare(h.title);break;case "estimate":let z=f.estimatedTime||0,de=h.estimatedTime||0;w=z-de;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:l,filterHighPriority:m,applyFilters:x,hasActiveFilters:g}}var f0,b0;if(typeof window<"u")try{let e=xs("ai");f0=e.generateObject,b0=e.generateText;}catch{}function h0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(f0&&b0&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),d=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),u=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function tc(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function y0(e){let{cards:t}=e,[a,r]=tc(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,m)=>{if(!m){r({selectedCardIds:[l],lastSelectedCardId:l});return}let g=m.ctrlKey||m.metaKey,x=m.shiftKey;if(g)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(x&&a.lastSelectedCardId){let b=t.find(f=>f.id===l),v=t.find(f=>f.id===a.lastSelectedCardId);if(b&&v&&b.columnId===v.columnId){let f=t.filter(T=>T.columnId===b.columnId).sort((T,I)=>T.position-I.position),h=f.findIndex(T=>T.id===a.lastSelectedCardId),w=f.findIndex(T=>T.id===l),[y,k]=h<w?[h,w]:[w,h],C=f.slice(y,k+1).map(T=>T.id),E=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:E,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),u=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:c,toggleCard:i,getSelectedCards:u}}var x0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function v0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...x0,...a}),[a]),[s,n]=react.useState([]),d=react.useCallback((b,v,f,h,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let y={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:v,columnId:f,strategy:h,color:w,isExpanded:true,position:s.filter(k=>k.columnId===f).length,createdAt:new Date};n(k=>[...k,y]);},[o.minCardsPerStack,s]),c=react.useCallback(b=>{n(v=>v.filter(f=>f.id!==b));},[]),i=react.useCallback(b=>{n(v=>v.map(f=>f.id===b?{...f,isExpanded:!f.isExpanded}:f));},[]),u=react.useCallback((b,v)=>{n(f=>f.map(h=>h.id===b&&!h.cardIds.includes(v)?{...h,cardIds:[...h.cardIds,v]}:h));},[]),l=react.useCallback((b,v)=>{n(f=>f.map(h=>{if(h.id===b){let w=h.cardIds.filter(y=>y!==v);return w.length<o.minCardsPerStack?null:{...h,cardIds:w}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),m=react.useCallback(b=>s.filter(v=>v.columnId===b).sort((v,f)=>v.position-f.position),[s]),g=react.useCallback(async b=>{let v=t.filter(k=>k.columnId===b);if(v.length<o.minCardsPerStack*2)return [];let f=[],h=new Map;v.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(C=>{h.has(C)||h.set(C,[]),h.get(C).push(k);});}),h.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:k.map(E=>E.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${C}"`,confidence:.85});});let w=new Map;v.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(C=>{w.has(C)||w.set(C,[]),w.get(C).push(k);});}),w.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:k.map(E=>E.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let y=new Map;if(v.forEach(k=>{k.priority&&(y.has(k.priority)||y.set(k.priority,[]),y.get(k.priority).push(k));}),y.forEach((k,C)=>{if(k.length>=o.minCardsPerStack){let E={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";f.push({stack:{title:`${E} ${C} Priority`,cardIds:k.map(T=>T.id),columnId:b,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let k of v){let E=(await r.findSimilar(k,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(E.length>=o.minCardsPerStack-1){let T=[k.id,...E.map(O=>O.card.id)],I=E.reduce((O,F)=>O+F.similarity,0)/E.length;f.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${E.length+1} similar tasks`,confidence:I});}}return f.filter(k=>k.confidence>=o.autoStackConfidenceThreshold).sort((k,C)=>C.confidence-k.confidence).slice(0,5)},[t,o,r]),x=react.useCallback(b=>{d(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[d]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),h=f[0];f.length>0&&h&&h.confidence>=.9&&x(h);});},[]),{stacks:s,createStack:d,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:l,getStacksForColumn:m,getSuggestions:g,applySuggestion:x,config:o}}var w0=react.createContext(null);function k0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=xs("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=xs("@libxai/core");n.set(c.id,new i(c));});let d=null;if(t?.board){let{Board:c}=xs("@libxai/core");d=new c(t.board);}r.current=new core.BoardStore({board:d,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(w0.Provider,{value:{store:o},children:e})}function Hi(){let e=react.useContext(w0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ds(){let e=Hi(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=react.useCallback(h=>{e.updateBoard(h);},[e]),c=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,w)=>{e.updateColumn(h,w);},[e]),u=react.useCallback(h=>{e.deleteColumn(h);},[e]),l=react.useCallback(h=>e.getColumn(h),[e]),m=react.useCallback(h=>{e.addCard(h);},[e]),g=react.useCallback((h,w)=>{e.updateCard(h,w);},[e]),x=react.useCallback(h=>{e.deleteCard(h);},[e]),b=react.useCallback((h,w,y)=>{e.moveCard(h,w,y);},[e]),v=react.useCallback(h=>e.getCard(h),[e]),f=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:l,addCard:m,updateCard:g,deleteCard:x,moveCard:b,getCard:v,getCardsByColumn:f}}function T0(e){let{cards:t}=ds();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function N0(e="position",t="asc"){let{cards:a}=ds();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?d[o.priority]:0,i=s.priority?d[s.priority]:0;n=c-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 zi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Wc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Nw=new zi;function S0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:c}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:l.map(x=>{let b=e[x.index];if(!b)return null;let v=c?c(b,x.index):x.index,f={position:"absolute",top:n?0:x.start,left:n?x.start:0,width:n?x.size:"100%",height:n?"100%":x.size};return jsxRuntime.jsx("div",{style:f,"data-index":x.index,children:r(b,x.index)},v)})})})}function E0(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function P0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:c,horizontal:i=true}){let u=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:d}),m=l.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:g,className:s,children:jsxRuntime.jsx("div",{style:x,children:m.map(b=>{let v=e[b.index];if(!v)return null;let f=c?c(v,b.index):b.index,h={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":b.index,children:o(v,b.index)},f)})})})}function M0(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function A0(e,t=10){return e>t}var nc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},sc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ic={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},lc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},dc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},cc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},uc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},pc={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)"},mc={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)"},gc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},fc={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}},bc={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}},Ui={spacing:nc,borderRadius:sc,fontSize:ic,fontWeight:lc,lineHeight:dc,zIndex:cc,duration:uc,easing:pc,shadows:mc,opacity:gc,kanban:fc,gantt:bc};function L0(e,t,a){return e[t]??a}function hc(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)?hc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Ew(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function yc(e="asakaa"){let t=hc(Ui),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Ew(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function pm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Zr(e,t){let a=pm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let c=d.name.toLowerCase();return n.every(i=>c.includes(i))})}function fd(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 m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}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 x=new Date(r),b=x.getDay(),v=g-b;return v<=0&&(v+=7),x.setDate(x.getDate()+v),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 m=parseInt(s[1],10),g=s[2].toLowerCase(),x=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?x.setDate(x.getDate()+m):g==="week"||g==="semana"||g==="semanas"?x.setDate(x.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&x.setMonth(x.getMonth()+m),x}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let m=parseInt(d[1],10),g=parseInt(d[2],10)-1,x=parseInt(d[3],10);return new Date(x,g,m)}let c={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 m=parseInt(i[1],10),g=c[i[2].toLowerCase()],x=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(x,g,m)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=u[l[1].toLowerCase()],g=parseInt(l[2],10),x=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(x,m,g)}return null}function bd(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 hd(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 mm(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 gm(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(),u=r[2].trim(),l=Zr(t,i),m=fd(u);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(m);return x.setDate(x.getDate()+g),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:m,endDate:x},message:`Moved "${l.name}" to ${m.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(),u=o[2].trim(),l=Zr(t,i),m=bd(u);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(l.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:g},message:`Extended "${l.name}" by ${m} 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(),u=s[2].trim(),l=Zr(t,i),m=hd(u);return l?m===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:m},message:`Set "${l.name}" progress to ${m}%.`,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(),u=n[2].trim(),l=Zr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:u},message:`Renamed "${l.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),u=d[2].trim(),l=Zr(t,i),m=Zr(t,u);return l?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:l.id,dependencyTo:m.id,message:`Linked "${l.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,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 c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=Zr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.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 fm(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 zv(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 Uv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function yi(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let l=a.find(m=>m.id===u);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>yi(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},d=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||d&&c&&Math.abs(c.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:c,progress:e.progress||0,status:zv(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 bm(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:Uv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function hm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>yi(r,e,t))}var yd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers"},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"}},xd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Carga Equipo",blockers:"Bloqueantes"},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"}},xi={en:yd,es:xd};function vd(e){return xi[e]||xi.en}function vi(e,t){let a=vd(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 wd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function ym(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 xm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=ym(e),i=wd[0],u=wd.find(g=>g.value===c)??i,l=u.icon,m=g=>{switch(ym(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:wd.map(g=>{let x=g.icon;return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),t(g.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(x,{className:p("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var kd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function wm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let c=kd.find(u=>u.value===e)??kd[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:p("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:kd.map(u=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(u.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:p("w-2 h-2 rounded-full",u.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function Xn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Cd(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 Nm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=react.useState(false),[c,i]=react.useState(""),u=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{let b=v=>{u.current&&!u.current.contains(v.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),react.useEffect(()=>{n&&l.current&&l.current.focus();},[n]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),g=b=>e.some(v=>v.name===b),x=b=>{if(a){if(g(b.name))a(e.filter(v=>v.name!==b.name));else {let v={name:b.name,initials:Xn(b.name),color:b.color||Cd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,v]);}d(false),i("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:p("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,v)=>jsxRuntime.jsx("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Cd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Xn(b.name)},`${b.name}-${v}`)),e.length>3&&jsxRuntime.jsxs("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),d(!n);},className:p("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:p("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:p("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,v)=>jsxRuntime.jsx("div",{className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Cd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Xn(b.name)},`${b.name}-${v}`)),e.length>2&&jsxRuntime.jsxs("span",{className:p("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:l,type:"text",value:c,onChange:b=>i(b.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,v)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Xn(b.name)}),b.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(h=>h.name!==b.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${b.name}-${v}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let v=g(b.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),x(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsxRuntime.jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):Xn(b.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),v&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}function Em({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:d=false,placeholder:c}){let[i,u]=react.useState(false),[l,m]=react.useState(o),[g,x]=react.useState(()=>{let E=o==="start"?e:t;if(E){let T=E instanceof Date?E:new Date(E);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=react.useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let E=T=>{b.current&&!b.current.contains(T.target)&&u(false);};return i&&document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let h=E=>E?E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let E=g.getFullYear(),T=g.getMonth(),I=new Date(E,T,1),F=new Date(E,T+1,0).getDate(),$=I.getDay(),z=[],A=new Date(E,T,0).getDate();for(let xe=$-1;xe>=0;xe--)z.push({date:new Date(E,T-1,A-xe),isCurrentMonth:false});for(let xe=1;xe<=F;xe++)z.push({date:new Date(E,T,xe),isCurrentMonth:true});let J=42-z.length;for(let xe=1;xe<=J;xe++)z.push({date:new Date(E,T+1,xe),isCurrentMonth:false});return z},[g]),y=E=>{if(r)o==="start"?a(E,f||void 0):a(v||void 0,E),u(false);else if(l==="start"){let T=f&&E>f?E:f;a(E,T||void 0),m("end");}else {let T=v&&E<v?E:v;a(T||void 0,E),u(false);}},k=()=>{let E=new Date,T=new Date(E);T.setDate(E.getDate()+1);let I=new Date(E);I.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let O=new Date(E);O.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let F=new Date(E);F.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let $=new Date(E);$.setDate(E.getDate()+14);let z=new Date(E);return z.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:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:I,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:O,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:F,display:F.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:$,display:$.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:z,display:z.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(d){let E=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:h(E)})]})}let C=r&&o==="start"?v:f;return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:E=>{E.stopPropagation(),u(!i);let T=o==="start"?v:f;T&&x(new Date(T.getFullYear(),T.getMonth(),1));},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:h(C)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(false)}),jsxRuntime.jsxs("div",{className:p("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:p("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[k().map((E,T)=>jsxRuntime.jsxs("button",{className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>y(E.date),children:[jsxRuntime.jsx("span",{children:E.label}),jsxRuntime.jsx("span",{className:p("text-xs",s?"text-white/30":"text-gray-400"),children:E.display})]},T)),jsxRuntime.jsx("div",{className:p("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),u(false);},className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:p("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:l==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:p("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>x(new Date),className:p("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>x(new Date(g.getFullYear(),g.getMonth()-1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>x(new Date(g.getFullYear(),g.getMonth()+1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((E,T)=>{let I=E.date.toDateString()===new Date().toDateString(),O=v?.toDateString()===E.date.toDateString(),F=f?.toDateString()===E.date.toDateString(),$=O||F,z=!r&&v&&f&&E.date>=v&&E.date<=f;return jsxRuntime.jsx("button",{onClick:()=>y(new Date(E.date)),className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),E.isCurrentMonth&&(s?"text-white":"text-gray-900"),I&&"ring-2 ring-[#007BFF]",O&&"bg-[#007BFF] text-white",F&&!O&&"bg-[#7C3AED] text-white",z&&!$&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!$&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:E.date.getDate()},T)})})]})]})]})]})}function Ci({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:d}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Em,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:d||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function yn(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ti(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[d,c]=react.useState(false),i=react.useRef(e),u=react.useRef([]);return react.useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let l=i.current??0,m=e,g=m-l,x=r/o;c(true);for(let b=1;b<=o;b++){let v=setTimeout(()=>{let f=b/o,h=1-Math.pow(1-f,3),w=Math.round(l+g*h);n(w),b===o&&(c(false),n(m));},x*b);u.current.push(v);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:d}}function Fm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,d]=react.useState(0),c=react.useRef(null),i=react.useRef(null),u=react.useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),d(0);let x=Date.now();i.current=setInterval(()=>{let b=Date.now()-x,v=Math.min(b/a*100,100);d(v);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),d(0);},a);},[a,e]),l=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),d(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:u,cancelChange:l}}function Am({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:d}=yn(),{displayValue:c,isAnimating:i}=Ti(e,{enabled:o,duration:300,steps:6}),u=m=>{if(r||!t)return;m.stopPropagation();let g=m.currentTarget.getBoundingClientRect(),x=m.clientX-g.left,b=Math.round(x/g.width*100),v=Math.max(0,Math.min(100,b));v!==e&&(t(v),s&&d());},l=c??e;return jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",n&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsxRuntime.jsx("div",{onClick:u,className:p("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:p("h-full rounded-full transition-[width]",l===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",i&&"transition-none"),style:{width:`${l}%`}})}),jsxRuntime.jsxs("span",{className:p("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[l,"%"]})]})}function Bm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[d,c]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let u=()=>{d!==e&&t?.(d),n(false);},l=m=>{m.key==="Enter"?u():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:p("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:d,onChange:m=>c(m.target.value),onBlur:u,onKeyDown:l,onClick:m=>m.stopPropagation(),className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:p("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function $m({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:d=true,enableSaveFlash:c=true}){let[i,u]=react.useState(false),[l,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:x,triggerFlash:b}=yn(),{displayValue:v,isAnimating:f}=Ti(e,{enabled:d&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let h=()=>{let y=parseFloat(l);if(!isNaN(y)){let k=y;o!==void 0&&(k=Math.max(o,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&b());}u(false);},w=y=>{y.key==="Enter"?h():y.key==="Escape"&&(m(e?.toString()||""),u(false));};return n||!t?jsxRuntime.jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:l,onChange:y=>m(y.target.value),onBlur:h,onKeyDown:w,onClick:y=>y.stopPropagation(),min:o,max:s,className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),u(true);},className:p("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),x&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Hm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:p("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:p("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:p("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-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:p("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),d(false);},className:p("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function Um({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:d,progress:c,startChange:i,cancelChange:u}=Fm(t,{delay:s}),l=g=>{g.stopPropagation(),!r&&t&&(o?d?u():i(!e):t(!e));},m=d?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:l,disabled:r||!t,className:p("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",d&&"ring-2 ring-offset-1",d&&m&&"ring-green-500/50",d&&!m&&"ring-red-500/50",d&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[d&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),d?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),d&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),u();},className:p("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:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Vm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:p("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:p("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function C2(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 T2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),c=parseInt(a[2],10);return d*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let d=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(d*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function ur({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:d=false,lens:c="hours",hourlyRate:i=0}){let[u,l]=react.useState(false),[m,g]=react.useState(""),x=react.useRef(null),{isFlashing:b,triggerFlash:v}=yn(),f=c==="financial"&&i>0,h=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:C2(e,r);react.useEffect(()=>{u&&x.current&&(x.current.focus(),x.current.select());},[u]),react.useEffect(()=>{if(e){let C=Math.floor(e/60),E=e%60;C>0&&E>0?g(`${C}h ${E}m`):C>0?g(`${C}h`):g(`${E}m`);}else g("");},[e,u]);let w=()=>{let C=T2(m);C!==e&&(t?.(C),n&&v()),l(false);},y=C=>{C.key==="Enter"?w():C.key==="Escape"&&l(false);};if(d)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let k=f?lucideReact.DollarSign:lucideReact.Clock;return s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(k,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:h})]}):u?jsxRuntime.jsx("input",{ref:x,type:"text",value:m,onChange:C=>g(C.target.value),onBlur:w,onKeyDown:y,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),l(true);},className:p("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(k,{className:p("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:h})]})}function Ym({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let d=o==="es";return a===0?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:d?"En Tiempo":"On Track"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?s(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?s(t):"\u2014"]}),n()]})}function Xm({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:d,lens:c="hours",hourlyRate:i=0}){let u=a==="es",l=c==="financial"&&i>0,m=M=>l?`$${Math.round(M*i).toLocaleString("en-US")}`:`${M}h`,[g,x]=react.useState(false),[b,v]=react.useState(false),[f,h]=react.useState(null),w=react.useRef(null),y=e.timeLoggedMinutes||0,k=e.effortMinutes||0,C=e.soldEffortMinutes||0,E=Math.round(y/60*10)/10,T=Math.round(k/60*10)/10,I=Math.round(C/60*10)/10,O=k>0?y/k*100:0,F=O>100?Math.round((y-k)/60*10)/10:0,$=O>100?"#FF2D20":O>=80?"#FFD60A":"#3BF06E";react.useEffect(()=>{if(!b&&!f)return;let M=G=>{w.current&&!w.current.contains(G.target)&&(v(false),h(null));};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[b,f]);let z=M=>{if(M.stopPropagation(),r&&!o&&!s){h("log");return}if(r||o||s){v(G=>!G),h(null);return}d&&d(e);},de=M=>{v(false),h(M);},A=async(M,G)=>{f==="log"&&r&&M?r(e,M,G):f==="estimate"&&o?o(e,M):f==="quoted"&&s&&s(e,M),h(null);},J=r||o||s||d,xe=[{mode:"log",icon:lucideReact.Clock,label:u?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:u?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:u?"T. Ofertado":"Quoted time",show:!!s}].filter(M=>M.show),Ge=f==="estimate"?k:f==="quoted"?C:void 0;return k===0&&y===0&&C===0?jsxRuntime.jsxs("div",{ref:w,className:"relative flex items-center gap-2",onClick:M=>M.stopPropagation(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),children:[jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&J&&jsxRuntime.jsx("button",{onClick:z,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",M.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",M.currentTarget.style.backgroundColor="transparent";},title:u?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:xe.map(M=>jsxRuntime.jsxs("button",{onClick:G=>{G.stopPropagation(),de(M.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:G=>{G.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.target.style.background="transparent";},children:[jsxRuntime.jsx(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:Ge||void 0,onSave:A,onClose:()=>h(null)})})})})]}):jsxRuntime.jsxs("div",{ref:w,className:"relative flex items-center gap-2 w-full",onClick:M=>M.stopPropagation(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:m(E)}),k>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(T)]}),F>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF2D20"},children:["+",m(F)," ",u?"Exceso":"Over"]})]}),k>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(O,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})}),C>0&&(s||n)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1",style:{marginTop:1},children:[jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:9,color:t?"rgba(255,255,255,0.25)":"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:[u?"Ofertado":"Quoted",":"]}),jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:10,color:t?"rgba(255,255,255,0.4)":"#6B7280"},children:m(I)})]})]}),J&&jsxRuntime.jsx("button",{onClick:z,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:g?1:0,pointerEvents:g?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",M.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",M.currentTarget.style.backgroundColor="transparent";},title:u?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:xe.map(M=>jsxRuntime.jsxs("button",{onClick:G=>{G.stopPropagation(),de(M.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:G=>{G.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.target.style.background="transparent";},children:[jsxRuntime.jsx(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:Ge||void 0,onSave:A,onClose:()=>h(null)})})})})]})}function Jm({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF2D20]/15 text-[#FF2D20]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#3BF06E]/15 text-[#3BF06E]";return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[a&&(a.avatar?jsxRuntime.jsx("img",{src:a.avatar,alt:a.name,className:p("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:p("w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold text-white ring-1",t?"ring-white/10":"ring-gray-200"),style:{backgroundColor:a.color||"#6B7280"},children:a.initials||a.name?.charAt(0)?.toUpperCase()||"?"})),jsxRuntime.jsx("span",{className:p("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxRuntime.jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var P2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Zm({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:p("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",P2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function Y2(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function q2(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 rg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:l,onReportBlocker:m,onCopyTaskLink:g}){let x=react.useRef(null),b=r==="es"?tg.es:tg.en;if(react.useEffect(()=>{let y=C=>{x.current&&!x.current.contains(C.target)&&t();},k=C=>{C.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",k);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),d&&(y.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),u.length>0&&y.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(k=>({id:`assign-${k.id}`,label:k.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:k.name.charAt(0).toUpperCase()}),onClick:()=>{let C=e.task.assignees||[],T=C.some(I=>I.name===k.name)?C.filter(I=>I.name!==k.name):[...C,{name:k.name,initials:Y2(k.name),color:k.color||q2(k.name),avatar:k.avatarUrl}];d({...e.task,assignees:T}),t();}}))})),l&&y.push({id:"log-time",label:b.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{l(e.task),t();}}),m&&y.push({id:"report-blocker",label:b.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&y.push({id:"copy-link",label:b.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},f=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),y},h=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:x,style:w,className:p("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:h.map(y=>y.separator?jsxRuntime.jsx("div",{className:p("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},y.id):y.submenu?jsxRuntime.jsx(X2,{item:y,isDark:a},y.id):jsxRuntime.jsxs("button",{onClick:y.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:p(y.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function X2({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:p("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxRuntime.jsxs("button",{onClick:d.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var tg={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",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},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",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var ug={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},m1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function mg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[c,i]=react.useState(""),[u,l]=react.useState(null),m=react.useRef(null),g=d==="es"?pg.es:pg.en;if(react.useLayoutEffect(()=>{if(!e||!m.current)return;let y=()=>{if(!m.current)return;let k=m.current.getBoundingClientRect(),E=window.innerHeight-k.top-20;l(Math.max(300,E));};return requestAnimationFrame(y),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[e]),react.useEffect(()=>{if(!e)return;let y=setTimeout(()=>{let k=E=>{m.current&&!m.current.contains(E.target)&&t();},C=E=>{E.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",C),m._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(y),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let x=y=>g.columns[y]||y,b=y=>{if(y==="name")return;let k=a.map(C=>C.id===y?{...C,visible:!C.visible}:C);o(k);},v=(y,k)=>{let C=a.find(T=>T.type===y&&(!k||T.customFieldId===k));if(C){b(C.id);return}let E={id:k||y,type:y,label:k?r.find(T=>T.id===k)?.name||y:x(y),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};o([...a,E]);},f=m1.filter(y=>x(y).toLowerCase().includes(c.toLowerCase())),h=r.filter(y=>y.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:m,style:{...u?{maxHeight:`${u}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",y.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:y=>i(y.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:y=>{y&&y.style.setProperty("--focus-border",w);},onFocus:y=>{y.currentTarget.style.borderColor=w,y.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:y=>{y.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",y.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:f.map(y=>{let k=a.find(T=>T.type===y&&!T.customFieldId),C=k?.visible??false,E=y==="name";return jsxRuntime.jsxs("button",{onClick:()=>{E||(k?b(k.id):v(y));},disabled:E,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:E?.4:1,cursor:E?"not-allowed":"pointer"},onMouseEnter:T=>{E||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:ug[y]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:x(y)})]},y)})})]}),h.length>0&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:h.map(y=>{let C=a.find(E=>E.customFieldId===y.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>v(y.type,y.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:E=>{E.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:ug[y.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:y.name})]},y.id)})})]})]})]})}var pg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",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",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var k1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function bg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[d,c]=react.useState("text"),[i,u]=react.useState([""]),l=o==="es"?fg.es:fg.en;react.useEffect(()=>{e&&(n(""),c("text"),u([""]));},[e]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:d};d==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{u([...i,""]);},x=(v,f)=>{let h=[...i];h[v]=f,u(h);},b=v=>{i.length>1&&u(i.filter((f,h)=>h!==v));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:p("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:p("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:p("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:p("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:l.fieldNamePlaceholder,className:p("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:k1.map(v=>jsxRuntime.jsxs("button",{onClick:()=>c(v.type),className:p("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsxRuntime.jsx("span",{className:p("text-xs",d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:l.types[v.type]})]},v.type))})]}),d==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((v,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:v,onChange:h=>x(f,h.target.value),placeholder:`${l.option} ${f+1}`,className:p("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>b(f),className:p("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:p("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:p("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var fg={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 xg={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 vg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=react.useState(false),c=react.useRef(null),i=react.useRef(0),u=s==="es"?xg.es:xg.en;react.useEffect(()=>{if(!n)return;let g=b=>{Date.now()-i.current<100||c.current&&!c.current.contains(b.target)&&d(false);},x=b=>{b.key==="Escape"&&d(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",x);}},[n]);let l=[{value:"all",label:u.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:u.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),d(x=>!x);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),u.filters,m&&jsxRuntime.jsx("span",{className:p("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:p("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:p("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:l.map(g=>{let x=e===g.value&&!t,b=()=>g.value==="all"?x?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),d(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",x&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:p(x?g.color:"text-gray-400","flex-shrink-0"),children:b()}),jsxRuntime.jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:p("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),d(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:p("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function wg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function kg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxRuntime.jsxs("div",{className:p("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:p("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:p("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,d=n>0?Math.min(Math.round(s/n*100),100):0,c=s>n&&n>0,i=c?"#FF2D20":d>=80?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:p("text-[11px] font-mono font-bold",c?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:wg(s)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:p("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:wg(n)})]}),n>0&&jsxRuntime.jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:i}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:p("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,d=s<0,c=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:p("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#FF2D20]/15 text-[#FF2D20]",!n&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:c})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let d=s.utilizationPercent>=100?"#FF2D20":s.utilizationPercent>=80?"#FFD60A":s.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(s.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${s.name}-${n}`)})})]})]})}var $1=[{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 Eg(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(...Eg(r.subtasks,t+1));return a}function H1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let u=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(u<=0)continue;let l=(s.progress||0)/u;r+=l,o++;}return o>0?r/o:null}function z1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function wn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=wn(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function $d(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Fg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:c=[],toolbarRightContent:i}){let{theme:u="dark",locale:l="en",customTranslations:m,showSearch:g=true,showHierarchy:x=true,tableColumns:b,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:h=true,showCreateTaskButton:w=false,onCreateTask:y,persistFilter:k=false,financialBlur:C,healthSidebar:E,lens:T="hours",hourlyRate:I=0,aggregateParentHours:O=false}=t,F=vi(l,m),$=u==="dark",z=react.useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let N=localStorage.getItem(k);if(N){let D=JSON.parse(N);return {statusFilter:D.statusFilter||"all",hideCompleted:D.hideCompleted||!1}}}catch(N){console.error("Error loading persisted filter:",N);}return {statusFilter:"all",hideCompleted:false}},[k]),de=react.useMemo(()=>{function N(D){let B=0,j=0;for(let se of D)if(se.subtasks&&se.subtasks.length>0){let pe=N(se.subtasks);B+=pe.spent,j+=pe.allocated;}else B+=se.timeLoggedMinutes??0,j+=se.effortMinutes??0;return {spent:B,allocated:j}}return N(e)},[e]),A=react.useMemo(()=>!E?.enabled||!E.data?E:{...E,data:{...E.data,totalHoursSpentMinutes:de.spent,totalHoursAllocatedMinutes:de.allocated}},[E,de]),[J,xe]=react.useState(true),[Ge,M]=react.useState("position"),[G,ae]=react.useState("asc"),[we,H]=react.useState(""),[X,Z]=react.useState(()=>z().statusFilter),[ge,Le]=react.useState(()=>z().hideCompleted),[Oe,rt]=react.useState(b||$1),[at,re]=react.useState(false),[it,Ie]=react.useState(false),[bt,pt]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[ct,Ce]=react.useState(null),[_e,tt]=react.useState(0),[Ke,U]=react.useState(0),ne=react.useRef(null),[S,q]=react.useState(null),[le,fe]=react.useState(null);react.useEffect(()=>{b&&rt(b);},[b]),react.useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:X,hideCompleted:ge}));}catch(N){console.error("Error persisting filter state:",N);}},[k,X,ge]);let _=react.useMemo(()=>{let N=new Set;function D(B){for(let j of B)j.subtasks?.length&&(j.isExpanded!==false&&N.add(j.id),D(j.subtasks));}return D(e),N},[e]),Q=react.useMemo(()=>Oe.filter(N=>N.visible),[Oe]),$e=react.useCallback(N=>{a.onTaskToggleExpand?.(N);},[a]),ke=react.useCallback(N=>{Ge===N?ae(D=>D==="asc"?"desc":"asc"):(M(N),ae("asc")),a.onSortChange?.({column:N,direction:G==="asc"?"desc":"asc"});},[Ge,G,a]),Be=react.useCallback(N=>{rt(N),a.onColumnsChange?.(N);},[a]),De=react.useCallback(N=>{let D=Oe.map(B=>B.id===N?{...B,visible:false}:B);Be(D);},[Oe,Be]),He=react.useCallback((N,D)=>{M(N),ae(D);},[]),st=react.useCallback((N,D,B)=>{h&&(N.preventDefault(),pt({isOpen:true,x:N.clientX,y:N.clientY,type:D?"task":"header",task:D,columnId:B}));},[h]),ot=react.useCallback(()=>{pt(N=>({...N,isOpen:false}));},[]),nt=react.useCallback((N,D)=>{if(!f)return;N.preventDefault(),N.stopPropagation();let B=Oe.find(j=>j.id===D);B&&(Ce(D),tt(N.clientX),U(B.width));},[Oe,f]);react.useEffect(()=>{if(!ct)return;let N=B=>{let j=B.clientX-_e,se=Math.max(50,Ke+j),pe=Oe.map(te=>te.id===ct?{...te,width:se}:te);rt(pe);},D=()=>{ct&&a.onColumnsChange?.(Oe),Ce(null);};return document.addEventListener("mousemove",N),document.addEventListener("mouseup",D),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",D);}},[ct,_e,Ke,Oe,a]);let mt=react.useCallback((N,D)=>{if(D==="name"){N.preventDefault();return}q(D),N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",D),N.currentTarget instanceof HTMLElement&&(N.currentTarget.style.opacity="0.5");},[]),Bt=react.useCallback(N=>{N.currentTarget instanceof HTMLElement&&(N.currentTarget.style.opacity="1"),q(null),fe(null);},[]),Tt=react.useCallback((N,D)=>{N.preventDefault(),D!=="name"&&(N.dataTransfer.dropEffect="move",fe(D));},[]),lt=react.useCallback(()=>{fe(null);},[]),ut=react.useCallback((N,D)=>{if(N.preventDefault(),!S||S===D||D==="name")return;let B=[...Oe],j=B.findIndex(te=>te.id===S),se=B.findIndex(te=>te.id===D);if(j===-1||se===-1)return;let pe=B.splice(j,1);pe[0]&&(B.splice(se,0,pe[0]),Be(B),q(null),fe(null));},[S,Oe,Be]),Et=react.useCallback(async N=>{if(a.onCreateCustomField){let D={...N,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(D);}Ie(false);},[a]),Nt=react.useCallback(N=>N.progress===100||N.status==="completed"?"completed":N.progress&&N.progress>0||N.status==="in-progress"?"in-progress":"todo",[]),Fe=react.useMemo(()=>{let N=Eg(e);if(we.trim()){let D=we.toLowerCase();N=N.filter(B=>B.name.toLowerCase().includes(D));}return X!=="all"&&(N=N.filter(D=>Nt(D)===X)),ge&&(N=N.filter(D=>Nt(D)!=="completed")),N.sort((D,B)=>{let j,se;switch(Ge){case "name":j=D.name.toLowerCase(),se=B.name.toLowerCase();break;case "startDate":j=D.startDate?.getTime()||0,se=B.startDate?.getTime()||0;break;case "endDate":j=D.endDate?.getTime()||0,se=B.endDate?.getTime()||0;break;case "progress":j=D.progress||0,se=B.progress||0;break;case "status":j=D.status||"todo",se=B.status||"todo";break;case "priority":let pe={urgent:0,high:1,medium:2,low:3,none:4};j=pe[D.priority]??4,se=pe[B.priority]??4;break;case "position":return 0;default:return 0}return j<se?G==="asc"?-1:1:j>se?G==="asc"?1:-1:0}),N},[e,we,X,ge,Ge,G,Nt]),ze=react.useCallback((N,D)=>{let B=pe=>{a.onTaskUpdate?.({...N,...pe});},j=pe=>pe?N.customFields?.find(me=>me.fieldId===pe)?.value:void 0,se=(pe,te)=>{if(!pe)return;let Ye=[...N.customFields||[]],qe=Ye.findIndex(At=>At.fieldId===pe);qe>=0?Ye[qe]={fieldId:pe,value:te}:Ye.push({fieldId:pe,value:te}),B({customFields:Ye});};switch(D.type){case "name":return null;case "status":return jsxRuntime.jsx(xm,{value:N.status||(N.progress===100?"completed":N.progress&&N.progress>0?"in-progress":"todo"),onChange:te=>{B({status:te,progress:te==="completed"?100:te==="in-progress"?50:0});},isDark:$,locale:l,translations:F.status});case "priority":return jsxRuntime.jsx(wm,{value:N.priority,onChange:te=>B({priority:te}),isDark:$,locale:l});case "assignees":return jsxRuntime.jsx(Nm,{value:N.assignees||[],availableUsers:d,onChange:te=>B({assignees:te}),isDark:$,locale:l});case "startDate":return jsxRuntime.jsx(Ci,{value:N.startDate,onChange:te=>B({startDate:te}),isDark:$,locale:l,dateField:"start",startDate:N.startDate,endDate:N.endDate});case "endDate":return jsxRuntime.jsx(Ci,{value:N.endDate,onChange:te=>B({endDate:te}),isDark:$,locale:l,dateField:"end",startDate:N.startDate,endDate:N.endDate});case "progress":return jsxRuntime.jsx(Am,{value:N.progress||0,onChange:te=>{let me=te===100?"completed":te>0?"in-progress":"todo";B({progress:te,status:me});},isDark:$});case "tags":return jsxRuntime.jsx(Vm,{value:N.tags||[],isDark:$});case "text":return jsxRuntime.jsx(Bm,{value:j(D.customFieldId)||"",onChange:te=>se(D.customFieldId,te),isDark:$});case "number":return jsxRuntime.jsx($m,{value:j(D.customFieldId)||0,onChange:te=>se(D.customFieldId,te),isDark:$});case "date":let pe=j(D.customFieldId);return jsxRuntime.jsx(Ci,{value:pe?new Date(pe):void 0,onChange:te=>se(D.customFieldId,te),isDark:$,locale:l});case "dropdown":return jsxRuntime.jsx(Hm,{value:j(D.customFieldId)||"",options:D.options||[],onChange:te=>se(D.customFieldId,te),isDark:$});case "checkbox":return jsxRuntime.jsx(Um,{value:j(D.customFieldId)||false,onChange:te=>se(D.customFieldId,te),isDark:$});case "estimatedTime":{let te=N.status==="completed"||N.progress===100;return jsxRuntime.jsx(ur,{value:N.estimatedTime,onChange:me=>B({estimatedTime:me}),isDark:$,locale:l,disabled:te,lens:T,hourlyRate:I})}case "quotedTime":{let te=N.status==="completed"||N.progress===100,me=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsxRuntime.jsx(ur,{value:N.quotedTime,onChange:Ye=>B({quotedTime:Ye}),isDark:$,locale:l,disabled:te,isBlurred:me,lens:T,hourlyRate:I})}case "elapsedTime":{let te=N.status==="completed"||N.progress===100;return jsxRuntime.jsx(ur,{value:N.elapsedTime,onChange:me=>B({elapsedTime:me}),isDark:$,locale:l,disabled:te,lens:T,hourlyRate:I})}case "effortMinutes":{if(O&&N.subtasks&&N.subtasks.length>0){let{allocated:me}=wn(N);return jsxRuntime.jsx(ur,{value:me>0?me:void 0,isDark:$,locale:l,disabled:true,lens:T,hourlyRate:I})}let te=N.status==="completed"||N.progress===100;return jsxRuntime.jsx(ur,{value:N.effortMinutes,onChange:me=>B({effortMinutes:me}),isDark:$,locale:l,disabled:te,lens:T,hourlyRate:I})}case "timeLoggedMinutes":{if(O&&N.subtasks&&N.subtasks.length>0){let{spent:me}=wn(N);return jsxRuntime.jsx(ur,{value:me>0?me:void 0,isDark:$,locale:l,disabled:true,lens:T,hourlyRate:I})}let te=N.status==="completed"||N.progress===100;return jsxRuntime.jsx(ur,{value:N.timeLoggedMinutes,onChange:a.onLogTime?me=>{a.onLogTime?.(N,me);}:void 0,isDark:$,locale:l,placeholder:l==="es"?"Agregar":"Add",disabled:te,lens:T,hourlyRate:I})}case "soldEffortMinutes":{if(O&&N.subtasks&&N.subtasks.length>0){let{quoted:Ye}=wn(N),qe=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(ur,{value:Ye>0?Ye:void 0,isDark:$,locale:l,disabled:true,isBlurred:qe,lens:T,hourlyRate:I})}let te=N.status==="completed"||N.progress===100,me=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(ur,{value:N.soldEffortMinutes,onChange:Ye=>B({soldEffortMinutes:Ye}),isDark:$,locale:l,disabled:te,isBlurred:me,lens:T,hourlyRate:I})}case "scheduleVariance":return jsxRuntime.jsx(Ym,{startDate:N.startDate,endDate:N.endDate,scheduleVariance:N.scheduleVariance,isDark:$,locale:l});case "hoursBar":{if(O&&N.hasChildren){let{spent:te,allocated:me,quoted:Ye}=wn(N),qe=te>me&&me>0;return jsxRuntime.jsxs("span",{className:p("text-[11px] font-mono flex items-center gap-1.5",$?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:p("font-bold",qe?"text-[#FF453A]":$?"text-white/80":"text-gray-800"),children:$d(te)}),me>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:$?"text-white/60":"text-gray-600",children:$d(me)})]}),Ye>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:$?"text-amber-400/70":"text-amber-600",children:$d(Ye)})]})]})}return jsxRuntime.jsx(Xm,{task:N,isDark:$,locale:l,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:I})}case "teamLoad":return jsxRuntime.jsx(Jm,{task:N,isDark:$});case "blockers":return jsxRuntime.jsx(Zm,{blockers:N.blockers,isDark:$,locale:l});default:return jsxRuntime.jsx("span",{className:p("text-sm",$?"text-white/60":"text-gray-500"),children:"-"})}},[a,$,l,d,F,O]),Y=react.useCallback(N=>{let B={name:F.columns.name,status:F.columns.status,priority:F.columns.priority,assignees:F.columns.assignees,startDate:F.columns.startDate,endDate:F.columns.endDate,progress:F.columns.progress,tags:F.columns.tags||(l==="es"?"Etiquetas":"Tags"),estimatedTime:F.columns.estimatedTime||(l==="es"?"Estimado":"Estimated"),quotedTime:F.columns.quotedTime||(l==="es"?"Ofertado":"Quoted"),elapsedTime:F.columns.elapsedTime||(l==="es"?"Ejecutado":"Executed"),soldEffortMinutes:F.columns.soldEffortMinutes||(l==="es"?"Ofertado":"Quoted"),effortMinutes:F.columns.effortMinutes||(l==="es"?"Estimado":"Estimated"),timeLoggedMinutes:F.columns.timeLoggedMinutes||(l==="es"?"Ejecutado":"Executed"),scheduleVariance:F.columns.scheduleVariance||(l==="es"?"Prog / Var":"Sched / Var"),hoursBar:F.columns.hoursBar||(l==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:F.columns.teamLoad||(l==="es"?"Carga Equipo":"Team Load"),blockers:F.columns.blockers||(l==="es"?"Bloqueantes":"Blockers")}[N.type]||N.label;return typeof B=="string"?B:String(B||N.type)},[F,l]),he=react.useMemo(()=>{let B=Q.reduce((se,pe)=>se+pe.width,0)+(v?48:0),j={};for(let se of Q)j[se.id]=`${se.width/B*100}%`;return j},[Q,v]);return r?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxRuntime.jsxs("p",{className:p("text-sm",$?"text-white/60":"text-gray-600"),children:[F.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",$?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:p("text-sm",$?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",$?"text-white":"text-gray-900"),children:F.empty.noTasks}),jsxRuntime.jsx("p",{className:p("text-sm",$?"text-white/60":"text-gray-600"),children:F.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:ne,className:p($?"bg-[#0D0D0D]":"bg-white",ct&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:p("flex-shrink-0 px-6 py-4 border-b",$?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:p("text-sm",$?"text-white/60":"text-gray-600"),children:[Fe.length," ",F.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:p("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",$?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:we,onChange:N=>H(N.target.value),placeholder:F.toolbar.searchPlaceholder,className:p("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",$?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),jsxRuntime.jsx(vg,{value:X,hideCompleted:ge,onChange:Z,onHideCompletedChange:Le,isDark:$,locale:l}),A?.enabled&&A.data&&!J&&jsxRuntime.jsx("button",{onClick:()=>xe(true),className:p("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",$?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:l==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),w&&y&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:y,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:F.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:p("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",$?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Q.map(N=>{let D=N.id!=="name",B=le===N.id&&S!==N.id;return jsxRuntime.jsxs("div",{className:p("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",$?"text-white/60":"text-gray-500",D&&"cursor-grab",S===N.id&&"opacity-50",B&&($?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:he[N.id],minWidth:N.minWidth},draggable:D,onDragStart:D?j=>mt(j,N.id):void 0,onDragEnd:D?Bt:void 0,onDragOver:D?j=>Tt(j,N.id):void 0,onDragLeave:D?lt:void 0,onDrop:D?j=>ut(j,N.id):void 0,onContextMenu:j=>st(j,void 0,N.id),children:[D&&jsxRuntime.jsx(lucideReact.GripVertical,{className:p("w-3 h-3 flex-shrink-0 transition-opacity",$?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),N.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>ke(N.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Y(N),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:p("w-3 h-3",Ge===N.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:Y(N)}),f&&N.resizable&&jsxRuntime.jsx("div",{className:p("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",ct===N.id&&"bg-[#007BFF]"),onMouseDown:j=>nt(j,N.id)})]},N.id)}),v&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:N=>{N.stopPropagation(),re(D=>!D);},className:p("p-0.5 rounded transition-colors",$?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",at&&($?"bg-white/[0.05]":"bg-gray-200")),title:l==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(mg,{isOpen:at,onClose:()=>re(false),columns:Oe,customFields:c,onColumnsChange:Be,onCreateCustomField:()=>{re(false),Ie(true);},isDark:$,locale:l})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Fe.map((N,D)=>{let B=_.has(N.id),j=Math.min(D*.01,.2),se=N.hasChildren&&N.level===0,pe=N.subtasks?.length||0;if(se){let{spent:te,allocated:me,quoted:Ye}=wn(N),qe=H1(N),At=z1(N);return jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:j},className:p("flex items-center border-y cursor-pointer",$?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>$e(N.id),children:Q.map(Wt=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:he[Wt.id],minWidth:Wt.minWidth},children:Wt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:sa=>{sa.stopPropagation(),$e(N.id);},className:p("p-0.5 rounded flex-shrink-0",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:B?jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-4 h-4",$?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",$?"text-white/40":"text-gray-500")})}),B?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:$?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:$?"#FFD60A":"#B45309"}}),N.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:$?"#FFD60A":"#B45309"},children:N.wbsCode}),jsxRuntime.jsx("span",{title:N.name,className:p("text-[11px] font-semibold uppercase tracking-wide truncate",$?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:N.name}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",$?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",pe," ",l==="es"?pe===1?"Tarea":"Tareas":pe===1?"Item":"Items",")"]}),qe!==null&&jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono flex-shrink-0",qe>=1?"text-[#32D74B]":qe>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",qe.toFixed(2)]}),At>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[l==="es"?"Conflicto":"Conflict",": ",At]})]}):Wt.type==="timeLoggedMinutes"?jsxRuntime.jsx(ur,{value:te>0?te:void 0,isDark:$,locale:l,disabled:true,lens:T,hourlyRate:I}):Wt.type==="soldEffortMinutes"?jsxRuntime.jsx(ur,{value:Ye>0?Ye:void 0,isDark:$,locale:l,disabled:true,lens:T,hourlyRate:I}):Wt.type==="effortMinutes"?jsxRuntime.jsx(ur,{value:me>0?me:void 0,isDark:$,locale:l,disabled:true,lens:T,hourlyRate:I}):ze(N,Wt)},Wt.id))},N.id)}return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:j},className:p("flex items-center border-b transition-colors",$?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(N),onDoubleClick:()=>a.onTaskDoubleClick?.(N),onContextMenu:te=>st(te,N),children:[Q.map(te=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:he[te.id],minWidth:te.minWidth},children:te.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[x&&N.level>0&&jsxRuntime.jsx("div",{style:{width:`${N.level*24}px`},className:"flex-shrink-0"}),x&&N.hasChildren&&jsxRuntime.jsx("button",{onClick:me=>{me.stopPropagation(),$e(N.id);},className:p("p-0.5 rounded flex-shrink-0",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:B?jsxRuntime.jsx(lucideReact.ChevronDown,{className:p("w-4 h-4",$?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:p("w-4 h-4",$?"text-white/60":"text-gray-400")})}),x&&!N.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(N.wbsCode||N.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[N.wbsCode&&jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",$?"text-[#007BFF]":"text-blue-600"),children:N.wbsCode}),N.taskCode&&jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",$?"text-white/40":"text-gray-400"),children:N.taskCode})]}),jsxRuntime.jsx("span",{className:p("truncate font-bold text-[13px]",$?"text-white":"text-gray-900",N.progress===100&&($?"line-through text-white/30":"line-through text-gray-400")),children:N.name}),N.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${N.tags[0].color}20`,color:N.tags[0].color},children:N.tags[0].name})]})]}):ze(N,te)},te.id)),v&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},N.id)})}),Fe.length===0&&we&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:p("w-12 h-12 mx-auto mb-4",$?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:p($?"text-white/60":"text-gray-600"),children:F.empty.noResults})]})})]})}),A?.enabled&&A.data&&J&&jsxRuntime.jsx(kg,{data:A.data,isDark:$,locale:l,onClose:()=>xe(false)})]}),jsxRuntime.jsx(rg,{state:bt,onClose:ot,isDark:$,locale:l,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:De,onColumnSort:He,availableUsers:d,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsxRuntime.jsx(bg,{isOpen:it,onClose:()=>Ie(false),onSave:Et,isDark:$,locale:l})]})}var Pg=[{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:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true}],Mg=[{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"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"}],Ag=[{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 Hd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},zd={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",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Ud={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",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Pi={dark:Hd,light:zd,neutral:Ud};function Lg(e){return Pi[e]||Pi.dark}var Wd={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",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Gd={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",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Mi={en:Wd,es:Gd};function es(e){return Mi[e]||Mi.en}function Ai(e,t){let a=es(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 Ig(e){let t=es(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 Bg(e,t=0,a=true){let r=es(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 as(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 _d(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 $g({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:p("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Ug=26,Y1=22,q1=10;function Hg(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function jd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function Wg(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function zg(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function X1({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:d=0}){let{task:c,spanCols:i,lane:u,isStart:l,isEnd:m}=e,g=c.progress===100||c.status==="completed",x=c.isCriticalPath,b=l&&m?"rounded":l?"rounded-l":m?"rounded-r":"",v=m?jd(c.effortMinutes,n,d):null,f=m?Wg(c,n,d):null,h=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:p("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",b,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":x?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${u*Ug}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${Y1}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:x?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:l?"3px":void 0,borderLeftColor:l?x?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[x&&l&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(v||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:p(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),h&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",h.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function Gg({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:c=[],onCreateTag:i,attachmentsByTask:u,comments:l,onAddComment:m,currentUser:g,mentionableUsers:x,onUploadCommentAttachments:b,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:h,timeEntries:w,timerState:y,onLogTime:k,onUpdateEstimate:C,onUpdateSoldEffort:E,onStartTimer:T,onStopTimer:I,onDiscardTimer:O,blurFinancials:F=false,suppressDetailModal:$=false,lens:z="hours",hourlyRate:de=0}){let{theme:A="dark",locale:J="en",customTranslations:xe,showBacklog:Ge=true}=t,M=Ai(J,xe),G=A==="dark"||A==="neutral",[ae,we]=react.useState(r||new Date),[H,X]=react.useState(null),[Z,ge]=react.useState(null),[Le,Oe]=react.useState(null),[rt,at]=react.useState({}),re=3,it=3,Ie=react.useCallback(_=>{ge(_.id),$||X(_),v?.(_.id);},[$,v]),[bt,pt]=react.useState(null),ct=react.useCallback(()=>{we(new Date(ae.getFullYear(),ae.getMonth()-1,1));},[ae]),Ce=react.useCallback(()=>{we(new Date(ae.getFullYear(),ae.getMonth()+1,1));},[ae]),_e=react.useCallback(()=>{we(new Date);},[]),tt=react.useMemo(()=>{let _=ae.getFullYear(),Q=ae.getMonth(),$e=new Date(_,Q,1),ke=new Date(_,Q+1,0),Be=$e.getDay(),De=ke.getDate(),He=as(e),st=new Date;st.setHours(0,0,0,0);let ot=[],nt=Be,mt=new Date(_,Q,0).getDate();for(let Tt=nt-1;Tt>=0;Tt--){let lt=new Date(_,Q-1,mt-Tt);ot.push({date:lt,isCurrentMonth:false,isToday:false,isWeekend:lt.getDay()===0||lt.getDay()===6,events:He.filter(ut=>_d(lt,ut)).map(ut=>({id:ut.id,title:ut.name,start:ut.startDate,end:ut.endDate,task:ut}))});}for(let Tt=1;Tt<=De;Tt++){let lt=new Date(_,Q,Tt),ut=lt.getTime()===st.getTime();ot.push({date:lt,isCurrentMonth:true,isToday:ut,isWeekend:lt.getDay()===0||lt.getDay()===6,events:He.filter(Et=>_d(lt,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}let Bt=42-ot.length;for(let Tt=1;Tt<=Bt;Tt++){let lt=new Date(_,Q+1,Tt);ot.push({date:lt,isCurrentMonth:false,isToday:false,isWeekend:lt.getDay()===0||lt.getDay()===6,events:He.filter(ut=>_d(lt,ut)).map(ut=>({id:ut.id,title:ut.name,start:ut.startDate,end:ut.endDate,task:ut}))});}return ot},[ae,e]),Ke=react.useMemo(()=>as(e).filter(_=>!_.startDate||!_.endDate),[e]),U=react.useMemo(()=>{let _=as(e),Q=0,$e=0,ke=0,Be=0,De=0;_.forEach(mt=>{mt.effortMinutes&&(Q+=mt.effortMinutes),mt.soldEffortMinutes&&($e+=mt.soldEffortMinutes),mt.scheduleVariance!=null&&(ke+=mt.scheduleVariance,Be++),mt.soldEffortMinutes&&mt.effortMinutes&&(De+=mt.soldEffortMinutes-mt.effortMinutes);});let He=$e>0?Math.min(100,Math.round(Q/$e*100)):0,st=Be>0?Math.round(ke/Be):0,nt=`${De<0?"-":"+"}${zg(De,z,de)}`;return {budgetUtil:He,avgVariance:st,costDisplay:nt,hasCostData:$e>0}},[e,z,de]),ne=react.useMemo(()=>{let _=[0,0,0,0,0,0];return tt.forEach((Q,$e)=>{let ke=Math.floor($e/7);Q.events.forEach(Be=>{if(Be.task.startDate&&Be.task.soldEffortMinutes){let De=new Date(Be.task.startDate),He=Q.date;De.getFullYear()===He.getFullYear()&&De.getMonth()===He.getMonth()&&De.getDate()===He.getDate()&&ke<_.length&&(_[ke]-=Be.task.soldEffortMinutes);}});}),_},[tt]),S=react.useMemo(()=>{let _=as(e),Q=new Map,$e=new Set,ke=[0,0,0,0,0,0];if(tt.length===0)return {segmentsByCell:Q,multiDayTaskIds:$e,maxLanesPerRow:ke};let Be=nt=>new Date(nt.getFullYear(),nt.getMonth(),nt.getDate()),De=Be(tt[0].date),He=Be(tt[tt.length-1].date),st=[];for(let nt of _){if(!nt.startDate||!nt.endDate)continue;let mt=Be(nt.startDate),Bt=Be(nt.endDate);if(mt.getTime()===Bt.getTime()||Bt<De||mt>He)continue;let Tt=mt<De?De:mt,lt=Bt>He?He:Bt,ut=Hg(Tt,De),Et=Hg(lt,De);ut<0||ut>41||Et<0||Et>41||ut!==Et&&($e.add(nt.id),st.push({task:nt,startIdx:ut,endIdx:Et}));}st.sort((nt,mt)=>nt.startIdx!==mt.startIdx?nt.startIdx-mt.startIdx:mt.endIdx-mt.startIdx-(nt.endIdx-nt.startIdx));let ot=[[],[],[],[],[],[]];for(let{task:nt,startIdx:mt,endIdx:Bt}of st){let Tt=Math.floor(mt/7),lt=Math.floor(Bt/7),ut=Be(nt.startDate),Et=Be(nt.endDate),Nt=false;for(let Fe=Tt;Fe<=lt;Fe++){let ze=Fe===Tt?mt%7:0,Y=Fe===lt?Bt%7:6,he=Y-ze+1,N=0,D=ot[Fe]??[];for(ot[Fe]||(ot[Fe]=D);N<D.length&&(D[N]??-1)>=ze;)N++;if(N>=q1){Nt=true;break}N>=D.length?D.push(Y):D[N]=Y,ke[Fe]=Math.max(ke[Fe]??0,N+1);let B=Fe===Tt&&ut>=De,j=Fe===lt&&Et<=He,se=Fe*7+ze,pe={taskId:nt.id,task:nt,rowIndex:Fe,startCol:ze,endCol:Y,spanCols:he,lane:N,isStart:B,isEnd:j};Q.has(se)||Q.set(se,[]),Q.get(se).push(pe);}Nt&&($e.delete(nt.id),Q.forEach((Fe,ze)=>{let Y=Fe.filter(he=>he.taskId!==nt.id);Y.length===0?Q.delete(ze):Q.set(ze,Y);}));}return {segmentsByCell:Q,multiDayTaskIds:$e,maxLanesPerRow:ke}},[tt,e]),q=J==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],le=ae.toLocaleDateString(J==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),fe=le.charAt(0).toUpperCase()+le.slice(1);return o?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",G?"bg-[#050505]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:p("text-sm font-mono",G?"text-white/30":"text-gray-600"),children:[M.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",G?"bg-[#050505]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:p("w-12 h-12 rounded-full flex items-center justify-center",G?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",G?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:p("text-sm",G?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:p("flex-1 flex items-center justify-center",G?"bg-[#050505]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:p("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",G?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-8 h-8",G?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:p("text-lg font-semibold mb-2",G?"text-white/90":"text-gray-900"),children:M.labels.noEvents}),jsxRuntime.jsx("p",{className:p("text-sm",G?"text-white/30":"text-gray-600"),children:M.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:p("flex-1 flex flex-col w-full h-full overflow-hidden",G?"bg-[#050505]":"bg-white",n),style:d,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:p("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",G?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:p("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",G?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-3.5 h-3.5",G?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:p("font-medium",G?"text-white":"text-gray-900"),children:J==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:p("h-4 w-px",G?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:ct,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",G?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:p("text-sm font-semibold tracking-tight min-w-[150px] text-center",G?"text-white":"text-gray-900"),children:fe}),jsxRuntime.jsx("button",{onClick:Ce,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",G?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:p("h-4 w-px",G?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:_e,className:p("px-2.5 py-1 text-xs rounded-md transition-all font-medium",G?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:M.navigation.today})]})]}),jsxRuntime.jsx("div",{className:p("grid grid-cols-7 sticky top-0 z-10",G?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:q.map(_=>jsxRuntime.jsx("div",{className:p("py-2 text-center text-[10px] font-bold uppercase tracking-widest",G?"text-white/60 font-mono":"text-gray-500"),children:_},_))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:p("grid grid-cols-7 min-h-[800px]",G?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>ge(null),children:tt.map((_,Q)=>{let $e=Q%7===6,ke=Q>=35;return jsxRuntime.jsxs("div",{className:p("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!$e&&(G?"border-r border-[#222]":"border-r border-gray-200"),!ke&&(G?"border-b border-[#222]":"border-b border-gray-200"),G?_.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":_.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",_.isToday&&G&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",_.isToday&&!G&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:p("text-xs font-mono select-none relative z-20",_.isToday?G?"text-[#007FFF] font-bold":"text-blue-600 font-bold":_.isCurrentMonth?G?"text-white/60":"text-gray-900":G?"text-white/20":"text-gray-400"),children:String(_.date.getDate()).padStart(2,"0")}),(()=>{let Be=Math.floor(Q/7),De=(S.maxLanesPerRow[Be]??0)*Ug,He=S.segmentsByCell.get(Q);return De===0&&!He?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${De}px`,zIndex:5},children:He?.map(st=>jsxRuntime.jsx(X1,{segment:st,isDark:G,blurFinancials:F,isSelected:Z===st.taskId,t:M,lens:z,hourlyRate:de,onClick:()=>{Ie(st.task),a.onEventClick?.({id:st.task.id,title:st.task.name,start:st.task.startDate,end:st.task.endDate,task:st.task});}},st.taskId))})})(),(()=>{let Be=_.events.filter(De=>De.task.isMilestone&&!S.multiDayTaskIds.has(De.id));return Be.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Be.slice(0,4).map(De=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:De.title,onClick:He=>{He.stopPropagation(),Ie(De.task);}},De.id)),Be.length>4&&jsxRuntime.jsxs("span",{className:p("text-[8px] font-mono",G?"text-white/30":"text-gray-400"),children:["+",Be.length-4]})]})})(),(()=>{let Be=[];_.events.forEach(He=>{He.task.blockers?.forEach(st=>{(st.severity==="warning"||st.severity==="critical")&&Be.push({taskId:He.id,type:st.type,severity:st.severity,variance:He.task.scheduleVariance});});});let De=Be[0];return De?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:p("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",De.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[M.labels.risk,": ",De.type,De.variance?` (+${Math.abs(De.variance)}d ${M.labels.delay})`:""]})]})}):null})(),(()=>{let Be=_.events.filter(ot=>!S.multiDayTaskIds.has(ot.id)),De=rt[Q]||re,He=Be.slice(0,De),st=Be.length-De;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[He.map(ot=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{Ie(ot.task),a.onEventClick?.(ot);},whileHover:{scale:1.01},className:p("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",ot.task.progress===100||ot.task.status==="completed"?G?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":G?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:G?ot.task.progress===100||ot.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:ot.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:p("flex-shrink-0 text-[9px]",ot.task.isMilestone?G?"text-amber-400":"text-amber-600":ot.task.isCriticalPath?"text-red-400":G?"text-[#1264FF]":"text-gray-400"),children:ot.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:ot.title})]},ot.id)),st>0&&jsxRuntime.jsxs("button",{onClick:ot=>{ot.stopPropagation(),at(nt=>({...nt,[Q]:De+it}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",G?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",st," ",J==="es"?"m\xE1s":"more"]}),De>re&&Be.length>re&&jsxRuntime.jsx("button",{onClick:ot=>{ot.stopPropagation(),at(nt=>({...nt,[Q]:re}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",G?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:J==="es"?"menos":"less"})]})})(),_.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Be=Q>=28,De=Q%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:He=>{He.stopPropagation(),pt(bt===Q?null:Q);},className:p("w-5 h-5 rounded flex items-center justify-center transition-all",bt===Q?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",G?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:p("w-3.5 h-3.5 transition-transform",bt===Q&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:bt===Q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>pt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:Be?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Be?-5:5,scale:.95},transition:{duration:.12},className:p("absolute w-[320px] rounded-lg shadow-2xl z-50",Be?"bottom-full mb-1":"top-full mt-1",De?"right-0":"left-0",G?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Fo,{onSubmit:He=>{a.onTaskCreate?.({name:He.name,startDate:He.startDate||_.date,endDate:He.endDate||_.date,priority:He.priority,assignees:He.assignee?[He.assignee]:void 0}),pt(null);},onCancel:()=>pt(null),availableUsers:t.availableUsers,isDark:G,locale:J==="es"?"es":"en",defaultDate:_.date,dropdownDirection:Be?"up":"down"})})]})})]})})()}),Q%7===6&&(()=>{let Be=Math.floor(Q/7),De=ne[Be];if(!De||De===0)return null;let He=zg(De,z,de);return jsxRuntime.jsxs("div",{className:p("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",De<0?"text-red-400":"text-emerald-400",F&&"blur-sm select-none"),children:[M.labels.cashOut,": ",De<0?"-":"+",He]})})()]},Q)})})})]}),Ge&&jsxRuntime.jsxs("aside",{className:p("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",G?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("flex-shrink-0 h-14 flex items-center justify-between px-4",G?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",G?"text-white/40":"text-gray-500"),children:M.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:p("text-[10px] font-mono tabular-nums",G?"text-white/20":"text-gray-400"),children:Ke.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Ke.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:p("w-10 h-10 rounded-xl flex items-center justify-center mb-3",G?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:p("w-5 h-5",G?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:p("text-xs font-mono",G?"text-white/20":"text-gray-400"),children:J==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Ke.map(_=>jsxRuntime.jsxs("button",{onClick:()=>{Ie(_);},className:p("w-full text-left rounded-md p-3 transition-all group/card",G?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:p("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",G?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:p("text-sm font-medium leading-snug line-clamp-2",G?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:_.name})]}),_.tags&&_.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[_.tags.slice(0,3).map(Q=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${Q.color}15`,color:Q.color,border:`1px solid ${Q.color}30`},children:Q.name},Q.id)),_.tags.length>3&&jsxRuntime.jsxs("span",{className:p("text-[9px] font-mono px-1 py-0.5",G?"text-white/20":"text-gray-400"),children:["+",_.tags.length-3]})]}),(_.effortMinutes||_.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:p("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",G?"text-white/25":"text-gray-400",F&&"blur-sm select-none"),children:[jd(_.effortMinutes,z,de)&&jsxRuntime.jsxs("span",{children:[M.labels.estimate,": ",jd(_.effortMinutes,z,de)]}),(()=>{let Q=Wg(_,z,de);return Q?jsxRuntime.jsx("span",{className:Q.isNegative?"text-red-400":"text-emerald-400",children:Q.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[_.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:p("w-3 h-3",_.priority==="urgent"||_.priority==="high"?"text-red-400":_.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx($g,{task:_,isDark:G})]}),_.assignees&&_.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:_.assignees.slice(0,2).map((Q,$e)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:Q.color||"#007FFF"},title:Q.name,children:Q.initials||Q.name?.slice(0,2).toUpperCase()},$e))})]})]},_.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:p("flex-shrink-0 px-3 py-2.5 border-t",G?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:M.labels.typeToAdd,className:p("w-full text-[11px] font-mono bg-transparent outline-none",G?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:_=>{_.key==="Enter"&&_.target.value.trim()&&(a.onTaskCreate?.({name:_.target.value.trim()}),_.target.value="");}})}),U.hasCostData&&jsxRuntime.jsxs("div",{className:p("flex-shrink-0 px-4 py-3 border-t space-y-2.5",G?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",G?"text-white/40":"text-gray-500"),children:["\u25C8 ",M.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:p("text-[10px] font-mono",G?"text-white/40":"text-gray-500"),children:M.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:p("text-[10px] font-mono font-bold tabular-nums",G?"text-white/60":"text-gray-700",F&&"blur-sm select-none"),children:[U.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:p("h-1.5 rounded-full overflow-hidden",G?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${U.budgetUtil}%`,background:U.budgetUtil>90?"#EF4444":U.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",G?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",G?"text-white/25":"text-gray-400"),children:M.labels.variance}),jsxRuntime.jsxs("div",{className:p("text-[11px] font-mono font-bold tabular-nums",U.avgVariance>0?"text-emerald-400":U.avgVariance<0?"text-red-400":G?"text-white/50":"text-gray-600"),children:[U.avgVariance>0?"+":"",U.avgVariance," ",M.labels.days]})]}),jsxRuntime.jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",G?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",G?"text-white/25":"text-gray-400"),children:M.labels.cost}),jsxRuntime.jsx("div",{className:p("text-[11px] font-mono font-bold tabular-nums",U.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",F&&"blur-sm select-none"),children:U.costDisplay})]})]})]})]})]}),!$&&jsxRuntime.jsx(Kr,{task:H,isOpen:!!H,onClose:()=>X(null),onTaskUpdate:_=>{a.onTaskUpdate?.(_),X(_);},theme:A==="dark"?"dark":"light",locale:J,availableUsers:t.availableUsers?.map(_=>({id:_.id,name:_.name,avatar:_.avatar,initials:_.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:H?u?.get(H.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:as(e).filter(_=>_.id!==H?.id),comments:l?.filter(_=>_.taskId===H?.id).map(_=>({..._,createdAt:_.createdAt instanceof Date?_.createdAt:new Date(_.createdAt),updatedAt:_.updatedAt instanceof Date?_.updatedAt:_.updatedAt?new Date(_.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:x,onUploadCommentAttachments:b,enableTimeTracking:f,timeTrackingSummary:h,timeEntries:w,isTimerRunning:y?.isRunning,timerElapsedSeconds:y?.elapsedSeconds,onTimeLog:k,onEstimateUpdate:C,onSoldEffortUpdate:E,onTimerStart:T,onTimerStop:I,onTimerDiscard:O,blurFinancials:F}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Oe(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:p("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",G?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between",G?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:p("font-medium text-sm",G?"text-white/90":"text-gray-900"),children:Le.date.toLocaleDateString(J==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Oe(null),className:p("p-1 rounded",G?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:Le.events.map(_=>jsxRuntime.jsxs("button",{onClick:()=>{Oe(null),Ie(_.task);},className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",G?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx($g,{task:_.task,isDark:G}),jsxRuntime.jsx("span",{className:p("text-sm truncate flex-1",G?"text-white/80":"text-gray-900"),children:_.title}),(_.task.priority==="high"||_.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},_.id))})]})]})})]})}var Kd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Yd={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",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},qd={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",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Bi={dark:Kd,light:Yd,neutral:qd};function Vg(e){return Bi[e]||Bi.dark}function Q1({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[c,i]=react.useState(false),u=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),l=react.useMemo(()=>{let g=u.length,x=new Set(u.flatMap(f=>f.assignedUserIds||[])).size,b=u.map(f=>f.priority).filter(Boolean),v=new Set(u.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:x,priorities:b,labels:v}},[u]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:p("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:p("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var jg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function os(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 ns(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 Kg(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 Yg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let c=react.useMemo(()=>({...jg,...n}),[n]),[i,u]=react.useState(new Set),l=react.useRef(null),m=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(w=>{let y=w.timestamp.toISOString().split("T")[0],k=h.get(y);k?k.push(w):h.set(y,[w]);}),Array.from(h.entries()).sort((w,y)=>y[0].localeCompare(w[0])).map(([w,y])=>({date:new Date(w),events:y.sort((k,C)=>C.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:x}=react.useMemo(()=>{let h=new Set,w=new Set;return e.forEach(y=>{h.add(y.userId),w.add(y.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(w)}},[e]),b=h=>{u(w=>{let y=new Set(w);return y.has(h)?y.delete(h):y.add(h),y});},v=h=>{let y=new Date().getTime()-h.getTime(),k=Math.floor(y/6e4),C=Math.floor(y/36e5),E=Math.floor(y/864e5);return k<1?"just now":k<60?`${k}m ago`:C<24?`${C}h ago`:E<7?`${E}d ago`:h.toLocaleDateString()},f=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:p("history-timeline-empty",d),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:p("history-timeline",c.compact&&"compact",d),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let w=h.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),x.map(h=>jsxRuntime.jsxs("option",{value:h,children:[ns(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let w=h.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:m.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((w,y)=>{let k=i.has(w.id),C=s===w.id,E=Kg(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:p("history-timeline-event",k&&"expanded",C&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:E},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ns(w.type)})}),y<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:E}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:os(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(w.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([T,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},T)),w.metadata&&Object.keys(w.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([T,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},T))]})]})]})]},w.id)})})]},h.date?.toISOString()||"all"))})]})}function Xg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:p("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:p("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&ns(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&os(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>d(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,x)=>jsxRuntime.jsx("div",{className:p("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>d(x),title:os(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:u.map(g=>jsxRuntime.jsxs("button",{className:p("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:p("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Xd(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 Jd(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 Jg(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 Qg(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function ow(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),d=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(u=>{let l=a/2,m=r/2;u.vx+=(l-u.x)*o.centerForce*i,u.vy+=(m-u.y)*o.centerForce*i,n.forEach(g=>{if(u.id===g.id)return;let x=u.x-g.x,b=u.y-g.y,v=Math.sqrt(x*x+b*b)||1,f=o.chargeStrength*i/(v*v);u.vx+=x/v*f,u.vy+=b/v*f;});}),t.forEach(u=>{let l=d.get(typeof u.source=="string"?u.source:u.source.id),m=d.get(typeof u.target=="string"?u.target:u.target.id);if(!l||!m)return;let g=m.x-l.x,x=m.y-l.y,b=Math.sqrt(g*g+x*x)||1,v=(b-o.linkDistance)/b*o.forceStrength*i;l.vx+=g*v,l.vy+=x*v,m.vx-=g*v,m.vy-=x*v;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function Zg({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:c}){let i=react.useRef(null),[u,l]=react.useState([]),[m,g]=react.useState(null),[x,b]=react.useState(null),[v,f]=react.useState(null),[h,w]=react.useState(1),[y,k]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let z=ow(e,t,a.width,a.height,a,150);l(z);},[e,t,a]);let C=react.useCallback((z,de)=>{a.enableDragging&&(de.stopPropagation(),g(z));},[a.enableDragging]),E=react.useCallback(z=>{if(!m||!i.current)return;let A=i.current.getBoundingClientRect(),J=(z.clientX-A.left-y.x)/h,xe=(z.clientY-A.top-y.y)/h;l(Ge=>Ge.map(M=>M.id===m?{...M,x:J,y:xe,fx:J,fy:xe}:M));},[m,h,y]),T=react.useCallback(()=>{g(null);},[]),I=react.useCallback((z,de)=>{de.stopPropagation(),d?.({type:"node-click",node:z,position:{x:de.clientX,y:de.clientY}});},[d]),O=react.useCallback((z,de)=>{de.stopPropagation(),d?.({type:"edge-click",edge:z,position:{x:de.clientX,y:de.clientY}});},[d]),F=react.useCallback(z=>{let de=u.find(A=>A.id===z);return de?{x:de.x,y:de.y}:{x:0,y:0}},[u]),$=react.useCallback(z=>{if(z.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return z.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let de=z.card.priority;return de==="URGENT"?"#ef4444":de==="HIGH"?"#f59e0b":de==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return z.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:p("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:p("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(z=>Math.min(z+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(z=>Math.max(z-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(z=>z.type))).map(z=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Xd(z)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Jg(z)," ",Jd(z)]})]},z))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:E,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(z=>{let de=F(typeof z.source=="string"?z.source:z.source.id),A=F(typeof z.target=="string"?z.target:z.target.id),J=Qg(z.type),xe=v===z.id,Ge=z.onCriticalPath;return jsxRuntime.jsxs("g",{className:p("relationships-graph-edge",xe&&"hovered",Ge&&"critical"),onMouseEnter:()=>f(z.id),onMouseLeave:()=>f(null),onClick:M=>O(z,M),children:[jsxRuntime.jsx("line",{x1:de.x,y1:de.y,x2:A.x,y2:A.y,stroke:Xd(z.type),strokeWidth:Ge?a.edgeWidth*2:a.edgeWidth,strokeOpacity:xe?1:.6,markerEnd:J?"url(#arrowhead)":void 0}),a.showEdgeLabels&&xe&&jsxRuntime.jsx("text",{x:(de.x+A.x)/2,y:(de.y+A.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Jd(z.type)})]},z.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(z=>{let de=x===z.id,A=z.onCriticalPath;return jsxRuntime.jsxs("g",{className:p("relationships-graph-node",de&&"hovered",A&&"critical"),transform:`translate(${z.x}, ${z.y})`,onMouseDown:J=>C(z.id,J),onMouseEnter:()=>b(z.id),onMouseLeave:()=>b(null),onClick:J=>I(z,J),children:[jsxRuntime.jsx("circle",{r:A?a.nodeSize*1.2:a.nodeSize,fill:$(z),stroke:A?"#fbbf24":"#ffffff",strokeWidth:A?3:2,opacity:de?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:z.card.title.length>20?z.card.title.substring(0,20)+"...":z.card.title})]},z.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function a0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[d,c]=react.useState(false),[i,u]=react.useState(null),[l,m]=react.useState(null),g=react.useRef(null),x=d||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let h=w=>{w.key==="Escape"&&!x&&b();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,x]);let b=()=>{x||(n(""),u(null),m(null),t());},v=async()=>{if(!(!s.trim()||x)){c(true),u(null),m(null);try{let h=await r(s.trim());m(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{l&&(a(l),b());};return e?jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:b,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,w)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,w)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},w)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref: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:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,w)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,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"}),l?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,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, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Qd={"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 sw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},iw={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 lw(e,t,a){let r=Qd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ss(e){return `$${e.toFixed(4)}`}var Zd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=lw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,m)=>l+m.cost,0),s=a.reduce((l,m)=>l+m.inputTokens,0),n=a.reduce((l,m)=>l+m.outputTokens,0),d=a.filter(l=>l.success),c=a.reduce((l,m)=>l+m.duration,0),i={},u={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,u[l.feature]=(u[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(u=>u.timestamp>=n).length,c=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:c,percentUsed:i,isExceeded:d>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$o=new Zd;function n0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState($o.getStats()),[s,n]=react.useState($o.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o($o.getStats()),n($o.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let d=$o.getRecentOperations(5);return jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ss(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let u=r.costsByFeature[c]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ss(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:d.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ss(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function l0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=react.useState(""),[c,i]=react.useState(""),[u,l]=react.useState(""),[m,g]=react.useState(false),[x,b]=react.useState(null),[v,f]=react.useState(null),[h,w]=react.useState(null),y=react.useRef(null),k=m||o;react.useEffect(()=>{e&&y.current&&y.current.focus();},[e]),react.useEffect(()=>{let O=F=>{F.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[e,k]);let C=()=>{k||(d(""),i(""),l(""),b(null),f(null),w(null),t());},E=async()=>{if(!(!n.trim()||k)){g(true),b(null),f(null),w(null);try{let O=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});f(O.tasks.tasks),w({from_cache:O.from_cache,tokens_used:O.tokens_used,mock_mode:O.mock_mode,similarity:O.similarity,tokens_saved:O.tokens_saved});}catch(O){b(O instanceof Error?O.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),C());};if(!e)return null;let I=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:C,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",I,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((O,F)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",F+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:O.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),O.start," \u2192 ",O.end]}),jsxRuntime.jsxs("span",{children:[O.duration," days"]}),O.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",O.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${O.priority==="high"?"bg-red-500/20 text-red-400":O.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:O.priority})]})},O.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:y,value:n,onChange:O=>d(O.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:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:O=>i(O.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:k})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:O=>l(O.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:k})]})]}),x&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((O,F)=>jsxRuntime.jsx("button",{onClick:()=>d(O),disabled:k,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:O},F))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:C,disabled:k,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"}),v?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:E,disabled:!n.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function $i({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(v=>{t&&ks(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,h,w)=>{console.warn(`Retry attempt ${h} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(v,f,h)=>{r(w=>{let y=w.cards.find(O=>O.id===v);if(!y)return w;let k=y.columnId,C={...y,columnId:f,position:h},E=w.cards.map(O=>O.id===v?C:O),T=w.columns.map(O=>{if(O.id===k)return {...O,cardIds:O.cardIds.filter(F=>F!==v)};if(O.id===f){let F=E.filter($=>$.columnId===f).sort(($,z)=>$.position-z.position);return {...O,cardIds:F.map($=>$.id)}}return O}),I={...w,cards:E,columns:T};return o(I),I});},[o]),n=react.useCallback(async(v,f)=>{r(h=>{let w=h.cards.map(k=>k.id===v?{...k,...f}:k),y={...h,cards:w};return o(y),y});},[o]),d=react.useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let w={...v,id:f},y=h.columns.map(C=>C.id===v.columnId?{...C,cardIds:[...C.cardIds,f]}:C),k={...h,cards:[...h.cards,w],columns:y};return o(k),k});},[o]),c=react.useCallback(async v=>{r(f=>{let h=f.cards.find(C=>C.id===v);if(!h)return f;let w=f.cards.filter(C=>C.id!==v),y=f.columns.map(C=>C.id===h.columnId?{...C,cardIds:C.cardIds.filter(E=>E!==v)}:C),k={...f,cards:w,columns:y};return o(k),k});},[o]),i=react.useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let w={...v,id:f,cardIds:[]},y={...h,columns:[...h.columns,w]};return o(y),y});},[o]),u=react.useCallback(async(v,f)=>{r(h=>{let w=h.columns.map(k=>k.id===v?{...k,...f}:k),y={...h,columns:w};return o(y),y});},[o]),l=react.useCallback(async v=>{r(f=>{let h=f.cards.filter(k=>k.columnId!==v),w=f.columns.filter(k=>k.id!==v),y={...f,cards:h,columns:w};return o(y),y});},[o]),m=react.useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(v),f},[d]),g=react.useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),x=react.useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:l},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:l,clearBoard:x}}}function c0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=$i({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(l=>l.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:c,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var is={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},p0={by:"none",order:"asc"};function m0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...is,...e}),[s,n]=react.useState({...p0,...t}),d=react.useCallback(b=>{o(v=>({...v,...b}));},[]),c=react.useCallback(b=>{n(v=>({...v,...b}));},[]),i=react.useCallback(()=>{o(is),n(p0);},[]),u=react.useCallback(()=>{a&&o({...is,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...is,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...is,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),x=react.useCallback(b=>{let v=[...b];if(r.search){let f=r.search.toLowerCase();v=v.filter(h=>h.title.toLowerCase().includes(f)||h.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,h=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),y=String(f.getDate()).padStart(2,"0"),k=`${h}-${w}-${y}`;v=v.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let E=C.endDate||C.dueDate;if(!E)return false;let T;if(typeof E=="string")T=E.split("T")[0]||E;else {let I=E.getUTCFullYear(),O=String(E.getUTCMonth()+1).padStart(2,"0"),F=String(E.getUTCDate()).padStart(2,"0");T=`${I}-${O}-${F}`;}switch(r.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let I=new Date(k+"T00:00:00"),O=new Date(T+"T00:00:00"),F=new Date(I);return F.setDate(F.getDate()+7),O>=I&&O<=F;case "custom":if(r.dateRange){let $=typeof E=="string"?new Date(E):E;return $>=r.dateRange.start&&$<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,h)=>{let w=0;switch(s.by){case "created":let y=f.createdAt?new Date(f.createdAt).getTime():0,k=h.createdAt?new Date(h.createdAt).getTime():0;w=y-k;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},E=C[f.priority||"LOW"],T=C[h.priority||"LOW"];w=E-T;break;case "dueDate":let I=f.endDate||f.dueDate,O=h.endDate||h.dueDate;if(!I)return 1;if(!O)return -1;let F=typeof I=="string"?new Date(I).getTime():I.getTime(),$=typeof O=="string"?new Date(O).getTime():O.getTime();w=F-$;break;case "title":w=f.title.localeCompare(h.title);break;case "estimate":let z=f.estimatedTime||0,de=h.estimatedTime||0;w=z-de;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:l,filterHighPriority:m,applyFilters:x,hasActiveFilters:g}}var f0,b0;if(typeof window<"u")try{let e=xs("ai");f0=e.generateObject,b0=e.generateText;}catch{}function h0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(f0&&b0&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),d=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),u=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function tc(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function y0(e){let{cards:t}=e,[a,r]=tc(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,m)=>{if(!m){r({selectedCardIds:[l],lastSelectedCardId:l});return}let g=m.ctrlKey||m.metaKey,x=m.shiftKey;if(g)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(x&&a.lastSelectedCardId){let b=t.find(f=>f.id===l),v=t.find(f=>f.id===a.lastSelectedCardId);if(b&&v&&b.columnId===v.columnId){let f=t.filter(T=>T.columnId===b.columnId).sort((T,I)=>T.position-I.position),h=f.findIndex(T=>T.id===a.lastSelectedCardId),w=f.findIndex(T=>T.id===l),[y,k]=h<w?[h,w]:[w,h],C=f.slice(y,k+1).map(T=>T.id),E=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:E,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),u=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:c,toggleCard:i,getSelectedCards:u}}var x0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function v0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...x0,...a}),[a]),[s,n]=react.useState([]),d=react.useCallback((b,v,f,h,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let y={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:v,columnId:f,strategy:h,color:w,isExpanded:true,position:s.filter(k=>k.columnId===f).length,createdAt:new Date};n(k=>[...k,y]);},[o.minCardsPerStack,s]),c=react.useCallback(b=>{n(v=>v.filter(f=>f.id!==b));},[]),i=react.useCallback(b=>{n(v=>v.map(f=>f.id===b?{...f,isExpanded:!f.isExpanded}:f));},[]),u=react.useCallback((b,v)=>{n(f=>f.map(h=>h.id===b&&!h.cardIds.includes(v)?{...h,cardIds:[...h.cardIds,v]}:h));},[]),l=react.useCallback((b,v)=>{n(f=>f.map(h=>{if(h.id===b){let w=h.cardIds.filter(y=>y!==v);return w.length<o.minCardsPerStack?null:{...h,cardIds:w}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),m=react.useCallback(b=>s.filter(v=>v.columnId===b).sort((v,f)=>v.position-f.position),[s]),g=react.useCallback(async b=>{let v=t.filter(k=>k.columnId===b);if(v.length<o.minCardsPerStack*2)return [];let f=[],h=new Map;v.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(C=>{h.has(C)||h.set(C,[]),h.get(C).push(k);});}),h.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:k.map(E=>E.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${C}"`,confidence:.85});});let w=new Map;v.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(C=>{w.has(C)||w.set(C,[]),w.get(C).push(k);});}),w.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:k.map(E=>E.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let y=new Map;if(v.forEach(k=>{k.priority&&(y.has(k.priority)||y.set(k.priority,[]),y.get(k.priority).push(k));}),y.forEach((k,C)=>{if(k.length>=o.minCardsPerStack){let E={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";f.push({stack:{title:`${E} ${C} Priority`,cardIds:k.map(T=>T.id),columnId:b,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let k of v){let E=(await r.findSimilar(k,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(E.length>=o.minCardsPerStack-1){let T=[k.id,...E.map(O=>O.card.id)],I=E.reduce((O,F)=>O+F.similarity,0)/E.length;f.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${E.length+1} similar tasks`,confidence:I});}}return f.filter(k=>k.confidence>=o.autoStackConfidenceThreshold).sort((k,C)=>C.confidence-k.confidence).slice(0,5)},[t,o,r]),x=react.useCallback(b=>{d(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[d]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),h=f[0];f.length>0&&h&&h.confidence>=.9&&x(h);});},[]),{stacks:s,createStack:d,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:l,getStacksForColumn:m,getSuggestions:g,applySuggestion:x,config:o}}var w0=react.createContext(null);function k0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=xs("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=xs("@libxai/core");n.set(c.id,new i(c));});let d=null;if(t?.board){let{Board:c}=xs("@libxai/core");d=new c(t.board);}r.current=new core.BoardStore({board:d,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(w0.Provider,{value:{store:o},children:e})}function Hi(){let e=react.useContext(w0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ds(){let e=Hi(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=react.useCallback(h=>{e.updateBoard(h);},[e]),c=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,w)=>{e.updateColumn(h,w);},[e]),u=react.useCallback(h=>{e.deleteColumn(h);},[e]),l=react.useCallback(h=>e.getColumn(h),[e]),m=react.useCallback(h=>{e.addCard(h);},[e]),g=react.useCallback((h,w)=>{e.updateCard(h,w);},[e]),x=react.useCallback(h=>{e.deleteCard(h);},[e]),b=react.useCallback((h,w,y)=>{e.moveCard(h,w,y);},[e]),v=react.useCallback(h=>e.getCard(h),[e]),f=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:l,addCard:m,updateCard:g,deleteCard:x,moveCard:b,getCard:v,getCardsByColumn:f}}function T0(e){let{cards:t}=ds();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function N0(e="position",t="asc"){let{cards:a}=ds();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?d[o.priority]:0,i=s.priority?d[s.priority]:0;n=c-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 zi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Wc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Nw=new zi;function S0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:c}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:l.map(x=>{let b=e[x.index];if(!b)return null;let v=c?c(b,x.index):x.index,f={position:"absolute",top:n?0:x.start,left:n?x.start:0,width:n?x.size:"100%",height:n?"100%":x.size};return jsxRuntime.jsx("div",{style:f,"data-index":x.index,children:r(b,x.index)},v)})})})}function E0(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function P0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:c,horizontal:i=true}){let u=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:d}),m=l.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:g,className:s,children:jsxRuntime.jsx("div",{style:x,children:m.map(b=>{let v=e[b.index];if(!v)return null;let f=c?c(v,b.index):b.index,h={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":b.index,children:o(v,b.index)},f)})})})}function M0(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function A0(e,t=10){return e>t}var nc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},sc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ic={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},lc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},dc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},cc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},uc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},pc={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)"},mc={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)"},gc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},fc={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}},bc={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}},Ui={spacing:nc,borderRadius:sc,fontSize:ic,fontWeight:lc,lineHeight:dc,zIndex:cc,duration:uc,easing:pc,shadows:mc,opacity:gc,kanban:fc,gantt:bc};function L0(e,t,a){return e[t]??a}function hc(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)?hc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Ew(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function yc(e="asakaa"){let t=hc(Ui),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Ew(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
414
414
|
${a.join(`
|
|
415
415
|
`)}
|
|
416
416
|
}`}function cs(e,t="asakaa"){let a=[],r=hc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
@@ -440,5 +440,5 @@ ${cs(vc,"asakaa").split(`
|
|
|
440
440
|
`)}
|
|
441
441
|
}
|
|
442
442
|
`}var Fw=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function B0({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=nn();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,d])=>{let c=n,i=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${d.displayName} theme`,"aria-pressed":i,title:d.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Fw,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:d.displayName})]},c)})})}
|
|
443
|
-
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=n0;exports.AI_FEATURES=iw;exports.AI_MODELS=Qd;exports.AddCardButton=Nl;exports.AddColumnButton=vl;exports.AttachmentUploader=Or;exports.BoardProvider=k0;exports.BulkOperationsToolbar=Vs;exports.BurnDownChart=Ol;exports.CUSTOM_FIELD_TYPES=Ag;exports.CalendarBoard=Gg;exports.Card=_r;exports.CardDetailModal=Ml;exports.CardDetailModalV2=Il;exports.CardHistoryReplay=Xg;exports.CardHistoryTimeline=Yg;exports.CardRelationshipsGraph=Zg;exports.CardStack=Q1;exports.CardTemplateSelector=Vl;exports.CircuitBreaker=Zi;exports.Column=Qo;exports.ColumnManager=Zs;exports.CommandPalette=El;exports.ConfigMenu=Yl;exports.ContextMenu=un;exports.DEFAULT_SHORTCUTS=Wn;exports.DEFAULT_TABLE_COLUMNS=Pg;exports.DEFAULT_TEMPLATES=Gl;exports.DateRangePicker=En;exports.DependenciesSelector=Pn;exports.DependencyLine=jn;exports.DistributionCharts=$l;exports.EditableColumnTitle=il;exports.ErrorBoundary=tn;exports.ExportImportModal=jl;exports.FilterBar=Kl;exports.GANTT_AI_SYSTEM_PROMPT=cm;exports.GanttAIAssistant=fi;exports.GanttBoard=nm;exports.GanttI18nContext=ln;exports.GanttMilestone=ci;exports.GanttToolbar=Qs;exports.GenerateGanttTasksDialog=l0;exports.GeneratePlanModal=a0;exports.GroupBySelector=Ul;exports.HealthBar=ml;exports.KanbanBoard=lo;exports.KanbanToolbar=yl;exports.KanbanViewAdapter=Hn;exports.KeyboardShortcutsHelp=Wl;exports.ListView=Fg;exports.MenuIcons=
|
|
443
|
+
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=n0;exports.AI_FEATURES=iw;exports.AI_MODELS=Qd;exports.AddCardButton=Nl;exports.AddColumnButton=vl;exports.AttachmentUploader=Or;exports.BoardProvider=k0;exports.BulkOperationsToolbar=Vs;exports.BurnDownChart=Ol;exports.CUSTOM_FIELD_TYPES=Ag;exports.CalendarBoard=Gg;exports.Card=_r;exports.CardDetailModal=Ml;exports.CardDetailModalV2=Il;exports.CardHistoryReplay=Xg;exports.CardHistoryTimeline=Yg;exports.CardRelationshipsGraph=Zg;exports.CardStack=Q1;exports.CardTemplateSelector=Vl;exports.CircuitBreaker=Zi;exports.Column=Qo;exports.ColumnManager=Zs;exports.CommandPalette=El;exports.ConfigMenu=Yl;exports.ContextMenu=un;exports.DEFAULT_SHORTCUTS=Wn;exports.DEFAULT_TABLE_COLUMNS=Pg;exports.DEFAULT_TEMPLATES=Gl;exports.DateRangePicker=En;exports.DependenciesSelector=Pn;exports.DependencyLine=jn;exports.DistributionCharts=$l;exports.EditableColumnTitle=il;exports.ErrorBoundary=tn;exports.ExportImportModal=jl;exports.FilterBar=Kl;exports.GANTT_AI_SYSTEM_PROMPT=cm;exports.GanttAIAssistant=fi;exports.GanttBoard=nm;exports.GanttI18nContext=ln;exports.GanttMilestone=ci;exports.GanttToolbar=Qs;exports.GenerateGanttTasksDialog=l0;exports.GeneratePlanModal=a0;exports.GroupBySelector=Ul;exports.HealthBar=ml;exports.KanbanBoard=lo;exports.KanbanToolbar=yl;exports.KanbanViewAdapter=Hn;exports.KeyboardShortcutsHelp=Wl;exports.ListView=Fg;exports.MenuIcons=_t;exports.PluginManager=zi;exports.PrioritySelector=To;exports.ProfitabilityReport=gl;exports.QuickTaskCreate=Fo;exports.RATE_LIMITS=sw;exports.STANDARD_FIELDS=Mg;exports.SwimlaneBoardView=Hl;exports.TagBadge=dl;exports.TagList=Nu;exports.TagPicker=no;exports.TaskBar=ni;exports.TaskDetailModal=Kr;exports.TaskFormModal=dm;exports.TaskGrid=ai;exports.ThemeModal=Ql;exports.ThemeProvider=kp;exports.ThemeSwitcher=B0;exports.TimeInputPopover=Ir;exports.TimePill=cl;exports.TimePopover=ul;exports.Timeline=pi;exports.UserAssignmentSelector=Do;exports.VelocityChart=Rl;exports.VirtualGrid=P0;exports.VirtualList=S0;exports.aiUsageTracker=$o;exports.borderRadius=sc;exports.calculatePosition=ws;exports.calendarDarkTheme=Kd;exports.calendarEnTranslations=Wd;exports.calendarEsTranslations=Gd;exports.calendarLightTheme=Yd;exports.calendarNeutralTheme=qd;exports.calendarThemes=Bi;exports.calendarTranslations=Mi;exports.cardToGanttTask=yi;exports.cardsToGanttTasks=hm;exports.cn=p;exports.createKanbanView=tp;exports.createRetryWrapper=ff;exports.darkTheme=ql;exports.darkTokenTheme=Wi;exports.defaultTheme=js;exports.designTokens=Ui;exports.duration=uc;exports.easing=pc;exports.exportTokensToCSS=I0;exports.findTaskByName=Zr;exports.fontSize=ic;exports.fontWeight=lc;exports.formatCost=ss;exports.ganttEnTranslations=Ys;exports.ganttEsTranslations=Tp;exports.ganttTaskToCardUpdate=bm;exports.ganttThemes=Qe;exports.ganttTokens=bc;exports.ganttTranslations=Zl;exports.ganttUtils=Pe;exports.generateCSSVariables=yc;exports.generateCompleteCSS=wc;exports.generateInitialPositions=uf;exports.generateTasksContext=um;exports.generateThemeVariables=cs;exports.getCalendarTheme=Vg;exports.getCalendarTranslations=es;exports.getListViewTheme=Lg;exports.getListViewTranslations=vd;exports.getMonthNames=Ig;exports.getToken=L0;exports.getTranslations=Np;exports.getWeekdayNames=Bg;exports.kanbanTokens=fc;exports.lightTheme=Xl;exports.lightTokenTheme=xc;exports.lineHeight=dc;exports.listViewDarkTheme=Hd;exports.listViewEnTranslations=yd;exports.listViewEsTranslations=xd;exports.listViewLightTheme=zd;exports.listViewNeutralTheme=Ud;exports.listViewThemes=Pi;exports.listViewTranslations=xi;exports.mergeCalendarTranslations=Ai;exports.mergeListViewTranslations=vi;exports.mergeTranslations=ed;exports.neutralTheme=Jl;exports.neutralTokenTheme=vc;exports.opacity=gc;exports.parseLocalCommand=gm;exports.parseNaturalDate=fd;exports.parseNaturalDuration=bd;exports.parseProgress=hd;exports.parseStatus=mm;exports.pluginManager=Nw;exports.retrySyncOperation=gf;exports.retryWithBackoff=ks;exports.shadows=mc;exports.shouldVirtualizeGrid=A0;exports.spacing=nc;exports.themes=Ao;exports.useAI=h0;exports.useBoard=c0;exports.useBoardCore=ds;exports.useBoardStore=Hi;exports.useCardStacking=v0;exports.useDragState=bl;exports.useFilteredCards=T0;exports.useFilters=m0;exports.useGanttI18n=Dr;exports.useKanbanState=$i;exports.useKeyboardShortcuts=xp;exports.useMultiSelect=y0;exports.useSelectionState=tc;exports.useSortedCards=N0;exports.useTheme=nn;exports.useVirtualGrid=M0;exports.useVirtualList=E0;exports.validateAIResponse=fm;exports.withErrorBoundary=Dl;exports.wouldCreateCircularDependency=Ts;exports.zIndex=cc;//# sourceMappingURL=index.cjs.map
|
|
444
444
|
//# sourceMappingURL=index.cjs.map
|