@libxai/board 1.4.16 → 1.4.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- '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'),Ju=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),J0=require('react-markdown'),Z0=require('remark-gfm'),Q0=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ju__default=/*#__PURE__*/_interopDefault(Ju);var J0__default=/*#__PURE__*/_interopDefault(J0);var Z0__default=/*#__PURE__*/_interopDefault(Z0);var Q0__default=/*#__PURE__*/_interopDefault(Q0);var Hn=(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 Wn=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 [Wn.Translate.toString(e),Wn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function m(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Gn(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 Rg(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function li(e,t){return e.length===0?1e3:t===0?Gn(null,e[0].position):t>=e.length?Gn(e[e.length-1].position,null):Gn(e[t-1].position,e[t].position)}function Ud(e,t=100){return e>t}var Og=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 $g(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 Vn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Og,onRetry:l}=t,c,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,u===a||!n(c,u))return {error:c,attempts:i,success:false};let f=$g(u,r,o,s);if(l)try{l(c,u,f);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,f));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function zg(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 Ug(e,t={}){return async(...a)=>Vn(()=>e(...a),t)}var di=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 Hd=(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))(Hd||{}),lo=class lo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,c?n:"");break;case "INFO":console.info(l,o,c?n:"");break;case "WARN":console.warn(l,o,c?n:"");break;case "ERROR":console.error(l,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",...lo.globalOptions};}static configure(t){lo.globalOptions={...lo.globalOptions,...t};}child(t){return new lo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new _n((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new _n(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Hd[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};lo.globalOptions={};var ci=lo,_n=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}},Wd=new ci;function Wg(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 Gg(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(l=>l.id===s.columnId);return [s.id,ui(s.title),ui(s.description||""),ui(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
- `)}async function Vg(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 Ju__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),c=297,i=210,u=n.width/n.height,d=c-20,p=d/u;p>i-20&&(p=i-20,d=p*u);let f=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});f.setFontSize(16),f.setTextColor(255,255,255),f.setFillColor(10,10,10),f.rect(0,0,c,15,"F"),f.text(e.title||"Kanban Board",10,10);let v=(c-d)/2;return f.addImage(l,"PNG",v,20,d,p),f}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 l=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,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(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 ui(e){return e.includes(",")||e.includes('"')||e.includes(`
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'),Ju=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),J0=require('react-markdown'),Z0=require('remark-gfm'),Q0=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ju__default=/*#__PURE__*/_interopDefault(Ju);var J0__default=/*#__PURE__*/_interopDefault(J0);var Z0__default=/*#__PURE__*/_interopDefault(Z0);var Q0__default=/*#__PURE__*/_interopDefault(Q0);var Hn=(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 Wn=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 [Wn.Translate.toString(e),Wn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function m(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Gn(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 Rg(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function di(e,t){return e.length===0?1e3:t===0?Gn(null,e[0].position):t>=e.length?Gn(e[e.length-1].position,null):Gn(e[t-1].position,e[t].position)}function Ud(e,t=100){return e>t}var Og=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 $g(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 Vn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Og,onRetry:l}=t,c,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,u===a||!n(c,u))return {error:c,attempts:i,success:false};let f=$g(u,r,o,s);if(l)try{l(c,u,f);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,f));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function zg(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 Ug(e,t={}){return async(...a)=>Vn(()=>e(...a),t)}var ci=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 Hd=(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))(Hd||{}),lo=class lo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,c?n:"");break;case "INFO":console.info(l,o,c?n:"");break;case "WARN":console.warn(l,o,c?n:"");break;case "ERROR":console.error(l,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",...lo.globalOptions};}static configure(t){lo.globalOptions={...lo.globalOptions,...t};}child(t){return new lo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new _n((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new _n(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Hd[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};lo.globalOptions={};var ui=lo,_n=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}},Wd=new ui;function Wg(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 Gg(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(l=>l.id===s.columnId);return [s.id,mi(s.title),mi(s.description||""),mi(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
+ `)}async function Vg(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 Ju__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),c=297,i=210,u=n.width/n.height,d=c-20,p=d/u;p>i-20&&(p=i-20,d=p*u);let f=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});f.setFontSize(16),f.setTextColor(255,255,255),f.setFillColor(10,10,10),f.rect(0,0,c,15,"F"),f.text(e.title||"Kanban Board",10,10);let v=(c-d)/2;return f.addImage(l,"PNG",v,20,d,p),f}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 l=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,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(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 mi(e){return e.includes(",")||e.includes('"')||e.includes(`
3
3
  `)?`"${e.replace(/"/g,'""')}"`:e}async function Vd(e,t,a,r){switch(t){case "json":return Wg(e,r);case "csv":return Gg(e);case "pdf":return await Vg(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function _d(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let 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"},l=new Blob([e],{type:n[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function _g(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 jg(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=jd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=jd(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((f,v)=>{i[f]=l[v]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function jd(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 Kd(e,t){switch(t){case "json":return _g(e);case "csv":return jg(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Yd(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 mi=react.createContext(null);function qd(){return react.useContext(mi)}var Xd=react.createContext(null);function Jd({children:e,themeName:t}){return jsxRuntime.jsx(Xd.Provider,{value:{themeName:t},children:e})}function Ao(){return react.useContext(Xd)}function ht({children:e,container:t}){let[a,r]=react.useState(false),o=qd(),s=Ao();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:l,themeName:c}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return 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 ac={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},ef="#BDC3C7",tf=({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 co({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let f=c.current.getBoundingClientRect(),v=window.innerHeight,k=window.innerWidth,g=160,y=220,h=4,b=f.right-g;b<10&&(b=f.left),b+g>k-10&&(b=k-g-10);let x=v-f.bottom,S=f.top,D;x>=y+h?D=f.bottom+h:S>=y+h?D=f.top-y-h:D=x>=S?f.bottom+h:Math.max(10,f.top-y-h),n({top:D,left:b}),o(true);};react.useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&!c.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let u=f=>{t(f),o(false);},d=e?ac[e]:null,p=d?.color||ef;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?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(ht,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[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(ac).map(([f,v])=>jsxRuntime.jsxs("button",{onClick:()=>u(f),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:v.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(tf,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===f&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),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: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("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var af=[{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 rn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),p=(Ao()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),x=window.innerHeight,S=window.innerWidth,D=320,T=380,w=4,R=b.left;R+D>S-10&&(R=S-D-10),R<10&&(R=10);let A=x-b.bottom,N=b.top,H;A>=T+w?H=b.bottom+w:N>=T+w?H=b.top-T-w:H=A>=N?b.bottom+w:Math.max(10,b.top-T-w),l({top:H,left:R}),s(true);};react.useEffect(()=>{let b=x=>{c.current&&!c.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),react.useEffect(()=>{let b=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]);let v=b=>{let x=new Date,S=R=>{let A=R.getFullYear(),N=String(R.getMonth()+1).padStart(2,"0"),H=String(R.getDate()).padStart(2,"0");return `${A}-${N}-${H}`},D=S(x),T=new Date(x);T.setDate(T.getDate()+b);let w=S(T);a(D,w),s(false);},k=()=>{if(!e||!t)return "Set date";let b=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=T.split("-").map(Number);if(w.length!==3||w.some(H=>isNaN(H)))return null;let R=w[0],A=w[1],N=w[2];return R===void 0||A===void 0||N===void 0?null:new Date(R,A-1,N)},x=b(e),S=b(t);if(!x||!S||isNaN(x.getTime())||isNaN(S.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[x.getMonth()]} ${x.getDate()} \u2013 ${D[S.getMonth()]} ${S.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),b<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${k()}`:"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:k()})]}),o&&jsxRuntime.jsx(ht,{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:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:p?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:af.map(b=>jsxRuntime.jsx("button",{onClick:()=>v(b.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:b.label},b.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:b=>a(b.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:b=>a(e,b.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function mo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,c]=react.useState(""),[i,u]=react.useState({top:0,left:0}),d=react.useRef(null),p=react.useRef(null),f=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),b=window.innerHeight,x=window.innerWidth,S=300,D=380,T=4,w=h.right-S;w<10&&(w=h.left),w+S>x-10&&(w=x-S-10);let R=b-h.bottom,A=h.top,N;R>=D+T?N=h.bottom+T:A>=D+T?N=h.top-D-T:N=R>=A?h.bottom+T:Math.max(10,h.top-D-T),u({top:N,left:w}),n(true);};react.useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&!p.current?.contains(b.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let v=h=>{let b=e.some(x=>x.id===h.id);a(b?e.filter(x=>x.id!==h.id):[...e,h]);},k=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),g=e.slice(0,o),y=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>s?n(false):f(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[g.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),y>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):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(ht,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[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:l,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:k.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"}):k.map(h=>{let b=e.some(x=>x.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>v(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:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.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:b?"#3b82f6":"transparent"},children:b?"\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 jn(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 d=u;return d.taskId||d.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,l=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)&&l(u))return true;if(n.has(u))return true}}return n.delete(c),false};return l(a)}function nn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=react.useState(false),[i,u]=react.useState(""),[d,p]=react.useState(t.length>0),[f,v]=react.useState({top:0,left:0}),[k,g]=react.useState(null),y=react.useRef(null),h=react.useRef(null),b=()=>{if(!h.current)return;let w=h.current.getBoundingClientRect(),R=window.innerHeight,A=window.innerWidth,N=300,H=d?380:120,I=4,re=w.right-N;re<10&&(re=w.left),re+N>A-10&&(re=A-N-10);let E=R-w.bottom,_=w.top,ie;E>=H+I?ie=w.bottom+I:_>=H+I?ie=w.top-H-I:ie=E>=_?w.bottom+I:Math.max(10,w.top-H-I),v({top:ie,left:re}),c(true);};react.useEffect(()=>{if(!l||!h.current)return;let w=h.current.getBoundingClientRect(),R=window.innerHeight,A=window.innerWidth,N=300,H=d?380:120,I=4,re=w.right-N;re<10&&(re=w.left),re+N>A-10&&(re=A-N-10);let E=R-w.bottom,_=w.top,ie;E>=H+I?ie=w.bottom+I:_>=H+I?ie=w.top-H-I:ie=E>=_?w.bottom+I:Math.max(10,w.top-H-I),v({top:ie,left:re});},[d,l]),react.useEffect(()=>{let w=R=>{y.current&&!y.current.contains(R.target)&&!h.current?.contains(R.target)&&(c(false),u(""));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),react.useEffect(()=>{let w=R=>{R.key==="Escape"&&(c(false),u(""));};if(l)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]);let x=w=>{let R=t.includes(w),A=a.find(N=>N.id===w);if(g(null),R){let N=t.filter(H=>H!==w);r(N),N.length===0&&p(false);}else {if(s&&jn(a,w,e)){let H=`Cannot add "${A?.title||w}" as dependency - would create circular reference`;g(H),n?.(w,A?.title||w),setTimeout(()=>g(null),3e3);return}r([...t,w]),p(true);}},S=()=>{let w=!d;p(w),w||r([]);},D=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>l?c(false):b(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),l&&jsxRuntime.jsx(ht,{children:jsxRuntime.jsxs("div",{ref:y,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[k&&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:k})]}),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:S,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&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"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>u(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):D.map(w=>{let R=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>x(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:A=>{A.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:A=>{A.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:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(false),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 Ar=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:p,transition:f,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:Wn.Transform.toString(p),transition:f};if(t)return jsxRuntime.jsx("div",{ref:d,style:k,...i,...u,onClick:()=>a?.(e),children:t(e)});let g=l.filter(x=>e.assignedUserIds?.includes(x.id)),y=e.progress===100,h=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),b={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:b,className:m("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:x=>{x.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:x=>{x.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:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((x,S)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),S===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]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:y?"line-through":"none",opacity:y?.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:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(co,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(rn,{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:(x,S)=>n?.(e.id,{startDate:x,endDate:S})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(mo,{assignedUsers:g,availableUsers:l,onChange:x=>n?.(e.id,{assignedUserIds:x.map(S=>S.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(nn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:c,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Ar.displayName="Card";var Kn={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"}},mc=({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 pc({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),u=[...Object.entries(Kn).map(([g,y])=>({id:g,label:y.label,color:y.color,icon:y.icon})),...r.filter(g=>!Object.keys(Kn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=Kn[e];if(g)return {...g,id:e};let y=r.find(h=>h.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{...Kn.todo,id:"todo"}},p=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),y=window.innerHeight,h=window.innerWidth,b=180,x=280,S=4,D=g.right-b;D<10&&(D=g.left),D+b>h-10&&(D=h-b-10);let T=y-g.bottom,w=g.top,R;T>=x+S?R=g.bottom+S:w>=x+S?R=g.top-x-S:R=T>=w?g.bottom+S:Math.max(10,g.top-x-S),l({top:R,left:D}),s(true);};react.useEffect(()=>{let g=y=>{c.current&&!c.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let f=g=>{t(g),s(false);},v=d(),k=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):p(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${k}10`,boxShadow:`0 0 0 2px ${k}30 inset`},title:v.label,children:jsxRuntime.jsx(mc,{icon:v.icon,color:k})}),o&&jsxRuntime.jsx(ht,{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(g=>jsxRuntime.jsxs("button",{onClick:()=>f(g.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:g.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(mc,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===g.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function gc({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[l,c]=react.useState(false),[i,u]=react.useState(e),[d,p]=react.useState({top:0,left:0}),f=react.useRef(null),v=react.useRef(null),k=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let b=v.current.getBoundingClientRect();p({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[s]),react.useEffect(()=>{let b=x=>{f.current&&!f.current.contains(x.target)&&!v.current?.contains(x.target)&&(n(false),c(false));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=x=>{x.key==="Escape"&&(n(false),c(false),u(e));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s,e]),react.useEffect(()=>{l&&k.current&&(k.current.focus(),k.current.select());},[l]);let g=()=>{c(true),u(e);},y=()=>{let b=i.trim();b&&b!==e&&t(b),c(false),n(false),u(e);},h=b=>{b.key==="Enter"?y():b.key==="Escape"&&(c(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(ht,{children:jsxRuntime.jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:k,type:"text",value:i,onChange:b=>u(b.target.value),onKeyDown:h,onBlur:y,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Bo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:p,onToggleCollapse:f,onColumnRename:v,onColumnDelete:k,isDeletable:g=false,className:y})=>{let{setNodeRef:h,isOver:b}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),S=u??Ud(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:S});if(a)return jsxRuntime.jsx("div",{ref:h,className:y,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let N=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:N}:N>=80?{state:"warning",percentage:N}:N>=60?{state:"approaching",percentage:N}:{state:"ok",percentage:N}})(),R=w.state==="exceeded",A=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:m("asakaa-column",b&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",y),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:m(A()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),w.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),w.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(v||k)&&jsxRuntime.jsx(gc,{columnTitle:e.title,onRename:N=>v?.(e.id,N),onDelete:k?()=>k(e.id):void 0,isDeletable:g}),f&&jsxRuntime.jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:S?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(N=>N.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):S?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(N=>{let H=t[N.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(Ar,{card:H,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},H.id):null})}):t.map(N=>jsxRuntime.jsx(Ar,{card:N,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},N.id))})})]})});Bo.displayName="Column";function bi({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.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:l,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:c,onKeyDown:i,className:m("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:m("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Cf(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 xc(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Tf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Nf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Df=["\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 kc({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:f,onRemoveFile:v,maxFileSizeMB:k=10}){let g=l==="dark",[y,h]=react.useState(false),[b,x]=react.useState([]),[S,D]=react.useState(0),[T,w]=react.useState(null),[R,A]=react.useState(false),N=react.useRef(null),H=react.useRef(null),I=react.useRef(null),re=react.useRef(null),E=react.useCallback((C,U)=>{let K=Cf(C,U);if(w(K),K){let ne=r.filter(me=>me.name.toLowerCase().includes(K.query)||me.email&&me.email.toLowerCase().includes(K.query)).slice(0,5);x(ne),h(ne.length>0),D(0);}else h(false),x([]);},[r]),_=C=>{let U=C.target.value;if(t(U),E(U,C.target.selectionStart||0),N.current){N.current.style.height="24px";let K=N.current.scrollHeight,ne=280,me=Math.min(K,ne);N.current.style.height=`${me}px`,N.current.style.overflowY=K>ne?"auto":"hidden";}},ie=()=>{N.current&&E(e,N.current.selectionStart||0);},Ee=react.useCallback(C=>{if(!T||!N.current)return;let U=e.slice(0,T.start),K=e.slice(T.end),ne=`@${C.name.replace(/\s+/g,"")} `,me=U+ne+K;t(me),h(false),w(null),setTimeout(()=>{if(N.current){let ce=T.start+ne.length;N.current.selectionStart=ce,N.current.selectionEnd=ce,N.current.focus();}},0);},[T,e,t]),L=C=>{if(y&&b.length>0)switch(C.key){case "ArrowDown":C.preventDefault(),D(U=>U<b.length-1?U+1:0);break;case "ArrowUp":C.preventDefault(),D(U=>U>0?U-1:b.length-1);break;case "Enter":{C.preventDefault();let U=b[S];U&&Ee(U);break}case "Tab":{C.preventDefault();let U=b[S];U&&Ee(U);break}case "Escape":C.preventDefault(),h(false);break}else C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),a());};react.useEffect(()=>{let C=U=>{H.current&&!H.current.contains(U.target)&&N.current&&!N.current.contains(U.target)&&h(false),re.current&&!re.current.contains(U.target)&&A(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]);let xe=react.useCallback(C=>{if(!N.current)return;let U=N.current.selectionStart||e.length,K=e.slice(0,U)+C+e.slice(U);t(K),A(false),setTimeout(()=>{if(N.current){let ne=U+C.length;N.current.selectionStart=ne,N.current.selectionEnd=ne,N.current.focus();}},0);},[e,t]),X=react.useCallback(C=>{if(!f||!C.target.files)return;let U=Array.from(C.target.files),K=k*1024*1024,ne=U.filter(me=>me.size>K?(console.warn(`File ${me.name} exceeds max size of ${k}MB`),false):true);ne.length>0&&f(ne),C.target.value="";},[f,k]),ee=react.useCallback(C=>C.type.startsWith("image/")?lucideReact.Image:C.type.includes("pdf")||C.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(y&&H.current){let C=H.current.children[S];C&&C.scrollIntoView({block:"nearest"});}},[S,y]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(C=>{let U=ee(C.file),K=C.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:m("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[K&&C.preview?jsxRuntime.jsx("img",{src:C.preview,alt:C.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(U,{className:m("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:m("text-xs truncate",g?"text-white":"text-gray-900"),children:C.file.name}),jsxRuntime.jsx("p",{className:m("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Nf(C.file.size)})]}),v&&jsxRuntime.jsx("button",{onClick:()=>v(C.id),className:m("p-0.5 rounded-full transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},C.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:m("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:m("flex items-end gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(!R),disabled:s||n,className:m("p-1 rounded transition-colors flex-shrink-0",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsx(framerMotion.motion.div,{ref:re,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Df.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>xe(C),className:m("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:C},C))})})})]}),d&&f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>I.current?.click(),disabled:s||n,className:m("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:I,type:"file",multiple:true,onChange:X,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:N,value:e,onChange:_,onSelect:ie,onKeyDown:L,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:m("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",g?"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()&&p.length===0||s,className:m("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&b.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:b.map((C,U)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ee(C),className:m("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",U===S?g?"bg-white/10":"bg-gray-100":g?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:C.color||"#8B5CF6"},children:Tf(C.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:m("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:C.name}),C.email&&jsxRuntime.jsx("p",{className:m("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:C.email})]})]},C.id))})})]})]})]})}function wc({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((l,c)=>l.type==="mention"?jsxRuntime.jsx("span",{className:m("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},c):jsxRuntime.jsx("span",{children:l.value},c))})}var Zn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function _r({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=react.useState(false),[i,u]=react.useState(""),[d,p]=react.useState(false),[f,v]=react.useState(Zn[10]||"#3B82F6"),[k,g]=react.useState({top:0,left:0}),y=react.useRef(null),h=react.useRef(null),b=react.useRef(null),x=react.useRef(null),S=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),D=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&h.current){let N=h.current.getBoundingClientRect();g({top:N.bottom+6,left:N.left});}},[l]),react.useEffect(()=>{let N=H=>{let I=H.target,re=y.current?.contains(I),E=b.current?.contains(I);!re&&!E&&(c(false),u(""),p(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),react.useEffect(()=>{l&&x.current&&x.current.focus();},[l]);let T=N=>{let H=e.some(I=>I.id===N.id);a(H?e.filter(I=>I.id!==N.id):[...e,N]);},w=async()=>{if(!(!r||!i.trim())){p(true);try{let N=await r(i.trim(),f);N&&(a([...e,N]),u(""),v(Zn[Math.floor(Math.random()*Zn.length)]||"#3B82F6"));}finally{p(false);}}},R=(N,H)=>{H.stopPropagation(),a(e.filter(I=>I.id!==N));},A={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:y,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:A,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:b,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:k.top,left:k.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:x,type:"text",value:i,onChange:N=>u(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&i.trim()&&!D&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(N=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${N.color}20`,color:N.color},onClick:H=>R(N.id,H),children:[N.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},N.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:S.length>0?S.map(N=>{let H=e.some(I=>I.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>T(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:I=>{H||(I.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:I=>{H||(I.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.name}),H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!D&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Zn.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>v(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:f===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,color:"#FFFFFF",opacity:d?.7:1},children:[d?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 vi({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 Tc({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(vi,{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 go=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Nc(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 Bf(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 Rf({className:e}){return jsxRuntime.jsxs("svg",{className:m("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 xi({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Bf(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Nc(e.loggedMinutes),i=e.estimateMinutes?Nc(e.estimateMinutes):null,u=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:m("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(Rf,{className:l[t]}),jsxRuntime.jsx("span",{children:u})]})}function Sc(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 es(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function zf(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 Uf({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Hf({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 Ec({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 Wf({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 ki({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:u,className:d}){let[p,f]=react.useState(""),[v,k]=react.useState(t.estimateMinutes?es(t.estimateMinutes):""),[g,y]=react.useState(""),[h,b]=react.useState(false),[x,S]=react.useState(false),D=react.useRef(null);react.useEffect(()=>{D.current?.focus();},[]);let T=async()=>{let A=Sc(p);if(!(A<=0||!s)){b(true);try{await s({durationMinutes:A,note:g.trim()||void 0,source:"manual"}),f(""),y("");}finally{b(false);}}},w=async()=>{if(!n)return;let A=v.trim()?Sc(v):null;await n(A),S(false);},R=A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),T()),A.key==="Escape"&&u?.();};return jsxRuntime.jsxs("div",{className:m("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[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(Ec,{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:zf(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(Hf,{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(Ec,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:m("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(Uf,{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(Wf,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:D,type:"text",value:p,onChange:A=>f(A.target.value),onKeyDown:R,placeholder:"8 (=8h), 2h 30m",className:m("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:T,disabled:h||!p.trim(),className:m("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:g,onChange:A=>y(A.target.value),onKeyDown:R,placeholder:"Note (optional)",className:m("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:es(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"}),x?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:v,onChange:A=>k(A.target.value),onKeyDown:A=>{A.key==="Enter"&&w(),A.key==="Escape"&&S(false);},onBlur:w,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:()=>S(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?es(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:m("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:m("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(A=>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:A.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:es(A.durationMinutes)})]},A.id))})]})]})}function jf(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 Kf(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function fo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=react.useState(Kf(r)),[i,u]=react.useState(""),[d,p]=react.useState(false),f=react.useRef(null);react.useEffect(()=>{f.current?.focus();},[]);let v=async()=>{p(true);let b=jf(l);await o(b&&b>0?b:null,i||void 0),p(false);},k=async()=>{p(true),await o(null),p(false);},g=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),v()),b.key==="Escape"&&s();},y={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},h={estimate:"8 (=8h)",quoted:"8 (=8h)",log:"8 (=8h)"};return jsxRuntime.jsxs("div",{className:m("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:m("text-sm font-medium",a?"text-white":"text-gray-900"),children:y[e]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:m("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx("input",{ref:f,type:"text",value:l,onChange:b=>c(b.target.value),onKeyDown:g,placeholder:h[e],className:m("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsxRuntime.jsx("p",{className:m("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 8 (=8h), 1h 30m, 45m, 2:30":"e.g. 8 (=8h), 1h 30m, 45m, 2:30"})]}),e==="log"&&jsxRuntime.jsx("div",{className:"mb-3",children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:b=>u(b.target.value),onKeyDown:g,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:m("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsxRuntime.jsx("button",{type:"button",onClick:v,disabled:d||!l.trim(),className:m("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:d?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:k,disabled:d,className:m("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function Yf(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 qf(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 Ti({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Yf(e.health),s=qf(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:m("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:m("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:m("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:m("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:m("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:m("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Ro(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Jf(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Zf(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 Qf(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 e0({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",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:m("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:m("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:m("text-2xl font-bold",o),children:[r?"+":"",Ro(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:m("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:m("text-sm font-medium mb-2",l),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:m("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:m("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:m("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:m("text-sm font-medium mb-2",l),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:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:m("font-medium",c),children:Ro(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:m("font-medium",c),children:Ro(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:m("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:m("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function t0({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",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:m("border-b",s,r&&m("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:m("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:m("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Ro(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Ro(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:m("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,Ro(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:m("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:m("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Zf(e.status,a),Jf(e.status,a)),children:Qf(e.status,t)})})]})}function Ni({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#0F1117]":"bg-gray-50",c=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",u=n?"text-[#E5E7EB]":"text-gray-900",d=n?"text-[#9CA3AF]":"text-gray-500",p=n?"bg-[#0F1117]/50":"bg-gray-50",f=react.useMemo(()=>e?[...e.tasks].sort((v,k)=>v.varianceMinutes===null?1:k.varianceMinutes===null?-1:k.varianceMinutes-v.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:m("space-y-6 p-6",l,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:m("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:m("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(e0,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:m("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:p,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:m("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:m("divide-y",i),children:f.map(v=>jsxRuntime.jsx(t0,{task:v,locale:a,isDark:n,onClick:s},v.taskId))})]})})}),jsxRuntime.jsx("div",{className:m("text-xs text-center",d),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 Oo(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 f0(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 $c(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 h0(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 Ir({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:f=[],comments:v=[],onAddComment:k,currentUser:g,mentionableUsers:y=[],onUploadCommentAttachments:h,enableTimeTracking:b=false,timeTrackingSummary:x,timeEntries:S=[],isTimerRunning:D=false,timerElapsedSeconds:T=0,onTimeLog:w,onEstimateUpdate:R,onSoldEffortUpdate:A,onTimerStart:N,onTimerStop:H,onTimerDiscard:I,blurFinancials:re=false}){let E=s==="dark",_={textTertiary:E?"#6B7280":"#9CA3AF",textSecondary:E?"#9CA3AF":"#6B7280",textPrimary:E?"#FFFFFF":"#111827",borderLight:E?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:E?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:E?"#1A1D25":"#FFFFFF",bgSecondary:E?"#0F1117":"#F9FAFB",hoverBg:E?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ie=e&&"title"in e&&!("name"in e),Ee=e,[L,xe]=react.useState(e?$c(e,l):null),[X,ee]=react.useState(false),[C,U]=react.useState(false),[K,ne]=react.useState(false),[me,ce]=react.useState(null),[Ne,Z]=react.useState(new Date),[je,Be]=react.useState(false),[Ye,dt]=react.useState(false),[ot,Je]=react.useState(""),[xt,gt]=react.useState(false),[yt,se]=react.useState(false),[B,J]=react.useState(false),[pe,we]=react.useState(false),[$e,Qe]=react.useState(""),nt=react.useRef(null),ze=react.useRef(null),[oa,G]=react.useState(""),Y=react.useRef(null),[be,Ze]=react.useState(""),[Ce,Fe]=react.useState(false),[q,Ue]=react.useState([]),[z,le]=react.useState(""),[Le,_e]=react.useState(false),Ge=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 M=$c(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:M?.id,taskName:M?.name,soldEffortMinutes:M?.soldEffortMinutes,quotedMinutes:M?.quotedMinutes,effortMinutes:M?.effortMinutes,timeLoggedMinutes:M?.timeLoggedMinutes}),xe(M),Qe(M.description||""),G(M.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!$e)return;let M=setTimeout(()=>{let ae=ze.current;ae&&(ae.style.height="auto",ae.style.height=`${Math.max(100,ae.scrollHeight)}px`);},50);return ()=>clearTimeout(M)},[t,$e]),react.useEffect(()=>()=>{nt.current&&clearTimeout(nt.current),Y.current&&clearTimeout(Y.current);},[]),react.useEffect(()=>{t&&Ge.current&&v.length>0&&setTimeout(()=>{Ge.current&&(Ge.current.scrollTop=Ge.current.scrollHeight);},100);},[t,v.length]);let Re=react.useCallback(M=>{xe(M),ie&&o&&Ee?o(h0(M,Ee)):r&&r(M);},[ie,Ee,o,r]),$=react.useCallback(()=>{ee(false),U(false),ne(false),ce(null),dt(false),Je(""),gt(false);},[]),j=react.useCallback((M,ae)=>{if(!L)return;let Oe={...L,[M]:ae};Re(Oe);},[L,Re]),ye=react.useCallback(()=>{let M=ze.current;M&&(M.style.height="auto",M.style.height=`${Math.max(100,M.scrollHeight)}px`);},[]),qe=react.useCallback(M=>{Qe(M),setTimeout(ye,0),nt.current&&clearTimeout(nt.current),nt.current=setTimeout(()=>{if(L){let ae={...L,description:M};Re(ae);}},800);},[L,Re,ye]),We=react.useCallback(M=>{G(M),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{if(L&&M.trim()){let ae={...L,name:M.trim()};Re(ae);}},800);},[L,Re]),W=react.useCallback(M=>{let ae=M.map(Oe=>{let Xe={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Oe};return Oe.type.startsWith("image/")&&(Xe.preview=URL.createObjectURL(Oe)),Xe});Ue(Oe=>[...Oe,...ae]);},[]),ue=react.useCallback(M=>{Ue(ae=>{let Oe=ae.find(Xe=>Xe.id===M);return Oe?.preview&&URL.revokeObjectURL(Oe.preview),ae.filter(Xe=>Xe.id!==M)});},[]),Se=react.useCallback(async()=>{if(!(!L||!be.trim()&&q.length===0||!k)){Fe(true);try{let M=xc(be,y),ae=[];if(q.length>0&&h){let Oe=q.map(Xe=>Xe.file);ae=await h(Oe);}await k(L.id,be.trim(),M.length>0?M:void 0,ae.length>0?ae:void 0),Ze(""),q.forEach(Oe=>{Oe.preview&&URL.revokeObjectURL(Oe.preview);}),Ue([]);}finally{Fe(false);}}},[L,be,q,k,y,h]),Ft=react.useCallback(()=>{if(!L||!z.trim())return;let M=L.subtasks||[],ae={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:z.trim(),progress:0,startDate:new Date,endDate:new Date,position:M.length},Oe=[...M,ae],Xe={...L,subtasks:Oe};Re(Xe),le(""),_e(false);},[L,z,Re]),lt=react.useCallback(M=>{if(!L?.subtasks)return;let ae=L.subtasks.map(Xe=>Xe.id===M?{...Xe,progress:Xe.progress===100?0:100}:Xe),Oe={...L,subtasks:ae};Re(Oe);},[L,Re]),kr=react.useCallback(M=>{if(!L?.subtasks)return;let ae=L.subtasks.filter(Xe=>Xe.id!==M),Oe={...L,subtasks:ae};Re(Oe);},[L,Re]),Za=react.useCallback(M=>{let ae=typeof M=="string"?new Date(M):M,Xe=new Date().getTime()-ae.getTime(),da=Math.floor(Xe/6e4),ya=Math.floor(Xe/36e5),Sa=Math.floor(Xe/864e5);return da<1?n==="es"?"Ahora":"Just now":da<60?n==="es"?`Hace ${da} min`:`${da}m ago`:ya<24?n==="es"?`Hace ${ya}h`:`${ya}h ago`:Sa<7?n==="es"?`Hace ${Sa}d`:`${Sa}d ago`:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),lr=react.useCallback(M=>{if(!L)return;let ae=L.progress||0;M==="completed"?ae=100:M==="in-progress"&&ae===0?ae=10:M==="todo"&&(ae=0);let Oe={...L,status:M,progress:ae};Re(Oe),ee(false);},[L,Re]),Qa=react.useCallback((M,ae)=>{if(!L)return;let Oe={...L,startDate:M,endDate:ae};Re(Oe);},[L,Re]),De=react.useCallback(()=>{let M=Ne.getFullYear(),ae=Ne.getMonth(),Oe=new Date(M,ae,1),da=new Date(M,ae+1,0).getDate(),ya=Oe.getDay(),Sa=[],Pa=new Date(M,ae,0).getDate();for(let Aa=ya-1;Aa>=0;Aa--)Sa.push({date:new Date(M,ae-1,Pa-Aa),isCurrentMonth:false});for(let Aa=1;Aa<=da;Aa++)Sa.push({date:new Date(M,ae,Aa),isCurrentMonth:true});let Ma=42-Sa.length;for(let Aa=1;Aa<=Ma;Aa++)Sa.push({date:new Date(M,ae+1,Aa),isCurrentMonth:false});return Sa},[Ne]),Rt=react.useCallback(async M=>{if(M.preventDefault(),M.stopPropagation(),J(false),!L||!d)return;let ae=Array.from(M.dataTransfer.files);if(ae.length!==0){we(true);try{await d(L.id,ae);}finally{we(false);}}},[L,d]),Ot=react.useCallback(async M=>{if(!L||!d||!M.target.files)return;let ae=Array.from(M.target.files);if(ae.length!==0){we(true);try{await d(L.id,ae);}finally{we(false);}M.target.value="";}},[L,d]),Da=react.useCallback(M=>{M.preventDefault(),M.stopPropagation(),J(true);},[]),wr=react.useCallback(M=>{M.preventDefault(),M.stopPropagation(),J(false);},[]),kt=react.useCallback(M=>M<1024?`${M} B`:M<1024*1024?`${(M/1024).toFixed(1)} KB`:`${(M/(1024*1024)).toFixed(1)} MB`,[]),dr=react.useCallback(M=>M.startsWith("image/")?lucideReact.Image:M.includes("pdf")||M.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!L?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&L&&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:m("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",E?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:m("px-6 py-3 border-b flex items-center gap-3 h-[49px]",E?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:m("w-4 h-4",E?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:m("text-xs px-2 py-0.5 rounded",E?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:m("text-xs font-mono",E?"text-[#6B7280]":"text-gray-400"),children:L.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 M=L.progress===100?0:100,Oe={...L,progress:M,status:M===100?"completed":"todo"};Re(Oe);},className:m("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",L.progress===100?"bg-green-500 border-green-500":E?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:L.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:oa,onChange:M=>We(M.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:m("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",L.progress===100?"line-through text-[#6B7280]":E?"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:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{$(),ee(!X);},className:m("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",L.progress===100||L.status==="completed"?"bg-green-500/20 text-green-400":L.progress&&L.progress>0||L.status==="in-progress"?"bg-blue-500/20 text-blue-400":E?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:L.progress===100||L.status==="completed"?n==="es"?"COMPLETADO":"DONE":L.progress&&L.progress>0||L.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ee(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",E?"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(M=>jsxRuntime.jsxs("button",{onClick:()=>lr(M.id),className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",E?"hover:bg-white/5":"hover:bg-gray-50",L.status===M.id&&(E?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",M.color)}),jsxRuntime.jsx("span",{className:E?"text-white":"text-gray-900",children:M.label})]},M.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{$(),ne(!K);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",E?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[L.assignees&&L.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[L.assignees.slice(0,3).map((M,ae)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:M.color||"#8B5CF6"},title:M.name,children:M.initials||M.name.slice(0,2).toUpperCase()},ae)),L.assignees.length>3&&jsxRuntime.jsxs("span",{className:m("text-xs",E?"text-[#6B7280]":"text-gray-400"),children:["+",L.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:m("text-sm",E?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",E?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ne(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",E?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(M=>{let ae=L.assignees?.some(Oe=>Oe.name===M.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Oe=L.assignees||[],Xe;ae?Xe=Oe.filter(da=>da.name!==M.name):Xe=[...Oe,M],j("assignees",Xe);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",E?"hover:bg-white/5":"hover:bg-gray-50",ae&&(E?"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:M.color||"#8B5CF6"},children:M.initials||M.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:m("flex-1",E?"text-white":"text-gray-900"),children:M.name}),ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},M.name)}):jsxRuntime.jsx("div",{className:m("px-3 py-4 text-sm text-center",E?"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:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{ce(me?null:"start"),Z(L.startDate||new Date);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",E?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[L.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:m("mx-1",E?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),L.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ce(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:m("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",E?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:m("w-44 py-2 border-r",E?"border-white/10":"border-gray-200"),children:[(()=>{let M=new Date,ae=new Date(M);ae.setDate(M.getDate()+1);let Oe=new Date(M);Oe.setDate(M.getDate()+((6-M.getDay()+7)%7||7));let Xe=new Date(M);Xe.setDate(M.getDate()+((1-M.getDay()+7)%7||7));let da=new Date(M);da.setDate(M.getDate()+(6-M.getDay()+7)%7+7);let ya=new Date(M);ya.setDate(M.getDate()+14);let Sa=new Date(M);return Sa.setDate(M.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:M,display:M.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ae,display:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Oe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Xe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:da,display:da.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ya,display:ya.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Sa,display:Sa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ma,Aa)=>jsxRuntime.jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",E?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(me==="start"){let tn=L.endDate&&Ma.date>L.endDate?Ma.date:L.endDate;Qa(Ma.date,tn),ce("end");}else {let tn=L.startDate&&Ma.date<L.startDate?Ma.date:L.startDate;Qa(tn,Ma.date),ce(null);}},children:[jsxRuntime.jsx("span",{children:Ma.label}),jsxRuntime.jsx("span",{className:m("text-xs",E?"text-[#6B7280]":"text-gray-400"),children:Ma.display})]},Aa))})(),jsxRuntime.jsx("div",{className:m("border-t mt-2 pt-2",E?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Qa(void 0,void 0),ce(null);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",E?"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:m("text-xs mb-3 px-2 py-1 rounded",E?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:me==="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:m("font-medium",E?"text-white":"text-gray-900"),children:Ne.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>Z(new Date),className:m("p-1 rounded text-sm transition-colors",E?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Z(new Date(Ne.getFullYear(),Ne.getMonth()-1)),className:m("p-1 rounded",E?"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:()=>Z(new Date(Ne.getFullYear(),Ne.getMonth()+1)),className:m("p-1 rounded",E?"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(M=>jsxRuntime.jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",E?"text-[#6B7280]":"text-gray-400"),children:M},M))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:De().map((M,ae)=>{let Oe=M.date.toDateString()===new Date().toDateString(),Xe=L.startDate?.toDateString()===M.date.toDateString(),da=L.endDate?.toDateString()===M.date.toDateString(),ya=Xe||da,Sa=L.startDate&&L.endDate&&M.date>=L.startDate&&M.date<=L.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Pa=new Date(M.date);if(me==="start"){let Ma=L.endDate&&Pa>L.endDate?Pa:L.endDate;Qa(Pa,Ma),ce("end");}else {let Ma=L.startDate&&Pa<L.startDate?Pa:L.startDate;Qa(Ma,Pa),ce(null);}},className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!M.isCurrentMonth&&(E?"text-[#4B5563]":"text-gray-300"),M.isCurrentMonth&&(E?"text-white":"text-gray-900"),Oe&&"ring-2 ring-[#3B82F6]",Xe&&"bg-[#3B82F6] text-white",da&&!Xe&&"bg-[#7C3AED] text-white",Sa&&!ya&&(E?"bg-[#7C3AED]/20":"bg-purple-100"),!ya&&(E?"hover:bg-white/10":"hover:bg-gray-100")),children:M.date.getDate()},ae)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{$(),U(!C);},className:m("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",L.priority==="high"||L.priority==="urgent"?"bg-red-500/20 text-red-400":L.priority==="medium"?"bg-yellow-500/20 text-yellow-400":L.priority==="low"?"bg-green-500/20 text-green-400":E?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:L.priority?L.priority==="high"||L.priority==="urgent"?n==="es"?"Alta":"High":L.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>U(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",E?"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(M=>jsxRuntime.jsxs("button",{onClick:()=>{j("priority",M.id),U(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",E?"hover:bg-white/5":"hover:bg-gray-50",L.priority===M.id&&(E?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",M.color)}),jsxRuntime.jsx("span",{className:E?"text-white":"text-gray-900",children:M.label})]},M.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:m("text-sm",E?"text-white":"text-gray-900"),children:L.startDate&&L.endDate?`${Math.ceil((L.endDate.getTime()-L.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:m("w-4 h-4 rounded-full border-2",E?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[je?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:L.progress||0,onChange:M=>{let ae=parseInt(M.target.value),Oe=L.status;ae===100?Oe="completed":ae>0?Oe="in-progress":Oe="todo";let Xe={...L,progress:ae,status:Oe};Re(Xe);},onBlur:()=>Be(false),className:m("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",E?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Be(true),className:m("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",E?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:m("h-full rounded-full transition-all",L.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${L.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:m("text-sm font-medium min-w-[40px]",E?"text-white":"text-gray-900"),children:[L.progress||0,"%"]})]})]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"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:L.status==="completed"||L.progress===100?jsxRuntime.jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",E?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?Oo(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>se("estimate"),className:m("text-sm px-2 py-0.5 rounded",E?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Oo(x.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>se("estimate"),className:m("text-sm",E?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:yt==="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(fo,{mode:"estimate",locale:n,isDark:E,currentValue:x?.estimateMinutes||null,onSave:async M=>{await R?.(L.id,M),se(false);},onClose:()=>se(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:re?jsxRuntime.jsx("span",{className:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",E?"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"}):L.status==="completed"||L.progress===100?jsxRuntime.jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",E?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:L.quotedMinutes?Oo(L.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):L.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>se("quoted"),className:m("text-sm px-2 py-0.5 rounded",E?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Oo(L.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>se("quoted"),className:m("text-sm",E?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:yt==="quoted"&&!re&&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(fo,{mode:"quoted",locale:n,isDark:E,currentValue:L.quotedMinutes||null,onSave:async M=>{A?(await A(L.id,M),xe(ae=>ae?{...ae,quotedMinutes:M}:null)):j("quotedMinutes",M),se(false);},onClose:()=>se(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[L.status==="completed"||L.progress===100?jsxRuntime.jsx("div",{className:m("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",E?"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"})}):D?jsxRuntime.jsxs("button",{type:"button",onClick:()=>H?.(L.id),className:m("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"}),f0(T||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>N?.(L.id),className:m("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",E?"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"})}),L.status==="completed"||L.progress===100?jsxRuntime.jsxs("div",{className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",E?"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:()=>se("log"),className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",E?"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"]}),x&&x.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:m("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":E?"text-white":"text-gray-900"),children:[Oo(x.loggedMinutes),x.estimateMinutes&&jsxRuntime.jsxs("span",{className:m("font-normal",E?"text-[#6B7280]":"text-gray-400"),children:[" / ",Oo(x.estimateMinutes)]})]}),x.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:m("h-full rounded-full transition-all",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:yt==="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(fo,{mode:"log",locale:n,isDark:E,currentValue:null,onSave:async(M,ae)=>{M&&await w?.(L.id,{durationMinutes:M,note:ae,source:"manual"}),se(false);},onClose:()=>se(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(_r,{selectedTags:L.tags||[],availableTags:c,onChange:M=>{j("tags",M);},onCreateTag:i,theme:_})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:m("w-4 h-4 mt-1.5",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0 mt-1",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[L.dependencies&&L.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:L.dependencies.map(M=>{let ae=f.find(Oe=>Oe.id===M);return jsxRuntime.jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",E?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ae?.name||M.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Oe=(L.dependencies||[]).filter(Xe=>Xe!==M);j("dependencies",Oe);},className:m("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},M)})}),jsxRuntime.jsxs("button",{onClick:()=>{$(),dt(!Ye);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",E?"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:m("text-sm",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ye&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{dt(false),Je("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",E?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:m("p-2 border-b",E?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:ot,onChange:M=>Je(M.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:m("w-full px-3 py-2 rounded-md text-sm outline-none",E?"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:f.length>0?f.filter(M=>M.id!==L.id).filter(M=>ot===""||M.name.toLowerCase().includes(ot.toLowerCase())).map(M=>{let ae=L.dependencies?.includes(M.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Oe=L.dependencies||[],Xe;ae?Xe=Oe.filter(da=>da!==M.id):Xe=[...Oe,M.id],j("dependencies",Xe);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",E?"hover:bg-white/5":"hover:bg-gray-50",ae&&(E?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:m("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ae?"bg-blue-500 border-blue-500":E?"border-white/30":"border-gray-300"),children:ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:m("block truncate",E?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("span",{className:m("text-xs",E?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]})]},M.id)}):jsxRuntime.jsx("div",{className:m("px-3 py-4 text-sm text-center",E?"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:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{$(),gt(!xt);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",E?"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:L.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:m("text-sm",E?"text-white":"text-gray-900"),children:go.find(M=>M.value===L.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",E?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>gt(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",E?"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:go.map(M=>{let ae=L.color===M.value;return jsxRuntime.jsx("button",{onClick:()=>{j("color",M.value),gt(false);},className:m("w-7 h-7 rounded-full flex items-center justify-center transition-all",ae&&"ring-2 ring-offset-2",E?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:M.value,outlineColor:ae?M.value:void 0},title:M.name,children:ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},M.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",E?"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:L.isMilestone||false,onChange:M=>j("isMilestone",M.target.checked),className:m("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",L.isMilestone?"bg-purple-500 border-purple-500":E?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:m("text-sm",E?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:m("mt-6 pt-4 border-t",E?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:m("w-4 h-4",E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:m("text-sm font-semibold",E?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:ze,value:$e,onChange:M=>qe(M.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:m("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",E?"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:m("mt-6 pt-4 border-t",E?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:m("text-sm font-semibold",E?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",L.subtasks&&L.subtasks.length>0&&jsxRuntime.jsxs("span",{className:m("ml-2 text-xs font-normal",E?"text-[#6B7280]":"text-gray-400"),children:["(",L.subtasks.filter(M=>M.progress===100).length,"/",L.subtasks.length,")"]})]})}),L.subtasks&&L.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...L.subtasks].sort((M,ae)=>(M.position??0)-(ae.position??0)).map(M=>jsxRuntime.jsxs("div",{className:m("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",E?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>lt(M.id),className:m("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",M.progress===100?"bg-green-500 border-green-500":E?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:M.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:m("text-sm flex-1",M.progress===100?"line-through text-[#6B7280]":E?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("button",{onClick:()=>kr(M.id),className:m("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",E?"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"})})]},M.id))}),Le?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:z,onChange:M=>le(M.target.value),onKeyDown:M=>{M.key==="Enter"&&z.trim()?Ft():M.key==="Escape"&&(_e(false),le(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:m("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",E?"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:Ft,disabled:!z.trim(),className:m("px-3 py-2 rounded-lg text-sm font-medium transition-colors",z.trim()?"bg-blue-500 hover:bg-blue-600 text-white":E?"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:()=>{_e(false),le("");},className:m("p-2 rounded-lg transition-colors",E?"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:()=>_e(true),className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",E?"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:m("mt-6 pt-4 border-t",E?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:m("text-sm font-semibold mb-3",E?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:m("ml-2 text-xs font-normal",E?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(M=>{let ae=dr(M.type),Oe=M.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:m("flex items-center gap-3 p-2 rounded-lg group transition-colors",E?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Oe&&M.thumbnailUrl?jsxRuntime.jsx("img",{src:M.thumbnailUrl,alt:M.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:m("w-10 h-10 rounded flex items-center justify-center",E?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ae,{className:m("w-5 h-5",E?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",className:m("text-sm font-medium truncate block hover:underline",E?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("p",{className:m("text-xs",E?"text-[#6B7280]":"text-gray-400"),children:kt(M.size)})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(M.id),className:m("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",E?"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"})})]},M.id)})}),jsxRuntime.jsxs("div",{onDragOver:Da,onDragLeave:wr,onDrop:Rt,className:m("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",B?E?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":E?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",pe&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Ot,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||pe}),pe?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:m("text-sm",E?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:m("w-6 h-6 mx-auto mb-2",B?"text-blue-500":E?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:m("text-sm",E?"text-[#9CA3AF]":"text-gray-500"),children:B?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"})]})}),!d&&jsxRuntime.jsx("p",{className:m("text-xs mt-1",E?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:m("w-96 border-l flex flex-col",E?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between h-[49px]",E?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:m("text-sm font-semibold",E?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",v.length>0&&jsxRuntime.jsxs("span",{className:m("ml-2 text-xs font-normal",E?"text-[#6B7280]":"text-gray-400"),children:["(",v.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:m("p-1.5 rounded transition-colors",E?"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=jd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=jd(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((f,v)=>{i[f]=l[v]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function jd(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 Kd(e,t){switch(t){case "json":return _g(e);case "csv":return jg(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Yd(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 pi=react.createContext(null);function qd(){return react.useContext(pi)}var Xd=react.createContext(null);function Jd({children:e,themeName:t}){return jsxRuntime.jsx(Xd.Provider,{value:{themeName:t},children:e})}function Ao(){return react.useContext(Xd)}function vt({children:e,container:t}){let[a,r]=react.useState(false),o=qd(),s=Ao();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:l,themeName:c}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return 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 ac={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},ef="#BDC3C7",tf=({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 co({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let f=c.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,g=160,y=220,h=4,b=f.right-g;b<10&&(b=f.left),b+g>w-10&&(b=w-g-10);let x=v-f.bottom,D=f.top,N;x>=y+h?N=f.bottom+h:D>=y+h?N=f.top-y-h:N=x>=D?f.bottom+h:Math.max(10,f.top-y-h),n({top:N,left:b}),o(true);};react.useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&!c.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let u=f=>{t(f),o(false);},d=e?ac[e]:null,p=d?.color||ef;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?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(vt,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[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(ac).map(([f,v])=>jsxRuntime.jsxs("button",{onClick:()=>u(f),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:v.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(tf,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===f&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),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: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("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var af=[{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 on({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),p=(Ao()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),x=window.innerHeight,D=window.innerWidth,N=320,C=380,k=4,R=b.left;R+N>D-10&&(R=D-N-10),R<10&&(R=10);let I=x-b.bottom,T=b.top,H;I>=C+k?H=b.bottom+k:T>=C+k?H=b.top-C-k:H=I>=T?b.bottom+k:Math.max(10,b.top-C-k),l({top:H,left:R}),s(true);};react.useEffect(()=>{let b=x=>{c.current&&!c.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),react.useEffect(()=>{let b=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]);let v=b=>{let x=new Date,D=R=>{let I=R.getFullYear(),T=String(R.getMonth()+1).padStart(2,"0"),H=String(R.getDate()).padStart(2,"0");return `${I}-${T}-${H}`},N=D(x),C=new Date(x);C.setDate(C.getDate()+b);let k=D(C);a(N,k),s(false);},w=()=>{if(!e||!t)return "Set date";let b=C=>{if(C instanceof Date)return C;if(typeof C!="string"||!C.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=C.split("-").map(Number);if(k.length!==3||k.some(H=>isNaN(H)))return null;let R=k[0],I=k[1],T=k[2];return R===void 0||I===void 0||T===void 0?null:new Date(R,I-1,T)},x=b(e),D=b(t);if(!x||!D||isNaN(x.getTime())||isNaN(D.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[x.getMonth()]} ${x.getDate()} \u2013 ${N[D.getMonth()]} ${D.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),b<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${w()}`:"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:w()})]}),o&&jsxRuntime.jsx(vt,{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:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:p?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:af.map(b=>jsxRuntime.jsx("button",{onClick:()=>v(b.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:b.label},b.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:b=>a(b.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:b=>a(e,b.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function mo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,c]=react.useState(""),[i,u]=react.useState({top:0,left:0}),d=react.useRef(null),p=react.useRef(null),f=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),b=window.innerHeight,x=window.innerWidth,D=300,N=380,C=4,k=h.right-D;k<10&&(k=h.left),k+D>x-10&&(k=x-D-10);let R=b-h.bottom,I=h.top,T;R>=N+C?T=h.bottom+C:I>=N+C?T=h.top-N-C:T=R>=I?h.bottom+C:Math.max(10,h.top-N-C),u({top:T,left:k}),n(true);};react.useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&!p.current?.contains(b.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let v=h=>{let b=e.some(x=>x.id===h.id);a(b?e.filter(x=>x.id!==h.id):[...e,h]);},w=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),g=e.slice(0,o),y=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>s?n(false):f(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[g.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),y>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):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(vt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[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:l,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:w.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"}):w.map(h=>{let b=e.some(x=>x.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>v(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:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.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:b?"#3b82f6":"transparent"},children:b?"\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 jn(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 d=u;return d.taskId||d.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,l=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)&&l(u))return true;if(n.has(u))return true}}return n.delete(c),false};return l(a)}function sn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=react.useState(false),[i,u]=react.useState(""),[d,p]=react.useState(t.length>0),[f,v]=react.useState({top:0,left:0}),[w,g]=react.useState(null),y=react.useRef(null),h=react.useRef(null),b=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),R=window.innerHeight,I=window.innerWidth,T=300,H=d?380:120,A=4,ee=k.right-T;ee<10&&(ee=k.left),ee+T>I-10&&(ee=I-T-10);let S=R-k.bottom,Y=k.top,ue;S>=H+A?ue=k.bottom+A:Y>=H+A?ue=k.top-H-A:ue=S>=Y?k.bottom+A:Math.max(10,k.top-H-A),v({top:ue,left:ee}),c(true);};react.useEffect(()=>{if(!l||!h.current)return;let k=h.current.getBoundingClientRect(),R=window.innerHeight,I=window.innerWidth,T=300,H=d?380:120,A=4,ee=k.right-T;ee<10&&(ee=k.left),ee+T>I-10&&(ee=I-T-10);let S=R-k.bottom,Y=k.top,ue;S>=H+A?ue=k.bottom+A:Y>=H+A?ue=k.top-H-A:ue=S>=Y?k.bottom+A:Math.max(10,k.top-H-A),v({top:ue,left:ee});},[d,l]),react.useEffect(()=>{let k=R=>{y.current&&!y.current.contains(R.target)&&!h.current?.contains(R.target)&&(c(false),u(""));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{let k=R=>{R.key==="Escape"&&(c(false),u(""));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]);let x=k=>{let R=t.includes(k),I=a.find(T=>T.id===k);if(g(null),R){let T=t.filter(H=>H!==k);r(T),T.length===0&&p(false);}else {if(s&&jn(a,k,e)){let H=`Cannot add "${I?.title||k}" as dependency - would create circular reference`;g(H),n?.(k,I?.title||k),setTimeout(()=>g(null),3e3);return}r([...t,k]),p(true);}},D=()=>{let k=!d;p(k),k||r([]);},N=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),C=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>l?c(false):b(),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:C,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:C},children:t.length})]}),l&&jsxRuntime.jsx(vt,{children:jsxRuntime.jsxs("div",{ref:y,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[w&&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:w})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&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"})]})}),d&&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:k=>u(k.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:N.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"}):N.map(k=>{let R=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>x(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.currentTarget.style.background="transparent";},children:[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:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&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:k.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(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 Ar=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:p,transition:f,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),w={transform:Wn.Transform.toString(p),transition:f};if(t)return jsxRuntime.jsx("div",{ref:d,style:w,...i,...u,onClick:()=>a?.(e),children:t(e)});let g=l.filter(x=>e.assignedUserIds?.includes(x.id)),y=e.progress===100,h=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),b={...w,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:b,className:m("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:x=>{x.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:x=>{x.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:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((x,D)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:N=>{N.currentTarget.style.display="none";}}),D===3&&h.length>4&&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]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:y?"line-through":"none",opacity:y?.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:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(co,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(on,{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:(x,D)=>n?.(e.id,{startDate:x,endDate:D})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(mo,{assignedUsers:g,availableUsers:l,onChange:x=>n?.(e.id,{assignedUserIds:x.map(D=>D.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(sn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:c,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Ar.displayName="Card";var Kn={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"}},mc=({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 pc({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),u=[...Object.entries(Kn).map(([g,y])=>({id:g,label:y.label,color:y.color,icon:y.icon})),...r.filter(g=>!Object.keys(Kn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=Kn[e];if(g)return {...g,id:e};let y=r.find(h=>h.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{...Kn.todo,id:"todo"}},p=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),y=window.innerHeight,h=window.innerWidth,b=180,x=280,D=4,N=g.right-b;N<10&&(N=g.left),N+b>h-10&&(N=h-b-10);let C=y-g.bottom,k=g.top,R;C>=x+D?R=g.bottom+D:k>=x+D?R=g.top-x-D:R=C>=k?g.bottom+D:Math.max(10,g.top-x-D),l({top:R,left:N}),s(true);};react.useEffect(()=>{let g=y=>{c.current&&!c.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let f=g=>{t(g),s(false);},v=d(),w=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):p(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:v.label,children:jsxRuntime.jsx(mc,{icon:v.icon,color:w})}),o&&jsxRuntime.jsx(vt,{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(g=>jsxRuntime.jsxs("button",{onClick:()=>f(g.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:g.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(mc,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===g.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function gc({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[l,c]=react.useState(false),[i,u]=react.useState(e),[d,p]=react.useState({top:0,left:0}),f=react.useRef(null),v=react.useRef(null),w=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let b=v.current.getBoundingClientRect();p({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[s]),react.useEffect(()=>{let b=x=>{f.current&&!f.current.contains(x.target)&&!v.current?.contains(x.target)&&(n(false),c(false));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=x=>{x.key==="Escape"&&(n(false),c(false),u(e));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s,e]),react.useEffect(()=>{l&&w.current&&(w.current.focus(),w.current.select());},[l]);let g=()=>{c(true),u(e);},y=()=>{let b=i.trim();b&&b!==e&&t(b),c(false),n(false),u(e);},h=b=>{b.key==="Enter"?y():b.key==="Escape"&&(c(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(vt,{children:jsxRuntime.jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:w,type:"text",value:i,onChange:b=>u(b.target.value),onKeyDown:h,onBlur:y,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Bo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:p,onToggleCollapse:f,onColumnRename:v,onColumnDelete:w,isDeletable:g=false,className:y})=>{let{setNodeRef:h,isOver:b}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),D=u??Ud(t.length),N=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:h,className:y,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let T=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:T}:T>=80?{state:"warning",percentage:T}:T>=60?{state:"approaching",percentage:T}:{state:"ok",percentage:T}})(),R=k.state==="exceeded",I=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:m("asakaa-column",b&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",y),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:m(I()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.state==="exceeded"&&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"})]}),k.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"})]}),k.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"})}),k.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(v||w)&&jsxRuntime.jsx(gc,{columnTitle:e.title,onRename:T=>v?.(e.id,T),onDelete:w?()=>w(e.id):void 0,isDeletable:g}),f&&jsxRuntime.jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(T=>T.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(T=>{let H=t[T.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${T.start}px)`},children:jsxRuntime.jsx(Ar,{card:H,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},H.id):null})}):t.map(T=>jsxRuntime.jsx(Ar,{card:T,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},T.id))})})]})});Bo.displayName="Column";function yi({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.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:l,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:c,onKeyDown:i,className:m("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:m("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Cf(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 xc(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Tf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Nf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Df=["\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 kc({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:f,onRemoveFile:v,maxFileSizeMB:w=10}){let g=l==="dark",[y,h]=react.useState(false),[b,x]=react.useState([]),[D,N]=react.useState(0),[C,k]=react.useState(null),[R,I]=react.useState(false),T=react.useRef(null),H=react.useRef(null),A=react.useRef(null),ee=react.useRef(null),S=react.useCallback((L,oe)=>{let ie=Cf(L,oe);if(k(ie),ie){let Se=r.filter(U=>U.name.toLowerCase().includes(ie.query)||U.email&&U.email.toLowerCase().includes(ie.query)).slice(0,5);x(Se),h(Se.length>0),N(0);}else h(false),x([]);},[r]),Y=L=>{let oe=L.target.value;if(t(oe),S(oe,L.target.selectionStart||0),T.current){T.current.style.height="24px";let ie=T.current.scrollHeight,Se=280,U=Math.min(ie,Se);T.current.style.height=`${U}px`,T.current.style.overflowY=ie>Se?"auto":"hidden";}},ue=()=>{T.current&&S(e,T.current.selectionStart||0);},Pe=react.useCallback(L=>{if(!C||!T.current)return;let oe=e.slice(0,C.start),ie=e.slice(C.end),Se=`@${L.name.replace(/\s+/g,"")} `,U=oe+Se+ie;t(U),h(false),k(null),setTimeout(()=>{if(T.current){let K=C.start+Se.length;T.current.selectionStart=K,T.current.selectionEnd=K,T.current.focus();}},0);},[C,e,t]),F=L=>{if(y&&b.length>0)switch(L.key){case "ArrowDown":L.preventDefault(),N(oe=>oe<b.length-1?oe+1:0);break;case "ArrowUp":L.preventDefault(),N(oe=>oe>0?oe-1:b.length-1);break;case "Enter":{L.preventDefault();let oe=b[D];oe&&Pe(oe);break}case "Tab":{L.preventDefault();let oe=b[D];oe&&Pe(oe);break}case "Escape":L.preventDefault(),h(false);break}else L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),a());};react.useEffect(()=>{let L=oe=>{H.current&&!H.current.contains(oe.target)&&T.current&&!T.current.contains(oe.target)&&h(false),ee.current&&!ee.current.contains(oe.target)&&I(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let pe=react.useCallback(L=>{if(!T.current)return;let oe=T.current.selectionStart||e.length,ie=e.slice(0,oe)+L+e.slice(oe);t(ie),I(false),setTimeout(()=>{if(T.current){let Se=oe+L.length;T.current.selectionStart=Se,T.current.selectionEnd=Se,T.current.focus();}},0);},[e,t]),J=react.useCallback(L=>{if(!f||!L.target.files)return;let oe=Array.from(L.target.files),ie=w*1024*1024,Se=oe.filter(U=>U.size>ie?(console.warn(`File ${U.name} exceeds max size of ${w}MB`),false):true);Se.length>0&&f(Se),L.target.value="";},[f,w]),te=react.useCallback(L=>L.type.startsWith("image/")?lucideReact.Image:L.type.includes("pdf")||L.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(y&&H.current){let L=H.current.children[D];L&&L.scrollIntoView({block:"nearest"});}},[D,y]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(L=>{let oe=te(L.file),ie=L.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:m("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[ie&&L.preview?jsxRuntime.jsx("img",{src:L.preview,alt:L.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(oe,{className:m("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:m("text-xs truncate",g?"text-white":"text-gray-900"),children:L.file.name}),jsxRuntime.jsx("p",{className:m("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Nf(L.file.size)})]}),v&&jsxRuntime.jsx("button",{onClick:()=>v(L.id),className:m("p-0.5 rounded-full transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},L.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:m("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:m("flex items-end gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>I(!R),disabled:s||n,className:m("p-1 rounded transition-colors flex-shrink-0",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsx(framerMotion.motion.div,{ref:ee,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Df.map(L=>jsxRuntime.jsx("button",{type:"button",onClick:()=>pe(L),className:m("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:L},L))})})})]}),d&&f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A.current?.click(),disabled:s||n,className:m("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:A,type:"file",multiple:true,onChange:J,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:T,value:e,onChange:Y,onSelect:ue,onKeyDown:F,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:m("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",g?"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()&&p.length===0||s,className:m("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&b.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:b.map((L,oe)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Pe(L),className:m("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",oe===D?g?"bg-white/10":"bg-gray-100":g?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:L.color||"#8B5CF6"},children:Tf(L.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:m("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:L.name}),L.email&&jsxRuntime.jsx("p",{className:m("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:L.email})]})]},L.id))})})]})]})]})}function wc({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((l,c)=>l.type==="mention"?jsxRuntime.jsx("span",{className:m("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},c):jsxRuntime.jsx("span",{children:l.value},c))})}var Zn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function _r({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=react.useState(false),[i,u]=react.useState(""),[d,p]=react.useState(false),[f,v]=react.useState(Zn[10]||"#3B82F6"),[w,g]=react.useState({top:0,left:0}),y=react.useRef(null),h=react.useRef(null),b=react.useRef(null),x=react.useRef(null),D=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),N=t.some(T=>T.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&h.current){let T=h.current.getBoundingClientRect();g({top:T.bottom+6,left:T.left});}},[l]),react.useEffect(()=>{let T=H=>{let A=H.target,ee=y.current?.contains(A),S=b.current?.contains(A);!ee&&!S&&(c(false),u(""),p(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),react.useEffect(()=>{l&&x.current&&x.current.focus();},[l]);let C=T=>{let H=e.some(A=>A.id===T.id);a(H?e.filter(A=>A.id!==T.id):[...e,T]);},k=async()=>{if(!(!r||!i.trim())){p(true);try{let T=await r(i.trim(),f);T&&(a([...e,T]),u(""),v(Zn[Math.floor(Math.random()*Zn.length)]||"#3B82F6"));}finally{p(false);}}},R=(T,H)=>{H.stopPropagation(),a(e.filter(A=>A.id!==T));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:y,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,disabled:s,children:[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(T=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.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:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:b,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:w.top,left:w.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:x,type:"text",value:i,onChange:T=>u(T.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:T=>{T.key==="Enter"&&i.trim()&&!N&&r&&k();}})}),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(T=>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:`${T.color}20`,color:T.color},onClick:H=>R(T.id,H),children:[T.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},T.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(T=>{let H=e.some(A=>A.id===T.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>C(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${T.color}15`:"transparent",color:o.textPrimary},onMouseEnter:A=>{H||(A.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:A=>{H||(A.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:T.name}),H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:T.color}})]},T.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()&&!N&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Zn.map(T=>jsxRuntime.jsx("button",{type:"button",onClick:()=>v(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:f===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxRuntime.jsxs("button",{type:"button",onClick:k,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,color:"#FFFFFF",opacity:d?.7:1},children:[d?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 xi({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 Tc({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(xi,{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 go=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Nc(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 Bf(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 Rf({className:e}){return jsxRuntime.jsxs("svg",{className:m("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 ki({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Bf(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Nc(e.loggedMinutes),i=e.estimateMinutes?Nc(e.estimateMinutes):null,u=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:m("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(Rf,{className:l[t]}),jsxRuntime.jsx("span",{children:u})]})}function Sc(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 es(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function zf(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 Uf({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Hf({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 Ec({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 Wf({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 wi({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:u,className:d}){let[p,f]=react.useState(""),[v,w]=react.useState(t.estimateMinutes?es(t.estimateMinutes):""),[g,y]=react.useState(""),[h,b]=react.useState(false),[x,D]=react.useState(false),N=react.useRef(null);react.useEffect(()=>{N.current?.focus();},[]);let C=async()=>{let I=Sc(p);if(!(I<=0||!s)){b(true);try{await s({durationMinutes:I,note:g.trim()||void 0,source:"manual"}),f(""),y("");}finally{b(false);}}},k=async()=>{if(!n)return;let I=v.trim()?Sc(v):null;await n(I),D(false);},R=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),C()),I.key==="Escape"&&u?.();};return jsxRuntime.jsxs("div",{className:m("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[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(Ec,{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:zf(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(Hf,{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(Ec,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:m("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(Uf,{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(Wf,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:N,type:"text",value:p,onChange:I=>f(I.target.value),onKeyDown:R,placeholder:"8 (=8h), 2h 30m",className:m("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:C,disabled:h||!p.trim(),className:m("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:g,onChange:I=>y(I.target.value),onKeyDown:R,placeholder:"Note (optional)",className:m("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:es(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"}),x?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:v,onChange:I=>w(I.target.value),onKeyDown:I=>{I.key==="Enter"&&k(),I.key==="Escape"&&D(false);},onBlur:k,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>D(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?es(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:m("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:m("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(I=>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:I.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:es(I.durationMinutes)})]},I.id))})]})]})}function jf(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 Kf(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function fo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=react.useState(Kf(r)),[i,u]=react.useState(""),[d,p]=react.useState(false),f=react.useRef(null);react.useEffect(()=>{f.current?.focus();},[]);let v=async()=>{p(true);let b=jf(l);await o(b&&b>0?b:null,i||void 0),p(false);},w=async()=>{p(true),await o(null),p(false);},g=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),v()),b.key==="Escape"&&s();},y={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},h={estimate:"8 (=8h)",quoted:"8 (=8h)",log:"8 (=8h)"};return jsxRuntime.jsxs("div",{className:m("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:m("text-sm font-medium",a?"text-white":"text-gray-900"),children:y[e]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:m("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx("input",{ref:f,type:"text",value:l,onChange:b=>c(b.target.value),onKeyDown:g,placeholder:h[e],className:m("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsxRuntime.jsx("p",{className:m("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 8 (=8h), 1h 30m, 45m, 2:30":"e.g. 8 (=8h), 1h 30m, 45m, 2:30"})]}),e==="log"&&jsxRuntime.jsx("div",{className:"mb-3",children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:b=>u(b.target.value),onKeyDown:g,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:m("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsxRuntime.jsx("button",{type:"button",onClick:v,disabled:d||!l.trim(),className:m("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:d?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:w,disabled:d,className:m("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function Yf(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 qf(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 Ni({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Yf(e.health),s=qf(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:m("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:m("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:m("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:m("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:m("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:m("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Ro(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Jf(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Zf(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 Qf(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 e0({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",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:m("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:m("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:m("text-2xl font-bold",o),children:[r?"+":"",Ro(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:m("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:m("text-sm font-medium mb-2",l),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:m("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:m("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:m("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:m("text-sm font-medium mb-2",l),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:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:m("font-medium",c),children:Ro(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:m("font-medium",c),children:Ro(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:m("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:m("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function t0({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",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:m("border-b",s,r&&m("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:m("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:m("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Ro(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Ro(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:m("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,Ro(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:m("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:m("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Zf(e.status,a),Jf(e.status,a)),children:Qf(e.status,t)})})]})}function Di({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#0F1117]":"bg-gray-50",c=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",u=n?"text-[#E5E7EB]":"text-gray-900",d=n?"text-[#9CA3AF]":"text-gray-500",p=n?"bg-[#0F1117]/50":"bg-gray-50",f=react.useMemo(()=>e?[...e.tasks].sort((v,w)=>v.varianceMinutes===null?1:w.varianceMinutes===null?-1:w.varianceMinutes-v.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:m("space-y-6 p-6",l,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:m("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:m("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(e0,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:m("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:p,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:m("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:m("divide-y",i),children:f.map(v=>jsxRuntime.jsx(t0,{task:v,locale:a,isDark:n,onClick:s},v.taskId))})]})})}),jsxRuntime.jsx("div",{className:m("text-xs text-center",d),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 Oo(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 f0(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 $c(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 h0(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 Ir({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:f=[],comments:v=[],onAddComment:w,currentUser:g,mentionableUsers:y=[],onUploadCommentAttachments:h,enableTimeTracking:b=false,timeTrackingSummary:x,timeEntries:D=[],isTimerRunning:N=false,timerElapsedSeconds:C=0,onTimeLog:k,onEstimateUpdate:R,onSoldEffortUpdate:I,onTimerStart:T,onTimerStop:H,onTimerDiscard:A,blurFinancials:ee=false}){let S=s==="dark",Y={textTertiary:S?"#6B7280":"#9CA3AF",textSecondary:S?"#9CA3AF":"#6B7280",textPrimary:S?"#FFFFFF":"#111827",borderLight:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:S?"#1A1D25":"#FFFFFF",bgSecondary:S?"#0F1117":"#F9FAFB",hoverBg:S?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ue=e&&"title"in e&&!("name"in e),Pe=e,[F,pe]=react.useState(e?$c(e,l):null),[J,te]=react.useState(false),[L,oe]=react.useState(false),[ie,Se]=react.useState(false),[U,K]=react.useState(null),[le,j]=react.useState(new Date),[Ie,he]=react.useState(false),[$e,Xe]=react.useState(false),[tt,Ye]=react.useState(""),[ht,it]=react.useState(false),[at,se]=react.useState(false),[B,Z]=react.useState(false),[ge,Ce]=react.useState(false),[Ue,et]=react.useState(""),lt=react.useRef(null),He=react.useRef(null),[ra,G]=react.useState(""),q=react.useRef(null),[ve,Qe]=react.useState(""),[Te,Ae]=react.useState(false),[X,We]=react.useState([]),[z,de]=react.useState(""),[Be,Ke]=react.useState(false),_e=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 P=$c(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),pe(P),et(P.description||""),G(P.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!Ue)return;let P=setTimeout(()=>{let re=He.current;re&&(re.style.height="auto",re.style.height=`${Math.max(100,re.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,Ue]),react.useEffect(()=>()=>{lt.current&&clearTimeout(lt.current),q.current&&clearTimeout(q.current);},[]),react.useEffect(()=>{t&&_e.current&&v.length>0&&setTimeout(()=>{_e.current&&(_e.current.scrollTop=_e.current.scrollHeight);},100);},[t,v.length]);let Oe=react.useCallback(P=>{pe(P),ue&&o&&Pe?o(h0(P,Pe)):r&&r(P);},[ue,Pe,o,r]),$=react.useCallback(()=>{te(false),oe(false),Se(false),K(null),Xe(false),Ye(""),it(false);},[]),_=react.useCallback((P,re)=>{if(!F)return;let ze={...F,[P]:re};Oe(ze);},[F,Oe]),xe=react.useCallback(()=>{let P=He.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),Je=react.useCallback(P=>{et(P),setTimeout(xe,0),lt.current&&clearTimeout(lt.current),lt.current=setTimeout(()=>{if(F){let re={...F,description:P};Oe(re);}},800);},[F,Oe,xe]),Ve=react.useCallback(P=>{G(P),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{if(F&&P.trim()){let re={...F,name:P.trim()};Oe(re);}},800);},[F,Oe]),W=react.useCallback(P=>{let re=P.map(ze=>{let Ze={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ze};return ze.type.startsWith("image/")&&(Ze.preview=URL.createObjectURL(ze)),Ze});We(ze=>[...ze,...re]);},[]),me=react.useCallback(P=>{We(re=>{let ze=re.find(Ze=>Ze.id===P);return ze?.preview&&URL.revokeObjectURL(ze.preview),re.filter(Ze=>Ze.id!==P)});},[]),Ee=react.useCallback(async()=>{if(!(!F||!ve.trim()&&X.length===0||!w)){Ae(true);try{let P=xc(ve,y),re=[];if(X.length>0&&h){let ze=X.map(Ze=>Ze.file);re=await h(ze);}await w(F.id,ve.trim(),P.length>0?P:void 0,re.length>0?re:void 0),Qe(""),X.forEach(ze=>{ze.preview&&URL.revokeObjectURL(ze.preview);}),We([]);}finally{Ae(false);}}},[F,ve,X,w,y,h]),At=react.useCallback(()=>{if(!F||!z.trim())return;let P=F.subtasks||[],re={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:z.trim(),progress:0,startDate:new Date,endDate:new Date,position:P.length},ze=[...P,re],Ze={...F,subtasks:ze};Oe(Ze),de(""),Ke(false);},[F,z,Oe]),ut=react.useCallback(P=>{if(!F?.subtasks)return;let re=F.subtasks.map(Ze=>Ze.id===P?{...Ze,progress:Ze.progress===100?0:100}:Ze),ze={...F,subtasks:re};Oe(ze);},[F,Oe]),kr=react.useCallback(P=>{if(!F?.subtasks)return;let re=F.subtasks.filter(Ze=>Ze.id!==P),ze={...F,subtasks:re};Oe(ze);},[F,Oe]),Za=react.useCallback(P=>{let re=typeof P=="string"?new Date(P):P,Ze=new Date().getTime()-re.getTime(),la=Math.floor(Ze/6e4),ya=Math.floor(Ze/36e5),Sa=Math.floor(Ze/864e5);return la<1?n==="es"?"Ahora":"Just now":la<60?n==="es"?`Hace ${la} min`:`${la}m ago`:ya<24?n==="es"?`Hace ${ya}h`:`${ya}h ago`:Sa<7?n==="es"?`Hace ${Sa}d`:`${Sa}d ago`:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),lr=react.useCallback(P=>{if(!F)return;let re=F.progress||0;P==="completed"?re=100:P==="in-progress"&&re===0?re=10:P==="todo"&&(re=0);let ze={...F,status:P,progress:re};Oe(ze),te(false);},[F,Oe]),Qa=react.useCallback((P,re)=>{if(!F)return;let ze={...F,startDate:P,endDate:re};Oe(ze);},[F,Oe]),De=react.useCallback(()=>{let P=le.getFullYear(),re=le.getMonth(),ze=new Date(P,re,1),la=new Date(P,re+1,0).getDate(),ya=ze.getDay(),Sa=[],Pa=new Date(P,re,0).getDate();for(let Aa=ya-1;Aa>=0;Aa--)Sa.push({date:new Date(P,re-1,Pa-Aa),isCurrentMonth:false});for(let Aa=1;Aa<=la;Aa++)Sa.push({date:new Date(P,re,Aa),isCurrentMonth:true});let Ma=42-Sa.length;for(let Aa=1;Aa<=Ma;Aa++)Sa.push({date:new Date(P,re+1,Aa),isCurrentMonth:false});return Sa},[le]),Rt=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),Z(false),!F||!d)return;let re=Array.from(P.dataTransfer.files);if(re.length!==0){Ce(true);try{await d(F.id,re);}finally{Ce(false);}}},[F,d]),Ot=react.useCallback(async P=>{if(!F||!d||!P.target.files)return;let re=Array.from(P.target.files);if(re.length!==0){Ce(true);try{await d(F.id,re);}finally{Ce(false);}P.target.value="";}},[F,d]),Da=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),Z(true);},[]),wr=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),Z(false);},[]),Ct=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),dr=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!F?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&F&&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:m("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",S?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:m("px-6 py-3 border-b flex items-center gap-3 h-[49px]",S?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:m("text-xs px-2 py-0.5 rounded",S?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:m("text-xs font-mono",S?"text-[#6B7280]":"text-gray-400"),children:F.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 P=F.progress===100?0:100,ze={...F,progress:P,status:P===100?"completed":"todo"};Oe(ze);},className:m("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",F.progress===100?"bg-green-500 border-green-500":S?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:F.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:ra,onChange:P=>Ve(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:m("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",F.progress===100?"line-through text-[#6B7280]":S?"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:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{$(),te(!J);},className:m("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",F.progress===100||F.status==="completed"?"bg-green-500/20 text-green-400":F.progress&&F.progress>0||F.status==="in-progress"?"bg-blue-500/20 text-blue-400":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:F.progress===100||F.status==="completed"?n==="es"?"COMPLETADO":"DONE":F.progress&&F.progress>0||F.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>lr(P.id),className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",F.status===P.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:S?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{$(),Se(!ie);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[F.assignees&&F.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[F.assignees.slice(0,3).map((P,re)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},re)),F.assignees.length>3&&jsxRuntime.jsxs("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:["+",F.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:m("text-sm",S?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Se(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(P=>{let re=F.assignees?.some(ze=>ze.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let ze=F.assignees||[],Ze;re?Ze=ze.filter(la=>la.name!==P.name):Ze=[...ze,P],_("assignees",Ze);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",re&&(S?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:m("flex-1",S?"text-white":"text-gray-900"),children:P.name}),re&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsxRuntime.jsx("div",{className:m("px-3 py-4 text-sm text-center",S?"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:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{K(U?null:"start"),j(F.startDate||new Date);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[F.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:m("mx-1",S?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),F.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>K(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:m("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:m("w-44 py-2 border-r",S?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,re=new Date(P);re.setDate(P.getDate()+1);let ze=new Date(P);ze.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Ze=new Date(P);Ze.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let la=new Date(P);la.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let ya=new Date(P);ya.setDate(P.getDate()+14);let Sa=new Date(P);return Sa.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:re,display:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ze,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ze,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:la,display:la.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ya,display:ya.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Sa,display:Sa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ma,Aa)=>jsxRuntime.jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(U==="start"){let an=F.endDate&&Ma.date>F.endDate?Ma.date:F.endDate;Qa(Ma.date,an),K("end");}else {let an=F.startDate&&Ma.date<F.startDate?Ma.date:F.startDate;Qa(an,Ma.date),K(null);}},children:[jsxRuntime.jsx("span",{children:Ma.label}),jsxRuntime.jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Ma.display})]},Aa))})(),jsxRuntime.jsx("div",{className:m("border-t mt-2 pt-2",S?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Qa(void 0,void 0),K(null);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[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:m("text-xs mb-3 px-2 py-1 rounded",S?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:U==="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:m("font-medium",S?"text-white":"text-gray-900"),children:le.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:()=>j(new Date),className:m("p-1 rounded text-sm transition-colors",S?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>j(new Date(le.getFullYear(),le.getMonth()-1)),className:m("p-1 rounded",S?"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:()=>j(new Date(le.getFullYear(),le.getMonth()+1)),className:m("p-1 rounded",S?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsxRuntime.jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",S?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:De().map((P,re)=>{let ze=P.date.toDateString()===new Date().toDateString(),Ze=F.startDate?.toDateString()===P.date.toDateString(),la=F.endDate?.toDateString()===P.date.toDateString(),ya=Ze||la,Sa=F.startDate&&F.endDate&&P.date>=F.startDate&&P.date<=F.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Pa=new Date(P.date);if(U==="start"){let Ma=F.endDate&&Pa>F.endDate?Pa:F.endDate;Qa(Pa,Ma),K("end");}else {let Ma=F.startDate&&Pa<F.startDate?Pa:F.startDate;Qa(Ma,Pa),K(null);}},className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(S?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(S?"text-white":"text-gray-900"),ze&&"ring-2 ring-[#3B82F6]",Ze&&"bg-[#3B82F6] text-white",la&&!Ze&&"bg-[#7C3AED] text-white",Sa&&!ya&&(S?"bg-[#7C3AED]/20":"bg-purple-100"),!ya&&(S?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},re)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{$(),oe(!L);},className:m("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",F.priority==="high"||F.priority==="urgent"?"bg-red-500/20 text-red-400":F.priority==="medium"?"bg-yellow-500/20 text-yellow-400":F.priority==="low"?"bg-green-500/20 text-green-400":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:F.priority?F.priority==="high"||F.priority==="urgent"?n==="es"?"Alta":"High":F.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>oe(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{_("priority",P.id),oe(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",F.priority===P.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:S?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:F.startDate&&F.endDate?`${Math.ceil((F.endDate.getTime()-F.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:m("w-4 h-4 rounded-full border-2",S?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Ie?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:F.progress||0,onChange:P=>{let re=parseInt(P.target.value),ze=F.status;re===100?ze="completed":re>0?ze="in-progress":ze="todo";let Ze={...F,progress:re,status:ze};Oe(Ze);},onBlur:()=>he(false),className:m("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",S?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>he(true),className:m("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",S?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:m("h-full rounded-full transition-all",F.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${F.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:m("text-sm font-medium min-w-[40px]",S?"text-white":"text-gray-900"),children:[F.progress||0,"%"]})]})]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"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:F.status==="completed"||F.progress===100?jsxRuntime.jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?Oo(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>se("estimate"),className:m("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Oo(x.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>se("estimate"),className:m("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:at==="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(fo,{mode:"estimate",locale:n,isDark:S,currentValue:x?.estimateMinutes||null,onSave:async P=>{await R?.(F.id,P),se(false);},onClose:()=>se(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:ee?jsxRuntime.jsx("span",{className:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",S?"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"}):F.status==="completed"||F.progress===100?jsxRuntime.jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:F.quotedMinutes?Oo(F.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):F.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>se("quoted"),className:m("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Oo(F.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>se("quoted"),className:m("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:at==="quoted"&&!ee&&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(fo,{mode:"quoted",locale:n,isDark:S,currentValue:F.quotedMinutes||null,onSave:async P=>{I?(await I(F.id,P),pe(re=>re?{...re,quotedMinutes:P}:null)):_("quotedMinutes",P),se(false);},onClose:()=>se(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[F.status==="completed"||F.progress===100?jsxRuntime.jsx("div",{className:m("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",S?"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"})}):N?jsxRuntime.jsxs("button",{type:"button",onClick:()=>H?.(F.id),className:m("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"}),f0(C||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>T?.(F.id),className:m("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",S?"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"})}),F.status==="completed"||F.progress===100?jsxRuntime.jsxs("div",{className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",S?"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:()=>se("log"),className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",S?"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"]}),x&&x.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:m("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":S?"text-white":"text-gray-900"),children:[Oo(x.loggedMinutes),x.estimateMinutes&&jsxRuntime.jsxs("span",{className:m("font-normal",S?"text-[#6B7280]":"text-gray-400"),children:[" / ",Oo(x.estimateMinutes)]})]}),x.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:m("h-full rounded-full transition-all",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:at==="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(fo,{mode:"log",locale:n,isDark:S,currentValue:null,onSave:async(P,re)=>{P&&await k?.(F.id,{durationMinutes:P,note:re,source:"manual"}),se(false);},onClose:()=>se(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(_r,{selectedTags:F.tags||[],availableTags:c,onChange:P=>{_("tags",P);},onCreateTag:i,theme:Y})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:m("w-4 h-4 mt-1.5",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0 mt-1",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[F.dependencies&&F.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:F.dependencies.map(P=>{let re=f.find(ze=>ze.id===P);return jsxRuntime.jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",S?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[re?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let ze=(F.dependencies||[]).filter(Ze=>Ze!==P);_("dependencies",ze);},className:m("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},P)})}),jsxRuntime.jsxs("button",{onClick:()=>{$(),Xe(!$e);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"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:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Xe(false),Ye("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:m("p-2 border-b",S?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:tt,onChange:P=>Ye(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:m("w-full px-3 py-2 rounded-md text-sm outline-none",S?"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:f.length>0?f.filter(P=>P.id!==F.id).filter(P=>tt===""||P.name.toLowerCase().includes(tt.toLowerCase())).map(P=>{let re=F.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let ze=F.dependencies||[],Ze;re?Ze=ze.filter(la=>la!==P.id):Ze=[...ze,P.id],_("dependencies",Ze);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",re&&(S?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:m("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",re?"bg-blue-500 border-blue-500":S?"border-white/30":"border-gray-300"),children:re&&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:m("block truncate",S?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:m("px-3 py-4 text-sm text-center",S?"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:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{$(),it(!ht);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"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:F.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:go.find(P=>P.value===F.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ht&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>it(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",S?"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:go.map(P=>{let re=F.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{_("color",P.value),it(false);},className:m("w-7 h-7 rounded-full flex items-center justify-center transition-all",re&&"ring-2 ring-offset-2",S?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:re?P.value:void 0},title:P.name,children:re&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"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:F.isMilestone||false,onChange:P=>_("isMilestone",P.target.checked),className:m("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",F.isMilestone?"bg-purple-500 border-purple-500":S?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:He,value:Ue,onChange:P=>Je(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:m("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",S?"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:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",F.subtasks&&F.subtasks.length>0&&jsxRuntime.jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",F.subtasks.filter(P=>P.progress===100).length,"/",F.subtasks.length,")"]})]})}),F.subtasks&&F.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...F.subtasks].sort((P,re)=>(P.position??0)-(re.position??0)).map(P=>jsxRuntime.jsxs("div",{className:m("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",S?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>ut(P.id),className:m("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":S?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:m("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":S?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("button",{onClick:()=>kr(P.id),className:m("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",S?"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"})})]},P.id))}),Be?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:z,onChange:P=>de(P.target.value),onKeyDown:P=>{P.key==="Enter"&&z.trim()?At():P.key==="Escape"&&(Ke(false),de(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:m("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",S?"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:At,disabled:!z.trim(),className:m("px-3 py-2 rounded-lg text-sm font-medium transition-colors",z.trim()?"bg-blue-500 hover:bg-blue-600 text-white":S?"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:()=>{Ke(false),de("");},className:m("p-2 rounded-lg transition-colors",S?"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:()=>Ke(true),className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",S?"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:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:m("text-sm font-semibold mb-3",S?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(P=>{let re=dr(P.type),ze=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:m("flex items-center gap-3 p-2 rounded-lg group transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ze&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:m("w-10 h-10 rounded flex items-center justify-center",S?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(re,{className:m("w-5 h-5",S?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:m("text-sm font-medium truncate block hover:underline",S?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Ct(P.size)})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(P.id),className:m("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",S?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:Da,onDragLeave:wr,onDrop:Rt,className:m("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",B?S?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":S?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ge&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Ot,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||ge}),ge?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:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:m("w-6 h-6 mx-auto mb-2",B?"text-blue-500":S?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:B?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"})]})}),!d&&jsxRuntime.jsx("p",{className:m("text-xs mt-1",S?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:m("w-96 border-l flex flex-col",S?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between h-[49px]",S?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",v.length>0&&jsxRuntime.jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",v.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:m("p-1.5 rounded transition-colors",S?"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
  }
@@ -13,10 +13,10 @@
13
13
  border-radius: 4px !important;
14
14
  }
15
15
  .activity-comments-scroll:hover::-webkit-scrollbar-thumb {
16
- background: ${E?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
16
+ background: ${S?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsxRuntime.jsx("div",{ref:Ge,className:m("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",E?"scrollbar-slim":"scrollbar-slim-light"),children:v.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...v].sort((M,ae)=>{let Oe=typeof M.createdAt=="string"?new Date(M.createdAt):M.createdAt,Xe=typeof ae.createdAt=="string"?new Date(ae.createdAt):ae.createdAt;return Oe.getTime()-Xe.getTime()}).map(M=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[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:M.user?.color||"#8B5CF6"},children:M.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:m("text-sm font-medium",E?"text-white":"text-gray-900"),children:M.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:m("text-xs",E?"text-[#6B7280]":"text-gray-400"),children:Za(M.createdAt)})]}),jsxRuntime.jsx("div",{className:m("text-sm",E?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(wc,{content:M.content,theme:s})}),M.attachments&&M.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:M.attachments.map(ae=>{let Oe=ae.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:ae.url,target:"_blank",rel:"noopener noreferrer",className:m("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",E?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Oe?jsxRuntime.jsx(lucideReact.Image,{className:m("w-4 h-4",E?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:m("w-4 h-4",E?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:m("text-xs truncate max-w-[100px]",E?"text-white":"text-gray-900"),children:ae.name})]},ae.id)})})]})]},M.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:m("w-10 h-10 mb-3",E?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:m("text-sm",E?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:m("py-4 pl-4 pr-2 border-t",E?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(kc,{value:be,onChange:Ze,onSubmit:Se,users:y,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!k,isSubmitting:Ce,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:q,onFilesSelect:W,onRemoveFile:ue})})]})]})]})})}function Si(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function Kr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,children:u,availableTags:d=[],onCreateTag:p,attachmentsByCard:f,onUploadAttachments:v,onDeleteAttachment:k,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onTaskOpen:x,onUploadCommentAttachments:S,enableTimeTracking:D,timeTrackingSummary:T,timeEntries:w,timerState:R,onLogTime:A,onUpdateEstimate:N,onUpdateSoldEffort:H,onStartTimer:I,onStopTimer:re,onDiscardTimer:E,blurFinancials:_=false}){let[ie,Ee]=Si(),[L,xe]=react.useState(null),[X,ee]=react.useState(false),C=react.useRef(null),U=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),K=o?.theme||"dark",ne=K==="dark"||K==="neutral",me=ne?"dark":"",ce=react.useCallback((se,B)=>{t.onCardUpdate?.(se,B);},[t]),Ne=react.useCallback((se,B)=>{t.onColumnUpdate?.(se,{title:B});},[t]),Z=react.useCallback(se=>{t.onColumnDelete?.(se);},[t]),je=["todo","in-progress","completed"],Be=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Ye=react.useMemo(()=>{let se=new Map;return e.columns.forEach(B=>{let J=B.cardIds.map(pe=>e.cards.find(we=>we.id===pe)).filter(pe=>pe!==void 0).sort((pe,we)=>pe.position-we.position);se.set(B.id,J);}),se},[e.cards,e.columns]);react.useEffect(()=>{let se=C.current;if(!se)return;let B=$e=>{let Qe=$e.target,nt=$e.button===1,ze=Qe===se||Qe.classList.contains("asakaa-column")&&!Qe.closest(".asakaa-card");(nt||$e.button===0&&ze&&!ie.isDragging)&&($e.preventDefault(),ee(true),U.current={x:$e.clientX,y:$e.clientY,scrollLeft:se.scrollLeft,scrollTop:se.scrollTop},se.style.cursor="grabbing",se.style.userSelect="none");},J=$e=>{if(!X)return;let Qe=$e.clientX-U.current.x,nt=$e.clientY-U.current.y;se.scrollLeft=U.current.scrollLeft-Qe,se.scrollTop=U.current.scrollTop-nt;},pe=()=>{X&&(ee(false),se.style.cursor="",se.style.userSelect="");},we=()=>{X&&(ee(false),se.style.cursor="",se.style.userSelect="");};return se.addEventListener("mousedown",B),document.addEventListener("mousemove",J),document.addEventListener("mouseup",pe),se.addEventListener("mouseleave",we),()=>{se.removeEventListener("mousedown",B),document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",pe),se.removeEventListener("mouseleave",we);}},[X,ie.isDragging]);let dt=react.useMemo(()=>e.cards.map(se=>({id:se.id,name:se.title,startDate:se.startDate?new Date(se.startDate):void 0,endDate:se.endDate?new Date(se.endDate):void 0,progress:se.progress||0,status:se.columnId,priority:se.priority?.toLowerCase(),dependencies:Array.isArray(se.dependencies)?se.dependencies.map(B=>typeof B=="string"?B:B.taskId):[]})),[e.cards]),ot=react.useCallback(se=>{let{active:B}=se,J=e.cards.find(pe=>pe.id===B.id);J&&Ee({isDragging:true,draggedCardId:J.id,sourceColumnId:J.columnId,targetColumnId:J.columnId});},[e.cards,Ee]),Je=react.useCallback(se=>{let{active:B,over:J}=se;if(!J||!e.cards.find($e=>$e.id===B.id))return;let we=null;J.data.current?.type==="column"?we=J.id:J.data.current?.type==="card"&&(we=e.cards.find(Qe=>Qe.id===J.id)?.columnId||null),we&&we!==ie.targetColumnId&&Ee({...ie,targetColumnId:we});},[e.cards,ie,Ee]),xt=react.useCallback(async se=>{let{active:B,over:J}=se;if(Ee({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!J)return;let pe=e.cards.find(nt=>nt.id===B.id);if(!pe)return;let we,$e;if(J.data.current?.type==="column"){we=J.id;let nt=Ye.get(we)||[];$e=li(nt,0);}else {let nt=e.cards.find(G=>G.id===J.id);if(!nt)return;we=nt.columnId;let ze=Ye.get(we)||[],oa=ze.findIndex(G=>G.id===J.id);$e=li(ze,oa);}let Qe=e.columns.find(nt=>nt.id===we);if(Qe&&Qe.wipLimit&&Qe.wipLimitType==="hard"){let nt=Ye.get(we)||[];if(pe.columnId!==we&&nt.length>=Qe.wipLimit){t.onWipLimitExceeded?.(Qe,pe);return}}(pe.columnId!==we||pe.position!==$e)&&await t.onCardMove?.(pe.id,we,$e);},[e.cards,e.columns,Ye,t,Ee]),gt=react.useCallback(se=>{xe(se),a?.(se),x?.(se.id);},[a,x]),yt=react.useCallback(se=>{t.onCardUpdate?.(se.id,se),xe(se);},[t]);return c?jsxRuntime.jsx("div",{className:m("asakaa-board",me,n),style:l,children:jsxRuntime.jsx(E0,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:m("asakaa-board",me,n),style:l,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(Jd,{themeName:K,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:Be,collisionDetection:core$1.closestCorners,onDragStart:ot,onDragOver:Je,onDragEnd:xt,children:[jsxRuntime.jsxs("div",{ref:C,className:m("asakaa-board",me,n),style:{...l,cursor:X?"grabbing":void 0},"data-theme":K,children:[e.columns.sort((se,B)=>se.position-B.position).map(se=>{let B=Ye.get(se.id)||[],J=!je.includes(se.id);return jsxRuntime.jsx(Bo,{column:se,cards:B,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:gt,onCardUpdate:ce,onColumnRename:Ne,onColumnDelete:Z,isDeletable:J,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},se.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:ie.draggedCardId?jsxRuntime.jsx(Ar,{card:e.cards.find(se=>se.id===ie.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(Ir,{task:L,isOpen:!!L,onClose:()=>xe(null),onCardUpdate:yt,theme:ne?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:L?f?.get(L.id)||[]:[],onUploadAttachments:v,onDeleteAttachment:k,availableTasks:dt,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onUploadCommentAttachments:S,enableTimeTracking:D,timeTrackingSummary:T,timeEntries:w,isTimerRunning:R?.isRunning,timerElapsedSeconds:R?.elapsedSeconds,onTimeLog:A,onEstimateUpdate:N,onSoldEffortUpdate:H,onTimerStart:I,onTimerStop:re,onTimerDiscard:E,blurFinancials:_})]})}function E0({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var L0={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},I0={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},B0={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},R0={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function O0({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function $0({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,c]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let f=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(f=>f.handler),p=async(f,v)=>{if(v){c(f);try{await v();}catch(k){console.error(`Export ${f} failed:`,k);}finally{c(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((f,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(f.id,f.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===f.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):f.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function z0({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function Pi({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i}){let u=r==="dark"?L0:I0,d={...o==="es"?B0:R0,...i},p=n||l||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($0,{theme:u,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx(O0,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsxRuntime.jsx(z0,{onClick:()=>t(),label:a||d.newTask}))]})})}function Fi({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(""),i=react.useCallback(()=>{let p=l.trim();p&&(e(p),c(""),n(false));},[l,e]),u=react.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(c(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:m("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:l,onChange:p=>c(p.target.value),onKeyDown:u,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:m("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ai({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:c="es"}){let[i,u]=react.useState(false),[d,p]=react.useState(false),[f,v]=react.useState(""),[k,g]=react.useState([]),[y,h]=react.useState(""),[b,x]=react.useState(""),[S,D]=react.useState(""),[T,w]=react.useState(false),[R,A]=react.useState(false),[N,H]=react.useState(false),I=react.useRef(null),re=react.useRef(null),E={placeholder:o||(c==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(c==="es"?"Agregar Tarea":"Add Task"),save:c==="es"?"Guardar":"Save",addAssignee:c==="es"?"Agregar asignado":"Add assignee",addDates:c==="es"?"Agregar fechas":"Add dates",addPriority:c==="es"?"Agregar prioridad":"Add priority",startDate:c==="es"?"Inicio":"Start",endDate:c==="es"?"Fin":"End",low:c==="es"?"Baja":"Low",medium:c==="es"?"Media":"Medium",high:c==="es"?"Alta":"High",urgent:c==="es"?"Urgente":"Urgent"},_=react.useCallback(()=>{v(""),g([]),h(""),x(""),D(""),w(false),A(false),H(false),u(false);},[]);react.useEffect(()=>{i&&I.current&&I.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let X=ee=>{re.current&&!re.current.contains(ee.target)&&(f.trim()||_());};return document.addEventListener("mousedown",X),()=>document.removeEventListener("mousedown",X)},[i,f,_]);let ie=react.useCallback(async()=>{let X=f.trim();if(!(!X||d)){p(true);try{await t({name:X,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:y?new Date(y):void 0,endDate:b?new Date(b):void 0,priority:S||void 0}),v(""),g([]),h(""),x(""),D(""),w(!1),A(!1),H(!1),I.current?.focus();}catch(ee){console.error("Error creating card:",ee);}finally{p(false);}}},[f,e,k,y,b,S,t,d]),Ee=react.useCallback(X=>{X.key==="Enter"&&!X.shiftKey?(X.preventDefault(),ie()):X.key==="Escape"&&_();},[ie,_]),L=react.useCallback(X=>{g(ee=>ee.includes(X)?ee.filter(C=>C!==X):[...ee,X]);},[]),xe=l==="dark";return i?jsxRuntime.jsxs("div",{ref:re,className:m("rounded-lg overflow-hidden shadow-lg",xe?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:I,type:"text",value:f,onChange:X=>v(X.target.value),onKeyDown:Ee,placeholder:E.placeholder,disabled:d,className:m("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",xe?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>w(!T),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||k.length>0?"bg-emerald-500/20 text-emerald-400":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:E.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),k.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:k.length})]}),jsxRuntime.jsx("button",{onClick:()=>A(!R),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||y||b?"bg-blue-500/20 text-blue-400":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:E.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>H(!N),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||S?S==="urgent"?"bg-red-500/20 text-red-400":S==="high"?"bg-orange-500/20 text-orange-400":S==="medium"?"bg-yellow-500/20 text-yellow-400":S==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:E.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:ie,disabled:!f.trim()||d,className:m("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):E.save})]})]}),T&&a.length>0&&jsxRuntime.jsx("div",{className:m("px-3 pb-3 pt-0","border-t",xe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(X=>jsxRuntime.jsxs("button",{onClick:()=>L(X.id),className:m("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(X.id)?"bg-emerald-500 text-white":xe?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[X.avatar?jsxRuntime.jsx("img",{src:X.avatar,alt:X.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:m("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(X.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:X.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:X.name.split(" ")[0]})]},X.id))})}),R&&jsxRuntime.jsx("div",{className:m("px-3 pb-3 pt-0","border-t",xe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-[10px] uppercase tracking-wide mb-1",xe?"text-gray-500":"text-gray-400"),children:E.startDate}),jsxRuntime.jsx("input",{type:"date",value:y,onChange:X=>h(X.target.value),className:m("w-full px-2 py-1.5 rounded text-xs border",xe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-[10px] uppercase tracking-wide mb-1",xe?"text-gray-500":"text-gray-400"),children:E.endDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:X=>x(X.target.value),className:m("w-full px-2 py-1.5 rounded text-xs border",xe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),N&&jsxRuntime.jsx("div",{className:m("px-3 pb-3 pt-0","border-t",xe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(X=>jsxRuntime.jsx("button",{onClick:()=>D(S===X?"":X),className:m("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",S===X?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[X]} text-white`:xe?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:E[X]},X))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:n,className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",xe?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:E.buttonLabel})]})}var gn=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(Kr,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
19
- `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Zc(e={}){return new gn(e)}var zo=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Li(e,t){let a=r=>jsxRuntime.jsx(zo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Bi({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[d,p]=react.useState(false),[f,v]=react.useState(""),[k,g]=react.useState("home"),[y,h]=react.useState(""),[b,x]=react.useState("");react.useEffect(()=>{let w=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),p(A=>!A)),R.key==="Escape"&&(p(false),g("home"),v(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{d||(g("home"),v(""),h(""),x(""));},[d]);let S=react.useCallback(()=>{p(false);},[]),D=react.useCallback(w=>{let[R,A]=w.split(":");switch(R){case "create-card":g("create-card");break;case "create-card-in":h(A||"");break;case "navigate":A?(a?.(A),S()):g("navigate");break;case "search":r?.(f),S();break;case "priority":g("priority");break;case "set-priority":b&&A&&(o?.(b,A),S());break;case "assign":g("assign");break;case "assign-user":b&&A&&(s?.(b,A),S());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),S();break;case "ai-predict-risks":l?.(),S();break;case "ai-usage":c?.(),S();break;case "back":g("home");break;}},[f,b,t,a,r,o,s,n,l,c,S]),T=react.useCallback(()=>{y&&f.trim()&&(t?.(y,f.trim()),S());},[y,f,t,S]);return d?jsxRuntime.jsx(ht,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:S,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:f,onValueChange:v,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:k==="create-card"&&y?"Type card title and press Enter...":k==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&k==="create-card"&&y&&T();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),k==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},w.id))})]}),k==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),k==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let R=e.columns.find(A=>A.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(A=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:A},A))})]},w.id)})})]}),k==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function tu(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
18
+ `}),jsxRuntime.jsx("div",{ref:_e,className:m("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",S?"scrollbar-slim":"scrollbar-slim-light"),children:v.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...v].sort((P,re)=>{let ze=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,Ze=typeof re.createdAt=="string"?new Date(re.createdAt):re.createdAt;return ze.getTime()-Ze.getTime()}).map(P=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[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:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:m("text-sm font-medium",S?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Za(P.createdAt)})]}),jsxRuntime.jsx("div",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(wc,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(re=>{let ze=re.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:re.url,target:"_blank",rel:"noopener noreferrer",className:m("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ze?jsxRuntime.jsx(lucideReact.Image,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:m("text-xs truncate max-w-[100px]",S?"text-white":"text-gray-900"),children:re.name})]},re.id)})})]})]},P.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:m("w-10 h-10 mb-3",S?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:m("text-sm",S?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:m("py-4 pl-4 pr-2 border-t",S?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(kc,{value:ve,onChange:Qe,onSubmit:Ee,users:y,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!w,isSubmitting:Te,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:X,onFilesSelect:W,onRemoveFile:me})})]})]})]})})}function Ei(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function Kr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,children:u,availableTags:d=[],onCreateTag:p,attachmentsByCard:f,onUploadAttachments:v,onDeleteAttachment:w,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onTaskOpen:x,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:C,timeEntries:k,timerState:R,onLogTime:I,onUpdateEstimate:T,onUpdateSoldEffort:H,onStartTimer:A,onStopTimer:ee,onDiscardTimer:S,blurFinancials:Y=false}){let[ue,Pe]=Ei(),[F,pe]=react.useState(null),[J,te]=react.useState(false),L=react.useRef(null),oe=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),ie=o?.theme||"dark",Se=ie==="dark"||ie==="neutral",U=Se?"dark":"",K=react.useCallback((se,B)=>{t.onCardUpdate?.(se,B);},[t]),le=react.useCallback((se,B)=>{t.onColumnUpdate?.(se,{title:B});},[t]),j=react.useCallback(se=>{t.onColumnDelete?.(se);},[t]),Ie=["todo","in-progress","completed"],he=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),$e=react.useMemo(()=>{let se=new Map;return e.columns.forEach(B=>{let Z=B.cardIds.map(ge=>e.cards.find(Ce=>Ce.id===ge)).filter(ge=>ge!==void 0).sort((ge,Ce)=>ge.position-Ce.position);se.set(B.id,Z);}),se},[e.cards,e.columns]);react.useEffect(()=>{let se=L.current;if(!se)return;let B=Ue=>{let et=Ue.target,lt=Ue.button===1,He=et===se||et.classList.contains("asakaa-column")&&!et.closest(".asakaa-card");(lt||Ue.button===0&&He&&!ue.isDragging)&&(Ue.preventDefault(),te(true),oe.current={x:Ue.clientX,y:Ue.clientY,scrollLeft:se.scrollLeft,scrollTop:se.scrollTop},se.style.cursor="grabbing",se.style.userSelect="none");},Z=Ue=>{if(!J)return;let et=Ue.clientX-oe.current.x,lt=Ue.clientY-oe.current.y;se.scrollLeft=oe.current.scrollLeft-et,se.scrollTop=oe.current.scrollTop-lt;},ge=()=>{J&&(te(false),se.style.cursor="",se.style.userSelect="");},Ce=()=>{J&&(te(false),se.style.cursor="",se.style.userSelect="");};return se.addEventListener("mousedown",B),document.addEventListener("mousemove",Z),document.addEventListener("mouseup",ge),se.addEventListener("mouseleave",Ce),()=>{se.removeEventListener("mousedown",B),document.removeEventListener("mousemove",Z),document.removeEventListener("mouseup",ge),se.removeEventListener("mouseleave",Ce);}},[J,ue.isDragging]);let Xe=react.useMemo(()=>e.cards.map(se=>({id:se.id,name:se.title,startDate:se.startDate?new Date(se.startDate):void 0,endDate:se.endDate?new Date(se.endDate):void 0,progress:se.progress||0,status:se.columnId,priority:se.priority?.toLowerCase(),dependencies:Array.isArray(se.dependencies)?se.dependencies.map(B=>typeof B=="string"?B:B.taskId):[]})),[e.cards]),tt=react.useCallback(se=>{let{active:B}=se,Z=e.cards.find(ge=>ge.id===B.id);Z&&Pe({isDragging:true,draggedCardId:Z.id,sourceColumnId:Z.columnId,targetColumnId:Z.columnId});},[e.cards,Pe]),Ye=react.useCallback(se=>{let{active:B,over:Z}=se;if(!Z||!e.cards.find(Ue=>Ue.id===B.id))return;let Ce=null;Z.data.current?.type==="column"?Ce=Z.id:Z.data.current?.type==="card"&&(Ce=e.cards.find(et=>et.id===Z.id)?.columnId||null),Ce&&Ce!==ue.targetColumnId&&Pe({...ue,targetColumnId:Ce});},[e.cards,ue,Pe]),ht=react.useCallback(async se=>{let{active:B,over:Z}=se;if(Pe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Z)return;let ge=e.cards.find(lt=>lt.id===B.id);if(!ge)return;let Ce,Ue;if(Z.data.current?.type==="column"){Ce=Z.id;let lt=$e.get(Ce)||[];Ue=di(lt,0);}else {let lt=e.cards.find(G=>G.id===Z.id);if(!lt)return;Ce=lt.columnId;let He=$e.get(Ce)||[],ra=He.findIndex(G=>G.id===Z.id);Ue=di(He,ra);}let et=e.columns.find(lt=>lt.id===Ce);if(et&&et.wipLimit&&et.wipLimitType==="hard"){let lt=$e.get(Ce)||[];if(ge.columnId!==Ce&&lt.length>=et.wipLimit){t.onWipLimitExceeded?.(et,ge);return}}(ge.columnId!==Ce||ge.position!==Ue)&&await t.onCardMove?.(ge.id,Ce,Ue);},[e.cards,e.columns,$e,t,Pe]),it=react.useCallback(se=>{pe(se),a?.(se),x?.(se.id);},[a,x]),at=react.useCallback(se=>{t.onCardUpdate?.(se.id,se),pe(se);},[t]);return c?jsxRuntime.jsx("div",{className:m("asakaa-board",U,n),style:l,children:jsxRuntime.jsx(E0,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:m("asakaa-board",U,n),style:l,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(Jd,{themeName:ie,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:he,collisionDetection:core$1.closestCorners,onDragStart:tt,onDragOver:Ye,onDragEnd:ht,children:[jsxRuntime.jsxs("div",{ref:L,className:m("asakaa-board",U,n),style:{...l,cursor:J?"grabbing":void 0},"data-theme":ie,children:[e.columns.sort((se,B)=>se.position-B.position).map(se=>{let B=$e.get(se.id)||[],Z=!Ie.includes(se.id);return jsxRuntime.jsx(Bo,{column:se,cards:B,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:it,onCardUpdate:K,onColumnRename:le,onColumnDelete:j,isDeletable:Z,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},se.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:ue.draggedCardId?jsxRuntime.jsx(Ar,{card:e.cards.find(se=>se.id===ue.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(Ir,{task:F,isOpen:!!F,onClose:()=>pe(null),onCardUpdate:at,theme:Se?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:F?f?.get(F.id)||[]:[],onUploadAttachments:v,onDeleteAttachment:w,availableTasks:Xe,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:C,timeEntries:k,isTimerRunning:R?.isRunning,timerElapsedSeconds:R?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:T,onSoldEffortUpdate:H,onTimerStart:A,onTimerStop:ee,onTimerDiscard:S,blurFinancials:Y})]})}function E0({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var L0={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},I0={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},B0={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},R0={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function O0({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function $0({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,c]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let f=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(f=>f.handler),p=async(f,v)=>{if(v){c(f);try{await v();}catch(w){console.error(`Export ${f} failed:`,w);}finally{c(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((f,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(f.id,f.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===f.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):f.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function z0({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function Mi({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i}){let u=r==="dark"?L0:I0,d={...o==="es"?B0:R0,...i},p=n||l||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($0,{theme:u,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx(O0,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsxRuntime.jsx(z0,{onClick:()=>t(),label:a||d.newTask}))]})})}function Ai({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(""),i=react.useCallback(()=>{let p=l.trim();p&&(e(p),c(""),n(false));},[l,e]),u=react.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(c(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:m("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:l,onChange:p=>c(p.target.value),onKeyDown:u,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:m("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Li({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:c="es"}){let[i,u]=react.useState(false),[d,p]=react.useState(false),[f,v]=react.useState(""),[w,g]=react.useState([]),[y,h]=react.useState(""),[b,x]=react.useState(""),[D,N]=react.useState(""),[C,k]=react.useState(false),[R,I]=react.useState(false),[T,H]=react.useState(false),A=react.useRef(null),ee=react.useRef(null),S={placeholder:o||(c==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(c==="es"?"Agregar Tarea":"Add Task"),save:c==="es"?"Guardar":"Save",addAssignee:c==="es"?"Agregar asignado":"Add assignee",addDates:c==="es"?"Agregar fechas":"Add dates",addPriority:c==="es"?"Agregar prioridad":"Add priority",startDate:c==="es"?"Inicio":"Start",endDate:c==="es"?"Fin":"End",low:c==="es"?"Baja":"Low",medium:c==="es"?"Media":"Medium",high:c==="es"?"Alta":"High",urgent:c==="es"?"Urgente":"Urgent"},Y=react.useCallback(()=>{v(""),g([]),h(""),x(""),N(""),k(false),I(false),H(false),u(false);},[]);react.useEffect(()=>{i&&A.current&&A.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let J=te=>{ee.current&&!ee.current.contains(te.target)&&(f.trim()||Y());};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[i,f,Y]);let ue=react.useCallback(async()=>{let J=f.trim();if(!(!J||d)){p(true);try{await t({name:J,columnId:e,assigneeIds:w.length>0?w:void 0,startDate:y?new Date(y):void 0,endDate:b?new Date(b):void 0,priority:D||void 0}),v(""),g([]),h(""),x(""),N(""),k(!1),I(!1),H(!1),A.current?.focus();}catch(te){console.error("Error creating card:",te);}finally{p(false);}}},[f,e,w,y,b,D,t,d]),Pe=react.useCallback(J=>{J.key==="Enter"&&!J.shiftKey?(J.preventDefault(),ue()):J.key==="Escape"&&Y();},[ue,Y]),F=react.useCallback(J=>{g(te=>te.includes(J)?te.filter(L=>L!==J):[...te,J]);},[]),pe=l==="dark";return i?jsxRuntime.jsxs("div",{ref:ee,className:m("rounded-lg overflow-hidden shadow-lg",pe?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:A,type:"text",value:f,onChange:J=>v(J.target.value),onKeyDown:Pe,placeholder:S.placeholder,disabled:d,className:m("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",pe?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>k(!C),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||w.length>0?"bg-emerald-500/20 text-emerald-400":pe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),w.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:w.length})]}),jsxRuntime.jsx("button",{onClick:()=>I(!R),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||y||b?"bg-blue-500/20 text-blue-400":pe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>H(!T),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":pe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:ue,disabled:!f.trim()||d,className:m("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):S.save})]})]}),C&&a.length>0&&jsxRuntime.jsx("div",{className:m("px-3 pb-3 pt-0","border-t",pe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(J=>jsxRuntime.jsxs("button",{onClick:()=>F(J.id),className:m("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",w.includes(J.id)?"bg-emerald-500 text-white":pe?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[J.avatar?jsxRuntime.jsx("img",{src:J.avatar,alt:J.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:m("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",w.includes(J.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:J.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:J.name.split(" ")[0]})]},J.id))})}),R&&jsxRuntime.jsx("div",{className:m("px-3 pb-3 pt-0","border-t",pe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-[10px] uppercase tracking-wide mb-1",pe?"text-gray-500":"text-gray-400"),children:S.startDate}),jsxRuntime.jsx("input",{type:"date",value:y,onChange:J=>h(J.target.value),className:m("w-full px-2 py-1.5 rounded text-xs border",pe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-[10px] uppercase tracking-wide mb-1",pe?"text-gray-500":"text-gray-400"),children:S.endDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:J=>x(J.target.value),className:m("w-full px-2 py-1.5 rounded text-xs border",pe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),T&&jsxRuntime.jsx("div",{className:m("px-3 pb-3 pt-0","border-t",pe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(J=>jsxRuntime.jsx("button",{onClick:()=>N(D===J?"":J),className:m("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===J?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[J]} text-white`:pe?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:S[J]},J))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:n,className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",pe?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:S.buttonLabel})]})}var fn=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(Kr,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
19
+ `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Zc(e={}){return new fn(e)}var zo=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Ii(e,t){let a=r=>jsxRuntime.jsx(zo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ri({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[d,p]=react.useState(false),[f,v]=react.useState(""),[w,g]=react.useState("home"),[y,h]=react.useState(""),[b,x]=react.useState("");react.useEffect(()=>{let k=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),p(I=>!I)),R.key==="Escape"&&(p(false),g("home"),v(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),react.useEffect(()=>{d||(g("home"),v(""),h(""),x(""));},[d]);let D=react.useCallback(()=>{p(false);},[]),N=react.useCallback(k=>{let[R,I]=k.split(":");switch(R){case "create-card":g("create-card");break;case "create-card-in":h(I||"");break;case "navigate":I?(a?.(I),D()):g("navigate");break;case "search":r?.(f),D();break;case "priority":g("priority");break;case "set-priority":b&&I&&(o?.(b,I),D());break;case "assign":g("assign");break;case "assign-user":b&&I&&(s?.(b,I),D());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),D();break;case "ai-predict-risks":l?.(),D();break;case "ai-usage":c?.(),D();break;case "back":g("home");break;}},[f,b,t,a,r,o,s,n,l,c,D]),C=react.useCallback(()=>{y&&f.trim()&&(t?.(y,f.trim()),D());},[y,f,t,D]);return d?jsxRuntime.jsx(vt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:f,onValueChange:v,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:w==="create-card"&&y?"Type card title and press Enter...":w==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&w==="create-card"&&y&&C();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),w==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},k.id))})]}),w==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),w==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let R=e.columns.find(I=>I.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:N,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},k.id)})})]}),w==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:N,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function tu(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
20
20
  position: fixed !important;
21
21
  inset: 0 !important;
22
22
  z-index: 2147483647 !important;
@@ -48,15 +48,15 @@
48
48
  padding: 8px 12px !important;
49
49
  background: rgba(0, 0, 0, 0.4) !important;
50
50
  border-radius: 20px !important;
51
- `,d.onclick=v=>v.stopPropagation(),a.forEach((v,k)=>{let g=document.createElement("button");g.className=`attachment-lightbox-dot ${k===r?"active":""}`,g.style.cssText=`
51
+ `,d.onclick=v=>v.stopPropagation(),a.forEach((v,w)=>{let g=document.createElement("button");g.className=`attachment-lightbox-dot ${w===r?"active":""}`,g.style.cssText=`
52
52
  width: 8px !important;
53
53
  height: 8px !important;
54
54
  border-radius: 50% !important;
55
- background: ${k===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
55
+ background: ${w===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
56
56
  border: none !important;
57
57
  padding: 0 !important;
58
58
  cursor: pointer !important;
59
- `,g.onclick=y=>{y.stopPropagation(),i(),o(k);},d.appendChild(g);});let p=document.createElement("button");p.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",p.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',p.style.cssText=`
59
+ `,g.onclick=y=>{y.stopPropagation(),i(),o(w);},d.appendChild(g);});let p=document.createElement("button");p.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",p.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',p.style.cssText=`
60
60
  position: absolute !important;
61
61
  left: 0 !important;
62
62
  top: 0 !important;
@@ -69,7 +69,7 @@
69
69
  border: none !important;
70
70
  cursor: pointer !important;
71
71
  opacity: 0.5 !important;
72
- `,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=v=>{v.stopPropagation();let k=r>0?r-1:a.length-1;i(),o(k);};let f=document.createElement("button");f.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",f.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',f.style.cssText=`
72
+ `,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=v=>{v.stopPropagation();let w=r>0?r-1:a.length-1;i(),o(w);};let f=document.createElement("button");f.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",f.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',f.style.cssText=`
73
73
  position: absolute !important;
74
74
  right: 0 !important;
75
75
  top: 0 !important;
@@ -82,7 +82,7 @@
82
82
  border: none !important;
83
83
  cursor: pointer !important;
84
84
  opacity: 0.5 !important;
85
- `,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=v=>{v.stopPropagation();let k=r<a.length-1?r+1:0;i(),o(k);},n.appendChild(d),n.appendChild(p),n.appendChild(f);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function _0(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 j0(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function Oi(e){return e.startsWith("image/")}function Er({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[c,i]=react.useState(false),[u,d]=react.useState(null),p=react.useRef(null),f=react.useRef(e);f.current=e;let v=react.useCallback((w,R)=>{R.preventDefault(),R.stopPropagation();let A=f.current.filter(I=>Oi(I.type)),N=A.findIndex(I=>I.id===w.id),H=I=>{let re=f.current.filter(_=>Oi(_.type)),E=re[I];E&&tu(E.url,E.name,re,I,H);};tu(w.url,w.name,A,N,H);},[]),k=react.useCallback(w=>{let R=[],A=[];return e.length+w.length>s?(A.push(`Maximum ${s} files allowed`),{valid:R,errors:A}):(w.forEach(N=>{if(N.size/1048576>r){A.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some(I=>N.type.match(I))){A.push(`${N.name} has invalid file type`);return}R.push(N);}),{valid:R,errors:A})},[e.length,s,r,o]),g=react.useCallback(async w=>{let{valid:R,errors:A}=k(w);if(A.length>0){d(A.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(N){d(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[k,t]),y=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(true);},[]),h=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);},[]),b=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),x=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);let R=Array.from(w.dataTransfer.files);g(R);},[g]),S=react.useCallback(w=>{let R=w.target.files?Array.from(w.target.files):[];g(R),p.current&&(p.current.value="");},[g]),D=react.useCallback(()=>{p.current?.click();},[]),T=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:b,onDrop:x,onClick:D,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:S,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(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Oi(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>v(w,R),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:w.thumbnailUrl||w.url,alt:w.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:j0(w.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:_0(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>T(w.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},w.id))})]})}function $i({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:f,onSuggestAssignee:v,onGenerateSubtasks:k,onEstimateEffort:g,currentUserId:y="user-1"}){let[h,b]=react.useState("details"),[x,S]=react.useState(false),[D,T]=react.useState({}),[w,R]=react.useState(""),[A,N]=react.useState(false),[H,I]=react.useState({});if(!t||!e)return null;let re=react.useCallback(()=>{S(false),T({}),b("details"),R(""),I({}),a();},[a]),E=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),T({}),S(false));},[e.id,D,r]),_=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),re());},[e.id,o,re]),ie=react.useCallback(()=>{u&&w.trim()&&(u(e.id,w.trim()),R(""));},[e.id,w,u]),Ee=react.useCallback(async()=>{if(v){N(true);try{let C=await v(e);I(U=>({...U,assignees:C}));}catch(C){console.error("Failed to suggest assignee:",C);}finally{N(false);}}},[e,v]),L=react.useCallback(async()=>{if(k){N(true);try{let C=await k(e);I(U=>({...U,subtasks:C}));}catch(C){console.error("Failed to generate subtasks:",C);}finally{N(false);}}},[e,k]),xe=react.useCallback(async()=>{if(g){N(true);try{let C=await g(e);I(U=>({...U,effort:C}));}catch(C){console.error("Failed to estimate effort:",C);}finally{N(false);}}},[e,g]),X={...e,...D},ee=s.filter(C=>X.assignedUserIds?.includes(C.id));return jsxRuntime.jsx(ht,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:re,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:C=>C.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:X.priority==="URGENT"?"#EF4444":X.priority==="HIGH"?"#F59E0B":X.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:D.title??X.title,onChange:C=>T({...D,title:C.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:X.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:E,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{S(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>S(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:_,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:re,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>b("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>b("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),x?jsxRuntime.jsx("textarea",{value:D.description??X.description??"",onChange:C=>T({...D,description:C.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:X.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??X.assignedUserIds??[],onChange:C=>{let U=Array.from(C.target.selectedOptions,K=>K.value);T({...D,assignedUserIds:U});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(C=>jsxRuntime.jsx("option",{value:C.id,children:C.name},C.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:ee.length>0?ee.map(C=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:C.color},children:C.initials}),jsxRuntime.jsx("span",{children:C.name})]},C.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"}),x?jsxRuntime.jsxs("select",{value:D.priority??X.priority??"",onChange:C=>T({...D,priority:C.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:X.priority==="URGENT"?"#EF4444":X.priority==="HIGH"?"#F59E0B":X.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:X.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:X.labels&&X.labels.length>0?X.labels.map(C=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:C},C)):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"}),x?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:X.startDate?new Date(X.startDate).toISOString().split("T")[0]:"",onChange:C=>T({...D,startDate:C.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:X.startDate?new Date(X.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:X.endDate?new Date(X.endDate).toISOString().split("T")[0]:"",onChange:C=>T({...D,endDate:C.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:X.endDate?new Date(X.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??X.estimatedTime??"",onChange:C=>T({...D,estimatedTime:C.target.value?parseFloat(C.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:X.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:X.dependencies&&X.dependencies.length>0?X.dependencies.map(C=>{let U=typeof C=="string"?C:C.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",U.slice(-4)]},U)}):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:X.createdAt?new Date(X.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:C=>R(C.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ie,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(C=>{let U=s.find(K=>K.id===C.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:[U&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:U.color},children:U.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:U?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(C.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(C.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:C.content})]},C.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:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(C=>{let U=s.find(K=>K.id===C.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[C.type.includes("CREATED")&&"\u2795",C.type.includes("UPDATED")&&"\u270F\uFE0F",C.type.includes("MOVED")&&"\u27A1\uFE0F",C.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",C.type.includes("COMMENT")&&"\u{1F4AC}",C.type.includes("ASSIGNED")&&"\u{1F464}",C.type.includes("PRIORITY")&&"\u{1F3AF}",C.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",C.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:U?.name||"Unknown"})," ",C.type.replace(/_/g," ").toLowerCase(),C.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:C.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(C.timestamp).toLocaleString()})]})]},C.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(Er,{cardId:e.id,attachments:i,onUpload:p?C=>p(e.id,C):void 0,onDelete:f,currentUserId:y,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:Ee,disabled:A||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:L,disabled:A||!k,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:xe,disabled:A||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),H.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((C,U)=>{let K=s.find(ne=>ne.id===C.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[K&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:K?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:C.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(C.confidence*100).toFixed(0),"%"]})]})]},U)})]}),H.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((C,U)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:C.title}),C.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:C.description}),C.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",C.estimatedTime,"h"]})]},U))]}),H.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[H.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.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(C=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${C.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:C.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:C.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:C.description}),C.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",C.suggestedAction]})]},C.id))]}),!H.assignees&&!H.subtasks&&!H.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 hn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,c]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,f=window.innerWidth,v=4,k=d.left;k+o>f-10&&(k=f-o-10),k<10&&(k=10);let g=p-d.bottom,y=d.top,h;return g>=s+v?h=d.bottom+v:y>=s+v?h=d.top-s-v:g>=y?h=d.bottom+v:h=Math.max(10,d.top-s-v),{top:h,left:k}},[e,o,s]);return react.useEffect(()=>{t&&c(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=f=>{let v=f.target;i.current&&!i.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(ht,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var tt={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#60A5FA",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#3B82F6",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#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"}};var eh=["LOW","MEDIUM","HIGH","URGENT"],th=["todo","in-progress","review","done"];function Hi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:f,availableColumns:v=[],availableLabels:k=[],availableTags:g=[],onCreateTag:y,onUploadCoverImage:h,unsplashAccessKey:b,theme:x,onSubtasksChange:S,attachments:D=[],onUploadAttachments:T,onDeleteAttachment:w}){let R=Ao(),A=x||R?.themeName||"dark",[N,H]=react.useState(e),[I,re]=react.useState(false),[E,_]=react.useState(()=>[...e?.subtasks||[]].sort((ue,Se)=>(ue.position??0)-(Se.position??0))),[ie,Ee]=react.useState(false),[L,xe]=react.useState(""),[X,ee]=react.useState(""),[C,U]=react.useState("all"),[K,ne]=react.useState(false),[me,ce]=react.useState(false),[Ne,Z]=react.useState(false),[je,Be]=react.useState(false),[Ye,dt]=react.useState(false),[ot,Je]=react.useState(false),xt=react.useRef(null),gt=react.useRef(null),yt=react.useRef(null),se=react.useRef(null),B=react.useRef(null),J=react.useRef(null),pe=react.useRef(null),we=react.useRef(null),$e=react.useRef(null),Qe=react.useRef(null),nt=react.useRef(null),ze=react.useRef(null);react.useEffect(()=>{if(e&&!N){H({...e});let W=[...e.subtasks||[]].sort((ue,Se)=>(ue.position??0)-(Se.position??0));_(W);}else if(e&&N&&e.id!==N.id){H({...e});let W=[...e.subtasks||[]].sort((ue,Se)=>(ue.position??0)-(Se.position??0));_(W);}},[e,N]),react.useEffect(()=>{let W=ue=>{let Se=ue.target;se.current&&!se.current.contains(Se)&&ne(false),B.current&&!B.current.contains(Se)&&ce(false),J.current&&!J.current.contains(Se)&&Z(false),pe.current&&!pe.current.contains(Se)&&Be(false);};if(K||me||Ne||je)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[K,me,Ne,je]),react.useEffect(()=>{if(!t)return;let W=ue=>{let Se=ue.target,Ft=Se.tagName==="INPUT"||Se.tagName==="TEXTAREA"||Se.isContentEditable;if(ue.key==="Escape"){ue.preventDefault(),K||me||Ne||je||Ye||ot?(ne(false),ce(false),Z(false),Be(false),dt(false),Je(false)):Ft||a();return}if(Ft&&ue.key!=="Escape")return;let lt=ue.metaKey||ue.ctrlKey;switch(ue.key.toLowerCase()){case "s":ue.preventDefault(),ne(true);break;case "a":ue.preventDefault(),Z(true);break;case "p":ue.preventDefault(),ce(true);break;case "l":ue.preventDefault(),Be(true);break;case "d":lt||(ue.preventDefault(),dt(true),setTimeout(()=>we.current?.focus(),0));break;case "e":lt||(ue.preventDefault(),Je(true));break;case "i":ue.preventDefault(),re(true),setTimeout(()=>gt.current?.focus(),0);break;case "t":ue.preventDefault(),Ee(true);break;case "c":ue.preventDefault(),yt.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,K,me,Ne,je,Ye,ot]);let oa=react.useCallback(W=>{let ue=W.currentTarget.textContent?.trim()||"";if(N&&ue!==N.title){let Se={...N,title:ue};H(Se),r?.(N.id,{title:ue});}},[N,r]),G=react.useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=N?.title||"",W.currentTarget.blur());},[N]),Y=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),re(false);},[N,e,r]),be=react.useCallback(W=>{if(N){let ue={...N,columnId:W};H(ue),r?.(N.id,{columnId:W}),ne(false);}},[N,r]),Ze=react.useCallback(W=>{if(N){let ue={...N,priority:W};H(ue),r?.(N.id,{priority:W}),ce(false);}},[N,r]),Ce=react.useCallback(W=>{if(N){let ue=N.assignedUserIds||[],Se=ue.includes(W)?ue.filter(lt=>lt!==W):[...ue,W],Ft={...N,assignedUserIds:Se};H(Ft),r?.(N.id,{assignedUserIds:Se});}},[N,r]),Fe=react.useCallback(W=>{if(N){let ue=N.labels||[],Se=ue.includes(W)?ue.filter(lt=>lt!==W):[...ue,W],Ft={...N,labels:Se};H(Ft),r?.(N.id,{labels:Se});}},[N,r]),q=react.useCallback(W=>{if(N){let ue={...N,tags:W};H(ue),r?.(N.id,{tags:W});}},[N,r]),Ue=react.useCallback(W=>{if(N){let ue=W.target.value,Se={...N,endDate:ue};H(Se),r?.(N.id,{endDate:ue}),dt(false);}},[N,r]),z=react.useCallback(W=>{if(N){let ue={...N,estimatedTime:parseFloat(W)||0};H(ue),r?.(N.id,{estimatedTime:parseFloat(W)||0});}},[N,r]),le=react.useCallback(()=>{if(L.trim()&&N){let W={id:`subtask-${Date.now()}`,title:L.trim(),completed:false,position:E.length,createdAt:new Date},ue=[...E,W];_(ue),xe(""),Ee(false),S?.(N.id,ue);}},[L,E,N,S]),Le=react.useCallback(W=>{let ue=E.map(Se=>Se.id===W?{...Se,completed:!Se.completed,updatedAt:new Date}:Se);_(ue),N&&S?.(N.id,ue);},[E,N,S]),_e=react.useCallback(W=>{let ue=E.filter(Se=>Se.id!==W);_(ue),N&&S?.(N.id,ue);},[E,N,S]),Ge=react.useCallback(()=>{X.trim()&&N&&c&&(c(N.id,X.trim()),ee(""));},[X,N,c]),Re=react.useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),Ge());},[Ge]),$=W=>jsxRuntime.jsx(J0__default.default,{remarkPlugins:[Z0__default.default],rehypePlugins:[Q0__default.default],components:{a:({node:ue,...Se})=>jsxRuntime.jsx("a",{...Se,target:"_blank",rel:"noopener noreferrer"})},children:W}),j=l.filter(W=>C==="comments"?W.type.includes("COMMENT"):C==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let ye=N||e,qe=s.filter(W=>ye.assignedUserIds?.includes(W.id)),We=E.filter(W=>W.completed).length;return jsxRuntime.jsx(ht,{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:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":A,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:xt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:oa,onKeyDown:G,children:ye.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:se,children:[jsxRuntime.jsxs("button",{ref:$e,className:"modal-v2-field",onClick:()=>ne(!K),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:ye.columnId||"No status"})]}),jsxRuntime.jsx(hn,{triggerRef:$e,isOpen:K,onClose:()=>ne(false),width:250,estimatedHeight:200,children:(v.length>0?v:th.map(W=>({id:W,title:W}))).map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ye.columnId===W.id?"active":""}`,onClick:()=>be(W.id),children:W.title},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:J,children:[jsxRuntime.jsxs("button",{ref:Qe,className:"modal-v2-field",onClick:()=>Z(!Ne),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:qe.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:qe.map(W=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:W.color},title:W.name,children:W.initials},W.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(hn,{triggerRef:Qe,isOpen:Ne,onClose:()=>Z(false),width:280,estimatedHeight:300,children:s.map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ye.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>Ce(W.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,ye.assignedUserIds?.includes(W.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"})})]},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:B,children:[jsxRuntime.jsxs("button",{ref:nt,className:"modal-v2-field",onClick:()=>ce(!me),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ye.priority||"None"})]}),jsxRuntime.jsxs(hn,{triggerRef:nt,isOpen:me,onClose:()=>ce(false),width:180,estimatedHeight:220,children:[eh.map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${ye.priority===W?"active":""}`,onClick:()=>Ze(W),children:W},W)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ze(""),children:"None"})]})]}),g.length>0||y?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(_r,{selectedTags:ye.tags||[],availableTags:g,onChange:q,onCreateTag:y,theme:tt[A]||tt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:pe,children:[jsxRuntime.jsxs("button",{ref:ze,className:"modal-v2-field",onClick:()=>Be(!je),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:ye.labels&&ye.labels.length>0?jsxRuntime.jsx("span",{children:ye.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(hn,{triggerRef:ze,isOpen:je,onClose:()=>Be(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ye.labels?.includes(W)?"active":""}`,onClick:()=>Fe(W),children:[W,ye.labels?.includes(W)&&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"})})]},W))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{dt(!Ye),setTimeout(()=>we.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:ye.endDate?new Date(ye.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:we,type:"date",value:typeof ye.endDate=="string"?ye.endDate.split("T")[0]:ye.endDate?(()=>{let W=new Date(ye.endDate),ue=W.getUTCFullYear(),Se=String(W.getUTCMonth()+1).padStart(2,"0"),Ft=String(W.getUTCDate()).padStart(2,"0");return `${ue}-${Se}-${Ft}`})():"",onChange:Ue,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Je(!ot),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ye.estimatedTime?`${ye.estimatedTime}h`:"Not set"})]}),ot&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ye.estimatedTime||"",onChange:W=>z(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Je(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"})]}),I?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ye.description||"",onChange:W=>{if(N){let ue={...N,description:W.target.value};H(ue);}},onBlur:Y,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>re(true),children:ye.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:$(ye.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"}),E.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[We,"/",E.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ee(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:[E.map(W=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Le(W.id),children:W.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:W.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>_e(W.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"})]})})]},W.id)),ie&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:L,onChange:W=>xe(W.target.value),onKeyDown:W=>{W.key==="Enter"&&le(),W.key==="Escape"&&(Ee(false),xe(""));},onBlur:le,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||D.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(Er,{cardId:ye.id,attachments:D,onUpload:T?W=>T(ye.id,W):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${C==="all"?"active":""}`,onClick:()=>U("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${C==="comments"?"active":""}`,onClick:()=>U("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${C==="history"?"active":""}`,onClick:()=>U("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:yt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:X,onChange:W=>ee(W.target.value),onKeyDown:Re,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:Ge,disabled:!X.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[j.map(W=>{let ue=s.find(Ft=>Ft.id===W.userId);if(W.type.includes("COMMENT")){let Ft=n.find(lt=>lt.id===W.metadata?.commentId);return Ft?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ue&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ue.color},children:ue.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:ue?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Ft.content})]})]},W.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[W.type.includes("CREATED")&&"\u2795",W.type.includes("UPDATED")&&"\u270F\uFE0F",W.type.includes("MOVED")&&"\u27A1\uFE0F",W.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",W.type.includes("ASSIGNED")&&"\u{1F464}",W.type.includes("PRIORITY")&&"\u{1F3AF}",W.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:ue?.name||"Unknown"})," ",W.type.replace(/_/g," ").toLowerCase(),W.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:W.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]})]},W.id)}),j.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 ch({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 Gi({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,c)=>l+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(ch,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.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,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function vh({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 Vi({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=l;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(vh,{})}),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 Eh={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},cu=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ph({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function uu({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 _i({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||Eh[c.name]||cu[e.indexOf(c)%cu.length]})),l=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?Ph:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(uu,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${d}%)`}})]}):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(uu,{})}),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:l[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var us=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[c,i]=react.useState(false),[u,d]=react.useState(false),[p,f]=react.useState(false);if(e.length===0)return null;let v=e.map(x=>x.id),k=x=>{r.onBulkUpdate?.(v,{priority:x}),l(false);},g=x=>{r.onBulkMove?.(v,x),i(false),a();},y=x=>{r.onBulkUpdate?.(v,{assignedUserIds:x}),d(false);},h=x=>{let S=new Set;e.forEach(T=>{T.labels?.forEach(w=>S.add(w));});let D=Array.from(new Set([...S,...x]));r.onBulkUpdate?.(v,{labels:D}),f(false);},b=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!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(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(x),children:[jsxRuntime.jsx("span",{className:m("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),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(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:b,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});us.displayName="BulkOperationsToolbar";function Ih(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,c,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(f=>{let v=a?.find(k=>k.id===f);n=`assignee-${f}`,l=v?.name||`User ${f}`,c=v?.color,i=v?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,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 p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=p.title,c=p.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,l=f,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,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 ji({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>Ih(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(Kr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:m("asakaa-swimlane-view",o),children:[l.map(i=>{let u=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),p={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&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(Kr,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),l.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 Ki=[{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 Yi({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=Ki.find(i=>i.value===e)||Ki[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:m("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:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:m("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:Ki.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:m("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 bn=[{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 Oh(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&l&&c}function hu(e={}){let{shortcuts:t=bn,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];},[]),l=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 d of o.current)if(Oh(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function zh(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Uh(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 Hh(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Uh(e),r=t?zh(t):"";return a?`${a} + ${r}`:r}function Wh(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 qi({shortcuts:e=bn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Wh(e);return jsxRuntime.jsxs("div",{className:m("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(([l,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"}),l]}),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:Hh(i)})]},i.action))})]},l))})}),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 Xi=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
85
+ `,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=v=>{v.stopPropagation();let w=r<a.length-1?r+1:0;i(),o(w);},n.appendChild(d),n.appendChild(p),n.appendChild(f);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function _0(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 j0(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 $i(e){return e.startsWith("image/")}function Er({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[c,i]=react.useState(false),[u,d]=react.useState(null),p=react.useRef(null),f=react.useRef(e);f.current=e;let v=react.useCallback((k,R)=>{R.preventDefault(),R.stopPropagation();let I=f.current.filter(A=>$i(A.type)),T=I.findIndex(A=>A.id===k.id),H=A=>{let ee=f.current.filter(Y=>$i(Y.type)),S=ee[A];S&&tu(S.url,S.name,ee,A,H);};tu(k.url,k.name,I,T,H);},[]),w=react.useCallback(k=>{let R=[],I=[];return e.length+k.length>s?(I.push(`Maximum ${s} files allowed`),{valid:R,errors:I}):(k.forEach(T=>{if(T.size/1048576>r){I.push(`${T.name} is too large (max ${r}MB)`);return}if(o&&!o.some(A=>T.type.match(A))){I.push(`${T.name} has invalid file type`);return}R.push(T);}),{valid:R,errors:I})},[e.length,s,r,o]),g=react.useCallback(async k=>{let{valid:R,errors:I}=w(k);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(T){d(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[w,t]),y=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(true);},[]),h=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);},[]),b=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),x=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);let R=Array.from(k.dataTransfer.files);g(R);},[g]),D=react.useCallback(k=>{let R=k.target.files?Array.from(k.target.files):[];g(R),p.current&&(p.current.value="");},[g]),N=react.useCallback(()=>{p.current?.click();},[]),C=react.useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:b,onDrop:x,onClick:N,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:D,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(k=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:$i(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>v(k,R),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:k.thumbnailUrl||k.url,alt:k.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:j0(k.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:_0(k.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>C(k.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"})})})]},k.id))})]})}function zi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:f,onSuggestAssignee:v,onGenerateSubtasks:w,onEstimateEffort:g,currentUserId:y="user-1"}){let[h,b]=react.useState("details"),[x,D]=react.useState(false),[N,C]=react.useState({}),[k,R]=react.useState(""),[I,T]=react.useState(false),[H,A]=react.useState({});if(!t||!e)return null;let ee=react.useCallback(()=>{D(false),C({}),b("details"),R(""),A({}),a();},[a]),S=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),C({}),D(false));},[e.id,N,r]),Y=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ee());},[e.id,o,ee]),ue=react.useCallback(()=>{u&&k.trim()&&(u(e.id,k.trim()),R(""));},[e.id,k,u]),Pe=react.useCallback(async()=>{if(v){T(true);try{let L=await v(e);A(oe=>({...oe,assignees:L}));}catch(L){console.error("Failed to suggest assignee:",L);}finally{T(false);}}},[e,v]),F=react.useCallback(async()=>{if(w){T(true);try{let L=await w(e);A(oe=>({...oe,subtasks:L}));}catch(L){console.error("Failed to generate subtasks:",L);}finally{T(false);}}},[e,w]),pe=react.useCallback(async()=>{if(g){T(true);try{let L=await g(e);A(oe=>({...oe,effort:L}));}catch(L){console.error("Failed to estimate effort:",L);}finally{T(false);}}},[e,g]),J={...e,...N},te=s.filter(L=>J.assignedUserIds?.includes(L.id));return jsxRuntime.jsx(vt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:ee,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:L=>L.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:J.priority==="URGENT"?"#EF4444":J.priority==="HIGH"?"#F59E0B":J.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:N.title??J.title,onChange:L=>C({...N,title:L.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:J.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:S,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),C({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:Y,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:ee,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>b("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>b("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>b("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),x?jsxRuntime.jsx("textarea",{value:N.description??J.description??"",onChange:L=>C({...N,description:L.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:J.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:N.assignedUserIds??J.assignedUserIds??[],onChange:L=>{let oe=Array.from(L.target.selectedOptions,ie=>ie.value);C({...N,assignedUserIds:oe});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(L=>jsxRuntime.jsx("option",{value:L.id,children:L.name},L.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:te.length>0?te.map(L=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:L.color},children:L.initials}),jsxRuntime.jsx("span",{children:L.name})]},L.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"}),x?jsxRuntime.jsxs("select",{value:N.priority??J.priority??"",onChange:L=>C({...N,priority:L.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:J.priority==="URGENT"?"#EF4444":J.priority==="HIGH"?"#F59E0B":J.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:J.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:J.labels&&J.labels.length>0?J.labels.map(L=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:L},L)):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"}),x?jsxRuntime.jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:J.startDate?new Date(J.startDate).toISOString().split("T")[0]:"",onChange:L=>C({...N,startDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:J.startDate?new Date(J.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:J.endDate?new Date(J.endDate).toISOString().split("T")[0]:"",onChange:L=>C({...N,endDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:J.endDate?new Date(J.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??J.estimatedTime??"",onChange:L=>C({...N,estimatedTime:L.target.value?parseFloat(L.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:J.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:J.dependencies&&J.dependencies.length>0?J.dependencies.map(L=>{let oe=typeof L=="string"?L:L.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",oe.slice(-4)]},oe)}):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:J.createdAt?new Date(J.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:k,onChange:L=>R(L.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ue,disabled:!k.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(L=>{let oe=s.find(ie=>ie.id===L.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:[oe&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:oe.color},children:oe.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:oe?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(L.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(L.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:L.content})]},L.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:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(L=>{let oe=s.find(ie=>ie.id===L.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("COMMENT")&&"\u{1F4AC}",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",L.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:oe?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:L.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.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(Er,{cardId:e.id,attachments:i,onUpload:p?L=>p(e.id,L):void 0,onDelete:f,currentUserId:y,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:Pe,disabled:I||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:F,disabled:I||!w,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:pe,disabled:I||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),H.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((L,oe)=>{let ie=s.find(Se=>Se.id===L.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ie&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ie.color},children:ie.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ie?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:L.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(L.confidence*100).toFixed(0),"%"]})]})]},oe)})]}),H.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((L,oe)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:L.title}),L.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:L.description}),L.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",L.estimatedTime,"h"]})]},oe))]}),H.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[H.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.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(L=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${L.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:L.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:L.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:L.description}),L.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",L.suggestedAction]})]},L.id))]}),!H.assignees&&!H.subtasks&&!H.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 bn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,c]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,f=window.innerWidth,v=4,w=d.left;w+o>f-10&&(w=f-o-10),w<10&&(w=10);let g=p-d.bottom,y=d.top,h;return g>=s+v?h=d.bottom+v:y>=s+v?h=d.top-s-v:g>=y?h=d.bottom+v:h=Math.max(10,d.top-s-v),{top:h,left:w}},[e,o,s]);return react.useEffect(()=>{t&&c(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=f=>{let v=f.target;i.current&&!i.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(vt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var ot={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#60A5FA",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#3B82F6",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#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"}};var eh=["LOW","MEDIUM","HIGH","URGENT"],th=["todo","in-progress","review","done"];function Wi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:f,availableColumns:v=[],availableLabels:w=[],availableTags:g=[],onCreateTag:y,onUploadCoverImage:h,unsplashAccessKey:b,theme:x,onSubtasksChange:D,attachments:N=[],onUploadAttachments:C,onDeleteAttachment:k}){let R=Ao(),I=x||R?.themeName||"dark",[T,H]=react.useState(e),[A,ee]=react.useState(false),[S,Y]=react.useState(()=>[...e?.subtasks||[]].sort((me,Ee)=>(me.position??0)-(Ee.position??0))),[ue,Pe]=react.useState(false),[F,pe]=react.useState(""),[J,te]=react.useState(""),[L,oe]=react.useState("all"),[ie,Se]=react.useState(false),[U,K]=react.useState(false),[le,j]=react.useState(false),[Ie,he]=react.useState(false),[$e,Xe]=react.useState(false),[tt,Ye]=react.useState(false),ht=react.useRef(null),it=react.useRef(null),at=react.useRef(null),se=react.useRef(null),B=react.useRef(null),Z=react.useRef(null),ge=react.useRef(null),Ce=react.useRef(null),Ue=react.useRef(null),et=react.useRef(null),lt=react.useRef(null),He=react.useRef(null);react.useEffect(()=>{if(e&&!T){H({...e});let W=[...e.subtasks||[]].sort((me,Ee)=>(me.position??0)-(Ee.position??0));Y(W);}else if(e&&T&&e.id!==T.id){H({...e});let W=[...e.subtasks||[]].sort((me,Ee)=>(me.position??0)-(Ee.position??0));Y(W);}},[e,T]),react.useEffect(()=>{let W=me=>{let Ee=me.target;se.current&&!se.current.contains(Ee)&&Se(false),B.current&&!B.current.contains(Ee)&&K(false),Z.current&&!Z.current.contains(Ee)&&j(false),ge.current&&!ge.current.contains(Ee)&&he(false);};if(ie||U||le||Ie)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[ie,U,le,Ie]),react.useEffect(()=>{if(!t)return;let W=me=>{let Ee=me.target,At=Ee.tagName==="INPUT"||Ee.tagName==="TEXTAREA"||Ee.isContentEditable;if(me.key==="Escape"){me.preventDefault(),ie||U||le||Ie||$e||tt?(Se(false),K(false),j(false),he(false),Xe(false),Ye(false)):At||a();return}if(At&&me.key!=="Escape")return;let ut=me.metaKey||me.ctrlKey;switch(me.key.toLowerCase()){case "s":me.preventDefault(),Se(true);break;case "a":me.preventDefault(),j(true);break;case "p":me.preventDefault(),K(true);break;case "l":me.preventDefault(),he(true);break;case "d":ut||(me.preventDefault(),Xe(true),setTimeout(()=>Ce.current?.focus(),0));break;case "e":ut||(me.preventDefault(),Ye(true));break;case "i":me.preventDefault(),ee(true),setTimeout(()=>it.current?.focus(),0);break;case "t":me.preventDefault(),Pe(true);break;case "c":me.preventDefault(),at.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,ie,U,le,Ie,$e,tt]);let ra=react.useCallback(W=>{let me=W.currentTarget.textContent?.trim()||"";if(T&&me!==T.title){let Ee={...T,title:me};H(Ee),r?.(T.id,{title:me});}},[T,r]),G=react.useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=T?.title||"",W.currentTarget.blur());},[T]),q=react.useCallback(()=>{T&&e&&T.description!==e.description&&r?.(T.id,{description:T.description}),ee(false);},[T,e,r]),ve=react.useCallback(W=>{if(T){let me={...T,columnId:W};H(me),r?.(T.id,{columnId:W}),Se(false);}},[T,r]),Qe=react.useCallback(W=>{if(T){let me={...T,priority:W};H(me),r?.(T.id,{priority:W}),K(false);}},[T,r]),Te=react.useCallback(W=>{if(T){let me=T.assignedUserIds||[],Ee=me.includes(W)?me.filter(ut=>ut!==W):[...me,W],At={...T,assignedUserIds:Ee};H(At),r?.(T.id,{assignedUserIds:Ee});}},[T,r]),Ae=react.useCallback(W=>{if(T){let me=T.labels||[],Ee=me.includes(W)?me.filter(ut=>ut!==W):[...me,W],At={...T,labels:Ee};H(At),r?.(T.id,{labels:Ee});}},[T,r]),X=react.useCallback(W=>{if(T){let me={...T,tags:W};H(me),r?.(T.id,{tags:W});}},[T,r]),We=react.useCallback(W=>{if(T){let me=W.target.value,Ee={...T,endDate:me};H(Ee),r?.(T.id,{endDate:me}),Xe(false);}},[T,r]),z=react.useCallback(W=>{if(T){let me={...T,estimatedTime:parseFloat(W)||0};H(me),r?.(T.id,{estimatedTime:parseFloat(W)||0});}},[T,r]),de=react.useCallback(()=>{if(F.trim()&&T){let W={id:`subtask-${Date.now()}`,title:F.trim(),completed:false,position:S.length,createdAt:new Date},me=[...S,W];Y(me),pe(""),Pe(false),D?.(T.id,me);}},[F,S,T,D]),Be=react.useCallback(W=>{let me=S.map(Ee=>Ee.id===W?{...Ee,completed:!Ee.completed,updatedAt:new Date}:Ee);Y(me),T&&D?.(T.id,me);},[S,T,D]),Ke=react.useCallback(W=>{let me=S.filter(Ee=>Ee.id!==W);Y(me),T&&D?.(T.id,me);},[S,T,D]),_e=react.useCallback(()=>{J.trim()&&T&&c&&(c(T.id,J.trim()),te(""));},[J,T,c]),Oe=react.useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),_e());},[_e]),$=W=>jsxRuntime.jsx(J0__default.default,{remarkPlugins:[Z0__default.default],rehypePlugins:[Q0__default.default],components:{a:({node:me,...Ee})=>jsxRuntime.jsx("a",{...Ee,target:"_blank",rel:"noopener noreferrer"})},children:W}),_=l.filter(W=>L==="comments"?W.type.includes("COMMENT"):L==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let xe=T||e,Je=s.filter(W=>xe.assignedUserIds?.includes(W.id)),Ve=S.filter(W=>W.completed).length;return jsxRuntime.jsx(vt,{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:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:ht,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ra,onKeyDown:G,children:xe.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:se,children:[jsxRuntime.jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>Se(!ie),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:xe.columnId||"No status"})]}),jsxRuntime.jsx(bn,{triggerRef:Ue,isOpen:ie,onClose:()=>Se(false),width:250,estimatedHeight:200,children:(v.length>0?v:th.map(W=>({id:W,title:W}))).map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${xe.columnId===W.id?"active":""}`,onClick:()=>ve(W.id),children:W.title},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Z,children:[jsxRuntime.jsxs("button",{ref:et,className:"modal-v2-field",onClick:()=>j(!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:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Je.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Je.map(W=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:W.color},title:W.name,children:W.initials},W.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(bn,{triggerRef:et,isOpen:le,onClose:()=>j(false),width:280,estimatedHeight:300,children:s.map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${xe.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>Te(W.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,xe.assignedUserIds?.includes(W.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"})})]},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:B,children:[jsxRuntime.jsxs("button",{ref:lt,className:"modal-v2-field",onClick:()=>K(!U),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:xe.priority||"None"})]}),jsxRuntime.jsxs(bn,{triggerRef:lt,isOpen:U,onClose:()=>K(false),width:180,estimatedHeight:220,children:[eh.map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${xe.priority===W?"active":""}`,onClick:()=>Qe(W),children:W},W)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Qe(""),children:"None"})]})]}),g.length>0||y?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(_r,{selectedTags:xe.tags||[],availableTags:g,onChange:X,onCreateTag:y,theme:ot[I]||ot.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ge,children:[jsxRuntime.jsxs("button",{ref:He,className:"modal-v2-field",onClick:()=>he(!Ie),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:xe.labels&&xe.labels.length>0?jsxRuntime.jsx("span",{children:xe.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(bn,{triggerRef:He,isOpen:Ie,onClose:()=>he(false),width:220,estimatedHeight:200,children:(w.length>0?w:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${xe.labels?.includes(W)?"active":""}`,onClick:()=>Ae(W),children:[W,xe.labels?.includes(W)&&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"})})]},W))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Xe(!$e),setTimeout(()=>Ce.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:xe.endDate?new Date(xe.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Ce,type:"date",value:typeof xe.endDate=="string"?xe.endDate.split("T")[0]:xe.endDate?(()=>{let W=new Date(xe.endDate),me=W.getUTCFullYear(),Ee=String(W.getUTCMonth()+1).padStart(2,"0"),At=String(W.getUTCDate()).padStart(2,"0");return `${me}-${Ee}-${At}`})():"",onChange:We,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ye(!tt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:xe.estimatedTime?`${xe.estimatedTime}h`:"Not set"})]}),tt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:xe.estimatedTime||"",onChange:W=>z(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ye(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"})]}),A?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:xe.description||"",onChange:W=>{if(T){let me={...T,description:W.target.value};H(me);}},onBlur:q,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>ee(true),children:xe.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:$(xe.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"}),S.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Ve,"/",S.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Pe(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:[S.map(W=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Be(W.id),children:W.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:W.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ke(W.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"})]})})]},W.id)),ue&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:F,onChange:W=>pe(W.target.value),onKeyDown:W=>{W.key==="Enter"&&de(),W.key==="Escape"&&(Pe(false),pe(""));},onBlur:de,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(C||N.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx(Er,{cardId:xe.id,attachments:N,onUpload:C?W=>C(xe.id,W):void 0,onDelete:k,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 ${L==="all"?"active":""}`,onClick:()=>oe("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="comments"?"active":""}`,onClick:()=>oe("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="history"?"active":""}`,onClick:()=>oe("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:at,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:J,onChange:W=>te(W.target.value),onKeyDown:Oe,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:_e,disabled:!J.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[_.map(W=>{let me=s.find(At=>At.id===W.userId);if(W.type.includes("COMMENT")){let At=n.find(ut=>ut.id===W.metadata?.commentId);return At?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[me&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:me.color},children:me.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:me?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:At.content})]})]},W.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[W.type.includes("CREATED")&&"\u2795",W.type.includes("UPDATED")&&"\u270F\uFE0F",W.type.includes("MOVED")&&"\u27A1\uFE0F",W.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",W.type.includes("ASSIGNED")&&"\u{1F464}",W.type.includes("PRIORITY")&&"\u{1F3AF}",W.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:me?.name||"Unknown"})," ",W.type.replace(/_/g," ").toLowerCase(),W.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:W.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]})]},W.id)}),_.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 ch({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 Vi({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,c)=>l+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(ch,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.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,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function vh({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 _i({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=l;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(vh,{})}),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 Eh={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},cu=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ph({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function uu({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 ji({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||Eh[c.name]||cu[e.indexOf(c)%cu.length]})),l=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?Ph:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(uu,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${d}%)`}})]}):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(uu,{})}),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:l[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var us=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[c,i]=react.useState(false),[u,d]=react.useState(false),[p,f]=react.useState(false);if(e.length===0)return null;let v=e.map(x=>x.id),w=x=>{r.onBulkUpdate?.(v,{priority:x}),l(false);},g=x=>{r.onBulkMove?.(v,x),i(false),a();},y=x=>{r.onBulkUpdate?.(v,{assignedUserIds:x}),d(false);},h=x=>{let D=new Set;e.forEach(C=>{C.labels?.forEach(k=>D.add(k));});let N=Array.from(new Set([...D,...x]));r.onBulkUpdate?.(v,{labels:N}),f(false);},b=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!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(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w(x),children:[jsxRuntime.jsx("span",{className:m("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),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(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:b,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});us.displayName="BulkOperationsToolbar";function Ih(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,c,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(f=>{let v=a?.find(w=>w.id===f);n=`assignee-${f}`,l=v?.name||`User ${f}`,c=v?.color,i=v?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,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 p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=p.title,c=p.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,l=f,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,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 Ki({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>Ih(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(Kr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:m("asakaa-swimlane-view",o),children:[l.map(i=>{let u=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),p={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&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(Kr,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),l.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 Yi=[{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 qi({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=Yi.find(i=>i.value===e)||Yi[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:m("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:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:m("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:Yi.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:m("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 yn=[{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 Oh(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&l&&c}function hu(e={}){let{shortcuts:t=yn,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];},[]),l=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 d of o.current)if(Oh(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function zh(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Uh(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 Hh(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Uh(e),r=t?zh(t):"";return a?`${a} + ${r}`:r}function Wh(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 Xi({shortcuts:e=yn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Wh(e);return jsxRuntime.jsxs("div",{className:m("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(([l,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"}),l]}),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:Hh(i)})]},i.action))})]},l))})}),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 Ji=[{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,8 +122,8 @@
122
122
  1.
123
123
 
124
124
  **Action items:**
125
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Ji({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 l=i=>{t(i),o(false);},c=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:m("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:m("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(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},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 Qi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[c,i]=react.useState("json"),[u,d]=react.useState(null),p=react.useRef(null);if(!t)return null;let f=async()=>{let k=o?.current||void 0,g=await Vd(e,c,k);_d(g,c);},v=async k=>{let g=k.target.files?.[0];if(g){try{let y=await Yd(g),h=g.name.endsWith(".json")?"json":"csv",b=Kd(y,h);d(b),b.success&&r&&r(b,y);}catch(y){d({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:m("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:()=>l("export"),className:m("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:()=>l("import"),className:m("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(k=>jsxRuntime.jsxs("button",{onClick:()=>i(k),className:m("p-4 rounded-lg border-2 transition-all text-center",c===k?"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:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),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:f,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:m("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:m("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((k,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},g))})]})]})]})]})]})}var Kh=["URGENT","HIGH","MEDIUM","LOW"],Yh=[{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"}],qh=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function el({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:p=false,groupBy:f="none",onGroupByChange:v}){let[k,g]=react.useState(true),y=react.useCallback(D=>{a({search:D.target.value});},[a]),h=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),b=react.useCallback(D=>{r({by:D.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),S=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${k?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:k?"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"}),S&&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)"]})]}),!k&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,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:y,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let T=D.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Kh.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let T=D.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let T=D.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:b,className:"filter-bar__select filter-bar__select--sm",children:Yh.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:f,onChange:D=>v(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:qh.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),S&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function tl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let f=v=>{d.current&&!d.current.contains(v.target)&&u(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let p=f=>{f(),u(false);};return jsxRuntime.jsxs("div",{className:m("relative",r),ref:d,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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>p(()=>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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 al={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},rl={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ol={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},yo={dark:al,light:rl,neutral:ol},ps="dark";var gs=react.createContext(void 0),nb="asakaa-theme";function vu({children:e,defaultTheme:t=ps,storageKey:a=nb}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=yo[r];Object.entries(c.colors).forEach(([u,d])=>{d&&l.style.setProperty(`--theme-${sb(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let p=c.colors[u];p&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:yo};return jsxRuntime.jsx(gs.Provider,{value:n,children:e})}function Go(){let e=react.useContext(gs);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function sb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function nl({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Go();return e?jsxRuntime.jsxs("div",{className:m("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(yo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:m("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 xu(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return tt[e]||tt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",tt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",tt[e].bgSecondary),bgGrid:r("--theme-bg-card",tt[e].bgGrid),bgWeekend:r("--theme-bg-hover",tt[e].bgWeekend),border:r("--theme-border-primary",tt[e].border),borderLight:r("--theme-border-subtle",tt[e].borderLight),textPrimary:r("--theme-text-primary",tt[e].textPrimary),textSecondary:r("--theme-text-secondary",tt[e].textSecondary),textTertiary:r("--theme-text-tertiary",tt[e].textTertiary),accent:r("--theme-accent-primary",tt[e].accent),accentHover:r("--theme-accent-hover",tt[e].accentHover),accentLight:r("--theme-accent-primary",tt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",tt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",tt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",tt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",tt[e].dependency),dependencyHover:r("--theme-border-secondary",tt[e].dependencyHover),criticalPath:r("--theme-error",tt[e].criticalPath),criticalPathLight:r("--theme-error",tt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",tt[e].today):e==="neutral"?r("--theme-text-primary",tt[e].today):r("--theme-error",tt[e].today),todayLight:e==="light"?r("--theme-accent-primary",tt[e].todayLight):e==="neutral"?r("--theme-text-primary",tt[e].todayLight):r("--theme-error",tt[e].todayLight),milestone:r("--theme-warning",tt[e].milestone),milestoneLight:r("--theme-warning",tt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",tt[e].statusTodo),statusInProgress:r("--theme-accent-primary",tt[e].statusInProgress),statusCompleted:r("--theme-success",tt[e].statusCompleted),hoverBg:r("--theme-bg-hover",tt[e].hoverBg),focusRing:r("--theme-accent-primary",tt[e].focusRing)}}var fs={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",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"}},ku={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",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"}},sl={en:fs,es:ku};function wu(e){return sl[e]||sl.en}function il(e,t){let a=wu(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 _o=react.createContext(fs);function Zr(){return react.useContext(_o)}function Sb({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,c]=react.useState(false),[i,u]=react.useState(null),d=react.useRef(null),p=Zr();if(react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&c(false);};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),!(t||a||r||o||s||n))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(g=>g.handler),k=async(g,y)=>{if(y){u(g);try{await y();}catch(h){console.error(`Export ${g} failed:`,h);}finally{u(null),c(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:v.map((g,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>k(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Eb({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Pb({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Mb({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Zr();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],c=l.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${c}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function Fb({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),c=Zr();react.useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let f=k=>{l.current&&!l.current.contains(k.target)&&n(false);},v=k=>{k.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",v),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(p),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:c.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:c.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:c.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p=>{p.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:u?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${u?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:u?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:c.toolbar.filter||"Filters"}),u&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:c.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(p=>{let f=t===p.value&&!r,v=()=>p.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${f?p.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:p.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},p.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:c.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function bs({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:p,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:k=false,onHideCompletedChange:g,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:S,onExportMSProject:D}){let T=Zr(),w=y||h||b||x||S||D,R=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],A=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Pb,{options:R,value:t,onChange:N=>a(N),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Mb,{theme:e,value:l,onChange:c}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Fb,{theme:e,value:f,onChange:v,hideCompleted:k,onHideCompletedChange:g})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||T.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sb,{theme:e,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:S,onExportMSProject:D}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Eb,{options:A,value:s,onChange:N=>n(N),theme:e})]})]})}function ys({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{l.current&&!l.current.contains(d.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(ht,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},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:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.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 jo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,p=8,f=window.innerWidth,v=window.innerHeight,k=t,g=a;t+u+p>f&&(k=t-u,k<p&&(k=p)),a+d+p>v&&(g=v-d-p,g<p&&(g=p)),c({x:k,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[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:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children: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:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.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 Lt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),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 Fu({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:p=true}){let f=react.useRef(false),v=react.useCallback(b=>{f.current=b;},[]),k=react.useCallback(b=>{let x=[],S=D=>{for(let T of D)x.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&S(T.subtasks);};return S(b),x},[]),g=react.useCallback(()=>{let b=k(e);for(let x of b)if(t.has(x.id))return x;return null},[e,t,k]),y=react.useCallback((b,x)=>{let S=k(e);if(S.length===0)return;let D=g();if(!D){a(S[0].id,false);return}let T=S.findIndex(A=>A.id===D.id);if(T===-1)return;let w=b==="up"?T-1:T+1;if(w<0||w>=S.length)return;let R=S[w];a(R.id,x);},[e,g,k,a]),h=react.useCallback(b=>{if(!p)return;let x=b.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||f.current){b.key==="Escape"&&(x.blur(),f.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?b.metaKey:b.ctrlKey,w=Array.from(t),R=g();if(b.key==="ArrowUp"){b.preventDefault(),y("up",b.shiftKey);return}if(b.key==="ArrowDown"){b.preventDefault(),y("down",b.shiftKey);return}if(R&&(b.key==="ArrowRight"||b.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(b.preventDefault(),(b.key==="ArrowRight"&&!R.isExpanded||b.key==="ArrowLeft"&&R.isExpanded)&&u(R.id));return}if(b.altKey&&(b.key==="ArrowUp"||b.key==="ArrowDown")){w.length>0&&(b.preventDefault(),n(w,b.key==="ArrowUp"?"up":"down"));return}if(b.key==="Tab"&&!b.shiftKey){w.length>0&&(b.preventDefault(),l(w));return}if(b.key==="Tab"&&b.shiftKey){w.length>0&&(b.preventDefault(),c(w));return}if(b.key==="Enter"&&!b.shiftKey&&!T){R&&(b.preventDefault(),r(R.id,"below"));return}if(b.key==="Enter"&&b.shiftKey&&!T){R&&(b.preventDefault(),r(R.id,"above"));return}if(b.key==="Enter"&&T){R&&(b.preventDefault(),d(R.id));return}if(b.key==="F2"){R&&(b.preventDefault(),i(R.id));return}if(b.key==="Delete"||b.key==="Backspace"&&T){w.length>0&&(b.preventDefault(),o(w));return}if(b.key==="d"&&T&&!b.shiftKey){w.length>0&&(b.preventDefault(),s(w));return}},[p,t,g,y,r,o,s,n,l,c,i,u,d]);return react.useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:v}}function Lu(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(p=>{let f=new Set(p);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=react.useCallback((d,p)=>{if(!a){o(d);return}let f=p.indexOf(a),v=p.indexOf(d);if(f===-1||v===-1){o(d);return}let k=Math.min(f,v),g=Math.max(f,v),y=p.slice(k,g+1);t(new Set(y)),r(d);},[a,o]),l=react.useCallback((d,p,f,v)=>{v?n(d,p):f?s(d):o(d);},[o,s,n]),c=react.useCallback((d,p)=>{p?t(f=>{let v=new Set(f);return v.add(d),v}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function Ko(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<n.length;l++){let c={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function vs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=vs(a.subtasks,t);if(r)return r}}return null}function gl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=gl(a.subtasks,t);if(r)return r}return null}function fl(e,t){if(t.length===0)return e;let a=Ko(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,p)=>{let f=[];return {tasks:d.filter(k=>{if(p.has(k.id))return f.push(k),false;if(k.subtasks){let g=n(k.subtasks,p);k.subtasks=g.tasks,f.push(...g.removed);}return true}),removed:f}},l=(d,p,f)=>d.map(v=>v.id===p?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:l(v.subtasks,p,f)}:v),c=new Set(t),{tasks:i,removed:u}=n(e,c);return l(i,s.id,u)}function hl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=gl(a,r);if(!o)continue;let s=gl(a,o.id),n=(i,u,d)=>{for(let p=0;p<i.length;p++){let f=i[p];if(f.id===u&&f.subtasks){let v=f.subtasks.findIndex(k=>k.id===d);if(v!==-1){let[k]=f.subtasks.splice(v,1);return k}}if(f.subtasks){let v=n(f.subtasks,u,d);if(v)return v}}return null},l=(i,u,d)=>{let p=i.findIndex(f=>f.id===u);if(p!==-1)return i.splice(p+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,u,d);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?l(s.subtasks,o.id,c):l(a,o.id,c));}return a}function bl(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,c)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,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]],true)};return s(r,o,a),r}function yl(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,d)=>({...u,id:`${u.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let i=c.findIndex(f=>f.id===o);if(i===-1){for(let f of c)if(f.subtasks){let v=n(f.subtasks);if(v)return v}return null}let u=c[i],d=`${u.id}-copy-${Date.now()}`,p={...u,id:d,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,d):void 0};return c.splice(i+1,0,p),p},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function Iu(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,n),true};return l(r),{tasks:r,newTask:n}}function vl(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:vl(r.subtasks,t,a)}:r)}function xl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:xl(a.subtasks,t)}:a)}function kl(e,t){let a=p=>{for(let f of p){if(f.id===t)return f;if(f.subtasks){let v=a(f.subtasks);if(v)return v}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,c=p=>{for(let f of p){if(f.id===t)return (f.subtasks||[]).length;if(f.subtasks){let v=c(f.subtasks);if(v>=0)return v}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6",position:i,parentId:t},d=p=>p.map(f=>{if(f.id===t){let v=f.subtasks||[];return {...f,subtasks:[...v,u],isExpanded:true}}return f.subtasks?{...f,subtasks:d(f.subtasks)}:f});return {tasks:d(e),newTask:u}}function Bu(e,t,a,r){if(t===a)return e;let o=vs(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(o,a))return e}let s=l=>l.filter(c=>c.id!==t).map(c=>c.subtasks&&c.subtasks.length>0?{...c,subtasks:s(c.subtasks)}:c),n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,p=[...u];return p.splice(d,0,{...o,parentId:a}),{...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function ws({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:p,onTaskUpdate:f,onTaskIndent:v,onTaskOutdent:k,onTaskMove:g,onMultiTaskDelete:y,onTaskDuplicate:h,onTaskCreate:b,onTaskRename:x,onCreateSubtask:S,onOpenTaskModal:D,onDeleteRequest:T,onTaskReparent:w}){let R=react.useContext(_o),[A,N]=react.useState(null),[H,I]=react.useState(null),[re,E]=react.useState(""),_=react.useRef(null),[ie,Ee]=react.useState(null),[L,xe]=react.useState(0),[X,ee]=react.useState(0),[C,U]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[K,ne]=react.useState(null),[me,ce]=react.useState(null),[Ne,Z]=react.useState(null),je=react.useRef(0),Be=5,Ye=react.useRef(false),[dt,ot]=react.useState(null),[Je,xt]=react.useState(false),[gt,yt]=react.useState(null),[se,B]=react.useState(false),J=react.useRef(null);react.useEffect(()=>{function $(j){J.current&&!J.current.contains(j.target)&&B(false);}if(se)return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[se]),react.useEffect(()=>{H&&_.current&&(_.current.focus(),_.current.select());},[H]),react.useEffect(()=>{if(!ie)return;let $=ye=>{let qe=ye.clientX-L,We=X+qe;p?.(ie,We);},j=()=>{Ee(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",$),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,L,X,p]);let{selectedTaskIds:pe,handleTaskClick:we,isTaskSelected:$e}=Lu(),{setIsEditing:Qe}=Fu({tasks:e,selectedTaskIds:pe,onTaskSelect:($,j)=>{let qe=Ko(e).map(We=>We.id);we($,qe,j||false,false);},onTaskCreate:b||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:$=>{let j=Ko(e).find(ye=>ye.id===$);j&&be(j);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:$=>{let j=Ko(e).find(ye=>ye.id===$);j&&D&&D(j);},enableKeyboard:true}),nt=($,j=0)=>{let ye=[],qe=[...$].sort((We,W)=>(We.position??0)-(W.position??0));for(let We of qe)ye.push({task:We,level:j}),We.subtasks&&We.subtasks.length>0&&We.isExpanded&&ye.push(...nt(We.subtasks,j+1));return ye},ze=nt(e),oa=48,G=Math.max(ze.length*a,600-oa),Y=$=>!$.startDate||!$.endDate?"-":`${Math.ceil(($.endDate.getTime()-$.startDate.getTime())/(1e3*60*60*24))}d`,be=$=>{I($.id),E($.name),Qe(true);},Ze=$=>{re.trim()&&re!==e.find(j=>j.id===$)?.name&&x?.($,re.trim()),I(null),E(""),Qe(false);},Ce=()=>{I(null),E(""),Qe(false);},Fe=($,j)=>{j.stopPropagation(),S?.($.id);},q=($,j)=>{j.preventDefault(),je.current=j.clientY,ne($),Ye.current=false,xt(false),ot({x:j.clientX,y:j.clientY});},Ue=$=>{if(!K||(Math.abs($.clientY-je.current)>Be&&!Ye.current&&(Ye.current=true,xt(true)),ot({x:$.clientX,y:$.clientY}),!Ye.current))return;let ye=document.querySelectorAll("[data-task-row]"),qe=null,We=null;ye.forEach(W=>{let ue=W.getBoundingClientRect(),Se=W.getAttribute("data-task-row");if(Se&&Se!==K&&$.clientY>=ue.top&&$.clientY<=ue.bottom){qe=Se;let Ft=$.clientY-ue.top,lt=ue.height;Ft<lt*.25?We="above":Ft>lt*.75?We="below":We="child";}}),ce(qe),Z(We);},z=()=>{if(Ye.current&&K&&me&&Ne){if(Ne==="child")w?.(K,me);else if(Ne==="above"||Ne==="below"){let $=(qe,We,W=null)=>{for(let ue of qe){if(ue.id===We)return W;if(ue.subtasks){let Se=$(ue.subtasks,We,ue.id);if(Se!==void 0)return Se}}},j=$(e,me,null),ye=(qe,We)=>{let W=qe.findIndex(ue=>ue.id===We);return Ne==="below"?W+1:W};if(j===null){let qe=ye(e,me);w?.(K,null,qe);}else {let qe=ze.find(We=>We.task.id===j)?.task;if(qe?.subtasks){let We=ye(qe.subtasks,me);w?.(K,j,We);}}}}ne(null),ce(null),Z(null),ot(null),Ye.current=false,xt(false);};react.useEffect(()=>{if(K)return document.addEventListener("mousemove",Ue),document.addEventListener("mouseup",z),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ue),document.removeEventListener("mouseup",z),document.body.style.cursor="",document.body.style.userSelect="";}},[K,me,Ne]);let le=($,j,ye)=>{switch($.id){case "name":let qe=H===j.id,We=A===j.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ye*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:We?1:.3},onMouseDown:De=>q(j.id,De),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),j.subtasks&&j.subtasks.length>0?jsxRuntime.jsx("button",{onClick:De=>{De.stopPropagation(),c?.(j.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:j.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:j.color||"#3B82F6",opacity:j.parentId?.6:1,borderColor:j.isMilestone?t.accent:"transparent",borderWidth:j.isMilestone?"2px":"0px"},title:j.isMilestone?"Milestone":j.parentId?"Subtask":"Task"})}),qe?jsxRuntime.jsx("input",{ref:_,type:"text",value:re,onChange:De=>E(De.target.value),onKeyDown:De=>{De.key==="Enter"?Ze(j.id):De.key==="Escape"&&Ce();},onBlur:()=>Ze(j.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:De=>De.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:j.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:j.parentId?"13px":"14px",fontWeight:j.isMilestone?600:j.parentId?400:600,letterSpacing:j.parentId?"0":"-0.01em"},title:j.name,children:j.name}),We&&!qe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:De=>De.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:De=>Fe(j,De),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:De=>{De.stopPropagation(),be(j);},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 ue=$.id==="startDate"?"startDate":"endDate",Se=j[ue],Ft=gt?.taskId===j.id&&gt?.field===ue,lt=De=>De?(typeof De=="string"?new Date(De):De).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:De=>De.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:De=>{if(Ft)yt(null);else {let Rt=De.currentTarget.getBoundingClientRect();yt({taskId:j.id,field:ue,month:Se?typeof Se=="string"?new Date(Se):Se:new Date,position:{top:Rt.bottom+4,left:Rt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:lt(Se)})]}),Ft&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>yt(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:gt?.position.top,left:gt?.position.left},onClick:De=>De.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let De=new Date,Rt=new Date(De);Rt.setDate(De.getDate()+1);let Ot=new Date(De);Ot.setDate(De.getDate()+7);let Da=new Date(De);return Da.setDate(De.getDate()+14),[{label:"Hoy",date:De},{label:"Ma\xF1ana",date:Rt},{label:"Pr\xF3xima semana",date:Ot},{label:"2 semanas",date:Da}].map((kt,dr)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:M=>M.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:M=>M.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(j.id,{[ue]:kt.date}),yt(null);},children:kt.label},dr))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:De=>De.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:De=>De.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(j.id,{[ue]:void 0}),yt(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:()=>yt(De=>De?{...De,month:new Date(De.month.getFullYear(),De.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:gt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>yt(De=>De?{...De,month:new Date(De.month.getFullYear(),De.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((De,Rt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:De},Rt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let De=gt?.month||new Date,Rt=De.getFullYear(),Ot=De.getMonth(),Da=new Date(Rt,Ot,1).getDay(),wr=new Date(Rt,Ot+1,0).getDate(),kt=new Date,dr=[];for(let ae=Da-1;ae>=0;ae--)dr.push({day:new Date(Rt,Ot,-ae).getDate(),date:new Date(Rt,Ot-1,new Date(Rt,Ot,-ae).getDate()),isCurrentMonth:false});for(let ae=1;ae<=wr;ae++)dr.push({day:ae,date:new Date(Rt,Ot,ae),isCurrentMonth:true});let M=42-dr.length;for(let ae=1;ae<=M;ae++)dr.push({day:ae,date:new Date(Rt,Ot+1,ae),isCurrentMonth:false});return dr.map((ae,Oe)=>{let Xe=ae.date.toDateString()===kt.toDateString(),ya=(Se?typeof Se=="string"?new Date(Se):Se:null)?.toDateString()===ae.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:ae.isCurrentMonth?ya?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ya?"#3B82F6":"transparent",boxShadow:Xe&&!ya?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(j.id,{[ue]:ae.date}),yt(null);},children:ae.day},Oe)})})()})]})]})]}),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:Y(j)})});case "assignees":let kr=r.filter(De=>j.assignees?.some(Rt=>Rt.name===De.name||Rt.initials===De.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(mo,{assignedUsers:kr,availableUsers:r,onChange:De=>{let Rt=De.map(Ot=>({id:Ot.id,name:Ot.name,initials:Ot.initials,color:Ot.color}));f?.(j.id,{assignees:Rt.length>0?Rt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(pc,{status:j.status||"todo",onChange:De=>{f?.(j.id,{status:De,progress:De==="completed"?100:j.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${j.progress}%`,backgroundColor:j.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:[j.progress,"%"]})]});case "priority":let Za={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},lr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Qa=Za[j.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(co,{priority:Qa,onChange:De=>{De&&f?.(j.id,{priority:lr[De]||"medium"});}})});default:return null}},Le=$=>[{id:"hide",label:"Hide Column",icon:Lt.Hide,onClick:()=>d($),disabled:$==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Lt.SortDesc,onClick:()=>{}}],_e=$=>$.subtasks&&$.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{S?.($.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{T?T($.id,$.name):y?.([$.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{n?.($);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{S?.($.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{f?.($.id,{status:"todo",progress:0});},disabled:$.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{f?.($.id,{status:"in-progress"});},disabled:$.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{f?.($.id,{status:"completed",progress:100});},disabled:$.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:R?.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{h?.([$.id]);}},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{T?T($.id,$.name):y?.([$.id]);}}],Ge=u.filter($=>$.visible),Re=Ge.reduce(($,j)=>$+j.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Re},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${oa}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:Ge.map(($,j)=>{let ye=j===Ge.length-1,qe=$.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${qe?"":"justify-center"}`,style:{width:`${$.width}px`,minWidth:`${$.minWidth??(qe?200:60)}px`,maxWidth:`${$.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ye?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:We=>{We.preventDefault(),U({isOpen:true,x:We.clientX,y:We.clientY,type:"header",columnId:$.id});},onMouseEnter:We=>{We.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:We=>{We.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:$.label,children:$.label}),$.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ie===$.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:We=>{We.preventDefault(),We.stopPropagation(),Ee($.id),xe(We.clientX),ee($.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},$.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(ys,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>B(!se),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"})}),se&&jsxRuntime.jsxs("div",{ref:J,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>B(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:G},children:ze.map(({task:$,level:j},ye)=>{let qe=$e($.id),We=me===$.id,W=We&&Ne==="above",ue=We&&Ne==="below",Se=We&&Ne==="child",Ft={};return Se&&(Ft.backgroundColor=`${t.accent}15`,Ft.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":$.id,className:`flex items-center cursor-pointer group ${K===$.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:qe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:qe?t.accentLight:Se?`${t.accent}15`:ye%2===0?t.bgPrimary:t.bgGrid,...Ft},onMouseEnter:()=>N($.id),onMouseLeave:()=>N(null),onClick:lt=>{let Za=Ko(e).map(De=>De.id),Qa=navigator.platform.toUpperCase().indexOf("MAC")>=0?lt.metaKey:lt.ctrlKey;we($.id,Za,Qa,lt.shiftKey),s?.($);},onDoubleClick:lt=>{lt.stopPropagation(),n?.($);},onContextMenu:lt=>{lt.preventDefault(),U({isOpen:true,x:lt.clientX,y:lt.clientY,type:"task",task:$}),l?.($,lt);},whileHover:{backgroundColor:qe?t.accentLight:t.hoverBg},children:[W&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ue&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ge.map((lt,kr)=>{let Za=kr===Ge.length-1,lr=lt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${lr?"justify-start":"justify-center"}`,style:{width:`${lt.width}px`,minWidth:`${lt.minWidth??(lr?200:60)}px`,maxWidth:`${lt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Za?"none":`1px solid ${A===$.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:le(lt,$,lr?j:0)},`${$.id}-${lt.id}`)})]},$.id)})}),jsxRuntime.jsx(jo,{isOpen:C.isOpen,x:C.x,y:C.y,items:C.type==="header"&&C.columnId?Le(C.columnId):C.type==="task"&&C.task?_e(C.task):[],onClose:()=>U({...C,isOpen:false}),theme:t}),Je&&dt&&K&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:dt.x+12,top:dt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let $=ze.find(j=>j.task.id===K)?.task;return $?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:$.name})}):null})()}),document.body)]})}function Uu(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[c,i]=react.useState(t),[u,d]=react.useState(null),[p,f]=react.useState(null),[v,k]=react.useState(null),[g,y]=react.useState(null),[h,b]=react.useState(0),[x,S]=react.useState(0),[D,T]=react.useState(null),[w,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:f,activeZone:v,setActiveZone:k,draggedSegmentIndex:g,setDraggedSegmentIndex:y,draggedSegmentStartX:h,setDraggedSegmentStartX:b,segmentDragOffsetX:x,setSegmentDragOffsetX:S,hoveredSegmentIndex:D,setHoveredSegmentIndex:T,isHovered:w,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(re,E)=>{r("none"),d(null),f(null),l(re),i(E),S(0),y(null),b(0);}}}function Ts({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:p,allTaskPositions:f=[],onDragMove:v,onHoverChange:k}){let g=Uu(t,r),y=react.useRef(null),h=react.useRef(null),b=react.useRef(null),{dragMode:x,setDragMode:S,dragOffset:D,setDragOffset:T,ghostX:w,setGhostX:R,ghostWidth:A,setGhostWidth:N,connectionLine:H,setConnectionLine:I,hoveredTaskId:re,setHoveredTaskId:E,activeZone:_,setActiveZone:ie,draggedSegmentIndex:Ee,setDraggedSegmentIndex:L,draggedSegmentStartX:xe,setDraggedSegmentStartX:X,segmentDragOffsetX:ee,setSegmentDragOffsetX:C,hoveredSegmentIndex:U,setHoveredSegmentIndex:K,isHovered:ne,setIsHovered:me,isDragging:ce,isResizing:Ne,isConnecting:Z,resetDragState:je}=g,Be=24,Ye=8,dt=e.endDate&&e.endDate<new Date&&e.progress<100,ot=e.isCriticalPath,Je=o.name==="neutral"||o.today==="#1C1917",xt=e.status==="completed"||e.progress===100,gt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},se=e.isCriticalPath||dt?"#DC2626":e.color?e.color:e.priority&&gt[e.priority]?gt[e.priority]:o.taskBarPrimary,J=(z=>z>=80?20:z>=60?15:z>=50?12:10)(r),pe=r<50,we=r<40;react.useEffect(()=>{if(k)if(ne&&!ce&&!e.segments){let z=a<100;k({task:e,x:t,y:a,width:r,height:Be,showBelow:z});}else k(null);},[ne,ce,e,t,a,r,Be,k]);let $e=z=>z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Qe=()=>{let z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${z} day${z!==1?"s":""}`},nt=z=>Math.round(z/s)*s,ze=z=>{let le=Math.round(z/s),Le=new Date(n);return Le.setDate(Le.getDate()+le),Le},oa=(z,le)=>{for(let Le of f){if(Le.id===e.id)continue;let _e=5;if(z>=Le.x-_e&&z<=Le.x+Le.width+_e&&le>=Le.y-_e&&le<=Le.y+Le.height+_e)return Le.id}return null},G=react.useCallback((z,le,Le)=>{z.preventDefault(),z.stopPropagation();let _e=y.current?.ownerSVGElement;if(!_e)return;let Ge=_e.createSVGPoint();Ge.x=z.clientX,Ge.y=z.clientY;let Re=Ge.matrixTransform(_e.getScreenCTM()?.inverse()),$=Le!==void 0?Le:t,j=le;if(!j){let ye=Re.x-$;z.shiftKey?(j="connect",I({x:t+r,y:a+Be/2})):z.ctrlKey||z.metaKey?j="move":z.altKey?j=ye<r/2?"resize-start":"resize-end":we?ye<r/2?j="move":j="resize-end":pe?ye<=J/2?j="resize-start":ye>=r-J/2?j="resize-end":j="move":ye<=J?j="resize-start":ye>=r-J?j="resize-end":j="move";}S(j),me(false),ie(null),j==="move"?T(Re.x-$):j==="connect"?I({x:t+r,y:a+Be/2}):T(0),R($),N(r);},[t,r,a,Be]),Y=react.useCallback(z=>{let le=y.current?.ownerSVGElement;if(!le)return;let Le=le.closest(".gantt-timeline-scroll");if(!Le)return;let _e=Le.getBoundingClientRect(),Ge=60,Re=15,$=0;if(z.clientX<_e.left+Ge){let j=_e.left+Ge-z.clientX;$=-Math.min(Re,j/2);}else if(z.clientX>_e.right-Ge){let j=z.clientX-(_e.right-Ge);$=Math.min(Re,j/2);}return $!==0&&(Le.scrollLeft+=$),$!==0},[]),be=react.useCallback(z=>{if(x==="none")return;b.current=z;let le=y.current?.ownerSVGElement;if(!le)return;if(x==="move"||x==="resize-start"||x==="resize-end"){let Ge=Y(z);Ge&&!h.current?h.current=window.setInterval(()=>{b.current&&(Y(b.current),be(b.current));},16):!Ge&&h.current&&(window.clearInterval(h.current),h.current=null);}let Le=le.createSVGPoint();Le.x=z.clientX,Le.y=z.clientY;let _e=Le.matrixTransform(le.getScreenCTM()?.inverse());if(x==="connect"){I({x:_e.x,y:_e.y});let Ge=oa(_e.x,_e.y);E(Ge);}else if(x==="move"){let Ge=_e.x-D,Re=nt(Ge);R(Re),N(r);let $=Math.round((Re-t)/s);if(v?.(e.id,$,true),e.segments&&e.segments.length>0&&Ee!==null){let j=Re-xe;C(j);}}else if(x==="resize-start"){let Ge=_e.x,Re=nt(Ge),$=t+r-Re;$>=s&&(R(Re),N($));}else if(x==="resize-end"){let Ge=_e.x,$=nt(Ge)-t;$>=s&&N($);}},[x,t,r,s,D,e,nt,Ee,xe,oa,E,I,R,N,C,v,Y]),Ze=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),b.current=null,x!=="none"){if(x==="connect")re&&p&&p(e,re),I(null),E(null);else {let z=e.endDate.getTime()-e.startDate.getTime(),le,Le,_e=true;if(x==="move"){if(le=ze(w),Le=new Date(le.getTime()+z),e.segments&&e.segments.length>0&&Ee!==null){let Ge=Math.round(ee/s),Re=e.segments.map((qe,We)=>{if(We===Ee){let W=new Date(qe.startDate),ue=new Date(qe.endDate);return W.setDate(W.getDate()+Ge),ue.setDate(ue.getDate()+Ge),{startDate:W,endDate:ue}}return qe}),$=Re.flatMap(qe=>[qe.startDate,qe.endDate]),j=new Date(Math.min(...$.map(qe=>qe.getTime()))),ye=new Date(Math.max(...$.map(qe=>qe.getTime())));d?.({...e,segments:Re},j,ye),je(t,r);return}}else x==="resize-start"?(le=ze(w),Le=e.endDate,le>Le&&(console.warn("Invalid date range: start date must be before or equal to end date"),_e=false)):x==="resize-end"?(le=e.startDate,Le=ze(w+A),Le<le&&(console.warn("Invalid date range: end date must be after or equal to start date"),_e=false)):_e=false;_e&&le&&Le&&(Le.getTime()<le.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,le,Le));}v?.(e.id,0,false),je(t,r);}},[x,w,A,e,d,re,p,t,r,s,ze,ee,Ee,je,v]);react.useEffect(()=>{if(x==="none")return;let z=Le=>{be(Le);},le=()=>{Ze();};return window.addEventListener("mousemove",z),window.addEventListener("mouseup",le),()=>{window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",le),h.current&&(window.clearInterval(h.current),h.current=null);}},[x,be,Ze]);let Ce=ce&&!Z?w:t,Fe=ce&&!Z?A:r,q=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:y,"data-task-bar":"true",onClick:()=>!ce&&c?.(e),onDoubleClick:z=>{ce||(z.stopPropagation(),i?.(e));},onContextMenu:z=>{z.preventDefault(),u?.(e,z);},onMouseEnter:()=>!ce&&me(true),onMouseLeave:()=>{ce||(me(false),ie(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Be,fill:"transparent",style:{pointerEvents:"all"}}),ne&&!ce&&!pe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:J,height:Be,fill:_==="resize-start"?o.accent:"transparent",opacity:_==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-start"),onMouseDown:z=>G(z,"resize-start")}),jsxRuntime.jsx("rect",{x:t+J,y:a,width:r-J*2,height:Be,fill:_==="move"?o.accent:"transparent",opacity:_==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:z=>G(z,"move")}),jsxRuntime.jsx("rect",{x:t+r-J,y:a,width:J,height:Be,fill:_==="resize-end"?o.accent:"transparent",opacity:_==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:z=>G(z,"resize-end")})]}),ne&&!ce&&we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Be,fill:_==="move"?o.accent:"transparent",opacity:_==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:z=>G(z,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Be,fill:_==="resize-end"?o.accent:"transparent",opacity:_==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:z=>G(z,"resize-end")}),ne&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Be-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ce&&!Z&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:a,width:A,height:Be,rx:Ye,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce,y:a,width:Fe,height:Be,rx:Ye,fill:se,"data-task-class":q,initial:{opacity:0,scale:.95},animate:{opacity:ce&&!Z?.15:e.parentId?.6:ne?.9:.8,scale:ne&&!ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:z=>G(z),style:{cursor:ce?Z?"crosshair":Ne?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Fe*(e.progress/100),height:Be,rx:Ye,fill:se,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((z,le)=>{let Le=(z.startDate.getTime()-n.getTime())/864e5*s,Ge=(z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Le+s,Re=ce&&x==="move"&&Ee===le,$=U===le,j=Re?Le+ee:Le;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ce&&K(le),onMouseLeave:()=>!ce&&K(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:j,y:a,width:Ge,height:Be,rx:Ye,fill:se,initial:{opacity:0,scale:.95},animate:{opacity:Re||e.parentId?.6:$?.9:.8,scale:$&&!ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ye=>{ye.stopPropagation(),L(le),X(Le),G(ye,void 0,Le);},style:{cursor:ce?Z?"crosshair":Ne?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:j,y:a,width:Ge*(e.progress/100),height:Be,rx:Ye,fill:se,opacity:1,style:{pointerEvents:"none"}})]},`segment-${le}`)}),Je&&(dt||ot)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ot&&!dt&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Fe,height:Be,rx:Ye,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),dt&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Fe,height:Be,rx:Ye,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Fe>60&&!e.segments&&(()=>{let z=l.taskLabel(e),le=typeof z=="string"?z:e.name,Le=le.length>Math.floor(Fe/8)?`${le.substring(0,Math.floor(Fe/8))}...`:le;return jsxRuntime.jsx("text",{x:Ce+12,y:a+Be/2,dominantBaseline:"middle",fill:xt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:xt?"line-through":"none"},children:Le})})(),Fe>100&&e.progress>0&&e.progress<100&&!ce&&!e.segments&&jsxRuntime.jsxs("text",{x:Ce+Fe-12,y:a+Be/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&Fe>80&&!ce&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ce+Fe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ce+Fe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ne||Ne)&&!Z&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ce-2,y:a,width:16,height:Be,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-start"),onMouseLeave:()=>ie(null),onMouseDown:z=>{z.stopPropagation(),G(z,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce+4,y:a+8,width:3,height:Be-16,rx:1.5,fill:_==="resize-start"||x==="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:Ce+Fe-14,y:a,width:16,height:Be,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-end"),onMouseLeave:()=>ie(null),onMouseDown:z=>{z.stopPropagation(),G(z,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce+Fe-7,y:a+8,width:3,height:Be-16,rx:1.5,fill:_==="resize-end"||x==="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:ne&&!ce&&!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+Be/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ie("connect"),onMouseLeave:()=>ie(null),onMouseDown:z=>{z.stopPropagation(),G(z,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Be/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:_==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Z&&H&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Be/2,x2:H.x,y2:H.y,stroke:re?o.statusCompleted:o.accent,strokeWidth:re?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:re?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:H.x,cy:H.y,r:re?8:6,fill:re?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),re&&jsxRuntime.jsx(framerMotion.motion.text,{x:H.x+15,y:H.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:H.x+10},animate:{opacity:1,x:H.x+15},transition:{duration:.2},children:"Connect"})]}),(ne||ce)&&!Z&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce-2,y:a-2,width:Fe+4,height:Be+4,rx:Ye+2,fill:"none",stroke:ce?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ce?.6:.4,initial:{opacity:0},animate:{opacity:ce?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ne&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+A,y1:0,x2:w+A,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ne&&!ce&&!e.segments&&!k&&(()=>{let Le=a<100,_e=Le?a+Be+13:a-82-13,Ge=Le?`M ${Ce+Fe/2-6} ${a+Be+3} L ${Ce+Fe/2} ${a+Be+13} L ${Ce+Fe/2+6} ${a+Be+3}`:`M ${Ce+Fe/2-6} ${a-13} L ${Ce+Fe/2} ${a-3} L ${Ce+Fe/2+6} ${a-13}`,Re=_e+22,$=_e+40,j=_e+55,ye=_e+70,qe=Le?_e+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Le?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Le?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ge,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ce+Fe/2-120,y:_e,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:Ce+Fe/2,y:Re,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Ce+Fe/2-110,y:$,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ce+Fe/2-70,y:$,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$e(e.startDate)}),jsxRuntime.jsx("text",{x:Ce+Fe/2-110,y:j,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ce+Fe/2-70,y:j,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$e(e.endDate)}),jsxRuntime.jsx("text",{x:Ce+Fe/2+10,y:$,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ce+Fe/2+65,y:$,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qe()}),jsxRuntime.jsx("text",{x:Ce+Fe/2+10,y:j,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ce+Fe/2+65,y:j,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:Ce+Fe/2-110,y:ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ce+Fe/2-50,y:ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(We=>We.name).join(", ").substring(0,30),e.assignees.map(We=>We.name).join(", ").length>30?"...":""]})]}),!Le&&jsxRuntime.jsx("text",{x:Ce+Fe/2,y:qe,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:we?"Left: move \u2022 Right: resize":pe?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Gu({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:c}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,u=i?130:82,d=13,p=c?s+l+d:s-u-d,f=c?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,v=p+22,k=p+40,g=p+55,y=p+70,h=p+90,b=p+105,x=p+120,S=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),D=()=>{if(!r.startDate||!r.endDate)return "N/A";let N=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${N} day${N!==1?"s":""}`},T=N=>{if(N==null||N===0)return "N/A";let H=Math.floor(N/60),I=N%60;return H===0?`${I}m`:I===0?`${H}h`:`${H}h ${I}m`},w={start:a==="es"?"Inicio:":"Start:",end:a==="es"?"Fin:":"End:",duration:a==="es"?"Duraci\xF3n:":"Duration:",progress:a==="es"?"Progreso:":"Progress:",assignees:a==="es"?"Asignados:":"Assignees:",estimated:a==="es"?"Estimado:":"Estimated:",logged:a==="es"?"Registrado:":"Logged:",quoted:a==="es"?"Ofertado:":"Quoted:"};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:o+n/2-120,y:p,width:240,height:u,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:o+n/2,y:v,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsxRuntime.jsx("text",{x:o+n/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.start}),jsxRuntime.jsx("text",{x:o+n/2-70,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?S(r.startDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2-110,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.end}),jsxRuntime.jsx("text",{x:o+n/2-70,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?S(r.endDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2+10,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.duration}),jsxRuntime.jsx("text",{x:o+n/2+65,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:D()}),jsxRuntime.jsx("text",{x:o+n/2+10,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.progress}),jsxRuntime.jsxs("text",{x:o+n/2+65,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.assignees}),jsxRuntime.jsxs("text",{x:o+n/2-50,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(N=>N.name).join(", ").substring(0,30),r.assignees.map(N=>N.name).join(", ").length>30?"...":""]})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.effortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.estimated}),jsxRuntime.jsx("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:T(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.logged}),jsxRuntime.jsx("text",{x:o+n/2-50,y:b,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:T(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.quoted}),jsxRuntime.jsx("text",{x:o+n/2-50,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:T(r.soldEffortMinutes)})]})]})]})})}function Cn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false}){let[,u]=react.useState(false),[d,p]=react.useState(null),f=r-t,v=f>0,k=Math.abs(f)<5,g=20,y=!k&&a<=e,h,b,x=a-e,S=e+x/2;if(b=S,n==="squared")if(k)h=`M ${e} ${t} L ${a} ${r}`;else if(y){let L=e+15,xe=a-g,X=v?t+20:t-20;b=xe,h=`M ${e} ${t} L ${L} ${t} L ${L} ${X} L ${xe} ${X} L ${xe} ${r} L ${a} ${r}`;}else b=a-g,h=`M ${e} ${t} L ${b} ${t} L ${b} ${r} L ${a} ${r}`;else h=`M ${e} ${t} C ${S} ${t}, ${S} ${r}, ${a} ${r}`;let D=5,T=`M ${a} ${r} L ${a-D} ${r-D*.5} M ${a} ${r} L ${a-D} ${r+D*.5}`,w=o.dependency,R=o.dependencyHover||w,A="#f87171",N="rgba(248, 113, 113, 0.15)",H=b,I=(t+r)/2;if(d)if(k)H=Math.max(e+10,Math.min(a-10,d.x)),I=t;else if(y){let Ee=e+15,L=a-g,xe=v?t+20:t-20,X=[[e,t,Ee,t],[Ee,t,Ee,xe],[Ee,xe,L,xe],[L,xe,L,r],[L,r,a,r]],ee=1/0,C={x:H,y:I};for(let U of X){let K=re(d.x,d.y,U[0],U[1],U[2],U[3]),ne=Math.hypot(d.x-K.x,d.y-K.y);ne<ee&&(ee=ne,C=K);}H=C.x,I=C.y;}else {let Ee=[[e,t,b,t],[b,t,b,r],[b,r,a,r]],L=1/0,xe={x:H,y:I};for(let X of Ee){let ee=re(d.x,d.y,X[0],X[1],X[2],X[3]),C=Math.hypot(d.x-ee.x,d.y-ee.y);C<L&&(L=C,xe=ee);}H=xe.x,I=xe.y;}function re(Ee,L,xe,X,ee,C){let U=ee-xe,K=C-X,ne=U*U+K*K;if(ne===0)return {x:xe,y:X};let me=((Ee-xe)*U+(L-X)*K)/ne;return me=Math.max(0,Math.min(1,me)),{x:xe+me*U,y:X+me*K}}let E=Ee=>{let L=Ee.currentTarget.ownerSVGElement;if(!L)return;let xe=L.getBoundingClientRect();p({x:Ee.clientX-xe.left,y:Ee.clientY-xe.top});},_=()=>{u(false),p(null),c?.(false);},ie=()=>{u(true),c?.(true);};return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:_,onMouseMove:E,children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:T,fill:"none",stroke:R,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:R,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Ee=>{Ee.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:H,cy:I,r:9,fill:N,stroke:A,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:H-3,y1:I-3,x2:H+3,y2:I+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:H+3,y1:I-3,x2:H-3,y2:I+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ie,onMouseLeave:_,onMouseMove:E,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:T,fill:"none",stroke:R,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:R,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:Ee=>{Ee.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:H,cy:I,r:9,fill:N,stroke:A,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:H-3,y1:I-3,x2:H+3,y2:I+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:H+3,y1:I-3,x2:H-3,y2:I+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:ie,onMouseLeave:_,onMouseMove:E,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:h,fill:"none",stroke:w,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:T,fill:"none",stroke:w,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:w,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Ds({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var ke={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,c=i=>{if(!n.has(i)){n.add(i),l.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ke.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ke.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ke.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=ke.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
126
- `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=ke.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=ke.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>ke.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ke.findTaskById(e,t);return !a||!a.dependencies?[]:ke.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ke.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ke.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=ke.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>ke.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=ke.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=c.startDate&&c.endDate?ke.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?ke.formatDate(c.startDate):"N/A",c.endDate?ke.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ke.flattenTasks(e).map(c=>{let i=c.startDate&&c.endDate?ke.calculateDuration(c.startDate,c.endDate):0;return {"Task ID":c.id,"Task Name":c.name,"Start Date":c.startDate?ke.formatDate(c.startDate):"","End Date":c.endDate?ke.formatDate(c.endDate):"","Duration (days)":i>0?i:"","Progress (%)":c.progress,Status:c.status||"",Assignees:c.assignees?.map(u=>u.name).join(", ")||"",Dependencies:c.dependencies?.join(", ")||"","Is Milestone":c.isMilestone?"Yes":"No","Parent ID":c.parentId||"",Level:c.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let l=a.utils.book_new();a.utils.book_append_sheet(l,s,"Gantt Tasks"),a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ke.flattenTasks(e),o=new Map;r.forEach((p,f)=>{o.set(p.id,f+1);});let s=p=>p.toISOString().replace("Z",""),n=ke.getEarliestStartDate(e)||new Date,l=ke.getLatestEndDate(e)||new Date,c=r.map((p,f)=>{let v=o.get(p.id),k=p.startDate&&p.endDate?ke.calculateDuration(p.startDate,p.endDate):0,g=(p.dependencies||[]).filter(y=>o.has(y)).map(y=>`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Zi({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 l=i=>{t(i),o(false);},c=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:m("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:m("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(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},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 el({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[c,i]=react.useState("json"),[u,d]=react.useState(null),p=react.useRef(null);if(!t)return null;let f=async()=>{let w=o?.current||void 0,g=await Vd(e,c,w);_d(g,c);},v=async w=>{let g=w.target.files?.[0];if(g){try{let y=await Yd(g),h=g.name.endsWith(".json")?"json":"csv",b=Kd(y,h);d(b),b.success&&r&&r(b,y);}catch(y){d({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:m("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:()=>l("export"),className:m("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:()=>l("import"),className:m("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(w=>jsxRuntime.jsxs("button",{onClick:()=>i(w),className:m("p-4 rounded-lg border-2 transition-all text-center",c===w?"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:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),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:f,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:m("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:m("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((w,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},g))})]})]})]})]})]})}var Kh=["URGENT","HIGH","MEDIUM","LOW"],Yh=[{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"}],qh=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function tl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:p=false,groupBy:f="none",onGroupByChange:v}){let[w,g]=react.useState(true),y=react.useCallback(N=>{a({search:N.target.value});},[a]),h=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),b=react.useCallback(N=>{r({by:N.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${w?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:w?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!w&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,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:y,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:N=>{let C=N.target.value;a({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Kh.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let C=N.target.value;a({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let C=N.target.value;a({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:b,className:"filter-bar__select filter-bar__select--sm",children:Yh.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:f,onChange:N=>v(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:qh.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function al({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let f=v=>{d.current&&!d.current.contains(v.target)&&u(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let p=f=>{f(),u(false);};return jsxRuntime.jsxs("div",{className:m("relative",r),ref:d,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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>p(()=>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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 rl={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ol={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},nl={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},yo={dark:rl,light:ol,neutral:nl},ps="dark";var gs=react.createContext(void 0),nb="asakaa-theme";function vu({children:e,defaultTheme:t=ps,storageKey:a=nb}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=yo[r];Object.entries(c.colors).forEach(([u,d])=>{d&&l.style.setProperty(`--theme-${sb(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let p=c.colors[u];p&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:yo};return jsxRuntime.jsx(gs.Provider,{value:n,children:e})}function Go(){let e=react.useContext(gs);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function sb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function sl({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Go();return e?jsxRuntime.jsxs("div",{className:m("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(yo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:m("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 xu(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ot[e]||ot.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ot[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ot[e].bgSecondary),bgGrid:r("--theme-bg-card",ot[e].bgGrid),bgWeekend:r("--theme-bg-hover",ot[e].bgWeekend),border:r("--theme-border-primary",ot[e].border),borderLight:r("--theme-border-subtle",ot[e].borderLight),textPrimary:r("--theme-text-primary",ot[e].textPrimary),textSecondary:r("--theme-text-secondary",ot[e].textSecondary),textTertiary:r("--theme-text-tertiary",ot[e].textTertiary),accent:r("--theme-accent-primary",ot[e].accent),accentHover:r("--theme-accent-hover",ot[e].accentHover),accentLight:r("--theme-accent-primary",ot[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ot[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ot[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ot[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ot[e].dependency),dependencyHover:r("--theme-border-secondary",ot[e].dependencyHover),criticalPath:r("--theme-error",ot[e].criticalPath),criticalPathLight:r("--theme-error",ot[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ot[e].today):e==="neutral"?r("--theme-text-primary",ot[e].today):r("--theme-error",ot[e].today),todayLight:e==="light"?r("--theme-accent-primary",ot[e].todayLight):e==="neutral"?r("--theme-text-primary",ot[e].todayLight):r("--theme-error",ot[e].todayLight),milestone:r("--theme-warning",ot[e].milestone),milestoneLight:r("--theme-warning",ot[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ot[e].statusTodo),statusInProgress:r("--theme-accent-primary",ot[e].statusInProgress),statusCompleted:r("--theme-success",ot[e].statusCompleted),hoverBg:r("--theme-bg-hover",ot[e].hoverBg),focusRing:r("--theme-accent-primary",ot[e].focusRing)}}var fs={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",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"}},ku={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",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"}},il={en:fs,es:ku};function wu(e){return il[e]||il.en}function ll(e,t){let a=wu(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 _o=react.createContext(fs);function Zr(){return react.useContext(_o)}function Sb({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,c]=react.useState(false),[i,u]=react.useState(null),d=react.useRef(null),p=Zr();if(react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&c(false);};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),!(t||a||r||o||s||n))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(g=>g.handler),w=async(g,y)=>{if(y){u(g);try{await y();}catch(h){console.error(`Export ${g} failed:`,h);}finally{u(null),c(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:v.map((g,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Eb({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Pb({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Mb({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Zr();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],c=l.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${c}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function Fb({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),c=Zr();react.useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let f=w=>{l.current&&!l.current.contains(w.target)&&n(false);},v=w=>{w.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",v),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(p),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:c.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:c.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:c.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p=>{p.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:u?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${u?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:u?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:c.toolbar.filter||"Filters"}),u&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:c.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(p=>{let f=t===p.value&&!r,v=()=>p.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${f?p.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:p.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},p.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:c.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function bs({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:p,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:w=false,onHideCompletedChange:g,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:D,onExportMSProject:N}){let C=Zr(),k=y||h||b||x||D||N,R=[{value:"day",label:C.toolbar.day},{value:"week",label:C.toolbar.week},{value:"month",label:C.toolbar.month}],I=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Pb,{options:R,value:t,onChange:T=>a(T),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Mb,{theme:e,value:l,onChange:c}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Fb,{theme:e,value:f,onChange:v,hideCompleted:w,onHideCompletedChange:g})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||C.toolbar.createTask})]}),(k||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sb,{theme:e,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:D,onExportMSProject:N}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Eb,{options:I,value:s,onChange:T=>n(T),theme:e})]})]})}function ys({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{l.current&&!l.current.contains(d.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(vt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},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:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.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 jo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,p=8,f=window.innerWidth,v=window.innerHeight,w=t,g=a;t+u+p>f&&(w=t-u,w<p&&(w=p)),a+d+p>v&&(g=v-d-p,g<p&&(g=p)),c({x:w,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[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:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children: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:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.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 Lt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),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 Fu({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:p=true}){let f=react.useRef(false),v=react.useCallback(b=>{f.current=b;},[]),w=react.useCallback(b=>{let x=[],D=N=>{for(let C of N)x.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&D(C.subtasks);};return D(b),x},[]),g=react.useCallback(()=>{let b=w(e);for(let x of b)if(t.has(x.id))return x;return null},[e,t,w]),y=react.useCallback((b,x)=>{let D=w(e);if(D.length===0)return;let N=g();if(!N){a(D[0].id,false);return}let C=D.findIndex(I=>I.id===N.id);if(C===-1)return;let k=b==="up"?C-1:C+1;if(k<0||k>=D.length)return;let R=D[k];a(R.id,x);},[e,g,w,a]),h=react.useCallback(b=>{if(!p)return;let x=b.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||f.current){b.key==="Escape"&&(x.blur(),f.current=false);return}let C=navigator.platform.toUpperCase().indexOf("MAC")>=0?b.metaKey:b.ctrlKey,k=Array.from(t),R=g();if(b.key==="ArrowUp"){b.preventDefault(),y("up",b.shiftKey);return}if(b.key==="ArrowDown"){b.preventDefault(),y("down",b.shiftKey);return}if(R&&(b.key==="ArrowRight"||b.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(b.preventDefault(),(b.key==="ArrowRight"&&!R.isExpanded||b.key==="ArrowLeft"&&R.isExpanded)&&u(R.id));return}if(b.altKey&&(b.key==="ArrowUp"||b.key==="ArrowDown")){k.length>0&&(b.preventDefault(),n(k,b.key==="ArrowUp"?"up":"down"));return}if(b.key==="Tab"&&!b.shiftKey){k.length>0&&(b.preventDefault(),l(k));return}if(b.key==="Tab"&&b.shiftKey){k.length>0&&(b.preventDefault(),c(k));return}if(b.key==="Enter"&&!b.shiftKey&&!C){R&&(b.preventDefault(),r(R.id,"below"));return}if(b.key==="Enter"&&b.shiftKey&&!C){R&&(b.preventDefault(),r(R.id,"above"));return}if(b.key==="Enter"&&C){R&&(b.preventDefault(),d(R.id));return}if(b.key==="F2"){R&&(b.preventDefault(),i(R.id));return}if(b.key==="Delete"||b.key==="Backspace"&&C){k.length>0&&(b.preventDefault(),o(k));return}if(b.key==="d"&&C&&!b.shiftKey){k.length>0&&(b.preventDefault(),s(k));return}},[p,t,g,y,r,o,s,n,l,c,i,u,d]);return react.useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:v}}function Lu(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(p=>{let f=new Set(p);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=react.useCallback((d,p)=>{if(!a){o(d);return}let f=p.indexOf(a),v=p.indexOf(d);if(f===-1||v===-1){o(d);return}let w=Math.min(f,v),g=Math.max(f,v),y=p.slice(w,g+1);t(new Set(y)),r(d);},[a,o]),l=react.useCallback((d,p,f,v)=>{v?n(d,p):f?s(d):o(d);},[o,s,n]),c=react.useCallback((d,p)=>{p?t(f=>{let v=new Set(f);return v.add(d),v}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function Ko(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<n.length;l++){let c={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function vs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=vs(a.subtasks,t);if(r)return r}}return null}function fl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=fl(a.subtasks,t);if(r)return r}return null}function hl(e,t){if(t.length===0)return e;let a=Ko(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,p)=>{let f=[];return {tasks:d.filter(w=>{if(p.has(w.id))return f.push(w),false;if(w.subtasks){let g=n(w.subtasks,p);w.subtasks=g.tasks,f.push(...g.removed);}return true}),removed:f}},l=(d,p,f)=>d.map(v=>v.id===p?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:l(v.subtasks,p,f)}:v),c=new Set(t),{tasks:i,removed:u}=n(e,c);return l(i,s.id,u)}function bl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=fl(a,r);if(!o)continue;let s=fl(a,o.id),n=(i,u,d)=>{for(let p=0;p<i.length;p++){let f=i[p];if(f.id===u&&f.subtasks){let v=f.subtasks.findIndex(w=>w.id===d);if(v!==-1){let[w]=f.subtasks.splice(v,1);return w}}if(f.subtasks){let v=n(f.subtasks,u,d);if(v)return v}}return null},l=(i,u,d)=>{let p=i.findIndex(f=>f.id===u);if(p!==-1)return i.splice(p+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,u,d);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?l(s.subtasks,o.id,c):l(a,o.id,c));}return a}function yl(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,c)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,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]],true)};return s(r,o,a),r}function vl(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 xn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((u,d)=>({...u,id:`${u.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let i=c.findIndex(f=>f.id===o);if(i===-1){for(let f of c)if(f.subtasks){let v=n(f.subtasks);if(v)return v}return null}let u=c[i],d=`${u.id}-copy-${Date.now()}`,p={...u,id:d,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,d):void 0};return c.splice(i+1,0,p),p},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function Iu(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,n),true};return l(r),{tasks:r,newTask:n}}function xl(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:xl(r.subtasks,t,a)}:r)}function kl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:kl(a.subtasks,t)}:a)}function wl(e,t){let a=p=>{for(let f of p){if(f.id===t)return f;if(f.subtasks){let v=a(f.subtasks);if(v)return v}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,c=p=>{for(let f of p){if(f.id===t)return (f.subtasks||[]).length;if(f.subtasks){let v=c(f.subtasks);if(v>=0)return v}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6",position:i,parentId:t},d=p=>p.map(f=>{if(f.id===t){let v=f.subtasks||[];return {...f,subtasks:[...v,u],isExpanded:true}}return f.subtasks?{...f,subtasks:d(f.subtasks)}:f});return {tasks:d(e),newTask:u}}function Bu(e,t,a,r){if(t===a)return e;let o=vs(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(o,a))return e}let s=l=>l.filter(c=>c.id!==t).map(c=>c.subtasks&&c.subtasks.length>0?{...c,subtasks:s(c.subtasks)}:c),n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,p=[...u];return p.splice(d,0,{...o,parentId:a}),{...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function ws({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:p,onTaskUpdate:f,onTaskIndent:v,onTaskOutdent:w,onTaskMove:g,onMultiTaskDelete:y,onTaskDuplicate:h,onTaskCreate:b,onTaskRename:x,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:C,onTaskReparent:k}){let R=react.useContext(_o),[I,T]=react.useState(null),[H,A]=react.useState(null),[ee,S]=react.useState(""),Y=react.useRef(null),[ue,Pe]=react.useState(null),[F,pe]=react.useState(0),[J,te]=react.useState(0),[L,oe]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ie,Se]=react.useState(null),[U,K]=react.useState(null),[le,j]=react.useState(null),Ie=react.useRef(0),he=5,$e=react.useRef(false),[Xe,tt]=react.useState(null),[Ye,ht]=react.useState(false),[it,at]=react.useState(null),[se,B]=react.useState(false),Z=react.useRef(null);react.useEffect(()=>{function $(_){Z.current&&!Z.current.contains(_.target)&&B(false);}if(se)return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[se]),react.useEffect(()=>{H&&Y.current&&(Y.current.focus(),Y.current.select());},[H]),react.useEffect(()=>{if(!ue)return;let $=xe=>{let Je=xe.clientX-F,Ve=J+Je;p?.(ue,Ve);},_=()=>{Pe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",$),document.addEventListener("mouseup",_),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",_),document.body.style.cursor="",document.body.style.userSelect="";}},[ue,F,J,p]);let{selectedTaskIds:ge,handleTaskClick:Ce,isTaskSelected:Ue}=Lu(),{setIsEditing:et}=Fu({tasks:e,selectedTaskIds:ge,onTaskSelect:($,_)=>{let Je=Ko(e).map(Ve=>Ve.id);Ce($,Je,_||false,false);},onTaskCreate:b||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:$=>{let _=Ko(e).find(xe=>xe.id===$);_&&ve(_);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:$=>{let _=Ko(e).find(xe=>xe.id===$);_&&N&&N(_);},enableKeyboard:true}),lt=($,_=0)=>{let xe=[],Je=[...$].sort((Ve,W)=>(Ve.position??0)-(W.position??0));for(let Ve of Je)xe.push({task:Ve,level:_}),Ve.subtasks&&Ve.subtasks.length>0&&Ve.isExpanded&&xe.push(...lt(Ve.subtasks,_+1));return xe},He=lt(e),ra=48,G=Math.max(He.length*a,600-ra),q=$=>!$.startDate||!$.endDate?"-":`${Math.ceil(($.endDate.getTime()-$.startDate.getTime())/(1e3*60*60*24))}d`,ve=$=>{A($.id),S($.name),et(true);},Qe=$=>{ee.trim()&&ee!==e.find(_=>_.id===$)?.name&&x?.($,ee.trim()),A(null),S(""),et(false);},Te=()=>{A(null),S(""),et(false);},Ae=($,_)=>{_.stopPropagation(),D?.($.id);},X=($,_)=>{_.preventDefault(),Ie.current=_.clientY,Se($),$e.current=false,ht(false),tt({x:_.clientX,y:_.clientY});},We=$=>{if(!ie||(Math.abs($.clientY-Ie.current)>he&&!$e.current&&($e.current=true,ht(true)),tt({x:$.clientX,y:$.clientY}),!$e.current))return;let xe=document.querySelectorAll("[data-task-row]"),Je=null,Ve=null;xe.forEach(W=>{let me=W.getBoundingClientRect(),Ee=W.getAttribute("data-task-row");if(Ee&&Ee!==ie&&$.clientY>=me.top&&$.clientY<=me.bottom){Je=Ee;let At=$.clientY-me.top,ut=me.height;At<ut*.25?Ve="above":At>ut*.75?Ve="below":Ve="child";}}),K(Je),j(Ve);},z=()=>{if($e.current&&ie&&U&&le){if(le==="child")k?.(ie,U);else if(le==="above"||le==="below"){let $=(Je,Ve,W=null)=>{for(let me of Je){if(me.id===Ve)return W;if(me.subtasks){let Ee=$(me.subtasks,Ve,me.id);if(Ee!==void 0)return Ee}}},_=$(e,U,null),xe=(Je,Ve)=>{let W=Je.findIndex(me=>me.id===Ve);return le==="below"?W+1:W};if(_===null){let Je=xe(e,U);k?.(ie,null,Je);}else {let Je=He.find(Ve=>Ve.task.id===_)?.task;if(Je?.subtasks){let Ve=xe(Je.subtasks,U);k?.(ie,_,Ve);}}}}Se(null),K(null),j(null),tt(null),$e.current=false,ht(false);};react.useEffect(()=>{if(ie)return document.addEventListener("mousemove",We),document.addEventListener("mouseup",z),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",We),document.removeEventListener("mouseup",z),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,U,le]);let de=($,_,xe)=>{switch($.id){case "name":let Je=H===_.id,Ve=I===_.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${xe*20}px`},children:[k&&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:Ve?1:.3},onMouseDown:De=>X(_.id,De),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),_.subtasks&&_.subtasks.length>0?jsxRuntime.jsx("button",{onClick:De=>{De.stopPropagation(),c?.(_.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:_.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:_.color||"#3B82F6",opacity:_.parentId?.6:1,borderColor:_.isMilestone?t.accent:"transparent",borderWidth:_.isMilestone?"2px":"0px"},title:_.isMilestone?"Milestone":_.parentId?"Subtask":"Task"})}),Je?jsxRuntime.jsx("input",{ref:Y,type:"text",value:ee,onChange:De=>S(De.target.value),onKeyDown:De=>{De.key==="Enter"?Qe(_.id):De.key==="Escape"&&Te();},onBlur:()=>Qe(_.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:De=>De.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:_.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:_.parentId?"13px":"14px",fontWeight:_.isMilestone?600:_.parentId?400:600,letterSpacing:_.parentId?"0":"-0.01em"},title:_.name,children:_.name}),Ve&&!Je&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:De=>De.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:De=>Ae(_,De),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:De=>{De.stopPropagation(),ve(_);},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 me=$.id==="startDate"?"startDate":"endDate",Ee=_[me],At=it?.taskId===_.id&&it?.field===me,ut=De=>De?(typeof De=="string"?new Date(De):De).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:De=>De.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:De=>{if(At)at(null);else {let Rt=De.currentTarget.getBoundingClientRect();at({taskId:_.id,field:me,month:Ee?typeof Ee=="string"?new Date(Ee):Ee:new Date,position:{top:Rt.bottom+4,left:Rt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:ut(Ee)})]}),At&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>at(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:it?.position.top,left:it?.position.left},onClick:De=>De.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let De=new Date,Rt=new Date(De);Rt.setDate(De.getDate()+1);let Ot=new Date(De);Ot.setDate(De.getDate()+7);let Da=new Date(De);return Da.setDate(De.getDate()+14),[{label:"Hoy",date:De},{label:"Ma\xF1ana",date:Rt},{label:"Pr\xF3xima semana",date:Ot},{label:"2 semanas",date:Da}].map((Ct,dr)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:P=>P.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(_.id,{[me]:Ct.date}),at(null);},children:Ct.label},dr))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:De=>De.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:De=>De.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(_.id,{[me]:void 0}),at(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:()=>at(De=>De?{...De,month:new Date(De.month.getFullYear(),De.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:it?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>at(De=>De?{...De,month:new Date(De.month.getFullYear(),De.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((De,Rt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:De},Rt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let De=it?.month||new Date,Rt=De.getFullYear(),Ot=De.getMonth(),Da=new Date(Rt,Ot,1).getDay(),wr=new Date(Rt,Ot+1,0).getDate(),Ct=new Date,dr=[];for(let re=Da-1;re>=0;re--)dr.push({day:new Date(Rt,Ot,-re).getDate(),date:new Date(Rt,Ot-1,new Date(Rt,Ot,-re).getDate()),isCurrentMonth:false});for(let re=1;re<=wr;re++)dr.push({day:re,date:new Date(Rt,Ot,re),isCurrentMonth:true});let P=42-dr.length;for(let re=1;re<=P;re++)dr.push({day:re,date:new Date(Rt,Ot+1,re),isCurrentMonth:false});return dr.map((re,ze)=>{let Ze=re.date.toDateString()===Ct.toDateString(),ya=(Ee?typeof Ee=="string"?new Date(Ee):Ee:null)?.toDateString()===re.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:re.isCurrentMonth?ya?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ya?"#3B82F6":"transparent",boxShadow:Ze&&!ya?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(_.id,{[me]:re.date}),at(null);},children:re.day},ze)})})()})]})]})]}),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:q(_)})});case "assignees":let kr=r.filter(De=>_.assignees?.some(Rt=>Rt.name===De.name||Rt.initials===De.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(mo,{assignedUsers:kr,availableUsers:r,onChange:De=>{let Rt=De.map(Ot=>({id:Ot.id,name:Ot.name,initials:Ot.initials,color:Ot.color}));f?.(_.id,{assignees:Rt.length>0?Rt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(pc,{status:_.status||"todo",onChange:De=>{f?.(_.id,{status:De,progress:De==="completed"?100:_.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${_.progress}%`,backgroundColor:_.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:[_.progress,"%"]})]});case "priority":let Za={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},lr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Qa=Za[_.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:De=>De.stopPropagation(),children:jsxRuntime.jsx(co,{priority:Qa,onChange:De=>{De&&f?.(_.id,{priority:lr[De]||"medium"});}})});default:return null}},Be=$=>[{id:"hide",label:"Hide Column",icon:Lt.Hide,onClick:()=>d($),disabled:$==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Lt.SortDesc,onClick:()=>{}}],Ke=$=>$.subtasks&&$.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{D?.($.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{C?C($.id,$.name):y?.([$.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{n?.($);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{D?.($.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{f?.($.id,{status:"todo",progress:0});},disabled:$.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{f?.($.id,{status:"in-progress"});},disabled:$.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{f?.($.id,{status:"completed",progress:100});},disabled:$.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:R?.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{h?.([$.id]);}},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{C?C($.id,$.name):y?.([$.id]);}}],_e=u.filter($=>$.visible),Oe=_e.reduce(($,_)=>$+_.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Oe},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${ra}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:_e.map(($,_)=>{let xe=_===_e.length-1,Je=$.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Je?"":"justify-center"}`,style:{width:`${$.width}px`,minWidth:`${$.minWidth??(Je?200:60)}px`,maxWidth:`${$.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:xe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ve=>{Ve.preventDefault(),oe({isOpen:true,x:Ve.clientX,y:Ve.clientY,type:"header",columnId:$.id});},onMouseEnter:Ve=>{Ve.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ve=>{Ve.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:$.label,children:$.label}),$.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ue===$.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ve=>{Ve.preventDefault(),Ve.stopPropagation(),Pe($.id),pe(Ve.clientX),te($.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},$.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(ys,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>B(!se),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"})}),se&&jsxRuntime.jsxs("div",{ref:Z,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>B(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:G},children:He.map(({task:$,level:_},xe)=>{let Je=Ue($.id),Ve=U===$.id,W=Ve&&le==="above",me=Ve&&le==="below",Ee=Ve&&le==="child",At={};return Ee&&(At.backgroundColor=`${t.accent}15`,At.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":$.id,className:`flex items-center cursor-pointer group ${ie===$.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Je?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Je?t.accentLight:Ee?`${t.accent}15`:xe%2===0?t.bgPrimary:t.bgGrid,...At},onMouseEnter:()=>T($.id),onMouseLeave:()=>T(null),onClick:ut=>{let Za=Ko(e).map(De=>De.id),Qa=navigator.platform.toUpperCase().indexOf("MAC")>=0?ut.metaKey:ut.ctrlKey;Ce($.id,Za,Qa,ut.shiftKey),s?.($);},onDoubleClick:ut=>{ut.stopPropagation(),n?.($);},onContextMenu:ut=>{ut.preventDefault(),oe({isOpen:true,x:ut.clientX,y:ut.clientY,type:"task",task:$}),l?.($,ut);},whileHover:{backgroundColor:Je?t.accentLight:t.hoverBg},children:[W&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),me&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),_e.map((ut,kr)=>{let Za=kr===_e.length-1,lr=ut.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${lr?"justify-start":"justify-center"}`,style:{width:`${ut.width}px`,minWidth:`${ut.minWidth??(lr?200:60)}px`,maxWidth:`${ut.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Za?"none":`1px solid ${I===$.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:de(ut,$,lr?_:0)},`${$.id}-${ut.id}`)})]},$.id)})}),jsxRuntime.jsx(jo,{isOpen:L.isOpen,x:L.x,y:L.y,items:L.type==="header"&&L.columnId?Be(L.columnId):L.type==="task"&&L.task?Ke(L.task):[],onClose:()=>oe({...L,isOpen:false}),theme:t}),Ye&&Xe&&ie&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Xe.x+12,top:Xe.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let $=He.find(_=>_.task.id===ie)?.task;return $?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:$.name})}):null})()}),document.body)]})}function Uu(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[c,i]=react.useState(t),[u,d]=react.useState(null),[p,f]=react.useState(null),[v,w]=react.useState(null),[g,y]=react.useState(null),[h,b]=react.useState(0),[x,D]=react.useState(0),[N,C]=react.useState(null),[k,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:f,activeZone:v,setActiveZone:w,draggedSegmentIndex:g,setDraggedSegmentIndex:y,draggedSegmentStartX:h,setDraggedSegmentStartX:b,segmentDragOffsetX:x,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:C,isHovered:k,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ee,S)=>{r("none"),d(null),f(null),l(ee),i(S),D(0),y(null),b(0);}}}function Ts({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:p,allTaskPositions:f=[],onDragMove:v,onHoverChange:w}){let g=Uu(t,r),y=react.useRef(null),h=react.useRef(null),b=react.useRef(null),{dragMode:x,setDragMode:D,dragOffset:N,setDragOffset:C,ghostX:k,setGhostX:R,ghostWidth:I,setGhostWidth:T,connectionLine:H,setConnectionLine:A,hoveredTaskId:ee,setHoveredTaskId:S,activeZone:Y,setActiveZone:ue,draggedSegmentIndex:Pe,setDraggedSegmentIndex:F,draggedSegmentStartX:pe,setDraggedSegmentStartX:J,segmentDragOffsetX:te,setSegmentDragOffsetX:L,hoveredSegmentIndex:oe,setHoveredSegmentIndex:ie,isHovered:Se,setIsHovered:U,isDragging:K,isResizing:le,isConnecting:j,resetDragState:Ie}=g,he=24,$e=8,Xe=e.endDate&&e.endDate<new Date&&e.progress<100,tt=e.isCriticalPath,Ye=o.name==="neutral"||o.today==="#1C1917",ht=e.status==="completed"||e.progress===100,it={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},se=e.isCriticalPath||Xe?"#DC2626":e.color?e.color:e.priority&&it[e.priority]?it[e.priority]:o.taskBarPrimary,Z=(z=>z>=80?20:z>=60?15:z>=50?12:10)(r),ge=r<50,Ce=r<40;react.useEffect(()=>{if(w)if(Se&&!K&&!e.segments){let z=a<100;w({task:e,x:t,y:a,width:r,height:he,showBelow:z});}else w(null);},[Se,K,e,t,a,r,he,w]);let Ue=z=>z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),et=()=>{let z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${z} day${z!==1?"s":""}`},lt=z=>Math.round(z/s)*s,He=z=>{let de=Math.round(z/s),Be=new Date(n);return Be.setDate(Be.getDate()+de),Be},ra=(z,de)=>{for(let Be of f){if(Be.id===e.id)continue;let Ke=5;if(z>=Be.x-Ke&&z<=Be.x+Be.width+Ke&&de>=Be.y-Ke&&de<=Be.y+Be.height+Ke)return Be.id}return null},G=react.useCallback((z,de,Be)=>{z.preventDefault(),z.stopPropagation();let Ke=y.current?.ownerSVGElement;if(!Ke)return;let _e=Ke.createSVGPoint();_e.x=z.clientX,_e.y=z.clientY;let Oe=_e.matrixTransform(Ke.getScreenCTM()?.inverse()),$=Be!==void 0?Be:t,_=de;if(!_){let xe=Oe.x-$;z.shiftKey?(_="connect",A({x:t+r,y:a+he/2})):z.ctrlKey||z.metaKey?_="move":z.altKey?_=xe<r/2?"resize-start":"resize-end":Ce?xe<r/2?_="move":_="resize-end":ge?xe<=Z/2?_="resize-start":xe>=r-Z/2?_="resize-end":_="move":xe<=Z?_="resize-start":xe>=r-Z?_="resize-end":_="move";}D(_),U(false),ue(null),_==="move"?C(Oe.x-$):_==="connect"?A({x:t+r,y:a+he/2}):C(0),R($),T(r);},[t,r,a,he]),q=react.useCallback(z=>{let de=y.current?.ownerSVGElement;if(!de)return;let Be=de.closest(".gantt-timeline-scroll");if(!Be)return;let Ke=Be.getBoundingClientRect(),_e=60,Oe=15,$=0;if(z.clientX<Ke.left+_e){let _=Ke.left+_e-z.clientX;$=-Math.min(Oe,_/2);}else if(z.clientX>Ke.right-_e){let _=z.clientX-(Ke.right-_e);$=Math.min(Oe,_/2);}return $!==0&&(Be.scrollLeft+=$),$!==0},[]),ve=react.useCallback(z=>{if(x==="none")return;b.current=z;let de=y.current?.ownerSVGElement;if(!de)return;if(x==="move"||x==="resize-start"||x==="resize-end"){let _e=q(z);_e&&!h.current?h.current=window.setInterval(()=>{b.current&&(q(b.current),ve(b.current));},16):!_e&&h.current&&(window.clearInterval(h.current),h.current=null);}let Be=de.createSVGPoint();Be.x=z.clientX,Be.y=z.clientY;let Ke=Be.matrixTransform(de.getScreenCTM()?.inverse());if(x==="connect"){A({x:Ke.x,y:Ke.y});let _e=ra(Ke.x,Ke.y);S(_e);}else if(x==="move"){let _e=Ke.x-N,Oe=lt(_e);R(Oe),T(r);let $=Math.round((Oe-t)/s);if(v?.(e.id,$,true),e.segments&&e.segments.length>0&&Pe!==null){let _=Oe-pe;L(_);}}else if(x==="resize-start"){let _e=Ke.x,Oe=lt(_e),$=t+r-Oe;$>=s&&(R(Oe),T($));}else if(x==="resize-end"){let _e=Ke.x,$=lt(_e)-t;$>=s&&T($);}},[x,t,r,s,N,e,lt,Pe,pe,ra,S,A,R,T,L,v,q]),Qe=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),b.current=null,x!=="none"){if(x==="connect")ee&&p&&p(e,ee),A(null),S(null);else {let z=e.endDate.getTime()-e.startDate.getTime(),de,Be,Ke=true;if(x==="move"){if(de=He(k),Be=new Date(de.getTime()+z),e.segments&&e.segments.length>0&&Pe!==null){let _e=Math.round(te/s),Oe=e.segments.map((Je,Ve)=>{if(Ve===Pe){let W=new Date(Je.startDate),me=new Date(Je.endDate);return W.setDate(W.getDate()+_e),me.setDate(me.getDate()+_e),{startDate:W,endDate:me}}return Je}),$=Oe.flatMap(Je=>[Je.startDate,Je.endDate]),_=new Date(Math.min(...$.map(Je=>Je.getTime()))),xe=new Date(Math.max(...$.map(Je=>Je.getTime())));d?.({...e,segments:Oe},_,xe),Ie(t,r);return}}else x==="resize-start"?(de=He(k),Be=e.endDate,de>Be&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ke=false)):x==="resize-end"?(de=e.startDate,Be=He(k+I),Be<de&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ke=false)):Ke=false;Ke&&de&&Be&&(Be.getTime()<de.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,de,Be));}v?.(e.id,0,false),Ie(t,r);}},[x,k,I,e,d,ee,p,t,r,s,He,te,Pe,Ie,v]);react.useEffect(()=>{if(x==="none")return;let z=Be=>{ve(Be);},de=()=>{Qe();};return window.addEventListener("mousemove",z),window.addEventListener("mouseup",de),()=>{window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",de),h.current&&(window.clearInterval(h.current),h.current=null);}},[x,ve,Qe]);let Te=K&&!j?k:t,Ae=K&&!j?I:r,X=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:y,"data-task-bar":"true",onClick:()=>!K&&c?.(e),onDoubleClick:z=>{K||(z.stopPropagation(),i?.(e));},onContextMenu:z=>{z.preventDefault(),u?.(e,z);},onMouseEnter:()=>!K&&U(true),onMouseLeave:()=>{K||(U(false),ue(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:he,fill:"transparent",style:{pointerEvents:"all"}}),Se&&!K&&!ge&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Z,height:he,fill:Y==="resize-start"?o.accent:"transparent",opacity:Y==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ue("resize-start"),onMouseDown:z=>G(z,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Z,y:a,width:r-Z*2,height:he,fill:Y==="move"?o.accent:"transparent",opacity:Y==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ue("move"),onMouseDown:z=>G(z,"move")}),jsxRuntime.jsx("rect",{x:t+r-Z,y:a,width:Z,height:he,fill:Y==="resize-end"?o.accent:"transparent",opacity:Y==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ue("resize-end"),onMouseDown:z=>G(z,"resize-end")})]}),Se&&!K&&Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:he,fill:Y==="move"?o.accent:"transparent",opacity:Y==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ue("move"),onMouseDown:z=>G(z,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:he,fill:Y==="resize-end"?o.accent:"transparent",opacity:Y==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ue("resize-end"),onMouseDown:z=>G(z,"resize-end")}),Se&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+he-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),K&&!j&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:a,width:I,height:he,rx:$e,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Te,y:a,width:Ae,height:he,rx:$e,fill:se,"data-task-class":X,initial:{opacity:0,scale:.95},animate:{opacity:K&&!j?.15:e.parentId?.6:Se?.9:.8,scale:Se&&!K?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:z=>G(z),style:{cursor:K?j?"crosshair":le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Te,y:a,width:Ae*(e.progress/100),height:he,rx:$e,fill:se,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((z,de)=>{let Be=(z.startDate.getTime()-n.getTime())/864e5*s,_e=(z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Be+s,Oe=K&&x==="move"&&Pe===de,$=oe===de,_=Oe?Be+te:Be;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!K&&ie(de),onMouseLeave:()=>!K&&ie(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:_,y:a,width:_e,height:he,rx:$e,fill:se,initial:{opacity:0,scale:.95},animate:{opacity:Oe||e.parentId?.6:$?.9:.8,scale:$&&!K?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:xe=>{xe.stopPropagation(),F(de),J(Be),G(xe,void 0,Be);},style:{cursor:K?j?"crosshair":le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:_,y:a,width:_e*(e.progress/100),height:he,rx:$e,fill:se,opacity:1,style:{pointerEvents:"none"}})]},`segment-${de}`)}),Ye&&(Xe||tt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[tt&&!Xe&&jsxRuntime.jsx("rect",{x:Te,y:a,width:Ae,height:he,rx:$e,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Xe&&jsxRuntime.jsx("rect",{x:Te,y:a,width:Ae,height:he,rx:$e,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ae>60&&!e.segments&&(()=>{let z=l.taskLabel(e),de=typeof z=="string"?z:e.name,Be=de.length>Math.floor(Ae/8)?`${de.substring(0,Math.floor(Ae/8))}...`:de;return jsxRuntime.jsx("text",{x:Te+12,y:a+he/2,dominantBaseline:"middle",fill:ht?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ht?"line-through":"none"},children:Be})})(),Ae>100&&e.progress>0&&e.progress<100&&!K&&!e.segments&&jsxRuntime.jsxs("text",{x:Te+Ae-12,y:a+he/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&Ae>80&&!K&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Te+Ae-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Te+Ae-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Se||le)&&!j&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Te-2,y:a,width:16,height:he,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ue("resize-start"),onMouseLeave:()=>ue(null),onMouseDown:z=>{z.stopPropagation(),G(z,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Te+4,y:a+8,width:3,height:he-16,rx:1.5,fill:Y==="resize-start"||x==="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:Te+Ae-14,y:a,width:16,height:he,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ue("resize-end"),onMouseLeave:()=>ue(null),onMouseDown:z=>{z.stopPropagation(),G(z,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Te+Ae-7,y:a+8,width:3,height:he-16,rx:1.5,fill:Y==="resize-end"||x==="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:Se&&!K&&!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+he/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ue("connect"),onMouseLeave:()=>ue(null),onMouseDown:z=>{z.stopPropagation(),G(z,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+he/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Y==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),j&&H&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+he/2,x2:H.x,y2:H.y,stroke:ee?o.statusCompleted:o.accent,strokeWidth:ee?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:ee?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:H.x,cy:H.y,r:ee?8:6,fill:ee?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),ee&&jsxRuntime.jsx(framerMotion.motion.text,{x:H.x+15,y:H.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:H.x+10},animate:{opacity:1,x:H.x+15},transition:{duration:.2},children:"Connect"})]}),(Se||K)&&!j&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Te-2,y:a-2,width:Ae+4,height:he+4,rx:$e+2,fill:"none",stroke:K?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:K?.6:.4,initial:{opacity:0},animate:{opacity:K?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+I,y1:0,x2:k+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se&&!K&&!e.segments&&!w&&(()=>{let Be=a<100,Ke=Be?a+he+13:a-82-13,_e=Be?`M ${Te+Ae/2-6} ${a+he+3} L ${Te+Ae/2} ${a+he+13} L ${Te+Ae/2+6} ${a+he+3}`:`M ${Te+Ae/2-6} ${a-13} L ${Te+Ae/2} ${a-3} L ${Te+Ae/2+6} ${a-13}`,Oe=Ke+22,$=Ke+40,_=Ke+55,xe=Ke+70,Je=Be?Ke+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Be?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Be?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:_e,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Te+Ae/2-120,y:Ke,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Te+Ae/2,y:Oe,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:Te+Ae/2-110,y:$,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Te+Ae/2-70,y:$,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.startDate)}),jsxRuntime.jsx("text",{x:Te+Ae/2-110,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Te+Ae/2-70,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.endDate)}),jsxRuntime.jsx("text",{x:Te+Ae/2+10,y:$,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Te+Ae/2+65,y:$,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:et()}),jsxRuntime.jsx("text",{x:Te+Ae/2+10,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Te+Ae/2+65,y:_,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:Te+Ae/2-110,y:xe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Te+Ae/2-50,y:xe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ve=>Ve.name).join(", ").substring(0,30),e.assignees.map(Ve=>Ve.name).join(", ").length>30?"...":""]})]}),!Be&&jsxRuntime.jsx("text",{x:Te+Ae/2,y:Je,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ce?"Left: move \u2022 Right: resize":ge?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Gu({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:c}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,u=i?130:82,d=13,p=c?s+l+d:s-u-d,f=c?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,v=p+22,w=p+40,g=p+55,y=p+70,h=p+90,b=p+105,x=p+120,D=T=>T.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),N=()=>{if(!r.startDate||!r.endDate)return "N/A";let T=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${T} day${T!==1?"s":""}`},C=T=>{if(T==null||T===0)return "N/A";let H=Math.floor(T/60),A=T%60;return H===0?`${A}m`:A===0?`${H}h`:`${H}h ${A}m`},k={start:a==="es"?"Inicio:":"Start:",end:a==="es"?"Fin:":"End:",duration:a==="es"?"Duraci\xF3n:":"Duration:",progress:a==="es"?"Progreso:":"Progress:",assignees:a==="es"?"Asignados:":"Assignees:",estimated:a==="es"?"Estimado:":"Estimated:",logged:a==="es"?"Registrado:":"Logged:",quoted:a==="es"?"Ofertado:":"Quoted:"};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:o+n/2-120,y:p,width:240,height:u,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:o+n/2,y:v,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsxRuntime.jsx("text",{x:o+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.start}),jsxRuntime.jsx("text",{x:o+n/2-70,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?D(r.startDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2-110,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.end}),jsxRuntime.jsx("text",{x:o+n/2-70,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?D(r.endDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2+10,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.duration}),jsxRuntime.jsx("text",{x:o+n/2+65,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:N()}),jsxRuntime.jsx("text",{x:o+n/2+10,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.progress}),jsxRuntime.jsxs("text",{x:o+n/2+65,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.assignees}),jsxRuntime.jsxs("text",{x:o+n/2-50,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(T=>T.name).join(", ").substring(0,30),r.assignees.map(T=>T.name).join(", ").length>30?"...":""]})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.effortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.estimated}),jsxRuntime.jsx("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:C(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.logged}),jsxRuntime.jsx("text",{x:o+n/2-50,y:b,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:C(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.quoted}),jsxRuntime.jsx("text",{x:o+n/2-50,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:C(r.soldEffortMinutes)})]})]})]})})}function Tn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false}){let[,u]=react.useState(false),[d,p]=react.useState(null),f=r-t,v=f>0,w=Math.abs(f)<5,g=20,y=!w&&a<=e,h,b,x=a-e,D=e+x/2;if(b=D,n==="squared")if(w)h=`M ${e} ${t} L ${a} ${r}`;else if(y){let F=e+15,pe=a-g,J=v?t+20:t-20;b=pe,h=`M ${e} ${t} L ${F} ${t} L ${F} ${J} L ${pe} ${J} L ${pe} ${r} L ${a} ${r}`;}else b=a-g,h=`M ${e} ${t} L ${b} ${t} L ${b} ${r} L ${a} ${r}`;else h=`M ${e} ${t} C ${D} ${t}, ${D} ${r}, ${a} ${r}`;let N=5,C=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,k=o.dependency,R=o.dependencyHover||k,I="#f87171",T="rgba(248, 113, 113, 0.15)",H=b,A=(t+r)/2;if(d)if(w)H=Math.max(e+10,Math.min(a-10,d.x)),A=t;else if(y){let Pe=e+15,F=a-g,pe=v?t+20:t-20,J=[[e,t,Pe,t],[Pe,t,Pe,pe],[Pe,pe,F,pe],[F,pe,F,r],[F,r,a,r]],te=1/0,L={x:H,y:A};for(let oe of J){let ie=ee(d.x,d.y,oe[0],oe[1],oe[2],oe[3]),Se=Math.hypot(d.x-ie.x,d.y-ie.y);Se<te&&(te=Se,L=ie);}H=L.x,A=L.y;}else {let Pe=[[e,t,b,t],[b,t,b,r],[b,r,a,r]],F=1/0,pe={x:H,y:A};for(let J of Pe){let te=ee(d.x,d.y,J[0],J[1],J[2],J[3]),L=Math.hypot(d.x-te.x,d.y-te.y);L<F&&(F=L,pe=te);}H=pe.x,A=pe.y;}function ee(Pe,F,pe,J,te,L){let oe=te-pe,ie=L-J,Se=oe*oe+ie*ie;if(Se===0)return {x:pe,y:J};let U=((Pe-pe)*oe+(F-J)*ie)/Se;return U=Math.max(0,Math.min(1,U)),{x:pe+U*oe,y:J+U*ie}}let S=Pe=>{let F=Pe.currentTarget.ownerSVGElement;if(!F)return;let pe=F.getBoundingClientRect();p({x:Pe.clientX-pe.left,y:Pe.clientY-pe.top});},Y=()=>{u(false),p(null),c?.(false);},ue=()=>{u(true),c?.(true);};return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:Y,onMouseMove:S,children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:R,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:R,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Pe=>{Pe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:H,cy:A,r:9,fill:T,stroke:I,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:H-3,y1:A-3,x2:H+3,y2:A+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:H+3,y1:A-3,x2:H-3,y2:A+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ue,onMouseLeave:Y,onMouseMove:S,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:R,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:R,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:Pe=>{Pe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:H,cy:A,r:9,fill:T,stroke:I,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:H-3,y1:A-3,x2:H+3,y2:A+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:H+3,y1:A-3,x2:H-3,y2:A+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:ue,onMouseLeave:Y,onMouseMove:S,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:h,fill:"none",stroke:k,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:C,fill:"none",stroke:k,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:k,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Ds({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var we={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,c=i=>{if(!n.has(i)){n.add(i),l.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=we.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=we.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=we.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=we.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
126
+ `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=we.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=we.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>we.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=we.findTaskById(e,t);return !a||!a.dependencies?[]:we.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>we.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>we.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=we.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>we.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=we.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=c.startDate&&c.endDate?we.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?we.formatDate(c.startDate):"N/A",c.endDate?we.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=we.flattenTasks(e).map(c=>{let i=c.startDate&&c.endDate?we.calculateDuration(c.startDate,c.endDate):0;return {"Task ID":c.id,"Task Name":c.name,"Start Date":c.startDate?we.formatDate(c.startDate):"","End Date":c.endDate?we.formatDate(c.endDate):"","Duration (days)":i>0?i:"","Progress (%)":c.progress,Status:c.status||"",Assignees:c.assignees?.map(u=>u.name).join(", ")||"",Dependencies:c.dependencies?.join(", ")||"","Is Milestone":c.isMilestone?"Yes":"No","Parent ID":c.parentId||"",Level:c.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let l=a.utils.book_new();a.utils.book_append_sheet(l,s,"Gantt Tasks"),a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=we.flattenTasks(e),o=new Map;r.forEach((p,f)=>{o.set(p.id,f+1);});let s=p=>p.toISOString().replace("Z",""),n=we.getEarliestStartDate(e)||new Date,l=we.getLatestEndDate(e)||new Date,c=r.map((p,f)=>{let v=o.get(p.id),w=p.startDate&&p.endDate?we.calculateDuration(p.startDate,p.endDate):0,g=(p.dependencies||[]).filter(y=>o.has(y)).map(y=>`
127
127
  <PredecessorLink>
128
128
  <PredecessorUID>${o.get(y)}</PredecessorUID>
129
129
  <Type>1</Type>
@@ -144,9 +144,9 @@
144
144
  <Priority>500</Priority>
145
145
  <Start>${p.startDate?s(p.startDate):""}</Start>
146
146
  <Finish>${p.endDate?s(p.endDate):""}</Finish>
147
- <Duration>PT${k*8}H0M0S</Duration>
147
+ <Duration>PT${w*8}H0M0S</Duration>
148
148
  <DurationFormat>7</DurationFormat>
149
- <Work>PT${k*8}H0M0S</Work>
149
+ <Work>PT${w*8}H0M0S</Work>
150
150
  <Stop>${p.endDate?s(p.endDate):""}</Stop>
151
151
  <Resume>${p.startDate?s(p.startDate):""}</Resume>
152
152
  <ResumeValid>0</ResumeValid>
@@ -178,15 +178,15 @@
178
178
  <OvertimeWork>PT0H0M0S</OvertimeWork>
179
179
  <ActualStart>${p.progress>0&&p.startDate?s(p.startDate):""}</ActualStart>
180
180
  <ActualFinish>${p.progress===100&&p.endDate?s(p.endDate):""}</ActualFinish>
181
- <ActualDuration>PT${Math.round(k*p.progress/100)*8}H0M0S</ActualDuration>
181
+ <ActualDuration>PT${Math.round(w*p.progress/100)*8}H0M0S</ActualDuration>
182
182
  <ActualCost>0</ActualCost>
183
183
  <ActualOvertimeCost>0</ActualOvertimeCost>
184
- <ActualWork>PT${Math.round(k*p.progress/100)*8}H0M0S</ActualWork>
184
+ <ActualWork>PT${Math.round(w*p.progress/100)*8}H0M0S</ActualWork>
185
185
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
186
- <RegularWork>PT${k*8}H0M0S</RegularWork>
187
- <RemainingDuration>PT${Math.round(k*(100-p.progress)/100)*8}H0M0S</RemainingDuration>
186
+ <RegularWork>PT${w*8}H0M0S</RegularWork>
187
+ <RemainingDuration>PT${Math.round(w*(100-p.progress)/100)*8}H0M0S</RemainingDuration>
188
188
  <RemainingCost>0</RemainingCost>
189
- <RemainingWork>PT${Math.round(k*(100-p.progress)/100)*8}H0M0S</RemainingWork>
189
+ <RemainingWork>PT${Math.round(w*(100-p.progress)/100)*8}H0M0S</RemainingWork>
190
190
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
191
191
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
192
192
  <ACWP>0</ACWP>
@@ -353,9 +353,9 @@
353
353
  </Calendars>
354
354
  <Tasks>${c}
355
355
  </Tasks>
356
- </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ke.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?ke.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let v=t.find(k=>k.id===f);if(v){o(v);let k=r.get(f)?.ef||0;d=Math.max(d,k);}}let p=d+u;r.set(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?ke.calculateDuration(i.startDate,i.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(i.id)),p=s;if(d.length>0)for(let v of d){l(v);let k=n.get(v.id)?.ls||0;p=Math.min(p,k);}let f=p-u;n.set(i.id,{ls:f,lf:p});};a.forEach(l);let c=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let p=d.ls-u.es;Math.abs(p)<.01&&c.push(i.id);}}return c},calculateSlack:(e,t)=>{let a=ke.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ke.calculateCriticalPath(e).includes(t))return 0;let o=ke.getDependentTasks(e,t);if(o.length===0){let l=ke.getLatestEndDate(e);if(!l)return null;let c=ke.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let n=ke.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ke.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ke.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ke.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=ke.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=ke.calculateEndDate(c,l),u=d=>d.map(p=>p.id===n.id?{...p,startDate:c,endDate:i}:p.subtasks?{...p,subtasks:u(p.subtasks)}:p);s=u(s),s=ke.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),u=1e3*60*60*24,d=ke.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(f,v,k=new Set)=>{if(k.has(f))return;k.add(f);let g=ke.getDependentTasks(e,f);for(let y of g){if(!y.startDate||!y.endDate)continue;let h=r.findIndex(N=>N.id===y.id);if(h===-1)continue;let b=y.startDate.getTime(),S=(y.endDate.getTime()-b)/u,T=(b-i)/u*s,w=T+v*s,R=Math.max(S*s,s),A=l+h*n+12;c.push({taskId:y.id,taskName:y.name,originalX:T,previewX:w,width:R,y:A,rowIndex:h,daysDelta:v,color:y.color}),p(y.id,v,k);}};return p(t,a),c},splitTask:(e,t,a,r=3)=>{let o=ke.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Es({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",onTaskClick:u,onTaskDblClick:d,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:k}){let y=Zr(),[h,b]=react.useState([]),[x,S]=react.useState(null),[D,T]=react.useState(null),w=react.useCallback(C=>{S(C);},[]),R=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),A=r==="day"?60:r==="week"?20:8,N=R*A*n,H=C=>{let U=new Date(Date.UTC(C.getFullYear(),C.getMonth(),C.getDate())),K=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-K);let ne=new Date(Date.UTC(U.getUTCFullYear(),0,1));return Math.ceil(((U.getTime()-ne.getTime())/864e5+1)/7)},I=C=>{let U=C.getDay();return U===0||U===6},re=react.useCallback(C=>{let U=Math.round(C/(A*n)),K=new Date(o);return K.setDate(K.getDate()+U),K},[o,A,n]),E=react.useCallback((C,U)=>{if(U.startDate&&U.endDate)return;let K=C.currentTarget.ownerSVGElement;if(!K)return;let ne=K.createSVGPoint();ne.x=C.clientX,ne.y=C.clientY;let me=ne.matrixTransform(K.getScreenCTM()?.inverse()),ce=re(me.x),Ne=new Date(ce);Ne.setDate(Ne.getDate()+1),f?.(U,ce,Ne);},[re,f]),_=react.useMemo(()=>{let C=me=>me.map(ce=>{if(ce.subtasks&&ce.subtasks.length>0){let Ne=C(ce.subtasks),Z=Ne.filter(je=>je.startDate&&je.endDate);if(Z.length>0){let je=Z.map(ot=>ot.startDate.getTime()),Be=Z.map(ot=>ot.endDate.getTime()),Ye=new Date(Math.min(...je)),dt=new Date(Math.max(...Be));return {...ce,subtasks:Ne,startDate:Ye,endDate:dt}}return {...ce,subtasks:Ne}}return ce}),U=(me,ce=[])=>{let Ne=[...me].sort((Z,je)=>(Z.position??0)-(je.position??0));for(let Z of Ne)ce.push(Z),Z.subtasks&&Z.subtasks.length>0&&(Z.isExpanded===void 0||Z.isExpanded)&&U(Z.subtasks,ce);return ce},K=C(e);return U(K)},[e]),ie=react.useCallback(C=>{if(!C.startDate||!C.endDate)return {x:0,width:0};let U=C.startDate.getTime(),K=C.endDate.getTime(),ne=o.getTime(),me=(U-ne)/(1e3*60*60*24),ce=(K-U)/(1e3*60*60*24),Ne=me*A*n,Z=Math.max(A*n,40),je=Math.max(ce*A*n,Z);return {x:Ne,width:je}},[o,A,n]),Ee=react.useMemo(()=>_.filter(C=>C.startDate&&C.endDate).map(C=>{let{x:U,width:K}=ie(C),me=_.findIndex(ce=>ce.id===C.id)*a+14;return {id:C.id,x:U,y:me,width:K,height:24}}),[_,ie]),L=react.useCallback((C,U,K)=>{if(!K||U===0){b([]);return}let ne=ke.calculateCascadePreview(e,C,U,_,o,A*n,a,48);b(ne);},[e,_,o,A,n,a,48]),xe=react.useMemo(()=>{let C=[],U=new Date(o);for(;U<=s;){let me=(U.getTime()-o.getTime())/864e5*A*n;if(r==="day")C.push({date:new Date(U),label:U.toLocaleDateString(l,{day:"numeric",month:"short"}),x:me}),U.setDate(U.getDate()+1);else if(r==="week"){let ce=H(U);C.push({date:new Date(U),label:`${y.labels.week} ${ce}`,x:me}),U.setDate(U.getDate()+7);}else C.push({date:new Date(U),label:U.toLocaleDateString(l,{month:"short",year:"numeric"}),x:me}),U.setMonth(U.getMonth()+1);}return C},[o,s,r,A,n,l,y.labels.week]),X=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*A*n,[o,A,n]),ee=Math.max(_.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(N,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(N,1e3),height:48,fill:t.bgGrid}),xe.map((C,U)=>jsxRuntime.jsxs("g",{children:[U>0&&jsxRuntime.jsx("line",{x1:C.x,y1:0,x2:C.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:C.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:C.label})]},`header-${U}`)),X>=0&&X<=N&&jsxRuntime.jsx("circle",{cx:X,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(N,1e3),height:ee,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(N,1e3),height:ee,fill:t.bgPrimary}),xe.map((C,U)=>{let K=xe[U+1]?.x||N,ne=I(C.date);return jsxRuntime.jsxs("g",{children:[ne&&jsxRuntime.jsx("rect",{x:C.x,y:0,width:K-C.x,height:_.length*a,fill:t.bgWeekend,opacity:1}),U>0&&jsxRuntime.jsx("line",{x1:C.x,y1:0,x2:C.x,y2:_.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},U)}),_.map((C,U)=>{let K=C.startDate&&C.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:U*a,width:N,height:a,fill:U%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${C.id}`),!K&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:U*a,width:N,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ne=>E(ne,C),onMouseEnter:ne=>{ne.currentTarget.setAttribute("fill",t.accentLight),ne.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:ne=>{ne.currentTarget.setAttribute("fill","transparent"),ne.currentTarget.setAttribute("opacity","1");}},`clickable-${C.id}`),jsxRuntime.jsx("text",{x:X>0?X:100,y:U*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:y.labels.clickToSetDates},`placeholder-${C.id}`)]})]},`row-group-${C.id}`)}),_.map((C,U)=>{if(!C.startDate||!C.endDate)return null;let{x:K,width:ne}=ie(C),me=U*a+14,ce=C.subtasks&&C.subtasks.length>0&&!C.isMilestone;return C.isMilestone?jsxRuntime.jsx(Ds,{task:C,x:K+ne/2,y:me+12,theme:t,onClick:u},C.id):ce?jsxRuntime.jsxs("g",{onClick:()=>u?.(C),onContextMenu:Ne=>{Ne.preventDefault(),Ne.stopPropagation(),p?.(C,Ne);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:K,y:me,width:ne,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:K,y1:me,x2:K+ne,y2:me,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:K,y1:me,x2:K,y2:me+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:K+ne,y1:me,x2:K+ne,y2:me+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:K,y1:me+24,x2:K+ne,y2:me+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),ne>60&&jsxRuntime.jsx("text",{x:K+12,y:me+12,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:C.name})]},C.id):jsxRuntime.jsx(Ts,{task:C,x:K,y:me,width:ne,theme:t,dayWidth:A*n,startDate:o,templates:c,onClick:u,onDoubleClick:d,onContextMenu:p,onDateChange:f,onDependencyCreate:v,allTaskPositions:Ee,onDragMove:L,onHoverChange:w},C.id)}),_.map((C,U)=>!C.dependencies||C.dependencies.length===0||!C.startDate||!C.endDate?null:C.dependencies.map(K=>{let ne=_.find(ot=>ot.id===K);if(!ne||!ne.startDate||!ne.endDate)return null;let me=_.findIndex(ot=>ot.id===K),ce=ie(ne),Ne=ie(C),Z=ce.x+ce.width,je=me*a+26,Be=Ne.x,Ye=U*a+26,dt=`dep-${K}-${C.id}`;return jsxRuntime.jsx(Cn,{x1:Z,y1:je,x2:Be,y2:Ye,theme:t,lineStyle:i,onDelete:()=>k?.(C.id,K),onHoverChange:ot=>{ot&&T({key:dt,fromId:K,toId:C.id,exitX:Z,exitY:je,enterX:Be,enterY:Ye});}},dt)})),h.map(C=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:C.previewX,y:C.y-48,width:C.width,height:32,rx:8,fill:C.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(C.daysDelta)>0&&jsxRuntime.jsx("text",{x:C.previewX+C.width/2,y:C.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:C.daysDelta>0?`+${C.daysDelta}d`:`${C.daysDelta}d`})]},`cascade-preview-${C.taskId}`)),D&&jsxRuntime.jsx(Cn,{x1:D.exitX,y1:D.exitY,x2:D.enterX,y2:D.enterY,theme:t,lineStyle:i,onDelete:()=>k?.(D.toId,D.fromId),hoverOverlayOnly:true,onHoverChange:C=>{C||T(null);}},`${D.key}-hover-overlay`),X>=0&&X<=N&&jsxRuntime.jsx("line",{x1:X,y1:0,x2:X,y2:ee,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),x&&jsxRuntime.jsx(Gu,{tooltipData:x,theme:t,locale:l==="es"?"es":"en"})]})]})}var xy=['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"'],ju=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),ky=()=>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"})}),wy=()=>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"})}),Cy=()=>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"})}),Ty=()=>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 Ps({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,u]=react.useState(false),[d,p]=react.useState(false),[f,v]=react.useState([]),[k,g]=react.useState(""),[y,h]=react.useState(false),[b,x]=react.useState(true),S=react.useRef(null),D=react.useRef(null),T=react.useRef(null),{enabled:w=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:A="bottom-right",onCommand:N,suggestions:H=xy,maxHistory:I=50,persistHistory:re}=a,E=re?.storageKey||"gantt-ai-history",_=re?.maxMessages??5;react.useEffect(()=>{if(re?.enabled)try{let ee=localStorage.getItem(E);if(ee){let U=JSON.parse(ee).map(K=>({...K,timestamp:new Date(K.timestamp)}));v(U.slice(-_));}}catch(ee){console.warn("[GanttAIAssistant] Failed to load persisted history:",ee);}},[re?.enabled,E,_]),react.useEffect(()=>{if(re?.enabled&&f.length>0)try{let ee=f.filter(C=>!C.isLoading).slice(-_);localStorage.setItem(E,JSON.stringify(ee));}catch(ee){console.warn("[GanttAIAssistant] Failed to persist history:",ee);}},[f,re?.enabled,E,_]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{i&&!d&&S.current&&setTimeout(()=>S.current?.focus(),100);},[i,d]);let ie=react.useCallback(ee=>{if(ee.success)switch(ee.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":ee.taskId&&ee.updates&&o?.(ee.taskId,ee.updates);break;case "create_task":ee.newTask&&s?.(ee.newTask);break;case "delete_task":ee.taskId&&n?.(ee.taskId);break;case "link_tasks":ee.dependencyFrom&&ee.dependencyTo&&l?.(ee.dependencyFrom,ee.dependencyTo);break;case "unlink_tasks":ee.taskId&&ee.dependencyFrom&&c?.(ee.taskId,ee.dependencyFrom);break}},[o,s,n,l,c]),Ee=react.useCallback(async ee=>{if(!ee.trim()||y)return;let C={id:`user-${Date.now()}`,role:"user",content:ee,timestamp:new Date};v(K=>[...K.slice(-(I-1)),C]),g(""),x(false),h(true);let U={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(K=>[...K,U]);try{if(N){let K=await N(ee,e);v(ne=>{let me=ne.filter(Ne=>!Ne.isLoading),ce={id:`assistant-${Date.now()}`,role:"assistant",content:K.message,timestamp:new Date,command:K};return [...me,ce]}),ie(K);}else v(K=>[...K.filter(me=>!me.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(K){v(ne=>[...ne.filter(ce=>!ce.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${K instanceof Error?K.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[y,I,N,e,ie]),L=ee=>{ee.preventDefault(),Ee(k);},xe=ee=>{g(ee),S.current?.focus();};if(react.useEffect(()=>{let ee=C=>{(C.metaKey||C.ctrlKey)&&C.key==="k"&&(C.preventDefault(),u(U=>!U),i||p(false)),C.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[i]),react.useEffect(()=>{if(!i)return;let ee=U=>{let K=U.target;T.current&&!T.current.contains(K)&&u(false);},C=setTimeout(()=>{document.addEventListener("mousedown",ee);},100);return ()=>{clearTimeout(C),document.removeEventListener("mousedown",ee);}},[i]),!w)return null;let X={"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(ht,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${X[A]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(ju,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${X[A]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(ju,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(ee=>!ee),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Cy,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(wy,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[f.length===0&&b&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:H.slice(0,4).map((ee,C)=>jsxRuntime.jsx("button",{onClick:()=>xe(ee),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:ee.length>30?ee.slice(0,30)+"...":ee},C))})]}),f.map(ee=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${ee.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${ee.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:ee.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:ee.role==="user"?"white":t.textPrimary},children:[ee.isLoading?jsxRuntime.jsx(Ty,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ee.content}),ee.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:ee.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:ee.command.success?"#10B981":"#EF4444"},children:[ee.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:ee.command.type.replace(/_/g," ")})]})]})},ee.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:L,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:S,type:"text",value:k,onChange:ee=>g(ee.target.value),placeholder:R,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!k.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(ky,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ku(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:p};if(!u)return {...d,present:p};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),c=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Yu({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&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 Ey={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ke.formatDate(e.startDate)} - ${ke.formatDate(e.endDate)}`);let a=ke.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=>ke.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function qu(e){return {...Ey,...e}}var Ry=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Zu=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:p=true,persistExpandedState:f,persistFilter:v,clearFiltersKey:k,aiAssistant:g,locale:y="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:x,onCreateTask:S,taskFilter:D,onTaskFilterChange:T,onThemeChange:w,onTaskClick:R,onTaskDblClick:A,onTaskContextMenu:N,onTaskUpdate:H,onProgressChange:I,onTaskEdit:re,onTaskAddSubtask:E,onTaskMarkIncomplete:_,onTaskSetInProgress:ie,onDependencyCreate:Ee,onDependencyDelete:L,onBeforeTaskAdd:xe,onAfterTaskAdd:X,onBeforeTaskUpdate:ee,onAfterTaskUpdate:C,onBeforeTaskDelete:U,onAfterTaskDelete:K,permissions:ne}=a,ce=react.useContext(gs)?.theme,[Ne,Z]=react.useState(ce||s||"dark"),[je,Be]=react.useState(n),[Ye,dt]=react.useState(l),[ot,Je]=react.useState(1),xt=react.useCallback(()=>v?typeof v=="string"?v:"gantt-filter-state":null,[v]),[gt,yt]=react.useState(()=>{if(!v)return "all";try{let P=typeof v=="string"?v:"gantt-filter-state",F=localStorage.getItem(P);if(F){let V=JSON.parse(F);if(V.taskFilter)return V.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),se=D??gt,B=T??yt,[J,pe]=react.useState(()=>{if(!v)return false;try{let P=typeof v=="string"?v:"gantt-filter-state",F=localStorage.getItem(P);if(F){let V=JSON.parse(F);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});react.useEffect(()=>{let P=xt();if(P)try{let F={taskFilter:se,hideCompleted:J};localStorage.setItem(P,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[se,J,xt]);let we=react.useRef(k);react.useEffect(()=>{if(we.current!==k&&k!==void 0){yt("all"),pe(false);let P=xt();if(P)try{localStorage.removeItem(P);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}we.current=k;},[k,xt]);let[$e,Qe]=react.useState(0),[nt,ze]=react.useState(false),[oa,G]=react.useState(null),[Y,be]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ze,Ce]=react.useState(null),[Fe,q]=react.useState(null);react.useEffect(()=>{ce&&ce!==Ne&&Z(ce);},[ce]),react.useEffect(()=>{s&&s!==Ne&&Z(s);},[s]);let Ue=react.useCallback(P=>{Z(P),w?.(P);},[w]),{state:z,setState:le,undo:Le,redo:_e,canUndo:Ge,canRedo:Re,clearHistory:$}=Ku(t,50),j=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),ye=react.useRef(new Map),qe=react.useRef(false);if(!qe.current&&f){qe.current=true;let P=typeof f=="string"?f:"gantt-expanded-tasks";try{let F=localStorage.getItem(P);if(F){let V=JSON.parse(F);Array.isArray(V)&&(ye.current=new Map(V));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let We=react.useCallback(()=>{let P=j();if(P)try{let F=Array.from(ye.current.entries());localStorage.setItem(P,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[j]);react.useEffect(()=>{let P=V=>{let oe=new Map;for(let ge of V){let ve=ge.id;oe.get(ve)||oe.set(ve,ge);}return Array.from(oe.values())},F=V=>V.map(oe=>{let ge=ye.current.get(oe.id),ve=ge!==void 0?{...oe,isExpanded:ge}:oe;if(ve.subtasks?.length){let wt=P(ve.subtasks);return {...ve,subtasks:F(wt)}}return ve});if(ye.current.size>0)le(F(t));else {let V=oe=>oe.map(ge=>ge.subtasks?.length?{...ge,subtasks:P(V(ge.subtasks))}:ge);le(V(t));}},[t,le]);let W=react.useRef(t),ue=react.useRef(true);react.useEffect(()=>{if(ue.current){ue.current=false,W.current=z;return}if(!r)return;let P=JSON.stringify(W.current),F=JSON.stringify(z);P!==F&&(W.current=z,r(z));},[z,r]);let Se=react.useMemo(()=>il(y,h),[y,h]),Ft=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}],[]),[lt,kr]=react.useState(()=>Ft(Se));react.useEffect(()=>{kr(P=>P.map(F=>({...F,label:Se.columns[F.id==="name"?"taskName":F.id]||F.label})));},[Se]);let Za=react.useMemo(()=>lt.filter(F=>F.visible).reduce((F,V)=>F+V.width,0),[lt]),lr=react.useRef(lt.filter(P=>P.visible).map(P=>P.id).join(","));react.useEffect(()=>{let P=lt.filter(oe=>oe.visible),F=P.map(oe=>oe.id).join(","),V=lr.current;if(F!==V){let oe=P.some(ve=>ve.id!=="name"),ge=V.includes(",");oe?!ge&&oe&&G(null):G(null),lr.current=F;}},[lt]);let Qa=60,De=.6,Rt=react.useMemo(()=>{let F=Za+Qa,V=typeof window<"u"?window.innerWidth*De:800,oe=Math.max(F,V);return oa!==null?Math.max(200,Math.min(oa,oe)):Math.max(200,F)},[oa,Za]),Ot=react.useRef(null),Da=react.useRef(null),wr=react.useRef(null),kt=react.useMemo(()=>xu(Ne),[Ne]),dr=react.useMemo(()=>({theme:kt,themeName:Ne}),[kt,Ne]),M=react.useMemo(()=>qu(d),[d]),ae=react.useMemo(()=>{if(!p)return z;let P=ke.calculateCriticalPath(z),F=V=>V.map(oe=>({...oe,isCriticalPath:P.includes(oe.id),subtasks:oe.subtasks?F(oe.subtasks):void 0}));return F(z)},[z,p]),Oe=react.useMemo(()=>{if(se==="all"&&!J)return ae;let P=F=>{let V=[];for(let oe of F){let ge=oe.subtasks?.length?P(oe.subtasks):void 0,ve=false;if(J)ve=oe.progress<100;else switch(se){case "all":ve=true;break;case "incomplete":ve=oe.progress<100;break;case "in_progress":ve=oe.progress>0&&oe.progress<100;break;case "completed":ve=oe.progress===100;break}(ve||ge&&ge.length>0)&&V.push({...oe,subtasks:ge});}return V};return P(ae)},[ae,se,J]),Xe=Ry(Ye);Yu({undo:Le,redo:_e,canUndo:Ge,canRedo:Re,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>ke.findTaskById(z,P),addTask:(P,F)=>{le(V=>{if(!F)return [...V,{...P,level:0}];let oe=ge=>ge.map(ve=>ve.id===F?{...ve,subtasks:[...ve.subtasks||[],{...P,parentId:F,level:(ve.level||0)+1}],isExpanded:true}:ve.subtasks?{...ve,subtasks:oe(ve.subtasks)}:ve);return oe(V)});},updateTask:(P,F)=>{le(V=>{let oe=ge=>ge.map(ve=>ve.id===P?{...ve,...F}:ve.subtasks?{...ve,subtasks:oe(ve.subtasks)}:ve);return oe(V)});},deleteTask:P=>{le(F=>{let V=oe=>oe.filter(ge=>ge.id===P?false:(ge.subtasks&&(ge.subtasks=V(ge.subtasks)),true));return V(F)});},deleteTasks:P=>{le(F=>yl(F,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let F=ke.findTaskById(z,P);F&&a.onTaskDuplicate(F);}else le(F=>vn(F,[P]).tasks);},splitTask:(P,F,V=3)=>{le(oe=>ke.splitTask(oe,P,F,V));},calculateEndDate:ke.calculateEndDate,calculateDuration:ke.calculateDuration,validateDependency:(P,F)=>!ke.validateDependencies(z,P,F),getAllTasks:()=>ke.flattenTasks(z),getTasksByStatus:P=>ke.flattenTasks(z).filter(F=>F.status===P),getTasksByParent:P=>P?ke.findTaskById(z,P)?.subtasks||[]:z.filter(V=>!V.parentId),getCriticalPath:()=>ke.flattenTasks(z).filter(P=>P.isCriticalPath),indentTask:P=>{le(F=>fl(F,[P]));},outdentTask:P=>{le(F=>hl(F,[P]));},moveTask:(P,F)=>{le(V=>bl(V,[P],F));},createSubtask:async P=>{let{tasks:F,newTask:V}=kl(z,P);if(xe){let oe=xe({...V,parentId:P});if((oe instanceof Promise?await oe:oe)===false)return}le(F),X&&X({...V,parentId:P});},scrollToTask:P=>{let V=ke.flattenTasks(z).findIndex(oe=>oe.id===P);if(V!==-1&&Ot.current){let oe=V*Xe;Ot.current.scrollTo({top:oe,behavior:"smooth"}),Da.current&&Da.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(P,F=2e3)=>{},expandTask:P=>{le(F=>{let V=oe=>oe.map(ge=>ge.id===P?{...ge,isExpanded:true}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(F)});},collapseTask:P=>{le(F=>{let V=oe=>oe.map(ge=>ge.id===P?{...ge,isExpanded:false}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(F)});},expandAll:()=>{le(P=>{let F=V=>V.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?F(oe.subtasks):void 0}));return F(P)});},collapseAll:()=>{le(P=>{let F=V=>V.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?F(oe.subtasks):void 0}));return F(P)});},undo:Le,redo:_e,canUndo:()=>Ge,canRedo:()=>Re,clearHistory:$,exportToPNG:async()=>{if(!wr.current||!Ot.current||!Da.current)throw new Error("Gantt container not found");let P=wr.current,F=Ot.current.querySelector(".gantt-grid-scroll"),V=Da.current,oe=F?.scrollTop||0,ge=V.scrollTop,ve=P.style.overflow,wt=P.style.height;try{let Ke=F?.querySelector(".gantt-taskgrid-content"),Vt=V.querySelector("svg"),At=Ke?.scrollHeight||F?.scrollHeight||600,ga=Vt?.getBoundingClientRect().height||V.scrollHeight,so=(P.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(At,ga)+20;F&&(F.scrollTop=0),V.scrollTop=0,P.style.overflow="visible",P.style.height=`${so}px`,await new Promise(Hr=>setTimeout(Hr,100));let Cr=await Ju__default.default(P,{backgroundColor:kt.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Hr=>{let Fo=window.getComputedStyle(Hr),io=parseInt(Fo.zIndex,10);return !isNaN(io)&&io>=50||Fo.position==="fixed"}});return new Promise((Hr,Fo)=>{Cr.toBlob(io=>{io?Hr(io):Fo(new Error("Failed to create blob from canvas"));},"image/png");})}finally{P.style.overflow=ve,P.style.height=wt,F&&(F.scrollTop=oe),V.scrollTop=ge;}},exportToPDF:async P=>{await ke.exportToPDF(z,P);},exportToExcel:async P=>{await ke.exportToExcel(z,P);},exportToJSON:()=>ke.exportToJSON(z),exportToCSV:()=>ke.exportToCSV(z),importFromJSON:P=>{let F=ke.importFromJSON(P);le(F);},getTasks:()=>z,refresh:()=>{le(P=>[...P]);},clearAll:()=>{le([]);}}),[z,Le,_e,Ge,Re,$,kt,Xe]);let da=react.useCallback(P=>{kr(F=>F.map(V=>V.id===P?{...V,visible:!V.visible}:V));},[]),ya=react.useCallback((P,F)=>{kr(V=>V.map(oe=>{if(oe.id!==P)return oe;let ge=oe.minWidth??100,ve=oe.maxWidth??800,wt=Math.max(ge,Math.min(ve,F));return {...oe,width:wt}}));},[]),Sa=react.useCallback(P=>{le(F=>{let V=xl(F,P),oe=ge=>{for(let ve of ge){if(ve.id===P){ye.current.set(P,ve.isExpanded??true);return}ve.subtasks?.length&&oe(ve.subtasks);}};return oe(V),We(),V}),a.onTaskToggleExpand?.(P);},[a,We]),Pa=react.useCallback((P,F)=>{if(ee&&ee(P,F)===false)return;let oe=ke.findTaskById(z,P)?.progress,ge=wt=>wt.map(Ke=>Ke.id===P?{...Ke,...F}:Ke.subtasks?{...Ke,subtasks:ge(Ke.subtasks)}:Ke);le(ge(z));let ve=ke.findTaskById(ge(z),P);ve&&(H?.(ve),C?.(ve),F.progress!==void 0&&oe!==void 0&&F.progress!==oe&&I?.(P,oe,F.progress));},[z,H,ee,C,I]),Ma=react.useCallback(P=>{P.length!==0&&(le(F=>fl(F,P)),a.onTaskIndent?.(P[0]));},[a]),Aa=react.useCallback(P=>{P.length!==0&&(le(F=>hl(F,P)),a.onTaskOutdent?.(P[0]));},[a]),tn=react.useCallback((P,F,V)=>{le(oe=>Bu(oe,P,F,V)),a.onTaskReparent?.(P,F,V);},[a]),hg=react.useCallback((P,F)=>{P.length!==0&&(le(V=>bl(V,P,F)),a.onTaskMove?.(P[0],F));},[a]),ei=react.useCallback(async P=>{let F=[];for(let V of P)U&&await Promise.resolve(U(V))===false||F.push(V);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(le(V=>yl(V,F)),F.forEach(V=>a.onTaskDelete?.(V))),K&&F.forEach(V=>K(V)));},[a,U,K]),bg=react.useCallback(P=>{a.onTaskDuplicate?P.forEach(F=>{let V=ke.findTaskById(z,F);V&&a.onTaskDuplicate(V);}):le(F=>vn(F,P).tasks);},[a,z]),yg=react.useCallback((P,F)=>{le(V=>{let{tasks:oe,newTask:ge}=Iu(V,P,F);return xe&&xe(ge)===false?V:(a.onTaskCreate?.(ge.parentId,ge.position||0),X?.(ge),oe)});},[a,xe,X]),vg=react.useCallback((P,F)=>{le(V=>vl(V,P,F)),a.onTaskRename?.(P,F);},[a]),ti=react.useCallback(P=>{let{onTaskAddSubtask:F}=a;if(F){let V=vs(z,P);if(V){F(V);return}}le(V=>{let{tasks:oe}=kl(V,P);return a.onTaskCreate?.(P,0),oe});},[a,z]),xg=react.useCallback((P,F,V)=>{let oe=P.startDate?Math.round((F.getTime()-P.startDate.getTime())/864e5):0,ge=Ke=>Ke.map(Vt=>Vt.id===P.id?{...Vt,startDate:F,endDate:V,...P.segments&&{segments:P.segments}}:Vt.subtasks?{...Vt,subtasks:ge(Vt.subtasks)}:Vt),ve=ge(z);ve=ke.autoScheduleDependents(ve,P.id,oe),le(ve);let wt={...P,startDate:F,endDate:V};H?.(wt);},[z,H]),kg=react.useCallback((P,F)=>{N?.(P,F),be({isOpen:true,x:F.clientX,y:F.clientY,task:P});},[N]),wg=react.useCallback((P,F)=>{let V=ke.splitTask(z,P.id,F);le(V),be({isOpen:false,x:0,y:0,task:null});},[z]),Fd=react.useCallback(P=>{let F=ke.findTaskById(z,P.id)||P;A?.(F),re||Ce(F);},[z,A,re]),Ad=react.useCallback((P,F,V)=>{let oe=new Map,ge=At=>{At.forEach(ga=>{ga.dependencies&&oe.set(ga.id,ga.dependencies),ga.subtasks&&ge(ga.subtasks);});};ge(V);let ve=oe.get(F)||[];oe.set(F,[...ve,P]);let wt=new Set,Ke=new Set,Vt=At=>{if(!wt.has(At)){wt.add(At),Ke.add(At);let ga=oe.get(At)||[];for(let er of ga){if(!wt.has(er)&&Vt(er))return true;if(Ke.has(er))return true}}return Ke.delete(At),false};return Vt(F)},[]),Ld=react.useCallback((P,F)=>{if(Ad(P.id,F,z)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
356
+ </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=we.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?we.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let v=t.find(w=>w.id===f);if(v){o(v);let w=r.get(f)?.ef||0;d=Math.max(d,w);}}let p=d+u;r.set(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?we.calculateDuration(i.startDate,i.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(i.id)),p=s;if(d.length>0)for(let v of d){l(v);let w=n.get(v.id)?.ls||0;p=Math.min(p,w);}let f=p-u;n.set(i.id,{ls:f,lf:p});};a.forEach(l);let c=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let p=d.ls-u.es;Math.abs(p)<.01&&c.push(i.id);}}return c},calculateSlack:(e,t)=>{let a=we.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(we.calculateCriticalPath(e).includes(t))return 0;let o=we.getDependentTasks(e,t);if(o.length===0){let l=we.getLatestEndDate(e);if(!l)return null;let c=we.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let n=we.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>we.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=we.findTaskById(e,t);if(!r||!r.endDate)return e;let o=we.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=we.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=we.calculateEndDate(c,l),u=d=>d.map(p=>p.id===n.id?{...p,startDate:c,endDate:i}:p.subtasks?{...p,subtasks:u(p.subtasks)}:p);s=u(s),s=we.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),u=1e3*60*60*24,d=we.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(f,v,w=new Set)=>{if(w.has(f))return;w.add(f);let g=we.getDependentTasks(e,f);for(let y of g){if(!y.startDate||!y.endDate)continue;let h=r.findIndex(T=>T.id===y.id);if(h===-1)continue;let b=y.startDate.getTime(),D=(y.endDate.getTime()-b)/u,C=(b-i)/u*s,k=C+v*s,R=Math.max(D*s,s),I=l+h*n+12;c.push({taskId:y.id,taskName:y.name,originalX:C,previewX:k,width:R,y:I,rowIndex:h,daysDelta:v,color:y.color}),p(y.id,v,w);}};return p(t,a),c},splitTask:(e,t,a,r=3)=>{let o=we.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ps({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",onTaskClick:u,onTaskDblClick:d,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:w}){let y=Zr(),[h,b]=react.useState([]),[x,D]=react.useState(null),[N,C]=react.useState(null),k=react.useRef(false),[R,I]=react.useState(new Set),T=react.useCallback(U=>{if(N&&!k.current){let K=U.target,le=false;for(;K&&K!==U.currentTarget;){if(K.getAttribute?.("data-dependency-line")==="true"||K.getAttribute?.("data-dependency-hover-overlay")==="true"){le=true;break}K=K.parentElement;}le||C(null);}},[N]),H=react.useCallback(U=>{D(U);},[]),A=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),ee=r==="day"?60:r==="week"?20:8,S=A*ee*n,Y=U=>{let K=new Date(Date.UTC(U.getFullYear(),U.getMonth(),U.getDate())),le=K.getUTCDay()||7;K.setUTCDate(K.getUTCDate()+4-le);let j=new Date(Date.UTC(K.getUTCFullYear(),0,1));return Math.ceil(((K.getTime()-j.getTime())/864e5+1)/7)},ue=U=>{let K=U.getDay();return K===0||K===6},Pe=react.useCallback(U=>{let K=Math.round(U/(ee*n)),le=new Date(o);return le.setDate(le.getDate()+K),le},[o,ee,n]),F=react.useCallback((U,K)=>{if(K.startDate&&K.endDate)return;let le=U.currentTarget.ownerSVGElement;if(!le)return;let j=le.createSVGPoint();j.x=U.clientX,j.y=U.clientY;let Ie=j.matrixTransform(le.getScreenCTM()?.inverse()),he=Pe(Ie.x),$e=new Date(he);$e.setDate($e.getDate()+1),f?.(K,he,$e);},[Pe,f]),pe=react.useMemo(()=>{let U=Ie=>Ie.map(he=>{if(he.subtasks&&he.subtasks.length>0){let $e=U(he.subtasks),Xe=$e.filter(tt=>tt.startDate&&tt.endDate);if(Xe.length>0){let tt=Xe.map(at=>at.startDate.getTime()),Ye=Xe.map(at=>at.endDate.getTime()),ht=new Date(Math.min(...tt)),it=new Date(Math.max(...Ye));return {...he,subtasks:$e,startDate:ht,endDate:it}}return {...he,subtasks:$e}}return he}),K=(Ie,he=[])=>{let $e=[...Ie].sort((Xe,tt)=>(Xe.position??0)-(tt.position??0));for(let Xe of $e)he.push(Xe),Xe.subtasks&&Xe.subtasks.length>0&&(Xe.isExpanded===void 0||Xe.isExpanded)&&K(Xe.subtasks,he);return he},le=U(e);return K(le)},[e]),J=react.useCallback(U=>{if(!U.startDate||!U.endDate)return {x:0,width:0};let K=U.startDate.getTime(),le=U.endDate.getTime(),j=o.getTime(),Ie=(K-j)/(1e3*60*60*24),he=(le-K)/(1e3*60*60*24),$e=Ie*ee*n,Xe=Math.max(ee*n,40),tt=Math.max(he*ee*n,Xe);return {x:$e,width:tt}},[o,ee,n]),te=react.useMemo(()=>pe.filter(U=>U.startDate&&U.endDate).map(U=>{let{x:K,width:le}=J(U),Ie=pe.findIndex(he=>he.id===U.id)*a+14;return {id:U.id,x:K,y:Ie,width:le,height:24}}),[pe,J]),L=react.useCallback((U,K,le)=>{if(!le||K===0){b([]);return}let j=we.calculateCascadePreview(e,U,K,pe,o,ee*n,a,48);b(j);},[e,pe,o,ee,n,a,48]),oe=react.useMemo(()=>{let U=[],K=new Date(o);for(;K<=s;){let Ie=(K.getTime()-o.getTime())/864e5*ee*n;if(r==="day")U.push({date:new Date(K),label:K.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Ie}),K.setDate(K.getDate()+1);else if(r==="week"){let he=Y(K);U.push({date:new Date(K),label:`${y.labels.week} ${he}`,x:Ie}),K.setDate(K.getDate()+7);}else U.push({date:new Date(K),label:K.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Ie}),K.setMonth(K.getMonth()+1);}return U},[o,s,r,ee,n,l,y.labels.week]),ie=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*ee*n,[o,ee,n]),Se=Math.max(pe.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(S,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(S,1e3),height:48,fill:t.bgGrid}),oe.map((U,K)=>jsxRuntime.jsxs("g",{children:[K>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-${K}`)),ie>=0&&ie<=S&&jsxRuntime.jsx("circle",{cx:ie,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(S,1e3),height:Se,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:T,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(S,1e3),height:Se,fill:t.bgPrimary}),oe.map((U,K)=>{let le=oe[K+1]?.x||S,j=ue(U.date);return jsxRuntime.jsxs("g",{children:[j&&jsxRuntime.jsx("rect",{x:U.x,y:0,width:le-U.x,height:pe.length*a,fill:t.bgWeekend,opacity:1}),K>0&&jsxRuntime.jsx("line",{x1:U.x,y1:0,x2:U.x,y2:pe.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},K)}),pe.map((U,K)=>{let le=U.startDate&&U.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:K*a,width:S,height:a,fill:K%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${U.id}`),!le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:K*a,width:S,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:j=>F(j,U),onMouseEnter:j=>{j.currentTarget.setAttribute("fill",t.accentLight),j.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:j=>{j.currentTarget.setAttribute("fill","transparent"),j.currentTarget.setAttribute("opacity","1");}},`clickable-${U.id}`),jsxRuntime.jsx("text",{x:ie>0?ie:100,y:K*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:y.labels.clickToSetDates},`placeholder-${U.id}`)]})]},`row-group-${U.id}`)}),pe.map((U,K)=>{if(!U.startDate||!U.endDate)return null;let{x:le,width:j}=J(U),Ie=K*a+14,he=U.subtasks&&U.subtasks.length>0&&!U.isMilestone;return U.isMilestone?jsxRuntime.jsx(Ds,{task:U,x:le+j/2,y:Ie+12,theme:t,onClick:u},U.id):he?jsxRuntime.jsxs("g",{onClick:()=>u?.(U),onContextMenu:$e=>{$e.preventDefault(),$e.stopPropagation(),p?.(U,$e);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:le,y:Ie,width:j,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:le,y1:Ie,x2:le+j,y2:Ie,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:le,y1:Ie,x2:le,y2:Ie+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:le+j,y1:Ie,x2:le+j,y2:Ie+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:le,y1:Ie+24,x2:le+j,y2:Ie+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),j>60&&jsxRuntime.jsx("text",{x:le+12,y:Ie+12,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:U.name})]},U.id):jsxRuntime.jsx(Ts,{task:U,x:le,y:Ie,width:j,theme:t,dayWidth:ee*n,startDate:o,templates:c,onClick:u,onDoubleClick:d,onContextMenu:p,onDateChange:f,onDependencyCreate:v,allTaskPositions:te,onDragMove:L,onHoverChange:H},U.id)}),pe.map((U,K)=>!U.dependencies||U.dependencies.length===0||!U.startDate||!U.endDate?null:U.dependencies.map(le=>{let j=pe.find(at=>at.id===le);if(!j||!j.startDate||!j.endDate)return null;let Ie=pe.findIndex(at=>at.id===le),he=J(j),$e=J(U),Xe=he.x+he.width,tt=Ie*a+26,Ye=$e.x,ht=K*a+26,it=`dep-${le}-${U.id}`;return R.has(it)?null:jsxRuntime.jsx(Tn,{x1:Xe,y1:tt,x2:Ye,y2:ht,theme:t,lineStyle:i,onDelete:()=>w?.(U.id,le),onHoverChange:at=>{k.current=at,at&&C({key:it,fromId:le,toId:U.id,exitX:Xe,exitY:tt,enterX:Ye,enterY:ht});}},it)})),h.map(U=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:U.previewX,y:U.y-48,width:U.width,height:32,rx:8,fill:U.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(U.daysDelta)>0&&jsxRuntime.jsx("text",{x:U.previewX+U.width/2,y:U.y-48+16,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}`)),N&&jsxRuntime.jsx(Tn,{x1:N.exitX,y1:N.exitY,x2:N.enterX,y2:N.enterY,theme:t,lineStyle:i,onDelete:()=>{let U=N.key;C(null),k.current=false,I(K=>new Set(K).add(U)),w?.(N.toId,N.fromId);},hoverOverlayOnly:true,onHoverChange:U=>{k.current=U,U||C(null);}},`${N.key}-hover-overlay`),ie>=0&&ie<=S&&jsxRuntime.jsx("line",{x1:ie,y1:0,x2:ie,y2:Se,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),x&&jsxRuntime.jsx(Gu,{tooltipData:x,theme:t,locale:l==="es"?"es":"en"})]})]})}var ky=['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"'],ju=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),wy=()=>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"})}),Cy=()=>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"})}),Ty=()=>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"})}),Ny=()=>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 Ms({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,u]=react.useState(false),[d,p]=react.useState(false),[f,v]=react.useState([]),[w,g]=react.useState(""),[y,h]=react.useState(false),[b,x]=react.useState(true),D=react.useRef(null),N=react.useRef(null),C=react.useRef(null),{enabled:k=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:T,suggestions:H=ky,maxHistory:A=50,persistHistory:ee}=a,S=ee?.storageKey||"gantt-ai-history",Y=ee?.maxMessages??5;react.useEffect(()=>{if(ee?.enabled)try{let te=localStorage.getItem(S);if(te){let oe=JSON.parse(te).map(ie=>({...ie,timestamp:new Date(ie.timestamp)}));v(oe.slice(-Y));}}catch(te){console.warn("[GanttAIAssistant] Failed to load persisted history:",te);}},[ee?.enabled,S,Y]),react.useEffect(()=>{if(ee?.enabled&&f.length>0)try{let te=f.filter(L=>!L.isLoading).slice(-Y);localStorage.setItem(S,JSON.stringify(te));}catch(te){console.warn("[GanttAIAssistant] Failed to persist history:",te);}},[f,ee?.enabled,S,Y]),react.useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{i&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[i,d]);let ue=react.useCallback(te=>{if(te.success)switch(te.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":te.taskId&&te.updates&&o?.(te.taskId,te.updates);break;case "create_task":te.newTask&&s?.(te.newTask);break;case "delete_task":te.taskId&&n?.(te.taskId);break;case "link_tasks":te.dependencyFrom&&te.dependencyTo&&l?.(te.dependencyFrom,te.dependencyTo);break;case "unlink_tasks":te.taskId&&te.dependencyFrom&&c?.(te.taskId,te.dependencyFrom);break}},[o,s,n,l,c]),Pe=react.useCallback(async te=>{if(!te.trim()||y)return;let L={id:`user-${Date.now()}`,role:"user",content:te,timestamp:new Date};v(ie=>[...ie.slice(-(A-1)),L]),g(""),x(false),h(true);let oe={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(ie=>[...ie,oe]);try{if(T){let ie=await T(te,e);v(Se=>{let U=Se.filter(le=>!le.isLoading),K={id:`assistant-${Date.now()}`,role:"assistant",content:ie.message,timestamp:new Date,command:ie};return [...U,K]}),ue(ie);}else v(ie=>[...ie.filter(U=>!U.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(ie){v(Se=>[...Se.filter(K=>!K.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ie instanceof Error?ie.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[y,A,T,e,ue]),F=te=>{te.preventDefault(),Pe(w);},pe=te=>{g(te),D.current?.focus();};if(react.useEffect(()=>{let te=L=>{(L.metaKey||L.ctrlKey)&&L.key==="k"&&(L.preventDefault(),u(oe=>!oe),i||p(false)),L.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[i]),react.useEffect(()=>{if(!i)return;let te=oe=>{let ie=oe.target;C.current&&!C.current.contains(ie)&&u(false);},L=setTimeout(()=>{document.addEventListener("mousedown",te);},100);return ()=>{clearTimeout(L),document.removeEventListener("mousedown",te);}},[i]),!k)return null;let J={"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(vt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${J[I]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(ju,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:C,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${J[I]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(ju,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(te=>!te),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Ty,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Cy,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[f.length===0&&b&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:H.slice(0,4).map((te,L)=>jsxRuntime.jsx("button",{onClick:()=>pe(te),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:te.length>30?te.slice(0,30)+"...":te},L))})]}),f.map(te=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${te.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${te.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:te.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:te.role==="user"?"white":t.textPrimary},children:[te.isLoading?jsxRuntime.jsx(Ny,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:te.content}),te.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:te.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:te.command.success?"#10B981":"#EF4444"},children:[te.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:te.command.type.replace(/_/g," ")})]})]})},te.id)),jsxRuntime.jsx("div",{ref:N})]}),jsxRuntime.jsxs("form",{onSubmit:F,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:D,type:"text",value:w,onChange:te=>g(te.target.value),placeholder:R,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!w.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(wy,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ku(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:p};if(!u)return {...d,present:p};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),c=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Yu({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&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 Py={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${we.formatDate(e.startDate)} - ${we.formatDate(e.endDate)}`);let a=we.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=>we.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function qu(e){return {...Py,...e}}var Oy=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Zu=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:p=true,persistExpandedState:f,persistFilter:v,clearFiltersKey:w,aiAssistant:g,locale:y="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:x,onCreateTask:D,taskFilter:N,onTaskFilterChange:C,onThemeChange:k,onTaskClick:R,onTaskDblClick:I,onTaskContextMenu:T,onTaskUpdate:H,onProgressChange:A,onTaskEdit:ee,onTaskAddSubtask:S,onTaskMarkIncomplete:Y,onTaskSetInProgress:ue,onDependencyCreate:Pe,onDependencyDelete:F,onBeforeTaskAdd:pe,onAfterTaskAdd:J,onBeforeTaskUpdate:te,onAfterTaskUpdate:L,onBeforeTaskDelete:oe,onAfterTaskDelete:ie,permissions:Se}=a,K=react.useContext(gs)?.theme,[le,j]=react.useState(K||s||"dark"),[Ie,he]=react.useState(n),[$e,Xe]=react.useState(l),[tt,Ye]=react.useState(1),ht=react.useCallback(()=>v?typeof v=="string"?v:"gantt-filter-state":null,[v]),[it,at]=react.useState(()=>{if(!v)return "all";try{let E=typeof v=="string"?v:"gantt-filter-state",M=localStorage.getItem(E);if(M){let V=JSON.parse(M);if(V.taskFilter)return V.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),se=N??it,B=C??at,[Z,ge]=react.useState(()=>{if(!v)return false;try{let E=typeof v=="string"?v:"gantt-filter-state",M=localStorage.getItem(E);if(M){let V=JSON.parse(M);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=ht();if(E)try{let M={taskFilter:se,hideCompleted:Z};localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[se,Z,ht]);let Ce=react.useRef(w);react.useEffect(()=>{if(Ce.current!==w&&w!==void 0){at("all"),ge(false);let E=ht();if(E)try{localStorage.removeItem(E);}catch(M){console.warn("[GanttBoard] Error clearing filter state from localStorage:",M);}}Ce.current=w;},[w,ht]);let[Ue,et]=react.useState(0),[lt,He]=react.useState(false),[ra,G]=react.useState(null),[q,ve]=react.useState({isOpen:false,x:0,y:0,task:null}),[Qe,Te]=react.useState(null),[Ae,X]=react.useState(null);react.useEffect(()=>{K&&K!==le&&j(K);},[K]),react.useEffect(()=>{s&&s!==le&&j(s);},[s]);let We=react.useCallback(E=>{j(E),k?.(E);},[k]),{state:z,setState:de,undo:Be,redo:Ke,canUndo:_e,canRedo:Oe,clearHistory:$}=Ku(t,50),_=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),xe=react.useRef(new Map),Je=react.useRef(false);if(!Je.current&&f){Je.current=true;let E=typeof f=="string"?f:"gantt-expanded-tasks";try{let M=localStorage.getItem(E);if(M){let V=JSON.parse(M);Array.isArray(V)&&(xe.current=new Map(V));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let Ve=react.useCallback(()=>{let E=_();if(E)try{let M=Array.from(xe.current.entries());localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[_]);react.useEffect(()=>{let E=V=>{let ne=new Map;for(let fe of V){let ke=fe.id;ne.get(ke)||ne.set(ke,fe);}return Array.from(ne.values())},M=V=>V.map(ne=>{let fe=xe.current.get(ne.id),ke=fe!==void 0?{...ne,isExpanded:fe}:ne;if(ke.subtasks?.length){let kt=E(ke.subtasks);return {...ke,subtasks:M(kt)}}return ke});if(xe.current.size>0)de(M(t));else {let V=ne=>ne.map(fe=>fe.subtasks?.length?{...fe,subtasks:E(V(fe.subtasks))}:fe);de(V(t));}},[t,de]);let W=react.useRef(t),me=react.useRef(true);react.useEffect(()=>{if(me.current){me.current=false,W.current=z;return}if(!r)return;let E=JSON.stringify(W.current),M=JSON.stringify(z);E!==M&&(W.current=z,r(z));},[z,r]);let Ee=react.useMemo(()=>ll(y,h),[y,h]),At=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ut,kr]=react.useState(()=>At(Ee));react.useEffect(()=>{kr(E=>E.map(M=>({...M,label:Ee.columns[M.id==="name"?"taskName":M.id]||M.label})));},[Ee]);let Za=react.useMemo(()=>ut.filter(M=>M.visible).reduce((M,V)=>M+V.width,0),[ut]),lr=react.useRef(ut.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=ut.filter(ne=>ne.visible),M=E.map(ne=>ne.id).join(","),V=lr.current;if(M!==V){let ne=E.some(ke=>ke.id!=="name"),fe=V.includes(",");ne?!fe&&ne&&G(null):G(null),lr.current=M;}},[ut]);let Qa=60,De=.6,Rt=react.useMemo(()=>{let M=Za+Qa,V=typeof window<"u"?window.innerWidth*De:800,ne=Math.max(M,V);return ra!==null?Math.max(200,Math.min(ra,ne)):Math.max(200,M)},[ra,Za]),Ot=react.useRef(null),Da=react.useRef(null),wr=react.useRef(null),Ct=react.useMemo(()=>xu(le),[le]),dr=react.useMemo(()=>({theme:Ct,themeName:le}),[Ct,le]),P=react.useMemo(()=>qu(d),[d]),re=react.useMemo(()=>{if(!p)return z;let E=we.calculateCriticalPath(z),M=V=>V.map(ne=>({...ne,isCriticalPath:E.includes(ne.id),subtasks:ne.subtasks?M(ne.subtasks):void 0}));return M(z)},[z,p]),ze=react.useMemo(()=>{if(se==="all"&&!Z)return re;let E=M=>{let V=[];for(let ne of M){let fe=ne.subtasks?.length?E(ne.subtasks):void 0,ke=false;if(Z)ke=ne.progress<100;else switch(se){case "all":ke=true;break;case "incomplete":ke=ne.progress<100;break;case "in_progress":ke=ne.progress>0&&ne.progress<100;break;case "completed":ke=ne.progress===100;break}(ke||fe&&fe.length>0)&&V.push({...ne,subtasks:fe});}return V};return E(re)},[re,se,Z]),Ze=Oy($e);Yu({undo:Be,redo:Ke,canUndo:_e,canRedo:Oe,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>we.findTaskById(z,E),addTask:(E,M)=>{de(V=>{if(!M)return [...V,{...E,level:0}];let ne=fe=>fe.map(ke=>ke.id===M?{...ke,subtasks:[...ke.subtasks||[],{...E,parentId:M,level:(ke.level||0)+1}],isExpanded:true}:ke.subtasks?{...ke,subtasks:ne(ke.subtasks)}:ke);return ne(V)});},updateTask:(E,M)=>{de(V=>{let ne=fe=>fe.map(ke=>ke.id===E?{...ke,...M}:ke.subtasks?{...ke,subtasks:ne(ke.subtasks)}:ke);return ne(V)});},deleteTask:E=>{de(M=>{let V=ne=>ne.filter(fe=>fe.id===E?false:(fe.subtasks&&(fe.subtasks=V(fe.subtasks)),true));return V(M)});},deleteTasks:E=>{de(M=>vl(M,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let M=we.findTaskById(z,E);M&&a.onTaskDuplicate(M);}else de(M=>xn(M,[E]).tasks);},splitTask:(E,M,V=3)=>{de(ne=>we.splitTask(ne,E,M,V));},calculateEndDate:we.calculateEndDate,calculateDuration:we.calculateDuration,validateDependency:(E,M)=>!we.validateDependencies(z,E,M),getAllTasks:()=>we.flattenTasks(z),getTasksByStatus:E=>we.flattenTasks(z).filter(M=>M.status===E),getTasksByParent:E=>E?we.findTaskById(z,E)?.subtasks||[]:z.filter(V=>!V.parentId),getCriticalPath:()=>we.flattenTasks(z).filter(E=>E.isCriticalPath),indentTask:E=>{de(M=>hl(M,[E]));},outdentTask:E=>{de(M=>bl(M,[E]));},moveTask:(E,M)=>{de(V=>yl(V,[E],M));},createSubtask:async E=>{let{tasks:M,newTask:V}=wl(z,E);if(pe){let ne=pe({...V,parentId:E});if((ne instanceof Promise?await ne:ne)===false)return}de(M),J&&J({...V,parentId:E});},scrollToTask:E=>{let V=we.flattenTasks(z).findIndex(ne=>ne.id===E);if(V!==-1&&Ot.current){let ne=V*Ze;Ot.current.scrollTo({top:ne,behavior:"smooth"}),Da.current&&Da.current.scrollTo({top:ne,behavior:"smooth"});}},highlightTask:(E,M=2e3)=>{},expandTask:E=>{de(M=>{let V=ne=>ne.map(fe=>fe.id===E?{...fe,isExpanded:true}:fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe);return V(M)});},collapseTask:E=>{de(M=>{let V=ne=>ne.map(fe=>fe.id===E?{...fe,isExpanded:false}:fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe);return V(M)});},expandAll:()=>{de(E=>{let M=V=>V.map(ne=>({...ne,isExpanded:true,subtasks:ne.subtasks?M(ne.subtasks):void 0}));return M(E)});},collapseAll:()=>{de(E=>{let M=V=>V.map(ne=>({...ne,isExpanded:false,subtasks:ne.subtasks?M(ne.subtasks):void 0}));return M(E)});},undo:Be,redo:Ke,canUndo:()=>_e,canRedo:()=>Oe,clearHistory:$,exportToPNG:async()=>{if(!wr.current||!Ot.current||!Da.current)throw new Error("Gantt container not found");let E=wr.current,M=Ot.current.querySelector(".gantt-grid-scroll"),V=Da.current,ne=M?.scrollTop||0,fe=V.scrollTop,ke=E.style.overflow,kt=E.style.height;try{let qe=M?.querySelector(".gantt-taskgrid-content"),pa=V.querySelector("svg"),yt=qe?.scrollHeight||M?.scrollHeight||600,ga=pa?.getBoundingClientRect().height||V.scrollHeight,so=(E.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(yt,ga)+20;M&&(M.scrollTop=0),V.scrollTop=0,E.style.overflow="visible",E.style.height=`${so}px`,await new Promise(Hr=>setTimeout(Hr,100));let Cr=await Ju__default.default(E,{backgroundColor:Ct.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Hr=>{let Fo=window.getComputedStyle(Hr),io=parseInt(Fo.zIndex,10);return !isNaN(io)&&io>=50||Fo.position==="fixed"}});return new Promise((Hr,Fo)=>{Cr.toBlob(io=>{io?Hr(io):Fo(new Error("Failed to create blob from canvas"));},"image/png");})}finally{E.style.overflow=ke,E.style.height=kt,M&&(M.scrollTop=ne),V.scrollTop=fe;}},exportToPDF:async E=>{await we.exportToPDF(z,E);},exportToExcel:async E=>{await we.exportToExcel(z,E);},exportToJSON:()=>we.exportToJSON(z),exportToCSV:()=>we.exportToCSV(z),importFromJSON:E=>{let M=we.importFromJSON(E);de(M);},getTasks:()=>z,refresh:()=>{de(E=>[...E]);},clearAll:()=>{de([]);}}),[z,Be,Ke,_e,Oe,$,Ct,Ze]);let la=react.useCallback(E=>{kr(M=>M.map(V=>V.id===E?{...V,visible:!V.visible}:V));},[]),ya=react.useCallback((E,M)=>{kr(V=>V.map(ne=>{if(ne.id!==E)return ne;let fe=ne.minWidth??100,ke=ne.maxWidth??800,kt=Math.max(fe,Math.min(ke,M));return {...ne,width:kt}}));},[]),Sa=react.useCallback(E=>{de(M=>{let V=kl(M,E),ne=fe=>{for(let ke of fe){if(ke.id===E){xe.current.set(E,ke.isExpanded??true);return}ke.subtasks?.length&&ne(ke.subtasks);}};return ne(V),Ve(),V}),a.onTaskToggleExpand?.(E);},[a,Ve]),Pa=react.useCallback((E,M)=>{if(te&&te(E,M)===false)return;let ne=we.findTaskById(z,E)?.progress,fe=kt=>kt.map(qe=>qe.id===E?{...qe,...M}:qe.subtasks?{...qe,subtasks:fe(qe.subtasks)}:qe);de(fe(z));let ke=we.findTaskById(fe(z),E);ke&&(H?.(ke),L?.(ke),M.progress!==void 0&&ne!==void 0&&M.progress!==ne&&A?.(E,ne,M.progress));},[z,H,te,L,A]),Ma=react.useCallback(E=>{E.length!==0&&(de(M=>hl(M,E)),a.onTaskIndent?.(E[0]));},[a]),Aa=react.useCallback(E=>{E.length!==0&&(de(M=>bl(M,E)),a.onTaskOutdent?.(E[0]));},[a]),an=react.useCallback((E,M,V)=>{de(ne=>Bu(ne,E,M,V)),a.onTaskReparent?.(E,M,V);},[a]),hg=react.useCallback((E,M)=>{E.length!==0&&(de(V=>yl(V,E,M)),a.onTaskMove?.(E[0],M));},[a]),ti=react.useCallback(async E=>{let M=[];for(let V of E)oe&&await Promise.resolve(oe(V))===false||M.push(V);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(de(V=>vl(V,M)),M.forEach(V=>a.onTaskDelete?.(V))),ie&&M.forEach(V=>ie(V)));},[a,oe,ie]),bg=react.useCallback(E=>{a.onTaskDuplicate?E.forEach(M=>{let V=we.findTaskById(z,M);V&&a.onTaskDuplicate(V);}):de(M=>xn(M,E).tasks);},[a,z]),yg=react.useCallback((E,M)=>{de(V=>{let{tasks:ne,newTask:fe}=Iu(V,E,M);return pe&&pe(fe)===false?V:(a.onTaskCreate?.(fe.parentId,fe.position||0),J?.(fe),ne)});},[a,pe,J]),vg=react.useCallback((E,M)=>{de(V=>xl(V,E,M)),a.onTaskRename?.(E,M);},[a]),ai=react.useCallback(E=>{let{onTaskAddSubtask:M}=a;if(M){let V=vs(z,E);if(V){M(V);return}}de(V=>{let{tasks:ne}=wl(V,E);return a.onTaskCreate?.(E,0),ne});},[a,z]),xg=react.useCallback((E,M,V)=>{let ne=!E.startDate&&!E.endDate,fe=E.startDate?Math.round((M.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,ke=pa=>pa.map(yt=>yt.id===E.id?{...yt,startDate:M,endDate:V,...E.segments&&{segments:E.segments}}:yt.subtasks?{...yt,subtasks:ke(yt.subtasks)}:yt),kt=ke(z);kt=we.autoScheduleDependents(kt,E.id,fe),de(kt);let qe={...E,startDate:M,endDate:V};ne&&a?.onTaskDateChange?a.onTaskDateChange(E,M,V):H?.(qe);},[z,H,a]),kg=react.useCallback((E,M)=>{T?.(E,M),ve({isOpen:true,x:M.clientX,y:M.clientY,task:E});},[T]),wg=react.useCallback((E,M)=>{let V=we.splitTask(z,E.id,M);de(V),ve({isOpen:false,x:0,y:0,task:null});},[z]),Fd=react.useCallback(E=>{let M=we.findTaskById(z,E.id)||E;I?.(M),ee||Te(M);},[z,I,ee]),Ad=react.useCallback((E,M,V)=>{let ne=new Map,fe=yt=>{yt.forEach(ga=>{ga.dependencies&&ne.set(ga.id,ga.dependencies),ga.subtasks&&fe(ga.subtasks);});};fe(V);let ke=ne.get(M)||[];ne.set(M,[...ke,E]);let kt=new Set,qe=new Set,pa=yt=>{if(!kt.has(yt)){kt.add(yt),qe.add(yt);let ga=ne.get(yt)||[];for(let er of ga){if(!kt.has(er)&&pa(er))return true;if(qe.has(er))return true}}return qe.delete(yt),false};return pa(M)},[]),Ld=react.useCallback((E,M)=>{if(Ad(E.id,M,z)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
357
357
 
358
- Task dependencies must flow in one direction only.`);return}let V=oe=>oe.map(ge=>{if(ge.id===F){let ve=ge.dependencies||[];if(!ve.includes(P.id))return {...ge,dependencies:[...ve,P.id]}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});le(V(z)),Ee?.(P.id,F);},[z,Ee,Ad]),Id=react.useCallback((P,F)=>{let V=oe=>oe.map(ge=>{if(ge.id===P&&ge.dependencies){let ve=ge.dependencies.filter(wt=>wt!==F);return {...ge,dependencies:ve}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});le(V(z)),L?.(P,F);},[z,L]),{startDate:Un,endDate:Cg}=react.useMemo(()=>{let P=z.filter(ve=>ve.startDate&&ve.endDate);if(P.length===0){let ve=new Date,wt=new Date(ve);wt.setDate(wt.getDate()-30);let Ke=new Date(ve);return Ke.setDate(Ke.getDate()+60),{startDate:wt,endDate:Ke}}let F=P.flatMap(ve=>[ve.startDate,ve.endDate]).filter(ve=>ve!==void 0),V=new Date(Math.min(...F.map(ve=>ve.getTime()))),oe=new Date(Math.max(...F.map(ve=>ve.getTime()))),ge=je==="day"?7:je==="week"?14:30;return V.setDate(V.getDate()-ge),oe.setDate(oe.getDate()+ge),{startDate:V,endDate:oe}},[z,je]),Tg=react.useCallback(async()=>{if(!wr.current||!Ot.current||!Da.current)return;await new Promise(so=>setTimeout(so,200));let P=wr.current,F=Ot.current.querySelector(".gantt-grid-scroll"),V=Da.current,oe=F?.scrollTop||0,ge=F?.scrollLeft||0,ve=V.scrollTop,wt=V.scrollLeft,Ke=P.style.overflow,Vt=P.style.height,At=F?.style.overflow||"",ga=V.style.overflow,er=P.style.width,Mo=V.style.width;try{let so=F?.querySelector(".gantt-taskgrid-content"),Cr=V.querySelector("svg"),Hr=Cr?.getAttribute("height")?parseInt(Cr.getAttribute("height"),10):Cr?.getBoundingClientRect().height||0,Fo=so?.scrollHeight||F?.scrollHeight||600,io=Math.max(Hr,V.scrollHeight),Od=Cr?.getAttribute("width")?parseInt(Cr.getAttribute("width"),10):Cr?.getBoundingClientRect().width||V.scrollWidth,Ag=P.querySelector('[class*="h-12"]')?.offsetHeight||48,ri=Math.max(Fo,io,Hr),oi=Ag+ri+50,ni=(F?.offsetWidth||300)+Od+10;F&&(F.scrollTop=0,F.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,P.style.overflow="visible",P.style.height=`${oi}px`,P.style.width=`${ni}px`,F&&(F.style.overflow="visible",F.style.height=`${ri+50}px`),V.style.overflow="visible",V.style.height=`${ri+50}px`,V.style.width=`${Od+10}px`,await new Promise(ii=>setTimeout(ii,150));let Lg=await Ju__default.default(P,{backgroundColor:kt.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:ni,height:oi,windowWidth:ni+100,windowHeight:oi+100,scrollX:0,scrollY:0,ignoreElements:ii=>{let $d=window.getComputedStyle(ii),zd=parseInt($d.zIndex,10);return !isNaN(zd)&&zd>=50||$d.position==="fixed"}}),si=document.createElement("a");si.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,si.href=Lg.toDataURL("image/png"),si.click();}finally{P.style.overflow=Ke,P.style.height=Vt,P.style.width=er,F&&(F.style.overflow=At,F.style.height="",F.scrollTop=oe,F.scrollLeft=ge),V.style.overflow=ga,V.style.height="",V.style.width=Mo,V.scrollTop=ve,V.scrollLeft=wt;}},[kt]),Ng=react.useCallback(async()=>{await ke.exportToPDF(z);},[z]),Dg=react.useCallback(async()=>{await ke.exportToExcel(z);},[z]),Sg=react.useCallback(()=>{let P=ke.exportToCSV(z),F=new Blob([P],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(F),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[z]),Eg=react.useCallback(()=>{let P=ke.exportToJSON(z),F=new Blob([P],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(F),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[z]),Pg=react.useCallback(()=>{ke.exportToMSProject(z,"Gantt Project","project.xml");},[z]),Mg=P=>{P.preventDefault(),ze(true);},Po=react.useRef(false),[ai,Bd]=react.useState(false),an=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let P=Da.current,F=Ot.current?.querySelector(".gantt-grid-scroll");if(!P||!F)return;let V=()=>{if(Po.current)return;Po.current=true;let Ke=P.scrollTop;Qe(Ke),F.scrollTop=Ke,requestAnimationFrame(()=>{Po.current=false;});},oe=()=>{if(Po.current)return;Po.current=true;let Ke=F.scrollTop;Qe(Ke),P.scrollTop=Ke,requestAnimationFrame(()=>{Po.current=false;});},ge=Ke=>{if(nt&&F){let At=F.parentElement?.getBoundingClientRect()?.left||0,ga=Ke.clientX-At,er=200,Mo=Za+Qa,so=window.innerWidth*De,Cr=Math.max(Mo,so);ga>=er&&ga<=Cr&&G(ga);}if(ai&&P){let Vt=Ke.clientX-an.current.x,At=Ke.clientY-an.current.y;P.scrollLeft=an.current.scrollLeft-Vt,P.scrollTop=an.current.scrollTop-At;}},ve=()=>{ze(false),Bd(false);},wt=Ke=>{if(Ke.button!==0)return;let Vt=Ke.target;Vt.closest("[data-task-bar]")||Vt.closest("[data-dependency-line]")||Vt.closest("button")||Vt.closest('[role="button"]')||Vt.tagName==="rect"&&Vt.getAttribute("data-clickable")==="true"||(Bd(true),an.current={x:Ke.clientX,y:Ke.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},Ke.preventDefault());};return P.addEventListener("scroll",V),F.addEventListener("scroll",oe),P.addEventListener("mousedown",wt),document.addEventListener("mousemove",ge),document.addEventListener("mouseup",ve),()=>{P.removeEventListener("scroll",V),F.removeEventListener("scroll",oe),P.removeEventListener("mousedown",wt),document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",ve);}},[nt,ai,Za]);let Rd=react.useRef(false),Fg=react.useRef(null);return react.useLayoutEffect(()=>{if(Rd.current||z.length===0||!Da.current)return;Rd.current=true,Fg.current=Un;let P=Da.current,F=new Date,V=je==="day"?60:je==="week"?20:8,oe=(F.getTime()-Un.getTime())/(1e3*60*60*24),ge=P.clientWidth,wt=oe*V*ot-ge/2;oe>=0&&ge>0&&(P.scrollLeft=Math.max(0,wt));},[z.length,Un,je,ot]),jsxRuntime.jsx(_o.Provider,{value:Se,children:jsxRuntime.jsx(mi.Provider,{value:dr,children:jsxRuntime.jsxs("div",{ref:wr,className:"flex flex-col h-full w-full",style:{backgroundColor:kt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(bs,{theme:kt,timeScale:je,onTimeScaleChange:Be,zoom:ot,onZoomChange:Je,currentTheme:Ne,onThemeChange:Ue,rowDensity:Ye,onRowDensityChange:dt,showThemeSelector:c,showCreateTaskButton:b&&ne?.canCreateTask!==false&&!ne?.canCreateSubtaskOnly,createTaskLabel:x,onCreateTask:S,taskFilter:se,onTaskFilterChange:B,hideCompleted:J,onHideCompletedChange:pe,onExportPNG:i?Tg:void 0,onExportPDF:i?Ng:void 0,onExportExcel:i?Dg:void 0,onExportCSV:i?Sg:void 0,onExportJSON:i?Eg:void 0,onExportMSProject:i?Pg:void 0}),jsxRuntime.jsxs("div",{ref:Ot,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Rt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ws,{tasks:Oe,theme:kt,rowHeight:Xe,availableUsers:u,templates:M,onTaskClick:R,onTaskDblClick:Fd,onTaskContextMenu:N,onTaskToggle:Sa,scrollTop:$e,columns:lt,onToggleColumn:da,onColumnResize:ya,onTaskUpdate:Pa,onTaskIndent:Ma,onTaskOutdent:Aa,onTaskMove:hg,onMultiTaskDelete:ei,onTaskDuplicate:bg,onTaskCreate:yg,onTaskRename:vg,onCreateSubtask:ti,onOpenTaskModal:R?P=>R(P):void 0,onDeleteRequest:(P,F)=>q({taskId:P,taskName:F}),onTaskReparent:tn})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:kt.border,zIndex:15},onMouseDown:Mg}),jsxRuntime.jsx("div",{ref:Da,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ai?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Es,{tasks:Oe,theme:kt,rowHeight:Xe,timeScale:je,startDate:Un,endDate:Cg,zoom:ot,locale:y,templates:M,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:R,onTaskDblClick:Fd,onTaskContextMenu:kg,onTaskDateChange:xg,onDependencyCreate:Ld,onDependencyDelete:Id})})]}),Y.task&&jsxRuntime.jsx(jo,{isOpen:Y.isOpen,x:Y.x,y:Y.y,theme:kt,onClose:()=>be({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=Y.task;if(!P)return [];let F=ke.findTaskById(z,P.id)||P,V=F.subtasks&&F.subtasks.length>0,oe=ne?.canCreateTask!==false,ge=ne?.canDeleteTask!==false;if(V){let At=[],ga=ne?.canDuplicateTask!==false;return oe&&At.push({id:"addSubtask",label:Se.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{E?E(F):ti(F.id);}}),ga&&At.push({id:"duplicate",label:Se.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):le(er=>vn(er,[F.id]).tasks),be({isOpen:false,x:0,y:0,task:null});}}),ge&&(At.length>0&&At.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),At.push({id:"delete",label:Se.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{q({taskId:F.id,taskName:F.name});}})),At}let ve=ne?.canUpdateTask!==false,wt=ne?.canDuplicateTask!==false,Ke=[];return ve&&Ke.push({id:"edit",label:Se.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{re?re(F):Ce(F);}}),oe&&Ke.push({id:"addSubtask",label:Se.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{E?E(F):ti(F.id);}}),Ke.length>0&&ve&&Ke.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ve&&(Ke.push({id:"markIncomplete",label:Se.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{_?_(F):Pa(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),Ke.push({id:"setInProgress",label:Se.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{ie?ie(F):Pa(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),Ke.push({id:"markComplete",label:Se.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{Pa(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(wt||ve&&F.startDate&&F.endDate)&&Ke.length>0&&Ke.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),wt&&Ke.push({id:"duplicate",label:Se.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):le(At=>vn(At,[F.id]).tasks),be({isOpen:false,x:0,y:0,task:null});}}),ve&&F.startDate&&F.endDate&&Ke.push({id:"split",label:Se.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{let At=F.startDate.getTime(),ga=F.endDate.getTime(),er=At+(ga-At)/2,Mo=new Date(er);wg(F,Mo);}}),ge&&(Ke.length>0&&Ke.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ke.push({id:"delete",label:Se.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{q({taskId:F.id,taskName:F.name});}})),Ke})()}),jsxRuntime.jsx(Ir,{task:Ze,isOpen:!!Ze,onClose:()=>Ce(null),onTaskUpdate:P=>{Ze&&(Pa(Ze.id,P),Ce(null));},theme:Ne==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Fe&&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:()=>q(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:kt.bgSecondary,border:`1px solid ${kt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${kt.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:kt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Se.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:kt.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="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:kt.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:kt.textPrimary},children:['"',Fe.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:kt.bgPrimary,borderTop:`1px solid ${kt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>q(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:kt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=kt.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ei([Fe.taskId]),q(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"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),g?.enabled&&jsxRuntime.jsx(Ps,{tasks:z,theme:kt,config:g,onTasksUpdate:le,onTaskUpdate:Pa,onTaskCreate:P=>{le(F=>[...F,P]);},onTaskDelete:P=>{ei([P]);},onDependencyCreate:(P,F)=>{let V=ke.findTaskById(z,P);V&&Ld(V,F);},onDependencyDelete:Id})]})})})});function Ky(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 Yy(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*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 Sl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],El=[{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 am({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:p=[],onUploadAttachments:f,onDeleteAttachment:v}){let k=[...Sl,...i.filter(B=>!Sl.some(J=>J.id===B.id))],g=tt[c]||tt.dark,[y,h]=react.useState(false),[b,x]=react.useState(false),[S,D]=react.useState(false),[T,w]=react.useState(false),[R,A]=react.useState({top:0,left:0}),[N,H]=react.useState(null),[I,re]=react.useState(new Date),[E,_]=react.useState({top:0,left:0}),[ie,Ee]=react.useState(false),[L,xe]=react.useState([]),[X,ee]=react.useState(false),[C,U]=react.useState(""),K=react.useRef(null),ne=react.useRef(null),me=react.useRef(null),ce=react.useRef(null),Ne=react.useRef(null),[Z,je]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Be,Ye]=react.useState({});react.useEffect(()=>{a?(je({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Ee(true)):(je({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Ee(false),xe([]));},[a,e]),react.useEffect(()=>{let B=J=>{K.current&&!K.current.contains(J.target)&&h(false),ne.current&&!ne.current.contains(J.target)&&x(false),me.current&&!me.current.contains(J.target)&&D(false),ce.current&&!ce.current.contains(J.target)&&w(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let dt=()=>{let B={};return Z.name.trim()||(B.name="El nombre es requerido"),Z.startDate&&Z.endDate&&Z.startDate>Z.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),Ye(B),Object.keys(B).length===0},ot=async B=>{if(B.preventDefault(),!!dt())try{let J=l==="create"&&L.length>0?{...Z,pendingFiles:L}:Z;await s(J),xe([]),t();}catch(J){console.error("Error submitting task:",J);}},Je=(B,J)=>{je(pe=>{let we={...pe,[B]:J};if(B==="status"){let $e=J;$e==="todo"?we.progress=0:$e==="in-progress"?(pe.progress===0||pe.progress===100)&&(we.progress=50):$e==="completed"||$e==="closed"?we.progress=100:($e==="in-review"||$e==="review")&&(we.progress=75);}if(B==="progress"){let $e=typeof J=="number"?J:parseInt(J,10);$e===100&&pe.status!=="completed"?we.status="completed":$e>0&&$e<100&&pe.status==="todo"?we.status="in-progress":$e===0&&pe.status!=="todo"&&(we.status="todo");}return we}),Be[B]&&Ye(pe=>{let we={...pe};return delete we[B],we});},xt=k.find(B=>B.id===Z.status)??Sl[0],gt=El.find(B=>B.id===Z.priority)??El[1],yt=go.find(B=>B.value===Z.color)??go[0],se={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:xt.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=g.hoverBg,B.currentTarget.style.color=g.textPrimary;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:ot,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:Z.name,onChange:B=>Je("name",B.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Be.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"}),Be.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:Z.description||"",onChange:B=>Je("description",B.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:K,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&h(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...se,borderColor:xt.color,backgroundColor:`${xt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:xt.color}}),jsxRuntime.jsx("span",{style:{color:xt.color},children:xt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:xt.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:k.map(B=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{Je("status",B.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,Z.status===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},B.id))})})]}),jsxRuntime.jsxs("div",{ref:ne,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:gt.color}}),jsxRuntime.jsx("span",{children:gt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:El.map(B=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{Je("priority",B.id),x(false);},children:[jsxRuntime.jsx("span",{children:B.icon}),B.label,Z.priority===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},B.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:me,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!S),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[Z.assignees&&Z.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:Z.assignees.slice(0,3).map((B,J)=>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:B.color||g.accent,borderColor:g.bgSecondary},children:B.initials},J))}),Z.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",Z.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(B=>{let J=Z.assignees?.some(pe=>pe.name===B.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:pe=>pe.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:pe=>pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let pe=J?(Z.assignees||[]).filter(we=>we.name!==B.name):[...Z.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(we=>we[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Je("assignees",pe);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:B.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:B.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},B.id)})})})]}),jsxRuntime.jsxs("div",{ref:ce,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)w(false);else {if(ce.current){let B=ce.current.getBoundingClientRect(),J=window.innerHeight,pe=120,$e=J-B.bottom<pe?B.top-pe-8:B.bottom+8;A({top:$e,left:B.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Z.color}}),jsxRuntime.jsx("span",{children:yt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:go.slice(0,18).map(B=>{let J=Z.color===B.value;return jsxRuntime.jsx("button",{type:"button",onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),Je("color",B.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:B.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:B.value,outline:J?`2px solid ${B.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},B.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(_r,{selectedTags:Z.tags||[],availableTags:u,onChange:B=>Je("tags",B),onCreateTag:d,theme:g,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:Ne,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(N==="start")H(null);else {if(Ne.current){let B=Ne.current.getBoundingClientRect(),J=window.innerHeight,pe=320,$e=J-B.bottom<pe?B.top-pe-8:B.bottom+8;_({top:$e,left:B.left});}H("start"),re(Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:n||Z.isMilestone,children:Z.startDate?Z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(N==="end")H(null);else {if(Ne.current){let B=Ne.current.getBoundingClientRect(),J=window.innerHeight,pe=320,$e=J-B.bottom<pe?B.top-pe-8:B.bottom+8;_({top:$e,left:B.left});}H("end"),re(Z.endDate||Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:n||Z.isMilestone,children:Z.endDate?Z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(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:`${E.top}px`,left:`${E.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let B=new Date,J=new Date(B);J.setDate(B.getDate()+1);let pe=new Date(B);pe.setDate(B.getDate()+7);let we=new Date(B);return we.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:J},{label:"Pr\xF3xima semana",date:pe},{label:"2 semanas",date:we}].map((Qe,nt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:ze=>ze.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ze=>ze.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(Je("startDate",Qe.date),(!Z.endDate||Qe.date>Z.endDate)&&Je("endDate",Qe.date),H("end")):(Je("endDate",Qe.date),(!Z.startDate||Qe.date<Z.startDate)&&Je("startDate",Qe.date),H(null));},children:Qe.label},nt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:B=>B.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{Je("startDate",void 0),Je("endDate",void 0),H(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:()=>re(new Date(I.getFullYear(),I.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:I.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>re(new Date(I.getFullYear(),I.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((B,J)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:B},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=I.getFullYear(),J=I.getMonth(),pe=new Date(B,J,1).getDay(),we=new Date(B,J+1,0).getDate(),$e=new Date,Qe=[];for(let ze=pe-1;ze>=0;ze--)Qe.push({day:new Date(B,J,-ze).getDate(),date:new Date(B,J-1,new Date(B,J,-ze).getDate()),isCurrentMonth:false});for(let ze=1;ze<=we;ze++)Qe.push({day:ze,date:new Date(B,J,ze),isCurrentMonth:true});let nt=42-Qe.length;for(let ze=1;ze<=nt;ze++)Qe.push({day:ze,date:new Date(B,J+1,ze),isCurrentMonth:false});return Qe.map((ze,oa)=>{let G=ze.date.toDateString()===$e.toDateString(),Y=Z.startDate?.toDateString()===ze.date.toDateString(),be=Z.endDate?.toDateString()===ze.date.toDateString(),Ze=Z.startDate&&Z.endDate&&ze.date>=Z.startDate&&ze.date<=Z.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ze.isCurrentMonth?Y||be?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:Y?"#3B82F6":be?"#7C3AED":Ze?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:G&&!Y&&!be?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(Je("startDate",ze.date),Z.endDate&&ze.date>Z.endDate&&Je("endDate",ze.date),H("end")):(Je("endDate",ze.date),Z.startDate&&ze.date<Z.startDate&&Je("startDate",ze.date),H(null));},children:ze.day},oa)})})()})]})]})]})})]}),Be.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Be.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:Z.progress,onChange:B=>Je("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"}20`,color:Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"},children:[Z.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ee(!ie),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${ie?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ie&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[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:g.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:g.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:Z.effortMinutes?Ky(Z.effortMinutes):"",onChange:B=>{let J=Yy(B.target.value);Je("effortMinutes",J);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textPrimary,border:`1px solid ${g.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(f||p.length>0||l==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",l==="create"?L.length>0&&`(${L.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsxRuntime.jsx(Er,{cardId:"pending",attachments:L.map((B,J)=>({id:`pending-${J}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>xe(J=>[...J,...B]),onDelete:B=>{let J=parseInt(B.replace("pending-",""),10);xe(pe=>pe.filter((we,$e)=>$e!==J));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Er,{cardId:a?.id||"new",attachments:p,onUpload:f&&a?.id?B=>f(a.id,B):void 0,onDelete:v,maxSizeMB:10,maxFiles:20}),l==="create"&&L.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[L.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:Z.isMilestone,onChange:B=>Je("isMilestone",B.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),Z.dependencies&&Z.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Z.dependencies.map(B=>{let J=r.find(pe=>pe.id===B);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[J?.name||B.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let pe=(Z.dependencies||[]).filter(we=>we!==B);Je("dependencies",pe);},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"})})]},B)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{ee(!X),U("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ee(false),U("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsxRuntime.jsx("input",{type:"text",value:C,onChange:B=>U(B.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(B=>B.id!==a?.id).filter(B=>C===""||B.name.toLowerCase().includes(C.toLowerCase())).map(B=>{let J=Z.dependencies?.includes(B.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let pe=Z.dependencies||[],we;J?we=pe.filter($e=>$e!==B.id):we=[...pe,B.id],Je("dependencies",we);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:J?`${g.accent}10`:"transparent"},onMouseEnter:pe=>{J||(pe.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:pe=>{pe.currentTarget.style.backgroundColor=J?`${g.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:J?g.accent:"transparent",borderColor:J?g.accent:g.borderLight},children:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:g.textPrimary},children:B.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:B.id.slice(0,8)})]})]},B.id)}),r.filter(B=>B.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:B=>!n&&(B.currentTarget.style.opacity="0.9"),onMouseLeave:B=>!n&&(B.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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var rm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
358
+ Task dependencies must flow in one direction only.`);return}let V=ne=>ne.map(fe=>{if(fe.id===M){let ke=fe.dependencies||[];if(!ke.includes(E.id))return {...fe,dependencies:[...ke,E.id]}}return fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe});de(V(z)),Pe?.(E.id,M);},[z,Pe,Ad]),Id=react.useCallback((E,M)=>{let V=ne=>ne.map(fe=>{if(fe.id===E&&fe.dependencies){let ke=fe.dependencies.filter(kt=>kt!==M);return {...fe,dependencies:ke}}return fe.subtasks?{...fe,subtasks:V(fe.subtasks)}:fe});de(V(z)),F?.(E,M);},[z,F]),{startDate:Un,endDate:Cg}=react.useMemo(()=>{let E=z.filter(ke=>ke.startDate&&ke.endDate);if(E.length===0){let ke=new Date,kt=new Date(ke);kt.setDate(kt.getDate()-30);let qe=new Date(ke);return qe.setDate(qe.getDate()+60),{startDate:kt,endDate:qe}}let M=E.flatMap(ke=>[ke.startDate,ke.endDate]).filter(ke=>ke!==void 0),V=new Date(Math.min(...M.map(ke=>ke.getTime()))),ne=new Date(Math.max(...M.map(ke=>ke.getTime()))),fe=Ie==="day"?7:Ie==="week"?14:30;return V.setDate(V.getDate()-fe),ne.setDate(ne.getDate()+fe),{startDate:V,endDate:ne}},[z,Ie]),Tg=react.useCallback(async()=>{if(!wr.current||!Ot.current||!Da.current)return;await new Promise(so=>setTimeout(so,200));let E=wr.current,M=Ot.current.querySelector(".gantt-grid-scroll"),V=Da.current,ne=M?.scrollTop||0,fe=M?.scrollLeft||0,ke=V.scrollTop,kt=V.scrollLeft,qe=E.style.overflow,pa=E.style.height,yt=M?.style.overflow||"",ga=V.style.overflow,er=E.style.width,Mo=V.style.width;try{let so=M?.querySelector(".gantt-taskgrid-content"),Cr=V.querySelector("svg"),Hr=Cr?.getAttribute("height")?parseInt(Cr.getAttribute("height"),10):Cr?.getBoundingClientRect().height||0,Fo=so?.scrollHeight||M?.scrollHeight||600,io=Math.max(Hr,V.scrollHeight),Od=Cr?.getAttribute("width")?parseInt(Cr.getAttribute("width"),10):Cr?.getBoundingClientRect().width||V.scrollWidth,Ag=E.querySelector('[class*="h-12"]')?.offsetHeight||48,oi=Math.max(Fo,io,Hr),ni=Ag+oi+50,si=(M?.offsetWidth||300)+Od+10;M&&(M.scrollTop=0,M.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,E.style.overflow="visible",E.style.height=`${ni}px`,E.style.width=`${si}px`,M&&(M.style.overflow="visible",M.style.height=`${oi+50}px`),V.style.overflow="visible",V.style.height=`${oi+50}px`,V.style.width=`${Od+10}px`,await new Promise(li=>setTimeout(li,150));let Lg=await Ju__default.default(E,{backgroundColor:Ct.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:si,height:ni,windowWidth:si+100,windowHeight:ni+100,scrollX:0,scrollY:0,ignoreElements:li=>{let $d=window.getComputedStyle(li),zd=parseInt($d.zIndex,10);return !isNaN(zd)&&zd>=50||$d.position==="fixed"}}),ii=document.createElement("a");ii.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ii.href=Lg.toDataURL("image/png"),ii.click();}finally{E.style.overflow=qe,E.style.height=pa,E.style.width=er,M&&(M.style.overflow=yt,M.style.height="",M.scrollTop=ne,M.scrollLeft=fe),V.style.overflow=ga,V.style.height="",V.style.width=Mo,V.scrollTop=ke,V.scrollLeft=kt;}},[Ct]),Ng=react.useCallback(async()=>{await we.exportToPDF(z);},[z]),Dg=react.useCallback(async()=>{await we.exportToExcel(z);},[z]),Sg=react.useCallback(()=>{let E=we.exportToCSV(z),M=new Blob([E],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(M),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[z]),Eg=react.useCallback(()=>{let E=we.exportToJSON(z),M=new Blob([E],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(M),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[z]),Pg=react.useCallback(()=>{we.exportToMSProject(z,"Gantt Project","project.xml");},[z]),Mg=E=>{E.preventDefault(),He(true);},Po=react.useRef(false),[ri,Bd]=react.useState(false),rn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=Da.current,M=Ot.current?.querySelector(".gantt-grid-scroll");if(!E||!M)return;let V=()=>{if(Po.current)return;Po.current=true;let qe=E.scrollTop;et(qe),M.scrollTop=qe,requestAnimationFrame(()=>{Po.current=false;});},ne=()=>{if(Po.current)return;Po.current=true;let qe=M.scrollTop;et(qe),E.scrollTop=qe,requestAnimationFrame(()=>{Po.current=false;});},fe=qe=>{if(lt&&M){let yt=M.parentElement?.getBoundingClientRect()?.left||0,ga=qe.clientX-yt,er=200,Mo=Za+Qa,so=window.innerWidth*De,Cr=Math.max(Mo,so);ga>=er&&ga<=Cr&&G(ga);}if(ri&&E){let pa=qe.clientX-rn.current.x,yt=qe.clientY-rn.current.y;E.scrollLeft=rn.current.scrollLeft-pa,E.scrollTop=rn.current.scrollTop-yt;}},ke=()=>{He(false),Bd(false);},kt=qe=>{if(qe.button!==0)return;let pa=qe.target;pa.closest("[data-task-bar]")||pa.closest("[data-dependency-line]")||pa.closest("button")||pa.closest('[role="button"]')||pa.tagName==="rect"&&pa.getAttribute("data-clickable")==="true"||(Bd(true),rn.current={x:qe.clientX,y:qe.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},qe.preventDefault());};return E.addEventListener("scroll",V),M.addEventListener("scroll",ne),E.addEventListener("mousedown",kt),document.addEventListener("mousemove",fe),document.addEventListener("mouseup",ke),()=>{E.removeEventListener("scroll",V),M.removeEventListener("scroll",ne),E.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",ke);}},[lt,ri,Za]);let Rd=react.useRef(false),Fg=react.useRef(null);return react.useLayoutEffect(()=>{if(Rd.current||z.length===0||!Da.current)return;Rd.current=true,Fg.current=Un;let E=Da.current,M=new Date,V=Ie==="day"?60:Ie==="week"?20:8,ne=(M.getTime()-Un.getTime())/(1e3*60*60*24),fe=E.clientWidth,kt=ne*V*tt-fe/2;ne>=0&&fe>0&&(E.scrollLeft=Math.max(0,kt));},[z.length,Un,Ie,tt]),jsxRuntime.jsx(_o.Provider,{value:Ee,children:jsxRuntime.jsx(pi.Provider,{value:dr,children:jsxRuntime.jsxs("div",{ref:wr,className:"flex flex-col h-full w-full",style:{backgroundColor:Ct.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(bs,{theme:Ct,timeScale:Ie,onTimeScaleChange:he,zoom:tt,onZoomChange:Ye,currentTheme:le,onThemeChange:We,rowDensity:$e,onRowDensityChange:Xe,showThemeSelector:c,showCreateTaskButton:b&&Se?.canCreateTask!==false&&!Se?.canCreateSubtaskOnly,createTaskLabel:x,onCreateTask:D,taskFilter:se,onTaskFilterChange:B,hideCompleted:Z,onHideCompletedChange:ge,onExportPNG:i?Tg:void 0,onExportPDF:i?Ng:void 0,onExportExcel:i?Dg:void 0,onExportCSV:i?Sg:void 0,onExportJSON:i?Eg:void 0,onExportMSProject:i?Pg:void 0}),jsxRuntime.jsxs("div",{ref:Ot,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Rt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ws,{tasks:ze,theme:Ct,rowHeight:Ze,availableUsers:u,templates:P,onTaskClick:R,onTaskDblClick:Fd,onTaskContextMenu:T,onTaskToggle:Sa,scrollTop:Ue,columns:ut,onToggleColumn:la,onColumnResize:ya,onTaskUpdate:Pa,onTaskIndent:Ma,onTaskOutdent:Aa,onTaskMove:hg,onMultiTaskDelete:ti,onTaskDuplicate:bg,onTaskCreate:yg,onTaskRename:vg,onCreateSubtask:ai,onOpenTaskModal:R?E=>R(E):void 0,onDeleteRequest:(E,M)=>X({taskId:E,taskName:M}),onTaskReparent:an})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Ct.border,zIndex:15},onMouseDown:Mg}),jsxRuntime.jsx("div",{ref:Da,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ri?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Ps,{tasks:ze,theme:Ct,rowHeight:Ze,timeScale:Ie,startDate:Un,endDate:Cg,zoom:tt,locale:y,templates:P,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:R,onTaskDblClick:Fd,onTaskContextMenu:kg,onTaskDateChange:xg,onDependencyCreate:Ld,onDependencyDelete:Id})})]}),q.task&&jsxRuntime.jsx(jo,{isOpen:q.isOpen,x:q.x,y:q.y,theme:Ct,onClose:()=>ve({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=q.task;if(!E)return [];let M=we.findTaskById(z,E.id)||E,V=M.subtasks&&M.subtasks.length>0,ne=Se?.canCreateTask!==false,fe=Se?.canDeleteTask!==false;if(V){let yt=[],ga=Se?.canDuplicateTask!==false;return ne&&yt.push({id:"addSubtask",label:Ee.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{S?S(M):ai(M.id);}}),ga&&yt.push({id:"duplicate",label:Ee.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(M):de(er=>xn(er,[M.id]).tasks),ve({isOpen:false,x:0,y:0,task:null});}}),fe&&(yt.length>0&&yt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),yt.push({id:"delete",label:Ee.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{X({taskId:M.id,taskName:M.name});}})),yt}let ke=Se?.canUpdateTask!==false,kt=Se?.canDuplicateTask!==false,qe=[];return ke&&qe.push({id:"edit",label:Ee.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{ee?ee(M):Te(M);}}),ne&&qe.push({id:"addSubtask",label:Ee.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{S?S(M):ai(M.id);}}),qe.length>0&&ke&&qe.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ke&&(qe.push({id:"markIncomplete",label:Ee.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{Y?Y(M):Pa(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"}),qe.push({id:"setInProgress",label:Ee.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{ue?ue(M):Pa(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"}),qe.push({id:"markComplete",label:Ee.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{Pa(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"})),(kt||ke&&M.startDate&&M.endDate)&&qe.length>0&&qe.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),kt&&qe.push({id:"duplicate",label:Ee.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(M):de(yt=>xn(yt,[M.id]).tasks),ve({isOpen:false,x:0,y:0,task:null});}}),ke&&M.startDate&&M.endDate&&qe.push({id:"split",label:Ee.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{let yt=M.startDate.getTime(),ga=M.endDate.getTime(),er=yt+(ga-yt)/2,Mo=new Date(er);wg(M,Mo);}}),fe&&(qe.length>0&&qe.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),qe.push({id:"delete",label:Ee.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{X({taskId:M.id,taskName:M.name});}})),qe})()}),jsxRuntime.jsx(Ir,{task:Qe,isOpen:!!Qe,onClose:()=>Te(null),onTaskUpdate:E=>{Qe&&(Pa(Qe.id,E),Te(null));},theme:le==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ae&&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:()=>X(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Ct.bgSecondary,border:`1px solid ${Ct.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Ct.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:Ct.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ee.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Ct.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="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:Ct.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Ct.textPrimary},children:['"',Ae.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Ct.bgPrimary,borderTop:`1px solid ${Ct.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>X(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Ct.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=Ct.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ti([Ae.taskId]),X(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),g?.enabled&&jsxRuntime.jsx(Ms,{tasks:z,theme:Ct,config:g,onTasksUpdate:de,onTaskUpdate:Pa,onTaskCreate:E=>{de(M=>[...M,E]);},onTaskDelete:E=>{ti([E]);},onDependencyCreate:(E,M)=>{let V=we.findTaskById(z,E);V&&Ld(V,M);},onDependencyDelete:Id})]})})})});function Yy(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 qy(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*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 Sl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],El=[{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 am({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:p=[],onUploadAttachments:f,onDeleteAttachment:v}){let w=[...Sl,...i.filter(B=>!Sl.some(Z=>Z.id===B.id))],g=ot[c]||ot.dark,[y,h]=react.useState(false),[b,x]=react.useState(false),[D,N]=react.useState(false),[C,k]=react.useState(false),[R,I]=react.useState({top:0,left:0}),[T,H]=react.useState(null),[A,ee]=react.useState(new Date),[S,Y]=react.useState({top:0,left:0}),[ue,Pe]=react.useState(false),[F,pe]=react.useState([]),[J,te]=react.useState(false),[L,oe]=react.useState(""),ie=react.useRef(null),Se=react.useRef(null),U=react.useRef(null),K=react.useRef(null),le=react.useRef(null),[j,Ie]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[he,$e]=react.useState({});react.useEffect(()=>{a?(Ie({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Pe(true)):(Ie({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Pe(false),pe([]));},[a,e]),react.useEffect(()=>{let B=Z=>{ie.current&&!ie.current.contains(Z.target)&&h(false),Se.current&&!Se.current.contains(Z.target)&&x(false),U.current&&!U.current.contains(Z.target)&&N(false),K.current&&!K.current.contains(Z.target)&&k(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let Xe=()=>{let B={};return j.name.trim()||(B.name="El nombre es requerido"),j.startDate&&j.endDate&&j.startDate>j.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),$e(B),Object.keys(B).length===0},tt=async B=>{if(B.preventDefault(),!!Xe())try{let Z=l==="create"&&F.length>0?{...j,pendingFiles:F}:j;await s(Z),pe([]),t();}catch(Z){console.error("Error submitting task:",Z);}},Ye=(B,Z)=>{Ie(ge=>{let Ce={...ge,[B]:Z};if(B==="status"){let Ue=Z;Ue==="todo"?Ce.progress=0:Ue==="in-progress"?(ge.progress===0||ge.progress===100)&&(Ce.progress=50):Ue==="completed"||Ue==="closed"?Ce.progress=100:(Ue==="in-review"||Ue==="review")&&(Ce.progress=75);}if(B==="progress"){let Ue=typeof Z=="number"?Z:parseInt(Z,10);Ue===100&&ge.status!=="completed"?Ce.status="completed":Ue>0&&Ue<100&&ge.status==="todo"?Ce.status="in-progress":Ue===0&&ge.status!=="todo"&&(Ce.status="todo");}return Ce}),he[B]&&$e(ge=>{let Ce={...ge};return delete Ce[B],Ce});},ht=w.find(B=>B.id===j.status)??Sl[0],it=El.find(B=>B.id===j.priority)??El[1],at=go.find(B=>B.value===j.color)??go[0],se={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ht.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=g.hoverBg,B.currentTarget.style.color=g.textPrimary;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:tt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:j.name,onChange:B=>Ye("name",B.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),he.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),he.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:j.description||"",onChange:B=>Ye("description",B.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&h(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...se,borderColor:ht.color,backgroundColor:`${ht.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:ht.color}}),jsxRuntime.jsx("span",{style:{color:ht.color},children:ht.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:ht.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:w.map(B=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:Z=>Z.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Z=>Z.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ye("status",B.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,j.status===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},B.id))})})]}),jsxRuntime.jsxs("div",{ref:Se,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:it.color}}),jsxRuntime.jsx("span",{children:it.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:El.map(B=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:Z=>Z.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Z=>Z.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ye("priority",B.id),x(false);},children:[jsxRuntime.jsx("span",{children:B.icon}),B.label,j.priority===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},B.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:U,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[j.assignees&&j.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:j.assignees.slice(0,3).map((B,Z)=>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:B.color||g.accent,borderColor:g.bgSecondary},children:B.initials},Z))}),j.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",j.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(B=>{let Z=j.assignees?.some(ge=>ge.name===B.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ge=>ge.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ge=Z?(j.assignees||[]).filter(Ce=>Ce.name!==B.name):[...j.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(Ce=>Ce[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Ye("assignees",ge);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:B.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:B.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:Z&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},B.id)})})})]}),jsxRuntime.jsxs("div",{ref:K,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(C)k(false);else {if(K.current){let B=K.current.getBoundingClientRect(),Z=window.innerHeight,ge=120,Ue=Z-B.bottom<ge?B.top-ge-8:B.bottom+8;I({top:Ue,left:B.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:j.color}}),jsxRuntime.jsx("span",{children:at.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(vt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:go.slice(0,18).map(B=>{let Z=j.color===B.value;return jsxRuntime.jsx("button",{type:"button",onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),Ye("color",B.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:B.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:B.value,outline:Z?`2px solid ${B.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},B.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(_r,{selectedTags:j.tags||[],availableTags:u,onChange:B=>Ye("tags",B),onCreateTag:d,theme:g,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:le,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!j.isMilestone)if(T==="start")H(null);else {if(le.current){let B=le.current.getBoundingClientRect(),Z=window.innerHeight,ge=320,Ue=Z-B.bottom<ge?B.top-ge-8:B.bottom+8;Y({top:Ue,left:B.left});}H("start"),ee(j.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:j.isMilestone?.5:1,cursor:j.isMilestone?"not-allowed":"pointer"},disabled:n||j.isMilestone,children:j.startDate?j.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!j.isMilestone)if(T==="end")H(null);else {if(le.current){let B=le.current.getBoundingClientRect(),Z=window.innerHeight,ge=320,Ue=Z-B.bottom<ge?B.top-ge-8:B.bottom+8;Y({top:Ue,left:B.left});}H("end"),ee(j.endDate||j.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:j.isMilestone?.5:1,cursor:j.isMilestone?"not-allowed":"pointer"},disabled:n||j.isMilestone,children:j.endDate?j.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(vt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(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:`${S.top}px`,left:`${S.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let B=new Date,Z=new Date(B);Z.setDate(B.getDate()+1);let ge=new Date(B);ge.setDate(B.getDate()+7);let Ce=new Date(B);return Ce.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:Z},{label:"Pr\xF3xima semana",date:ge},{label:"2 semanas",date:Ce}].map((et,lt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:He=>He.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:He=>He.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(Ye("startDate",et.date),(!j.endDate||et.date>j.endDate)&&Ye("endDate",et.date),H("end")):(Ye("endDate",et.date),(!j.startDate||et.date<j.startDate)&&Ye("startDate",et.date),H(null));},children:et.label},lt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:B=>B.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ye("startDate",void 0),Ye("endDate",void 0),H(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:()=>ee(new Date(A.getFullYear(),A.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:A.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ee(new Date(A.getFullYear(),A.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((B,Z)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:B},Z))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=A.getFullYear(),Z=A.getMonth(),ge=new Date(B,Z,1).getDay(),Ce=new Date(B,Z+1,0).getDate(),Ue=new Date,et=[];for(let He=ge-1;He>=0;He--)et.push({day:new Date(B,Z,-He).getDate(),date:new Date(B,Z-1,new Date(B,Z,-He).getDate()),isCurrentMonth:false});for(let He=1;He<=Ce;He++)et.push({day:He,date:new Date(B,Z,He),isCurrentMonth:true});let lt=42-et.length;for(let He=1;He<=lt;He++)et.push({day:He,date:new Date(B,Z+1,He),isCurrentMonth:false});return et.map((He,ra)=>{let G=He.date.toDateString()===Ue.toDateString(),q=j.startDate?.toDateString()===He.date.toDateString(),ve=j.endDate?.toDateString()===He.date.toDateString(),Qe=j.startDate&&j.endDate&&He.date>=j.startDate&&He.date<=j.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:He.isCurrentMonth?q||ve?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:q?"#3B82F6":ve?"#7C3AED":Qe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:G&&!q&&!ve?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(Ye("startDate",He.date),j.endDate&&He.date>j.endDate&&Ye("endDate",He.date),H("end")):(Ye("endDate",He.date),j.startDate&&He.date<j.startDate&&Ye("startDate",He.date),H(null));},children:He.day},ra)})})()})]})]})]})})]}),he.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:he.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:j.progress,onChange:B=>Ye("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:j.progress<30?"#EF4444":j.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:`${j.progress<30?"#EF4444":j.progress<70?"#F59E0B":"#10B981"}20`,color:j.progress<30?"#EF4444":j.progress<70?"#F59E0B":"#10B981"},children:[j.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Pe(!ue),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${ue?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ue&&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:g.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:g.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:j.effortMinutes?Yy(j.effortMinutes):"",onChange:B=>{let Z=qy(B.target.value);Ye("effortMinutes",Z);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textPrimary,border:`1px solid ${g.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(f||p.length>0||l==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",l==="create"?F.length>0&&`(${F.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsxRuntime.jsx(Er,{cardId:"pending",attachments:F.map((B,Z)=>({id:`pending-${Z}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>pe(Z=>[...Z,...B]),onDelete:B=>{let Z=parseInt(B.replace("pending-",""),10);pe(ge=>ge.filter((Ce,Ue)=>Ue!==Z));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Er,{cardId:a?.id||"new",attachments:p,onUpload:f&&a?.id?B=>f(a.id,B):void 0,onDelete:v,maxSizeMB:10,maxFiles:20}),l==="create"&&F.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[F.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:j.isMilestone,onChange:B=>Ye("isMilestone",B.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),j.dependencies&&j.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:j.dependencies.map(B=>{let Z=r.find(ge=>ge.id===B);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[Z?.name||B.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ge=(j.dependencies||[]).filter(Ce=>Ce!==B);Ye("dependencies",ge);},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"})})]},B)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{te(!J),oe("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{te(false),oe("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsxRuntime.jsx("input",{type:"text",value:L,onChange:B=>oe(B.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(B=>B.id!==a?.id).filter(B=>L===""||B.name.toLowerCase().includes(L.toLowerCase())).map(B=>{let Z=j.dependencies?.includes(B.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ge=j.dependencies||[],Ce;Z?Ce=ge.filter(Ue=>Ue!==B.id):Ce=[...ge,B.id],Ye("dependencies",Ce);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Z?`${g.accent}10`:"transparent"},onMouseEnter:ge=>{Z||(ge.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:ge=>{ge.currentTarget.style.backgroundColor=Z?`${g.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:Z?g.accent:"transparent",borderColor:Z?g.accent:g.borderLight},children:Z&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:g.textPrimary},children:B.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:B.id.slice(0,8)})]})]},B.id)}),r.filter(B=>B.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:B=>!n&&(B.currentTarget.style.opacity="0.9"),onMouseLeave:B=>!n&&(B.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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var rm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
359
359
 
360
360
  AVAILABLE COMMANDS:
361
361
  1. move_task - Move a task to a different date
@@ -400,13 +400,13 @@ If ambiguous, ask for clarification in the message field.`;function om(e){return
400
400
  ${nm(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
401
401
  `)}
402
402
 
403
- Today's date: ${new Date().toISOString().split("T")[0]}`}function nm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ur(e,t){let a=nm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return n.every(i=>c.includes(i))})}function Pl(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let f={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(f!==void 0){let v=new Date(r),k=v.getDay(),g=f-k;return g<=0&&(g+=7),v.setDate(v.getDate()+g),v}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),f=s[2].toLowerCase(),v=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?v.setDate(v.getDate()+p):f==="week"||f==="semana"||f==="semanas"?v.setDate(v.getDate()+p*7):(f==="month"||f==="mes"||f==="meses")&&v.setMonth(v.getMonth()+p),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),f=parseInt(l[2],10)-1,v=parseInt(l[3],10);return new Date(v,f,p)}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 p=parseInt(i[1],10),f=c[i[2].toLowerCase()],v=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(v,f,p)}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},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=u[d[1].toLowerCase()],f=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(v,p,f)}return null}function Ml(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 Fl(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 sm(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 im(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(),d=Ur(t,i),p=Pl(u);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(p);return v.setDate(v.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:v},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),d=Ur(t,i),p=Ml(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.name}" by ${p} days. New end date: ${f.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),u=s[2].trim(),d=Ur(t,i),p=Fl(u);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),d=Ur(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.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 l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),u=l[2].trim(),d=Ur(t,i),p=Ur(t,u);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName: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=Ur(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 lm(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 qy(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 Xy(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function As(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(p=>p.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>As(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},l=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:qy(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 dm(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:Xy(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function cm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>As(r,e,t))}var Al={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Ll={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Ls={en:Al,es:Ll};function Il(e){return Ls[e]||Ls.en}function Is(e,t){let a=Il(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 Bl=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function um(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 mm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let c=um(e),i=Bl[0],u=Bl.find(f=>f.value===c)??i,d=u.icon,p=f=>{switch(um(f)){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(d,{className:m("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:m("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Bl.map(f=>{let v=f.icon;return jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),t(f.value),n(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",c===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(v,{className:m("w-4 h-4",f.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p(f.value)})]},f.value)})})]})}var Rl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function gm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let u=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let c=Rl.find(u=>u.value===e)??Rl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:m("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:m("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Rl.map(u=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(u.value),n(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===u.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:m("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 Os(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function $s(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 fv(e,t){if(!e)return null;let a=Math.round(e.assignedHoursThisWeek/e.weeklyCapacity*100);switch(e.level){case "light":return {color:t?"text-green-400 bg-green-500/20":"text-green-600 bg-green-100",icon:null,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "moderate":return {color:t?"text-yellow-400 bg-yellow-500/20":"text-yellow-600 bg-yellow-100",icon:lucideReact.Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "heavy":return {color:t?"text-orange-400 bg-orange-500/20":"text-orange-600 bg-orange-100",icon:lucideReact.Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "overloaded":return {color:t?"text-red-400 bg-red-500/20":"text-red-600 bg-red-100",icon:lucideReact.AlertTriangle,label:`${a}%`,tooltip:`SOBRECARGADO: ${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`}}}function bm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false,showWorkloadIndicators:n=true}){let[l,c]=react.useState(false),[i,u]=react.useState(""),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&(c(false),u(""));};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]);let p=t.filter(g=>g.name.toLowerCase().includes(i.toLowerCase())||g.email?.toLowerCase().includes(i.toLowerCase())),f=n?[...p].sort((g,y)=>{let h={light:0,moderate:1,heavy:2,overloaded:3},b=g.workload?.level??"light",x=y.workload?.level??"light";return h[b]-h[x]}):p,v=g=>e.some(y=>y.name===g),k=g=>{if(a)if(v(g.name))a(e.filter(y=>y.name!==g.name));else {let y={name:g.name,initials:Os(g.name),color:g.color||$s(g.name).replace("bg-","").replace("-500",""),avatar:g.avatarUrl};a([...e,y]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:m("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((g,y)=>jsxRuntime.jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!g.avatar&&$s(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,title:g.name,children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||Os(g.name)},`${g.name}-${y}`)),e.length>3&&jsxRuntime.jsxs("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),c(!l);},className:m("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:m("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:m("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((g,y)=>jsxRuntime.jsx("div",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!g.avatar&&$s(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||Os(g.name)},`${g.name}-${y}`)),e.length>2&&jsxRuntime.jsxs("span",{className:m("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),l&&jsxRuntime.jsxs("div",{className:m("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-72",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[n&&jsxRuntime.jsxs("div",{className:m("px-3 py-2 text-xs border-b flex items-center gap-3",r?"text-[#9CA3AF] border-white/10":"text-gray-500 border-gray-200"),children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),o==="es"?"Ligera":"Light"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-yellow-500"}),o==="es"?"Moderada":"Moderate"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"}),o==="es"?"Alta":"Heavy"]})]}),jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:g=>u(g.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:m("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:g=>g.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:f.length===0?jsxRuntime.jsx("p",{className:m("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):f.map(g=>{let y=fv(g.workload,r);return jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),k(g);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",g.workload?.level==="overloaded"&&(r?"bg-red-500/5":"bg-red-50")),title:y?.tooltip,children:[jsxRuntime.jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!g.avatarUrl&&$s(g.name)),children:g.avatarUrl?jsxRuntime.jsx("img",{src:g.avatarUrl,alt:g.name,className:"w-full h-full rounded-full object-cover"}):Os(g.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:g.name}),g.email&&jsxRuntime.jsx("div",{className:m("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:g.email})]}),n&&y&&jsxRuntime.jsxs("div",{className:m("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",y.color),children:[y.icon&&jsxRuntime.jsx(y.icon,{className:"w-3 h-3"}),y.label]}),v(g.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},g.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((g,y)=>jsxRuntime.jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[g.name,jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==g.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${g.name}-${y}`))})]})]})}function xm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:c}){let[i,u]=react.useState(false),[d,p]=react.useState(o),[f,v]=react.useState(()=>{let T=o==="start"?e:t;if(T){let w=T instanceof Date?T:new Date(T);return new Date(w.getFullYear(),w.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),k=react.useRef(null),g=e?e instanceof Date?e:new Date(e):null,y=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let T=w=>{k.current&&!k.current.contains(w.target)&&u(false);};return i&&document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),react.useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let h=T=>T?T.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",b=react.useCallback(()=>{let T=f.getFullYear(),w=f.getMonth(),R=new Date(T,w,1),N=new Date(T,w+1,0).getDate(),H=R.getDay(),I=[],E=new Date(T,w,0).getDate();for(let ie=H-1;ie>=0;ie--)I.push({date:new Date(T,w-1,E-ie),isCurrentMonth:false});for(let ie=1;ie<=N;ie++)I.push({date:new Date(T,w,ie),isCurrentMonth:true});let _=42-I.length;for(let ie=1;ie<=_;ie++)I.push({date:new Date(T,w+1,ie),isCurrentMonth:false});return I},[f]),x=T=>{if(r)o==="start"?a(T,y||void 0):a(g||void 0,T),u(false);else if(d==="start"){let w=y&&T>y?T:y;a(T,w||void 0),p("end");}else {let w=g&&T<g?T:g;a(w||void 0,T),u(false);}},S=()=>{let T=new Date,w=new Date(T);w.setDate(T.getDate()+1);let R=new Date(T);R.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let A=new Date(T);A.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let N=new Date(T);N.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let H=new Date(T);H.setDate(T.getDate()+14);let I=new Date(T);return I.setDate(T.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:R,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:A,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:N,display:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:I,display:I.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let T=r&&o==="start"?g:y;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:m("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(T)})]})}let D=r&&o==="start"?g:y;return jsxRuntime.jsxs("div",{ref:k,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:T=>{T.stopPropagation(),u(!i);let w=o==="start"?g:y;w&&v(new Date(w.getFullYear(),w.getMonth(),1));},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:m("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(D)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(false)}),jsxRuntime.jsxs("div",{className:m("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:m("w-44 py-2 border-r",s?"border-white/10":"border-gray-200"),children:[S().map((T,w)=>jsxRuntime.jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(T.date),children:[jsxRuntime.jsx("span",{children:T.label}),jsxRuntime.jsx("span",{className:m("text-xs",s?"text-[#6B7280]":"text-gray-400"),children:T.display})]},w)),jsxRuntime.jsx("div",{className:m("border-t mt-2 pt-2",s?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,y||void 0):a(g||void 0,void 0):a(void 0,void 0),u(false);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[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:m("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:m("font-medium",s?"text-white":"text-gray-900"),children:f.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:()=>v(new Date),className:m("p-1 rounded text-sm transition-colors",s?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()-1)),className:m("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:m("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()+1)),className:m("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("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(T=>jsxRuntime.jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",s?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:b().map((T,w)=>{let R=T.date.toDateString()===new Date().toDateString(),A=g?.toDateString()===T.date.toDateString(),N=y?.toDateString()===T.date.toDateString(),H=A||N,I=!r&&g&&y&&T.date>=g&&T.date<=y;return jsxRuntime.jsx("button",{onClick:()=>x(new Date(T.date)),className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(s?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(s?"text-white":"text-gray-900"),R&&"ring-2 ring-[#3B82F6]",A&&"bg-[#3B82F6] text-white",N&&!A&&"bg-[#7C3AED] text-white",I&&!H&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!H&&(s?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},w)})})]})]})]})]})}function zs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(xm,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(p,f)=>{t&&t(s==="start"?p:f);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Zo(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 Us(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,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 d=i.current??0,p=e,f=p-d,v=r/o;c(true);for(let k=1;k<=o;k++){let g=setTimeout(()=>{let y=k/o,h=1-Math.pow(1-y,3),b=Math.round(d+f*h);n(b),k===o&&(c(false),n(p));},v*k);u.current.push(g);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function km(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),c=react.useRef(null),i=react.useRef(null),u=react.useCallback(f=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(f),l(0);let v=Date.now();i.current=setInterval(()=>{let k=Date.now()-v,g=Math.min(k/a*100,100);l(g);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(f),s(null),l(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(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:d}}function Tm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:l}=Zo(),{displayValue:c,isAnimating:i}=Us(e,{enabled:o,duration:300,steps:6}),u=p=>{if(r||!t)return;p.stopPropagation();let f=p.currentTarget.getBoundingClientRect(),v=p.clientX-f.left,k=Math.round(v/f.width*100),g=Math.max(0,Math.min(100,k));g!==e&&(t(g),s&&l());},d=c??e;return jsxRuntime.jsxs("div",{className:m("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-all duration-300",n&&(a?"bg-green-500/30":"bg-green-500/20")),children:[jsxRuntime.jsx("div",{onClick:u,className:m("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:m("h-full rounded-full transition-all",d===100?"bg-green-500":"bg-[#3B82F6]",i&&"transition-none"),style:{width:`${d}%`}})}),jsxRuntime.jsxs("span",{className:m("text-xs w-8 text-right tabular-nums transition-all",a?"text-[#9CA3AF]":"text-gray-500",i&&"font-medium scale-105"),children:[d,"%"]})]})}function Sm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,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=()=>{l!==e&&t?.(l),n(false);},d=p=>{p.key==="Enter"?u():p.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:m("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:p=>c(p.target.value),onBlur:u,onKeyDown:d,onClick:p=>p.stopPropagation(),className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:m("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Mm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,u]=react.useState(false),[d,p]=react.useState(e?.toString()||""),f=react.useRef(null),{isFlashing:v,triggerFlash:k}=Zo(),{displayValue:g,isAnimating:y}=Us(e,{enabled:l&&!i});react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]),react.useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let x=parseFloat(d);if(!isNaN(x)){let S=x;o!==void 0&&(S=Math.max(o,S)),s!==void 0&&(S=Math.min(s,S)),S!==e&&(t?.(S),c&&k());}u(false);},b=x=>{x.key==="Enter"?h():x.key==="Escape"&&(p(e?.toString()||""),u(false));};return n||!t?jsxRuntime.jsx("span",{className:m("text-sm transition-all",a?"text-[#94A3B8]":"text-gray-500",y&&"font-medium"),children:g!==void 0?g:r}):i?jsxRuntime.jsx("input",{ref:f,type:"number",value:d,onChange:x=>p(x.target.value),onBlur:h,onKeyDown:b,onClick:x=>x.stopPropagation(),min:o,max:s,className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),u(true);},className:m("text-sm text-left w-full px-2 py-1 rounded transition-all duration-300",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",g===void 0&&(a?"text-[#6B7280]":"text-gray-400"),v&&(a?"bg-green-500/30":"bg-green-500/20"),y&&"font-medium scale-105"),children:g!==void 0?g:r})}function Fm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:m("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:m("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:m("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),l(false);},className:m("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Lm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:c,startChange:i,cancelChange:u}=km(t,{delay:s}),d=f=>{f.stopPropagation(),!r&&t&&(o?l?u():i(!e):t(!e));},p=l?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:m("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-all",p?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&p&&"ring-green-500/50",l&&!p&&"ring-red-500/50",l&&(a?"ring-offset-[#0F1117]":"ring-offset-white")),children:[l&&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:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),u();},className:m("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 Rm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:m("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:m("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function Bv(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 Rv(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*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 wo({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false}){let[c,i]=react.useState(false),[u,d]=react.useState(""),p=react.useRef(null),{isFlashing:f,triggerFlash:v}=Zo(),k=Bv(e,r);react.useEffect(()=>{c&&p.current&&(p.current.focus(),p.current.select());},[c]),react.useEffect(()=>{if(e){let h=Math.floor(e/60),b=e%60;h>0&&b>0?d(`${h}h ${b}m`):h>0?d(`${h}h`):d(`${b}m`);}else d("");},[e,c]);let g=()=>{let h=Rv(u);h!==e&&(t?.(h),n&&v()),i(false);},y=h=>{h.key==="Enter"?g():h.key==="Escape"&&i(false);};return l?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:m("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-[#94A3B8]":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]}):s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:k})]}):c?jsxRuntime.jsx("input",{ref:p,type:"text",value:u,onChange:h=>d(h.target.value),onBlur:g,onKeyDown:y,onClick:h=>h.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),i(true);},className:m("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-all duration-300 overflow-hidden",a?"hover:bg-white/10":"hover:bg-gray-100",e!=null&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400",f&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:m("w-3 h-3 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate",children:k})]})}function Xv(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Jv(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Wm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:u=[]}){let d=react.useRef(null),p=r==="es"?Um.es:Um.en;if(react.useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&t();},h=b=>{b.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:p.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}),l&&(y.push({id:"status",label:p.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:p.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&y.push({id:"assign",label:p.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let b=e.task.assignees||[],S=b.some(D=>D.name===h.name)?b.filter(D=>D.name!==h.name):[...b,{name:h.name,initials:Xv(h.name),color:h.color||Jv(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:S}),t();}}))})),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:p.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:p.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},v=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:p.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:p.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:p.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),y},k=e.type==="task"?f():v(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:d,style:g,className:m("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:k.map(y=>y.separator?jsxRuntime.jsx("div",{className:m("my-1 h-px",a?"bg-white/10":"bg-gray-200")},y.id):y.submenu?jsxRuntime.jsx(Zv,{item:y,isDark:a},y.id):jsxRuntime.jsxs("button",{onClick:y.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:m(y.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function Zv({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:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:m("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Um={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var qm={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"}),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"})},px=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function Jm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[c,i]=react.useState(""),[u,d]=react.useState(null),p=react.useRef(null),f=l==="es"?Xm.es:Xm.en;if(react.useLayoutEffect(()=>{if(!e||!p.current)return;let b=()=>{if(!p.current)return;let x=p.current.getBoundingClientRect(),D=window.innerHeight-x.top-20;d(Math.max(300,D));};return requestAnimationFrame(b),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[e]),react.useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let x=D=>{p.current&&!p.current.contains(D.target)&&t();},S=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",x),document.addEventListener("keydown",S),p._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",S);};},100);return ()=>{clearTimeout(b),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let v=b=>f.columns[b]||b,k=b=>{if(b==="name")return;let x=a.map(S=>S.id===b?{...S,visible:!S.visible}:S);o(x);},g=(b,x)=>{let S=a.find(T=>T.type===b&&(!x||T.customFieldId===x));if(S){k(S.id);return}let D={id:x||b,type:b,label:x?r.find(T=>T.id===x)?.name||b:v(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:x};o([...a,D]);},y=px.filter(b=>v(b).toLowerCase().includes(c.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(c.toLowerCase()));return jsxRuntime.jsxs("div",{ref:p,style:u?{maxHeight:`${u}px`}:void 0,className:m("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50 flex flex-col",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:m("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:m("font-medium",n?"text-white":"text-gray-900"),children:f.title}),jsxRuntime.jsx("button",{onClick:t,className:m("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:m("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:m("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:b=>i(b.target.value),placeholder:f.searchPlaceholder,className:m("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain",onWheel:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:m("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:y.map(b=>{let x=a.find(T=>T.type===b&&!T.customFieldId),S=x?.visible??false,D=b==="name";return jsxRuntime.jsxs("button",{onClick:()=>{D||(x?k(x.id):g(b));},disabled:D,className:m("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",D&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:m("w-5 h-5 rounded border flex items-center justify-center",S?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:S&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:qm[b]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:v(b)})]},b)})})]}),h.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:m("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:h.map(b=>{let S=a.find(D=>D.customFieldId===b.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>g(b.type,b.id),className:m("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:m("w-5 h-5 rounded border flex items-center justify-center",S?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:S&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:qm[b.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:b.name})]},b.id)})})]})]})]})}var Xm={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",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var wx=[{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 ep({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,c]=react.useState("text"),[i,u]=react.useState([""]),d=o==="es"?Qm.es:Qm.en;react.useEffect(()=>{e&&(n(""),c("text"),u([""]));},[e]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let p=()=>{if(!s.trim())return;let g={name:s.trim(),type:l};l==="dropdown"&&(g.options=i.filter(y=>y.trim())),a(g),t();},f=()=>{u([...i,""]);},v=(g,y)=>{let h=[...i];h[g]=y,u(h);},k=g=>{i.length>1&&u(i.filter((y,h)=>h!==g));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:m("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:m("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:m("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:m("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:m("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:d.fieldNamePlaceholder,className:m("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:wx.map(g=>jsxRuntime.jsxs("button",{onClick:()=>c(g.type),className:m("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsxRuntime.jsx("span",{className:m("text-xs",l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[g.type]})]},g.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((g,y)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:g,onChange:h=>v(y,h.target.value),placeholder:`${d.option} ${y+1}`,className:m("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>k(y),className:m("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},y)),jsxRuntime.jsxs("button",{onClick:f,className:m("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:m("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:p,disabled:!s.trim(),className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Qm={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 rp={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 op({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),u=s==="es"?rp.es:rp.en;react.useEffect(()=>{if(!n)return;let f=k=>{Date.now()-i.current<100||c.current&&!c.current.contains(k.target)&&l(false);},v=k=>{k.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);}},[n]);let d=[{value:"all",label:u.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{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"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),l(v=>!v);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),u.filters,p&&jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:m("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:m("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:m("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:u.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(f=>{let v=e===f.value&&!t,k=()=>f.value==="all"?v?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(f.value),r(false),l(false);},className:m("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",v&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m(v?f.color:"text-gray-400","flex-shrink-0"),children:k()}),jsxRuntime.jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),v&&jsxRuntime.jsx(lucideReact.Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsxRuntime.jsx("div",{className:m("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let f=!t;r(f),f&&a("all"),l(false);},className:m("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:m("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var Rx=[{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 lp(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(...lp(r.subtasks,t+1));return a}function dp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[]}){let{theme:i="dark",locale:u="en",customTranslations:d,showSearch:p=true,showHierarchy:f=true,tableColumns:v,allowColumnCustomization:k=true,allowColumnResize:g=true,enableContextMenu:y=true,showCreateTaskButton:h=false,onCreateTask:b,persistFilter:x=false,financialBlur:S}=t,D=Is(u,d),T=i==="dark",w=react.useCallback(()=>{if(!x||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let G=localStorage.getItem(x);if(G){let Y=JSON.parse(G);return {statusFilter:Y.statusFilter||"all",hideCompleted:Y.hideCompleted||!1}}}catch(G){console.error("Error loading persisted filter:",G);}return {statusFilter:"all",hideCompleted:false}},[x]),[R,A]=react.useState("startDate"),[N,H]=react.useState("asc"),[I,re]=react.useState(""),[E,_]=react.useState(()=>w().statusFilter),[ie,Ee]=react.useState(()=>w().hideCompleted),[L,xe]=react.useState(v||Rx),[X,ee]=react.useState(false),[C,U]=react.useState(false),[K,ne]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[me,ce]=react.useState(null),[Ne,Z]=react.useState(0),[je,Be]=react.useState(0),Ye=react.useRef(null);react.useEffect(()=>{v&&xe(v);},[v]),react.useEffect(()=>{if(!(!x||typeof window>"u"))try{localStorage.setItem(x,JSON.stringify({statusFilter:E,hideCompleted:ie}));}catch(G){console.error("Error persisting filter state:",G);}},[x,E,ie]);let dt=react.useMemo(()=>{let G=new Set;function Y(be){for(let Ze of be)Ze.subtasks?.length&&(Ze.isExpanded!==false&&G.add(Ze.id),Y(Ze.subtasks));}return Y(e),G},[e]),ot=react.useMemo(()=>L.filter(G=>G.visible),[L]),Je=react.useCallback(G=>{a.onTaskToggleExpand?.(G);},[a]),xt=react.useCallback(G=>{R===G?H(Y=>Y==="asc"?"desc":"asc"):(A(G),H("asc")),a.onSortChange?.({column:G,direction:N==="asc"?"desc":"asc"});},[R,N,a]),gt=react.useCallback(G=>{xe(G),a.onColumnsChange?.(G);},[a]),yt=react.useCallback(G=>{let Y=L.map(be=>be.id===G?{...be,visible:false}:be);gt(Y);},[L,gt]),se=react.useCallback((G,Y)=>{A(G),H(Y);},[]),B=react.useCallback((G,Y,be)=>{y&&(G.preventDefault(),ne({isOpen:true,x:G.clientX,y:G.clientY,type:Y?"task":"header",task:Y,columnId:be}));},[y]),J=react.useCallback(()=>{ne(G=>({...G,isOpen:false}));},[]),pe=react.useCallback((G,Y)=>{if(!g)return;G.preventDefault(),G.stopPropagation();let be=L.find(Ze=>Ze.id===Y);be&&(ce(Y),Z(G.clientX),Be(be.width));},[L,g]);react.useEffect(()=>{if(!me)return;let G=be=>{let Ze=be.clientX-Ne,Ce=Math.max(50,je+Ze),Fe=L.map(q=>q.id===me?{...q,width:Ce}:q);xe(Fe);},Y=()=>{me&&a.onColumnsChange?.(L),ce(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",Y);}},[me,Ne,je,L,a]);let we=react.useCallback(async G=>{if(a.onCreateCustomField){let Y={...G,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}U(false);},[a]),$e=react.useCallback(G=>G.progress===100||G.status==="completed"?"completed":G.progress&&G.progress>0||G.status==="in-progress"?"in-progress":"todo",[]),Qe=react.useMemo(()=>{let G=lp(e);if(I.trim()){let Y=I.toLowerCase();G=G.filter(be=>be.name.toLowerCase().includes(Y));}return E!=="all"&&(G=G.filter(Y=>$e(Y)===E)),ie&&(G=G.filter(Y=>$e(Y)!=="completed")),G.sort((Y,be)=>{let Ze,Ce;switch(R){case "name":Ze=Y.name.toLowerCase(),Ce=be.name.toLowerCase();break;case "startDate":Ze=Y.startDate?.getTime()||0,Ce=be.startDate?.getTime()||0;break;case "endDate":Ze=Y.endDate?.getTime()||0,Ce=be.endDate?.getTime()||0;break;case "progress":Ze=Y.progress||0,Ce=be.progress||0;break;case "status":Ze=Y.status||"todo",Ce=be.status||"todo";break;case "priority":let Fe={urgent:0,high:1,medium:2,low:3,none:4};Ze=Fe[Y.priority]??4,Ce=Fe[be.priority]??4;break;default:return 0}return Ze<Ce?N==="asc"?-1:1:Ze>Ce?N==="asc"?1:-1:0}),G},[e,I,E,ie,R,N,$e]),nt=react.useCallback((G,Y)=>{let be=Fe=>{a.onTaskUpdate?.({...G,...Fe});},Ze=Fe=>Fe?G.customFields?.find(Ue=>Ue.fieldId===Fe)?.value:void 0,Ce=(Fe,q)=>{if(!Fe)return;let z=[...G.customFields||[]],le=z.findIndex(Le=>Le.fieldId===Fe);le>=0?z[le]={fieldId:Fe,value:q}:z.push({fieldId:Fe,value:q}),be({customFields:z});};switch(Y.type){case "name":return null;case "status":return jsxRuntime.jsx(mm,{value:G.status||(G.progress===100?"completed":G.progress&&G.progress>0?"in-progress":"todo"),onChange:q=>{be({status:q,progress:q==="completed"?100:q==="in-progress"?50:0});},isDark:T,locale:u,translations:D.status});case "priority":return jsxRuntime.jsx(gm,{value:G.priority,onChange:q=>be({priority:q}),isDark:T,locale:u});case "assignees":return jsxRuntime.jsx(bm,{value:G.assignees||[],availableUsers:l,onChange:q=>be({assignees:q}),isDark:T,locale:u});case "startDate":return jsxRuntime.jsx(zs,{value:G.startDate,onChange:q=>be({startDate:q}),isDark:T,locale:u,dateField:"start",startDate:G.startDate,endDate:G.endDate});case "endDate":return jsxRuntime.jsx(zs,{value:G.endDate,onChange:q=>be({endDate:q}),isDark:T,locale:u,dateField:"end",startDate:G.startDate,endDate:G.endDate});case "progress":return jsxRuntime.jsx(Tm,{value:G.progress||0,onChange:q=>{let Ue=q===100?"completed":q>0?"in-progress":"todo";be({progress:q,status:Ue});},isDark:T});case "tags":return jsxRuntime.jsx(Rm,{value:G.tags||[],isDark:T});case "text":return jsxRuntime.jsx(Sm,{value:Ze(Y.customFieldId)||"",onChange:q=>Ce(Y.customFieldId,q),isDark:T});case "number":return jsxRuntime.jsx(Mm,{value:Ze(Y.customFieldId)||0,onChange:q=>Ce(Y.customFieldId,q),isDark:T});case "date":let Fe=Ze(Y.customFieldId);return jsxRuntime.jsx(zs,{value:Fe?new Date(Fe):void 0,onChange:q=>Ce(Y.customFieldId,q),isDark:T,locale:u});case "dropdown":return jsxRuntime.jsx(Fm,{value:Ze(Y.customFieldId)||"",options:Y.options||[],onChange:q=>Ce(Y.customFieldId,q),isDark:T});case "checkbox":return jsxRuntime.jsx(Lm,{value:Ze(Y.customFieldId)||false,onChange:q=>Ce(Y.customFieldId,q),isDark:T});case "estimatedTime":{let q=G.status==="completed"||G.progress===100;return jsxRuntime.jsx(wo,{value:G.estimatedTime,onChange:Ue=>be({estimatedTime:Ue}),isDark:T,locale:u,disabled:q})}case "quotedTime":{let q=G.status==="completed"||G.progress===100,Ue=S?.enabled&&(!S.columns||S.columns.includes("quotedTime"));return jsxRuntime.jsx(wo,{value:G.quotedTime,onChange:z=>be({quotedTime:z}),isDark:T,locale:u,disabled:q,isBlurred:Ue})}case "elapsedTime":{let q=G.status==="completed"||G.progress===100;return jsxRuntime.jsx(wo,{value:G.elapsedTime,onChange:Ue=>be({elapsedTime:Ue}),isDark:T,locale:u,disabled:q})}case "effortMinutes":{let q=G.status==="completed"||G.progress===100;return jsxRuntime.jsx(wo,{value:G.effortMinutes,onChange:Ue=>be({effortMinutes:Ue}),isDark:T,locale:u,disabled:q})}case "timeLoggedMinutes":{let q=G.status==="completed"||G.progress===100;return jsxRuntime.jsx(wo,{value:G.timeLoggedMinutes,onChange:a.onLogTime?Ue=>{a.onLogTime?.(G,Ue);}:void 0,isDark:T,locale:u,placeholder:u==="es"?"Agregar":"Add",disabled:q})}case "soldEffortMinutes":{let q=G.status==="completed"||G.progress===100,Ue=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(wo,{value:G.soldEffortMinutes,onChange:z=>be({soldEffortMinutes:z}),isDark:T,locale:u,disabled:q,isBlurred:Ue})}default:return jsxRuntime.jsx("span",{className:m("text-sm",T?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,T,u,l,D]),ze=react.useCallback(G=>{let be={name:D.columns.name,status:D.columns.status,priority:D.columns.priority,assignees:D.columns.assignees,startDate:D.columns.startDate,endDate:D.columns.endDate,progress:D.columns.progress,tags:D.columns.tags||(u==="es"?"Etiquetas":"Tags"),estimatedTime:D.columns.estimatedTime||(u==="es"?"Estimado":"Estimated"),quotedTime:D.columns.quotedTime||(u==="es"?"Ofertado":"Quoted"),elapsedTime:D.columns.elapsedTime||(u==="es"?"Tiempo":"Time Spent"),effortMinutes:D.columns.effortMinutes||(u==="es"?"Estimado":"Estimated"),timeLoggedMinutes:D.columns.timeLoggedMinutes||(u==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:D.columns.soldEffortMinutes||(u==="es"?"Ofertado":"Quoted")}[G.type]||G.label;return typeof be=="string"?be:String(be||G.type)},[D,u]),oa=react.useMemo(()=>ot.reduce((G,Y)=>G+Y.width,0)+(k?48:0),[ot,k]);return r?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:m("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:[D.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:m("text-lg font-semibold mb-2",T?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:m("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:m("text-lg font-semibold mb-2",T?"text-white":"text-gray-900"),children:D.empty.noTasks}),jsxRuntime.jsx("p",{className:m("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Ye,className:m("flex-1 flex flex-col w-full h-full overflow-hidden",T?"bg-[#0F1117]":"bg-white",me&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:m("flex-shrink-0 px-6 py-4 border-b",T?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(op,{value:E,hideCompleted:ie,onChange:_,onHideCompletedChange:Ee,isDark:T,locale:u}),jsxRuntime.jsxs("div",{className:m("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:[Qe.length," ",D.pagination.tasks]}),p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:m("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",T?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:I,onChange:G=>re(G.target.value),placeholder:D.toolbar.searchPlaceholder,className:m("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",T?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),h&&b&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:b,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:D.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:oa},children:[jsxRuntime.jsxs("div",{className:m("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",T?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[ot.map(G=>jsxRuntime.jsxs("div",{className:m("relative flex items-center gap-2 px-4 py-3",T?"text-[#9CA3AF]":"text-gray-500"),style:{width:G.width,minWidth:G.minWidth},onContextMenu:Y=>B(Y,void 0,G.id),children:[G.sortable?jsxRuntime.jsxs("button",{onClick:()=>xt(G.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[ze(G),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:m("w-3 h-3",R===G.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:ze(G)}),g&&G.resizable&&jsxRuntime.jsx("div",{className:m("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",me===G.id&&"bg-[#3B82F6]"),onMouseDown:Y=>pe(Y,G.id)})]},G.id)),k&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),ee(Y=>!Y);},className:m("p-1.5 rounded-lg transition-colors",T?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",X&&(T?"bg-white/10":"bg-gray-200")),title:u==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(Jm,{isOpen:X,onClose:()=>ee(false),columns:L,customFields:c,onColumnsChange:gt,onCreateCustomField:()=>{ee(false),U(true);},isDark:T,locale:u})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Qe.map((G,Y)=>{let be=dt.has(G.id),Ze=Math.min(Y*.01,.2);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ze},className:m("flex items-center border-b transition-colors",T?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(G),onDoubleClick:()=>a.onTaskDoubleClick?.(G),onContextMenu:Ce=>B(Ce,G),children:[ot.map(Ce=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Ce.width,minWidth:Ce.minWidth},children:Ce.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&G.level>0&&jsxRuntime.jsx("div",{style:{width:`${G.level*24}px`},className:"flex-shrink-0"}),f&&G.hasChildren&&jsxRuntime.jsx("button",{onClick:Fe=>{Fe.stopPropagation(),Je(G.id);},className:m("p-0.5 rounded flex-shrink-0",T?"hover:bg-white/10":"hover:bg-gray-200"),children:be?jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-400")})}),f&&!G.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("span",{className:m("truncate font-medium",T?"text-white":"text-gray-900",G.progress===100&&(T?"line-through text-[#6B7280]":"line-through text-gray-400")),children:G.name})]}):nt(G,Ce)},Ce.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},G.id)})}),Qe.length===0&&I&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:m("w-12 h-12 mx-auto mb-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:m(T?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.noResults})]})})]})}),jsxRuntime.jsx(Wm,{state:K,onClose:J,isDark:T,locale:u,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:yt,onColumnSort:se,availableUsers:l}),jsxRuntime.jsx(ep,{isOpen:C,onClose:()=>U(false),onSave:we,isDark:T,locale:u})]})}var cp=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true}],up=[{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"}],mp=[{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 Yl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},ql={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"},Xl={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"},Gs={dark:Yl,light:ql,neutral:Xl};function pp(e){return Gs[e]||Gs.dark}var Jl={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Zl={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Vs={en:Jl,es:Zl};function Fn(e){return Vs[e]||Vs.en}function _s(e,t){let a=Fn(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 gp(e){let t=Fn(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 fp(e,t=0,a=true){let r=Fn(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 xp(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 ed(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 kp({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Cp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:k,onTaskOpen:g,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,timerState:x,onLogTime:S,onUpdateEstimate:D,onUpdateSoldEffort:T,onStartTimer:w,onStopTimer:R,onDiscardTimer:A,blurFinancials:N=false}){let{theme:H="dark",locale:I="en",customTranslations:re}=t,E=_s(I,re),_=H==="dark",[ie,Ee]=react.useState(r||new Date),[L,xe]=react.useState(null),[X,ee]=react.useState(null),[C,U]=react.useState({}),K=4,ne=3,[me,ce]=react.useState(null),[Ne,Z]=react.useState(""),[je,Be]=react.useState(void 0),[Ye,dt]=react.useState(null),[ot,Je]=react.useState(false),[xt,gt]=react.useState(false),[yt,se]=react.useState(null),[B,J]=react.useState(false),[pe,we]=react.useState(new Date),$e=react.useCallback(()=>{Ee(new Date(ie.getFullYear(),ie.getMonth()-1,1));},[ie]),Qe=react.useCallback(()=>{Ee(new Date(ie.getFullYear(),ie.getMonth()+1,1));},[ie]),nt=react.useCallback(()=>{Ee(new Date);},[]),ze=react.useMemo(()=>{let Y=ie.getFullYear(),be=ie.getMonth(),Ze=new Date(Y,be,1),Ce=new Date(Y,be+1,0),Fe=Ze.getDay(),q=Ce.getDate(),Ue=xp(e),z=new Date;z.setHours(0,0,0,0);let le=[],Le=Fe,_e=new Date(Y,be,0).getDate();for(let Re=Le-1;Re>=0;Re--){let $=new Date(Y,be-1,_e-Re);le.push({date:$,isCurrentMonth:false,isToday:false,isWeekend:$.getDay()===0||$.getDay()===6,events:Ue.filter(j=>ed($,j)).map(j=>({id:j.id,title:j.name,start:j.startDate,end:j.endDate,task:j}))});}for(let Re=1;Re<=q;Re++){let $=new Date(Y,be,Re),j=$.getTime()===z.getTime();le.push({date:$,isCurrentMonth:true,isToday:j,isWeekend:$.getDay()===0||$.getDay()===6,events:Ue.filter(ye=>ed($,ye)).map(ye=>({id:ye.id,title:ye.name,start:ye.startDate,end:ye.endDate,task:ye}))});}let Ge=42-le.length;for(let Re=1;Re<=Ge;Re++){let $=new Date(Y,be+1,Re);le.push({date:$,isCurrentMonth:false,isToday:false,isWeekend:$.getDay()===0||$.getDay()===6,events:Ue.filter(j=>ed($,j)).map(j=>({id:j.id,title:j.name,start:j.startDate,end:j.endDate,task:j}))});}return le},[ie,e]),oa=I==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],G=ie.toLocaleDateString(I==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",_?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:m("text-sm",_?"text-[#9CA3AF]":"text-gray-600"),children:[E.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",_?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:m("text-lg font-semibold mb-2",_?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:m("text-sm",_?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",_?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:m("text-lg font-semibold mb-2",_?"text-white":"text-gray-900"),children:E.labels.noEvents}),jsxRuntime.jsx("p",{className:m("text-sm",_?"text-[#9CA3AF]":"text-gray-600"),children:E.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:m("flex-1 flex flex-col w-full h-full overflow-auto",_?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:m("flex-shrink-0 px-6 py-4 border-b",_?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:m("text-xl font-semibold capitalize",_?"text-white":"text-gray-900"),children:G}),jsxRuntime.jsx("button",{onClick:nt,className:m("px-3 py-1.5 text-sm rounded-lg transition-colors",_?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:E.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:$e,className:m("p-2 rounded-lg transition-colors",_?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:m("w-5 h-5",_?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Qe,className:m("p-2 rounded-lg transition-colors",_?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("w-5 h-5",_?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:oa.map(Y=>jsxRuntime.jsx("div",{className:m("py-2 text-center text-xs font-medium uppercase",_?"text-[#9CA3AF]":"text-gray-500"),children:Y},Y))}),jsxRuntime.jsx("div",{className:m("grid grid-cols-7 auto-rows-min gap-px rounded-lg",_?"bg-[#2D2D2D]":"bg-gray-300"),children:ze.map((Y,be)=>{let Ze=Y.date.getDay()===0||Y.date.getDay()===6;return jsxRuntime.jsxs("div",{className:m("min-h-[120px] p-2 transition-colors flex flex-col relative group",_?Ze?"bg-[#1C1F26]":Y.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Ze?"bg-gray-100":Y.isCurrentMonth?"bg-white":"bg-gray-50",Y.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ce=C[be]||K,Fe=Y.events.slice(0,Ce),q=Y.events.length-Ce;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Fe.map(Ue=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{xe(Ue.task),a.onEventClick?.(Ue),g?.(Ue.task.id);},whileHover:{scale:1.02},className:m("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Ue.task.progress===100?_?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":_?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(kp,{task:Ue.task}),jsxRuntime.jsx("span",{className:"truncate",children:Ue.title})]})},Ue.id)),q>0&&jsxRuntime.jsxs("button",{onClick:Ue=>{Ue.stopPropagation(),U(z=>({...z,[be]:Ce+ne}));},className:m("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",_?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",q," ",I==="es"?"M\xC1S":"MORE"]}),Ce>K&&Y.events.length>K&&jsxRuntime.jsx("button",{onClick:Ue=>{Ue.stopPropagation(),U(z=>({...z,[be]:K}));},className:m("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",_?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:I==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ce=be>=28,Fe=be%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),me===be?ce(null):(ce(be),Z(""),Be(void 0),dt(null),se(null),Je(false),gt(false),J(false),we(Y.date));},className:m("w-5 h-5 rounded flex items-center justify-center transition-all",me===be?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",_?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:m("w-3.5 h-3.5 transition-transform",me===be&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me===be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ce(null),Z(""),Be(void 0),dt(null),se(null),Je(false),gt(false),J(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ce?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ce?-5:5,scale:.95},transition:{duration:.12},className:m("absolute w-[320px] rounded-lg shadow-2xl z-50",Ce?"bottom-full mb-1":"top-full mt-1",Fe?"right-0":"left-0",_?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:q=>{q.stopPropagation(),Je(false),gt(false),J(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Ne,onChange:q=>Z(q.target.value),placeholder:I==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:m("w-full bg-transparent text-sm outline-none placeholder:opacity-40",_?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:q=>{if(q.key==="Enter"&&Ne.trim()){let Ue=t.availableUsers?.find(le=>le.id===Ye),z=yt||Y.date;a.onTaskCreate?.({name:Ne.trim(),startDate:z,endDate:z,priority:je,assignees:Ue?[Ue]:void 0}),Z(""),Be(void 0),dt(null),se(null),ce(null);}q.key==="Escape"&&(ce(null),Z(""),Be(void 0),dt(null),se(null));}})}),jsxRuntime.jsxs("div",{className:m("px-2.5 py-2 flex items-center justify-between border-t",_?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),Je(!ot),gt(false);},className:m("p-1 rounded transition-colors",je?je==="urgent"||je==="high"?"text-red-400 bg-red-500/20":je==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":_?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",_?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[{id:"urgent",label:I==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:I==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:I==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:I==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:I==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxRuntime.jsxs("button",{onClick:()=>{Be(q.id),Je(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",_?"hover:bg-white/5":"hover:bg-gray-50",je===q.id&&(_?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",q.color)}),jsxRuntime.jsx("span",{className:_?"text-white":"text-gray-900",children:q.label})]},q.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:q=>{q.stopPropagation(),J(!B),Je(false),gt(false),we(yt||Y.date);},className:m("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",yt?"bg-[#7C3AED]/20 text-[#7C3AED]":_?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(yt||Y.date).toLocaleDateString(I==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",_?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsx("div",{className:m("w-40 py-2 border-r",_?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,Ue=new Date(q);Ue.setDate(q.getDate()+1);let z=new Date(q);z.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let le=new Date(q);le.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let Le=new Date(q);Le.setDate(q.getDate()+14);let _e=new Date(q);return _e.setDate(q.getDate()+28),[{label:I==="es"?"Hoy":"Today",date:q,display:q.toLocaleDateString(I==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:I==="es"?"Ma\xF1ana":"Tomorrow",date:Ue,display:Ue.toLocaleDateString(I==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:I==="es"?"Este fin de semana":"This weekend",date:z,display:I==="es"?"s\xE1b.":"sat."},{label:I==="es"?"Pr\xF3xima semana":"Next week",date:le,display:I==="es"?"lun.":"mon."},{label:I==="es"?"2 semanas":"2 weeks",date:Le,display:Le.toLocaleDateString(I==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:I==="es"?"4 semanas":"4 weeks",date:_e,display:_e.toLocaleDateString(I==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Re,$)=>jsxRuntime.jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",_?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{se(Re.date),J(false);},children:[jsxRuntime.jsx("span",{children:Re.label}),jsxRuntime.jsx("span",{className:m("text-[10px]",_?"text-[#6B7280]":"text-gray-400"),children:Re.display})]},$))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:m("text-xs font-medium",_?"text-white":"text-gray-900"),children:pe.toLocaleDateString(I==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>we(new Date),className:m("px-1.5 py-0.5 rounded text-[10px] transition-colors",_?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:I==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>we(new Date(pe.getFullYear(),pe.getMonth()-1)),className:m("p-0.5 rounded",_?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>we(new Date(pe.getFullYear(),pe.getMonth()+1)),className:m("p-0.5 rounded",_?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(I==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsxRuntime.jsx("div",{className:m("w-6 h-6 flex items-center justify-center text-[10px]",_?"text-[#6B7280]":"text-gray-400"),children:q},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=pe.getFullYear(),Ue=pe.getMonth(),z=new Date(q,Ue,1).getDay(),le=new Date(q,Ue+1,0).getDate(),Le=new Date(q,Ue,0).getDate(),_e=new Date,Ge=[];for(let $=z-1;$>=0;$--)Ge.push({dayNum:Le-$,isCurrentMonth:false,date:new Date(q,Ue-1,Le-$)});for(let $=1;$<=le;$++)Ge.push({dayNum:$,isCurrentMonth:true,date:new Date(q,Ue,$)});let Re=42-Ge.length;for(let $=1;$<=Re;$++)Ge.push({dayNum:$,isCurrentMonth:false,date:new Date(q,Ue+1,$)});return Ge.map(($,j)=>{let ye=$.date.toDateString()===_e.toDateString(),qe=(yt||Y.date).toDateString()===$.date.toDateString();return jsxRuntime.jsx("button",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!$.isCurrentMonth&&(_?"text-[#4B5563]":"text-gray-300"),$.isCurrentMonth&&(_?"text-white":"text-gray-900"),ye&&"ring-1 ring-[#3B82F6]",qe&&"bg-[#7C3AED] text-white",!qe&&(_?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{se($.date),J(false);},children:$.dayNum},j)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),gt(!xt),Je(false);},className:m("p-1 rounded transition-colors",Ye?"text-[#7C3AED] bg-[#7C3AED]/20":_?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Ye?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(q=>q.id===Ye)?.color||"#7C3AED"},children:t.availableUsers?.find(q=>q.id===Ye)?.initials||t.availableUsers?.find(q=>q.id===Ye)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xt&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",_?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{dt(null),gt(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",_?"hover:bg-white/5":"hover:bg-gray-50",!Ye&&(_?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:m("w-5 h-5 rounded-full flex items-center justify-center",_?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:_?"text-[#9CA3AF]":"text-gray-500",children:I==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(q=>jsxRuntime.jsxs("button",{onClick:()=>{dt(q.id),gt(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",_?"hover:bg-white/5":"hover:bg-gray-50",Ye===q.id&&(_?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:q.color||"#7C3AED"},children:q.initials||q.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:_?"text-white":"text-gray-900",children:q.name})]},q.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:m("px-3 py-2 text-xs",_?"text-[#6B7280]":"text-gray-400"),children:I==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Ne.trim()){let q=t.availableUsers?.find(z=>z.id===Ye),Ue=yt||Y.date;a.onTaskCreate?.({name:Ne.trim(),startDate:Ue,endDate:Ue,priority:je,assignees:q?[q]:void 0}),Z(""),Be(void 0),dt(null),se(null),ce(null);}},disabled:!Ne.trim(),className:m("px-2.5 py-1 rounded text-xs font-medium transition-colors",Ne.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":_?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:I==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:m("text-sm font-medium",Y.isToday?"text-[#3B82F6]":Y.isCurrentMonth?_?"text-white":"text-gray-900":_?"text-[#6B7280]":"text-gray-400"),children:Y.date.getDate()})]})]},be)})})]})}),jsxRuntime.jsx(Ir,{task:L,isOpen:!!L,onClose:()=>xe(null),onTaskUpdate:Y=>{a.onTaskUpdate?.(Y),xe(Y);},theme:H==="dark"?"dark":"light",locale:I,availableUsers:t.availableUsers?.map(Y=>({id:Y.id,name:Y.name,avatar:Y.avatar,initials:Y.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:L?u?.get(L.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:xp(e).filter(Y=>Y.id!==L?.id),comments:d?.filter(Y=>Y.taskId===L?.id).map(Y=>({...Y,createdAt:Y.createdAt instanceof Date?Y.createdAt:new Date(Y.createdAt),updatedAt:Y.updatedAt instanceof Date?Y.updatedAt:Y.updatedAt?new Date(Y.updatedAt):void 0})),onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:k,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:S,onEstimateUpdate:D,onSoldEffortUpdate:T,onTimerStart:w,onTimerStop:R,onTimerDiscard:A,blurFinancials:N}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>ee(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:m("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",_?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between",_?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:m("font-medium",_?"text-white":"text-gray-900"),children:X.date.toLocaleDateString(I==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>ee(null),className:m("p-1 rounded",_?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:X.events.map(Y=>jsxRuntime.jsxs("button",{onClick:()=>{ee(null),xe(Y.task),g?.(Y.task.id);},className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",_?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(kp,{task:Y.task}),jsxRuntime.jsx("span",{className:m("text-sm truncate flex-1",_?"text-white":"text-gray-900"),children:Y.title}),Y.task.priority==="high"||Y.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},Y.id))})]})]})})]})}var td={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},ad={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"},rd={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"},js={dark:td,light:ad,neutral:rd};function Tp(e){return js[e]||js.dark}function jx({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=react.useState(false),u=react.useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=react.useMemo(()=>{let f=u.length,v=new Set(u.flatMap(y=>y.assignedUserIds||[])).size,k=u.map(y=>y.priority).filter(Boolean),g=new Set(u.flatMap(y=>y.labels||[])).size;return {totalCards:f,uniqueAssignees:v,priorities:k,labels:g}},[u]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:m("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:m("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:f=>{f.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:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children: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(f=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsxRuntime.jsx("h4",{children:f.title}),f.description&&jsxRuntime.jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Dp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ln(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 In(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 Sp(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 Ep({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=react.useMemo(()=>({...Dp,...n}),[n]),[i,u]=react.useState(new Set),d=react.useRef(null),p=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(b=>{let x=b.timestamp.toISOString().split("T")[0],S=h.get(x);S?S.push(b):h.set(x,[b]);}),Array.from(h.entries()).sort((b,x)=>x[0].localeCompare(b[0])).map(([b,x])=>({date:new Date(b),events:x.sort((S,D)=>D.timestamp.getTime()-S.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:f,uniqueTypes:v}=react.useMemo(()=>{let h=new Set,b=new Set;return e.forEach(x=>{h.add(x.userId),b.add(x.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(b)}},[e]),k=h=>{u(b=>{let x=new Set(b);return x.has(h)?x.delete(h):x.add(h),x});},g=h=>{let x=new Date().getTime()-h.getTime(),S=Math.floor(x/6e4),D=Math.floor(x/36e5),T=Math.floor(x/864e5);return S<1?"just now":S<60?`${S}m ago`:D<24?`${D}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},y=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:m("history-timeline-empty",l),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:m("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,types:b?[b]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(h=>jsxRuntime.jsxs("option",{value:h,children:[In(h)," ",h.replace("_"," ")]},h))]}),f.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,users:b?[b]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),f.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})})]}),y>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:p.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((b,x)=>{let S=i.has(b.id),D=s===b.id,T=Sp(b.type);return jsxRuntime.jsxs("div",{"data-event-id":b.id,className:m("history-timeline-event",S&&"expanded",D&&"selected"),onClick:()=>o?.(b),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:In(b.type)})}),x<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&b.userAvatar&&jsxRuntime.jsx("img",{src:b.userAvatar,alt:b.userName||b.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:b.userName||b.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Ln(b)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?g(b.timestamp):b.timestamp.toLocaleString()})]}),Object.keys(b.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),k(b.id);},children:[S?"\u25BC":"\u25B6"," Show changes"]}),S&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(b.changes).map(([w,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},w)),b.metadata&&Object.keys(b.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(b.metadata).map(([w,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},w))]})]})]})]},b.id)})})]},h.date?.toISOString()||"all"))})]})}function Mp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:m("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:m("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&In(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Ln(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:f=>l(parseInt(f.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((f,v)=>jsxRuntime.jsx("div",{className:m("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>l(v),title:Ln(f)},f.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(f=>jsxRuntime.jsxs("button",{className:m("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>c(f),children:[f,"x"]},f))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(f=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxRuntime.jsxs("div",{className:m("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 od(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 nd(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 Fp(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 Ap(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Zx(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})),l=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(u=>{let d=a/2,p=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(p-u.y)*o.centerForce*i,n.forEach(f=>{if(u.id===f.id)return;let v=u.x-f.x,k=u.y-f.y,g=Math.sqrt(v*v+k*k)||1,y=o.chargeStrength*i/(g*g);u.vx+=v/g*y,u.vy+=k/g*y;});}),t.forEach(u=>{let d=l.get(typeof u.source=="string"?u.source:u.source.id),p=l.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!p)return;let f=p.x-d.x,v=p.y-d.y,k=Math.sqrt(f*f+v*v)||1,g=(k-o.linkDistance)/k*o.forceStrength*i;d.vx+=f*g,d.vy+=v*g,p.vx-=f*g,p.vy-=v*g;}),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 Lp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=react.useRef(null),[u,d]=react.useState([]),[p,f]=react.useState(null),[v,k]=react.useState(null),[g,y]=react.useState(null),[h,b]=react.useState(1),[x,S]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let I=Zx(e,t,a.width,a.height,a,150);d(I);},[e,t,a]);let D=react.useCallback((I,re)=>{a.enableDragging&&(re.stopPropagation(),f(I));},[a.enableDragging]),T=react.useCallback(I=>{if(!p||!i.current)return;let E=i.current.getBoundingClientRect(),_=(I.clientX-E.left-x.x)/h,ie=(I.clientY-E.top-x.y)/h;d(Ee=>Ee.map(L=>L.id===p?{...L,x:_,y:ie,fx:_,fy:ie}:L));},[p,h,x]),w=react.useCallback(()=>{f(null);},[]),R=react.useCallback((I,re)=>{re.stopPropagation(),l?.({type:"node-click",node:I,position:{x:re.clientX,y:re.clientY}});},[l]),A=react.useCallback((I,re)=>{re.stopPropagation(),l?.({type:"edge-click",edge:I,position:{x:re.clientX,y:re.clientY}});},[l]),N=react.useCallback(I=>{let re=u.find(E=>E.id===I);return re?{x:re.x,y:re.y}:{x:0,y:0}},[u]),H=react.useCallback(I=>{if(I.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return I.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let re=I.card.priority;return re==="URGENT"?"#ef4444":re==="HIGH"?"#f59e0b":re==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return I.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:m("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:m("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:()=>b(I=>Math.min(I+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(I=>Math.max(I-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{b(1),S({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(I=>I.type))).map(I=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:od(I)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Fp(I)," ",nd(I)]})]},I))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(I=>{let re=N(typeof I.source=="string"?I.source:I.source.id),E=N(typeof I.target=="string"?I.target:I.target.id),_=Ap(I.type),ie=g===I.id,Ee=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:m("relationships-graph-edge",ie&&"hovered",Ee&&"critical"),onMouseEnter:()=>y(I.id),onMouseLeave:()=>y(null),onClick:L=>A(I,L),children:[jsxRuntime.jsx("line",{x1:re.x,y1:re.y,x2:E.x,y2:E.y,stroke:od(I.type),strokeWidth:Ee?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ie?1:.6,markerEnd:_?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ie&&jsxRuntime.jsx("text",{x:(re.x+E.x)/2,y:(re.y+E.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:nd(I.type)})]},I.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(I=>{let re=v===I.id,E=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:m("relationships-graph-node",re&&"hovered",E&&"critical"),transform:`translate(${I.x}, ${I.y})`,onMouseDown:_=>D(I.id,_),onMouseEnter:()=>k(I.id),onMouseLeave:()=>k(null),onClick:_=>R(I,_),children:[jsxRuntime.jsx("circle",{r:E?a.nodeSize*1.2:a.nodeSize,fill:H(I),stroke:E?"#fbbf24":"#ffffff",strokeWidth:E?3:2,opacity:re?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:I.card.title.length>20?I.card.title.substring(0,20)+"...":I.card.title})]},I.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 Rp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,c]=react.useState(false),[i,u]=react.useState(null),[d,p]=react.useState(null),f=react.useRef(null),v=l||o;react.useEffect(()=>{e&&f.current&&f.current.focus();},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&!v&&k();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,v]);let k=()=>{v||(n(""),u(null),p(null),t());},g=async()=>{if(!(!s.trim()||v)){c(true),u(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},y=()=>{d&&(a(d),k());};return e?jsxRuntime.jsxs(ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),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:k,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,b)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},b))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,b)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},b)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:f,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:v}),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,b)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},b))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&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:k,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var sd={"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 e2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},t2={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 a2(e,t,a){let r=sd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Bn(e){return `$${e.toFixed(4)}`}var id=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=a2(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),l=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=n).length,c=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:c,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},No=new id;function zp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(No.getStats()),[s,n]=react.useState(No.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(No.getStats()),n(No.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 l=No.getRecentOperations(5);return jsxRuntime.jsxs(ht,{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:Bn(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,d=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:Bn(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:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.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:l.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:Bn(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 Wp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[c,i]=react.useState(""),[u,d]=react.useState(""),[p,f]=react.useState(false),[v,k]=react.useState(null),[g,y]=react.useState(null),[h,b]=react.useState(null),x=react.useRef(null),S=p||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let A=N=>{N.key==="Escape"&&!S&&D();};if(e)return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[e,S]);let D=()=>{S||(l(""),i(""),d(""),k(null),y(null),b(null),t());},T=async()=>{if(!(!n.trim()||S)){f(true),k(null),y(null),b(null);try{let A=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});y(A.tasks.tasks),b({from_cache:A.from_cache,tokens_used:A.tokens_used,mock_mode:A.mock_mode,similarity:A.similarity,tokens_saved:A.tokens_saved});}catch(A){k(A instanceof Error?A.message:"Failed to generate tasks");}finally{f(false);}}},w=()=>{g&&(a(g),D());};if(!e)return null;let R=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:A=>A.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:D,disabled:S,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((A,N)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",N+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:A.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"})]}),A.start," \u2192 ",A.end]}),jsxRuntime.jsxs("span",{children:[A.duration," days"]}),A.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",A.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${A.priority==="high"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:A.priority})]})},A.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:x,value:n,onChange:A=>l(A.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:S}),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:A=>i(A.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:S})]}),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:A=>d(A.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:S})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),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((A,N)=>jsxRuntime.jsx("button",{onClick:()=>l(A),disabled:S,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:A},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:S&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:D,disabled:S,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:T,disabled:!n.trim()||S,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:S?"Generating...":"Generate Tasks"})]})]})]})})]})}function qs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&Vn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,h,b)=>{console.warn(`Retry attempt ${h} after ${b}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),s=react.useCallback(async(g,y,h)=>{r(b=>{let x=b.cards.find(A=>A.id===g);if(!x)return b;let S=x.columnId,D={...x,columnId:y,position:h},T=b.cards.map(A=>A.id===g?D:A),w=b.columns.map(A=>{if(A.id===S)return {...A,cardIds:A.cardIds.filter(N=>N!==g)};if(A.id===y){let N=T.filter(H=>H.columnId===y).sort((H,I)=>H.position-I.position);return {...A,cardIds:N.map(H=>H.id)}}return A}),R={...b,cards:T,columns:w};return o(R),R});},[o]),n=react.useCallback(async(g,y)=>{r(h=>{let b=h.cards.map(S=>S.id===g?{...S,...y}:S),x={...h,cards:b};return o(x),x});},[o]),l=react.useCallback(async g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y},x=h.columns.map(D=>D.id===g.columnId?{...D,cardIds:[...D.cardIds,y]}:D),S={...h,cards:[...h.cards,b],columns:x};return o(S),S});},[o]),c=react.useCallback(async g=>{r(y=>{let h=y.cards.find(D=>D.id===g);if(!h)return y;let b=y.cards.filter(D=>D.id!==g),x=y.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(T=>T!==g)}:D),S={...y,cards:b,columns:x};return o(S),S});},[o]),i=react.useCallback(async g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y,cardIds:[]},x={...h,columns:[...h.columns,b]};return o(x),x});},[o]),u=react.useCallback(async(g,y)=>{r(h=>{let b=h.columns.map(S=>S.id===g?{...S,...y}:S),x={...h,columns:b};return o(x),x});},[o]),d=react.useCallback(async g=>{r(y=>{let h=y.cards.filter(S=>S.columnId!==g),b=y.columns.filter(S=>S.id!==g),x={...y,cards:h,columns:b};return o(x),x});},[o]),p=react.useCallback(g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),y},[l]),f=react.useCallback(g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),y},[i]),v=react.useCallback(()=>{r(g=>{let y={...g,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:f,deleteCard:c,deleteColumn:d,clearBoard:v}}}function Vp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=qs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.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 Rn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},jp={by:"none",order:"asc"};function Kp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Rn,...e}),[s,n]=react.useState({...jp,...t}),l=react.useCallback(k=>{o(g=>({...g,...k}));},[]),c=react.useCallback(k=>{n(g=>({...g,...k}));},[]),i=react.useCallback(()=>{o(Rn),n(jp);},[]),u=react.useCallback(()=>{a&&o({...Rn,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Rn,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...Rn,priorities:["HIGH","URGENT"]});},[]),f=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]),v=react.useCallback(k=>{let g=[...k];if(r.search){let y=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(y)||h.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,h=y.getFullYear(),b=String(y.getMonth()+1).padStart(2,"0"),x=String(y.getDate()).padStart(2,"0"),S=`${h}-${b}-${x}`;g=g.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let T=D.endDate||D.dueDate;if(!T)return false;let w;if(typeof T=="string")w=T.split("T")[0]||T;else {let R=T.getUTCFullYear(),A=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");w=`${R}-${A}-${N}`;}switch(r.dateFilter){case "overdue":return w<S;case "today":return w===S;case "this-week":let R=new Date(S+"T00:00:00"),A=new Date(w+"T00:00:00"),N=new Date(R);return N.setDate(N.getDate()+7),A>=R&&A<=N;case "custom":if(r.dateRange){let H=typeof T=="string"?new Date(T):T;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(g=g.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(b=>r.assignees.includes(b)))),r.labels.length>0&&(g=g.filter(y=>y.labels&&y.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(y=>r.columns.includes(y.columnId))),s.by!=="none"&&g.sort((y,h)=>{let b=0;switch(s.by){case "created":let x=y.createdAt?new Date(y.createdAt).getTime():0,S=h.createdAt?new Date(h.createdAt).getTime():0;b=x-S;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=D[y.priority||"LOW"],w=D[h.priority||"LOW"];b=T-w;break;case "dueDate":let R=y.endDate||y.dueDate,A=h.endDate||h.dueDate;if(!R)return 1;if(!A)return -1;let N=typeof R=="string"?new Date(R).getTime():R.getTime(),H=typeof A=="string"?new Date(A).getTime():A.getTime();b=N-H;break;case "title":b=y.title.localeCompare(h.title);break;case "estimate":let I=y.estimatedTime||0,re=h.estimatedTime||0;b=I-re;break;default:b=0;}return s.order==="asc"?b:-b}),g},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:p,applyFilters:v,hasActiveFilters:f}}var qp,Xp;if(typeof window<"u")try{let e=Hn("ai");qp=e.generateObject,Xp=e.generateText;}catch{}function Jp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(qp&&Xp&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let f=p instanceof Error?p:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let f=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let f=p instanceof Error?p:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let f=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[s]),u=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let f=p instanceof Error?p:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function dd(){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 Zp(e){let{cards:t}=e,[a,r]=dd(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=p.ctrlKey||p.metaKey,v=p.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let k=t.find(y=>y.id===d),g=t.find(y=>y.id===a.lastSelectedCardId);if(k&&g&&k.columnId===g.columnId){let y=t.filter(w=>w.columnId===k.columnId).sort((w,R)=>w.position-R.position),h=y.findIndex(w=>w.id===a.lastSelectedCardId),b=y.findIndex(w=>w.id===d),[x,S]=h<b?[h,b]:[b,h],D=y.slice(x,S+1).map(w=>w.id),T=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:T,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),u=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var Qp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function eg(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Qp,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((k,g,y,h,b)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:k,cardIds:g,columnId:y,strategy:h,color:b,isExpanded:true,position:s.filter(S=>S.columnId===y).length,createdAt:new Date};n(S=>[...S,x]);},[o.minCardsPerStack,s]),c=react.useCallback(k=>{n(g=>g.filter(y=>y.id!==k));},[]),i=react.useCallback(k=>{n(g=>g.map(y=>y.id===k?{...y,isExpanded:!y.isExpanded}:y));},[]),u=react.useCallback((k,g)=>{n(y=>y.map(h=>h.id===k&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=react.useCallback((k,g)=>{n(y=>y.map(h=>{if(h.id===k){let b=h.cardIds.filter(x=>x!==g);return b.length<o.minCardsPerStack?null:{...h,cardIds:b}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=react.useCallback(k=>s.filter(g=>g.columnId===k).sort((g,y)=>g.position-y.position),[s]),f=react.useCallback(async k=>{let g=t.filter(S=>S.columnId===k);if(g.length<o.minCardsPerStack*2)return [];let y=[],h=new Map;g.forEach(S=>{S.labels&&S.labels.length>0&&S.labels.forEach(D=>{h.has(D)||h.set(D,[]),h.get(D).push(S);});}),h.forEach((S,D)=>{S.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:S.map(T=>T.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${S.length} cards with label "${D}"`,confidence:.85});});let b=new Map;g.forEach(S=>{S.assignedUserIds&&S.assignedUserIds.length>0&&S.assignedUserIds.forEach(D=>{b.has(D)||b.set(D,[]),b.get(D).push(S);});}),b.forEach((S,D)=>{S.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:S.map(T=>T.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${S.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(g.forEach(S=>{S.priority&&(x.has(S.priority)||x.set(S.priority,[]),x.get(S.priority).push(S));}),x.forEach((S,D)=>{if(S.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";y.push({stack:{title:`${T} ${D} Priority`,cardIds:S.map(w=>w.id),columnId:k,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${S.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let S of g){let T=(await r.findSimilar(S,g)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let w=[S.id,...T.map(A=>A.card.id)],R=T.reduce((A,N)=>A+N.similarity,0)/T.length;y.push({stack:{title:`\u2728 Similar to "${S.title.substring(0,30)}${S.title.length>30?"...":""}"`,cardIds:w,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:R});}}return y.filter(S=>S.confidence>=o.autoStackConfidenceThreshold).sort((S,D)=>D.confidence-S.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(k=>{l(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let y=await f(g),h=y[0];y.length>0&&h&&h.confidence>=.9&&v(h);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:p,getSuggestions:f,applySuggestion:v,config:o}}var tg=react.createContext(null);function ag({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}=Hn("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Hn("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Hn("@libxai/core");l=new c(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(tg.Provider,{value:{store:o},children:e})}function Xs(){let e=react.useContext(tg);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function $n(){let e=Xs(),[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 l=react.useCallback(h=>{e.updateBoard(h);},[e]),c=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,b)=>{e.updateColumn(h,b);},[e]),u=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),p=react.useCallback(h=>{e.addCard(h);},[e]),f=react.useCallback((h,b)=>{e.updateCard(h,b);},[e]),v=react.useCallback(h=>{e.deleteCard(h);},[e]),k=react.useCallback((h,b,x)=>{e.moveCard(h,b,x);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),y=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:d,addCard:p,updateCard:f,deleteCard:v,moveCard:k,getCard:g,getCardsByColumn:y}}function og(e){let{cards:t}=$n();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 ng(e="position",t="asc"){let{cards:a}=$n();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?l[o.priority]:0,i=s.priority?l[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 Js=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Wd.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},v2=new Js;function ig({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=u.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:p,className:o,children:jsxRuntime.jsx("div",{style:f,children:d.map(v=>{let k=e[v.index];if(!k)return null;let g=c?c(k,v.index):v.index,y={position:"absolute",top:n?0:v.start,left:n?v.start:0,width:n?v.size:"100%",height:n?"100%":v.size};return jsxRuntime.jsx("div",{style:y,"data-index":v.index,children:r(k,v.index)},g)})})})}function lg(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 cg({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:c,horizontal:i=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:f,className:s,children:jsxRuntime.jsx("div",{style:v,children:p.map(k=>{let g=e[k.index];if(!g)return null;let y=c?c(g,k.index):k.index,h={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":k.index,children:o(g,k.index)},y)})})})}function ug(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 mg(e,t=10){return e>t}var pd={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},gd={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},fd={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},hd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},bd={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},yd={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},vd={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},xd={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)"},kd={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)"},wd={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Cd={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},Td={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}},Zs={spacing:pd,borderRadius:gd,fontSize:fd,fontWeight:hd,lineHeight:bd,zIndex:yd,duration:vd,easing:xd,shadows:kd,opacity:wd,kanban:Cd,gantt:Td};function pg(e,t,a){return e[t]??a}function Nd(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)?Nd(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function w2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Dd(e="asakaa"){let t=Nd(Zs),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=w2(o);a.push(` ${s}: ${n};`);}return `:root {
403
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function nm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ur(e,t){let a=nm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return n.every(i=>c.includes(i))})}function Pl(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let f={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(f!==void 0){let v=new Date(r),w=v.getDay(),g=f-w;return g<=0&&(g+=7),v.setDate(v.getDate()+g),v}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),f=s[2].toLowerCase(),v=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?v.setDate(v.getDate()+p):f==="week"||f==="semana"||f==="semanas"?v.setDate(v.getDate()+p*7):(f==="month"||f==="mes"||f==="meses")&&v.setMonth(v.getMonth()+p),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),f=parseInt(l[2],10)-1,v=parseInt(l[3],10);return new Date(v,f,p)}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 p=parseInt(i[1],10),f=c[i[2].toLowerCase()],v=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(v,f,p)}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},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=u[d[1].toLowerCase()],f=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(v,p,f)}return null}function Ml(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 Fl(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 sm(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 im(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(),d=Ur(t,i),p=Pl(u);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(p);return v.setDate(v.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:v},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),d=Ur(t,i),p=Ml(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.name}" by ${p} days. New end date: ${f.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),u=s[2].trim(),d=Ur(t,i),p=Fl(u);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),d=Ur(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.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 l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),u=l[2].trim(),d=Ur(t,i),p=Ur(t,u);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName: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=Ur(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 lm(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 Xy(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 Jy(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ls(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(p=>p.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Ls(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},l=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:Xy(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 dm(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:Jy(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function cm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ls(r,e,t))}var Al={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Ll={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Is={en:Al,es:Ll};function Il(e){return Is[e]||Is.en}function Bs(e,t){let a=Il(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 Bl=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function um(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 mm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let c=um(e),i=Bl[0],u=Bl.find(f=>f.value===c)??i,d=u.icon,p=f=>{switch(um(f)){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(d,{className:m("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:m("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Bl.map(f=>{let v=f.icon;return jsxRuntime.jsxs("button",{onClick:w=>{w.stopPropagation(),t(f.value),n(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",c===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(v,{className:m("w-4 h-4",f.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p(f.value)})]},f.value)})})]})}var Rl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function gm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let u=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let c=Rl.find(u=>u.value===e)??Rl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:m("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:m("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Rl.map(u=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(u.value),n(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===u.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:m("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 $s(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function zs(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 hv(e,t){if(!e)return null;let a=Math.round(e.assignedHoursThisWeek/e.weeklyCapacity*100);switch(e.level){case "light":return {color:t?"text-green-400 bg-green-500/20":"text-green-600 bg-green-100",icon:null,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "moderate":return {color:t?"text-yellow-400 bg-yellow-500/20":"text-yellow-600 bg-yellow-100",icon:lucideReact.Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "heavy":return {color:t?"text-orange-400 bg-orange-500/20":"text-orange-600 bg-orange-100",icon:lucideReact.Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "overloaded":return {color:t?"text-red-400 bg-red-500/20":"text-red-600 bg-red-100",icon:lucideReact.AlertTriangle,label:`${a}%`,tooltip:`SOBRECARGADO: ${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`}}}function bm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false,showWorkloadIndicators:n=true}){let[l,c]=react.useState(false),[i,u]=react.useState(""),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&(c(false),u(""));};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]);let p=t.filter(g=>g.name.toLowerCase().includes(i.toLowerCase())||g.email?.toLowerCase().includes(i.toLowerCase())),f=n?[...p].sort((g,y)=>{let h={light:0,moderate:1,heavy:2,overloaded:3},b=g.workload?.level??"light",x=y.workload?.level??"light";return h[b]-h[x]}):p,v=g=>e.some(y=>y.name===g),w=g=>{if(a)if(v(g.name))a(e.filter(y=>y.name!==g.name));else {let y={name:g.name,initials:$s(g.name),color:g.color||zs(g.name).replace("bg-","").replace("-500",""),avatar:g.avatarUrl};a([...e,y]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:m("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((g,y)=>jsxRuntime.jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!g.avatar&&zs(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,title:g.name,children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||$s(g.name)},`${g.name}-${y}`)),e.length>3&&jsxRuntime.jsxs("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),c(!l);},className:m("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:m("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:m("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((g,y)=>jsxRuntime.jsx("div",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!g.avatar&&zs(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||$s(g.name)},`${g.name}-${y}`)),e.length>2&&jsxRuntime.jsxs("span",{className:m("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),l&&jsxRuntime.jsxs("div",{className:m("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-72",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[n&&jsxRuntime.jsxs("div",{className:m("px-3 py-2 text-xs border-b flex items-center gap-3",r?"text-[#9CA3AF] border-white/10":"text-gray-500 border-gray-200"),children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),o==="es"?"Ligera":"Light"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-yellow-500"}),o==="es"?"Moderada":"Moderate"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"}),o==="es"?"Alta":"Heavy"]})]}),jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:g=>u(g.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:m("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:g=>g.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:f.length===0?jsxRuntime.jsx("p",{className:m("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):f.map(g=>{let y=hv(g.workload,r);return jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),w(g);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",g.workload?.level==="overloaded"&&(r?"bg-red-500/5":"bg-red-50")),title:y?.tooltip,children:[jsxRuntime.jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!g.avatarUrl&&zs(g.name)),children:g.avatarUrl?jsxRuntime.jsx("img",{src:g.avatarUrl,alt:g.name,className:"w-full h-full rounded-full object-cover"}):$s(g.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:g.name}),g.email&&jsxRuntime.jsx("div",{className:m("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:g.email})]}),n&&y&&jsxRuntime.jsxs("div",{className:m("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",y.color),children:[y.icon&&jsxRuntime.jsx(y.icon,{className:"w-3 h-3"}),y.label]}),v(g.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},g.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((g,y)=>jsxRuntime.jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[g.name,jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==g.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${g.name}-${y}`))})]})]})}function xm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:c}){let[i,u]=react.useState(false),[d,p]=react.useState(o),[f,v]=react.useState(()=>{let C=o==="start"?e:t;if(C){let k=C instanceof Date?C:new Date(C);return new Date(k.getFullYear(),k.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),w=react.useRef(null),g=e?e instanceof Date?e:new Date(e):null,y=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let C=k=>{w.current&&!w.current.contains(k.target)&&u(false);};return i&&document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),react.useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let h=C=>C?C.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",b=react.useCallback(()=>{let C=f.getFullYear(),k=f.getMonth(),R=new Date(C,k,1),T=new Date(C,k+1,0).getDate(),H=R.getDay(),A=[],S=new Date(C,k,0).getDate();for(let ue=H-1;ue>=0;ue--)A.push({date:new Date(C,k-1,S-ue),isCurrentMonth:false});for(let ue=1;ue<=T;ue++)A.push({date:new Date(C,k,ue),isCurrentMonth:true});let Y=42-A.length;for(let ue=1;ue<=Y;ue++)A.push({date:new Date(C,k+1,ue),isCurrentMonth:false});return A},[f]),x=C=>{if(r)o==="start"?a(C,y||void 0):a(g||void 0,C),u(false);else if(d==="start"){let k=y&&C>y?C:y;a(C,k||void 0),p("end");}else {let k=g&&C<g?C:g;a(k||void 0,C),u(false);}},D=()=>{let C=new Date,k=new Date(C);k.setDate(C.getDate()+1);let R=new Date(C);R.setDate(C.getDate()+((6-C.getDay()+7)%7||7));let I=new Date(C);I.setDate(C.getDate()+((1-C.getDay()+7)%7||7));let T=new Date(C);T.setDate(C.getDate()+(6-C.getDay()+7)%7+7);let H=new Date(C);H.setDate(C.getDate()+14);let A=new Date(C);return A.setDate(C.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:R,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let C=r&&o==="start"?g:y;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:m("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(C)})]})}let N=r&&o==="start"?g:y;return jsxRuntime.jsxs("div",{ref:w,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),u(!i);let k=o==="start"?g:y;k&&v(new Date(k.getFullYear(),k.getMonth(),1));},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:m("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(N)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(false)}),jsxRuntime.jsxs("div",{className:m("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:C=>C.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:m("w-44 py-2 border-r",s?"border-white/10":"border-gray-200"),children:[D().map((C,k)=>jsxRuntime.jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(C.date),children:[jsxRuntime.jsx("span",{children:C.label}),jsxRuntime.jsx("span",{className:m("text-xs",s?"text-[#6B7280]":"text-gray-400"),children:C.display})]},k)),jsxRuntime.jsx("div",{className:m("border-t mt-2 pt-2",s?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,y||void 0):a(g||void 0,void 0):a(void 0,void 0),u(false);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[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:m("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:m("font-medium",s?"text-white":"text-gray-900"),children:f.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:()=>v(new Date),className:m("p-1 rounded text-sm transition-colors",s?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()-1)),className:m("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:m("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()+1)),className:m("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("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(C=>jsxRuntime.jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",s?"text-[#6B7280]":"text-gray-400"),children:C},C))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:b().map((C,k)=>{let R=C.date.toDateString()===new Date().toDateString(),I=g?.toDateString()===C.date.toDateString(),T=y?.toDateString()===C.date.toDateString(),H=I||T,A=!r&&g&&y&&C.date>=g&&C.date<=y;return jsxRuntime.jsx("button",{onClick:()=>x(new Date(C.date)),className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!C.isCurrentMonth&&(s?"text-[#4B5563]":"text-gray-300"),C.isCurrentMonth&&(s?"text-white":"text-gray-900"),R&&"ring-2 ring-[#3B82F6]",I&&"bg-[#3B82F6] text-white",T&&!I&&"bg-[#7C3AED] text-white",A&&!H&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!H&&(s?"hover:bg-white/10":"hover:bg-gray-100")),children:C.date.getDate()},k)})})]})]})]})]})}function Us({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(xm,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(p,f)=>{t&&t(s==="start"?p:f);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Qo(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 Hs(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,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 d=i.current??0,p=e,f=p-d,v=r/o;c(true);for(let w=1;w<=o;w++){let g=setTimeout(()=>{let y=w/o,h=1-Math.pow(1-y,3),b=Math.round(d+f*h);n(b),w===o&&(c(false),n(p));},v*w);u.current.push(g);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function km(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),c=react.useRef(null),i=react.useRef(null),u=react.useCallback(f=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(f),l(0);let v=Date.now();i.current=setInterval(()=>{let w=Date.now()-v,g=Math.min(w/a*100,100);l(g);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(f),s(null),l(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(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:d}}function Tm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:l}=Qo(),{displayValue:c,isAnimating:i}=Hs(e,{enabled:o,duration:300,steps:6}),u=p=>{if(r||!t)return;p.stopPropagation();let f=p.currentTarget.getBoundingClientRect(),v=p.clientX-f.left,w=Math.round(v/f.width*100),g=Math.max(0,Math.min(100,w));g!==e&&(t(g),s&&l());},d=c??e;return jsxRuntime.jsxs("div",{className:m("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-all duration-300",n&&(a?"bg-green-500/30":"bg-green-500/20")),children:[jsxRuntime.jsx("div",{onClick:u,className:m("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:m("h-full rounded-full transition-all",d===100?"bg-green-500":"bg-[#3B82F6]",i&&"transition-none"),style:{width:`${d}%`}})}),jsxRuntime.jsxs("span",{className:m("text-xs w-8 text-right tabular-nums transition-all",a?"text-[#9CA3AF]":"text-gray-500",i&&"font-medium scale-105"),children:[d,"%"]})]})}function Sm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,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=()=>{l!==e&&t?.(l),n(false);},d=p=>{p.key==="Enter"?u():p.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:m("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:p=>c(p.target.value),onBlur:u,onKeyDown:d,onClick:p=>p.stopPropagation(),className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:m("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Mm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,u]=react.useState(false),[d,p]=react.useState(e?.toString()||""),f=react.useRef(null),{isFlashing:v,triggerFlash:w}=Qo(),{displayValue:g,isAnimating:y}=Hs(e,{enabled:l&&!i});react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]),react.useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let x=parseFloat(d);if(!isNaN(x)){let D=x;o!==void 0&&(D=Math.max(o,D)),s!==void 0&&(D=Math.min(s,D)),D!==e&&(t?.(D),c&&w());}u(false);},b=x=>{x.key==="Enter"?h():x.key==="Escape"&&(p(e?.toString()||""),u(false));};return n||!t?jsxRuntime.jsx("span",{className:m("text-sm transition-all",a?"text-[#94A3B8]":"text-gray-500",y&&"font-medium"),children:g!==void 0?g:r}):i?jsxRuntime.jsx("input",{ref:f,type:"number",value:d,onChange:x=>p(x.target.value),onBlur:h,onKeyDown:b,onClick:x=>x.stopPropagation(),min:o,max:s,className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),u(true);},className:m("text-sm text-left w-full px-2 py-1 rounded transition-all duration-300",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",g===void 0&&(a?"text-[#6B7280]":"text-gray-400"),v&&(a?"bg-green-500/30":"bg-green-500/20"),y&&"font-medium scale-105"),children:g!==void 0?g:r})}function Fm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:m("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:m("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:m("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),l(false);},className:m("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Lm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:c,startChange:i,cancelChange:u}=km(t,{delay:s}),d=f=>{f.stopPropagation(),!r&&t&&(o?l?u():i(!e):t(!e));},p=l?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:m("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-all",p?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&p&&"ring-green-500/50",l&&!p&&"ring-red-500/50",l&&(a?"ring-offset-[#0F1117]":"ring-offset-white")),children:[l&&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:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),u();},className:m("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 Rm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:m("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:m("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function Rv(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 Ov(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*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 wo({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false}){let[c,i]=react.useState(false),[u,d]=react.useState(""),p=react.useRef(null),{isFlashing:f,triggerFlash:v}=Qo(),w=Rv(e,r);react.useEffect(()=>{c&&p.current&&(p.current.focus(),p.current.select());},[c]),react.useEffect(()=>{if(e){let h=Math.floor(e/60),b=e%60;h>0&&b>0?d(`${h}h ${b}m`):h>0?d(`${h}h`):d(`${b}m`);}else d("");},[e,c]);let g=()=>{let h=Ov(u);h!==e&&(t?.(h),n&&v()),i(false);},y=h=>{h.key==="Enter"?g():h.key==="Escape"&&i(false);};return l?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:m("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-[#94A3B8]":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]}):s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:w})]}):c?jsxRuntime.jsx("input",{ref:p,type:"text",value:u,onChange:h=>d(h.target.value),onBlur:g,onKeyDown:y,onClick:h=>h.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),i(true);},className:m("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-all duration-300 overflow-hidden",a?"hover:bg-white/10":"hover:bg-gray-100",e!=null&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400",f&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:m("w-3 h-3 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate",children:w})]})}function Jv(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Zv(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 Wm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:u=[]}){let d=react.useRef(null),p=r==="es"?Um.es:Um.en;if(react.useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&t();},h=b=>{b.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:p.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}),l&&(y.push({id:"status",label:p.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:p.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&y.push({id:"assign",label:p.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let b=e.task.assignees||[],D=b.some(N=>N.name===h.name)?b.filter(N=>N.name!==h.name):[...b,{name:h.name,initials:Jv(h.name),color:h.color||Zv(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:D}),t();}}))})),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:p.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:p.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},v=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:p.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:p.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:p.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),y},w=e.type==="task"?f():v(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:d,style:g,className:m("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:w.map(y=>y.separator?jsxRuntime.jsx("div",{className:m("my-1 h-px",a?"bg-white/10":"bg-gray-200")},y.id):y.submenu?jsxRuntime.jsx(Qv,{item:y,isDark:a},y.id):jsxRuntime.jsxs("button",{onClick:y.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:m(y.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function Qv({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:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:m("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Um={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var qm={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"}),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"})},gx=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function Jm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[c,i]=react.useState(""),[u,d]=react.useState(null),p=react.useRef(null),f=l==="es"?Xm.es:Xm.en;if(react.useLayoutEffect(()=>{if(!e||!p.current)return;let b=()=>{if(!p.current)return;let x=p.current.getBoundingClientRect(),N=window.innerHeight-x.top-20;d(Math.max(300,N));};return requestAnimationFrame(b),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[e]),react.useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let x=N=>{p.current&&!p.current.contains(N.target)&&t();},D=N=>{N.key==="Escape"&&t();};document.addEventListener("mousedown",x),document.addEventListener("keydown",D),p._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(b),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let v=b=>f.columns[b]||b,w=b=>{if(b==="name")return;let x=a.map(D=>D.id===b?{...D,visible:!D.visible}:D);o(x);},g=(b,x)=>{let D=a.find(C=>C.type===b&&(!x||C.customFieldId===x));if(D){w(D.id);return}let N={id:x||b,type:b,label:x?r.find(C=>C.id===x)?.name||b:v(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:x};o([...a,N]);},y=gx.filter(b=>v(b).toLowerCase().includes(c.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(c.toLowerCase()));return jsxRuntime.jsxs("div",{ref:p,style:u?{maxHeight:`${u}px`}:void 0,className:m("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50 flex flex-col",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:m("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:m("font-medium",n?"text-white":"text-gray-900"),children:f.title}),jsxRuntime.jsx("button",{onClick:t,className:m("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:m("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:m("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:b=>i(b.target.value),placeholder:f.searchPlaceholder,className:m("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain",onWheel:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:m("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:y.map(b=>{let x=a.find(C=>C.type===b&&!C.customFieldId),D=x?.visible??false,N=b==="name";return jsxRuntime.jsxs("button",{onClick:()=>{N||(x?w(x.id):g(b));},disabled:N,className:m("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",N&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:m("w-5 h-5 rounded border flex items-center justify-center",D?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:qm[b]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:v(b)})]},b)})})]}),h.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:m("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:h.map(b=>{let D=a.find(N=>N.customFieldId===b.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>g(b.type,b.id),className:m("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:m("w-5 h-5 rounded border flex items-center justify-center",D?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:qm[b.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:b.name})]},b.id)})})]})]})]})}var Xm={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",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Cx=[{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 ep({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,c]=react.useState("text"),[i,u]=react.useState([""]),d=o==="es"?Qm.es:Qm.en;react.useEffect(()=>{e&&(n(""),c("text"),u([""]));},[e]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let p=()=>{if(!s.trim())return;let g={name:s.trim(),type:l};l==="dropdown"&&(g.options=i.filter(y=>y.trim())),a(g),t();},f=()=>{u([...i,""]);},v=(g,y)=>{let h=[...i];h[g]=y,u(h);},w=g=>{i.length>1&&u(i.filter((y,h)=>h!==g));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:m("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:m("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:m("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:m("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:m("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:d.fieldNamePlaceholder,className:m("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Cx.map(g=>jsxRuntime.jsxs("button",{onClick:()=>c(g.type),className:m("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsxRuntime.jsx("span",{className:m("text-xs",l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[g.type]})]},g.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((g,y)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:g,onChange:h=>v(y,h.target.value),placeholder:`${d.option} ${y+1}`,className:m("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>w(y),className:m("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},y)),jsxRuntime.jsxs("button",{onClick:f,className:m("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:m("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:p,disabled:!s.trim(),className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Qm={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 rp={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 op({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),u=s==="es"?rp.es:rp.en;react.useEffect(()=>{if(!n)return;let f=w=>{Date.now()-i.current<100||c.current&&!c.current.contains(w.target)&&l(false);},v=w=>{w.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);}},[n]);let d=[{value:"all",label:u.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{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"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),l(v=>!v);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),u.filters,p&&jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:m("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:m("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:m("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:u.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(f=>{let v=e===f.value&&!t,w=()=>f.value==="all"?v?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(f.value),r(false),l(false);},className:m("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",v&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m(v?f.color:"text-gray-400","flex-shrink-0"),children:w()}),jsxRuntime.jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),v&&jsxRuntime.jsx(lucideReact.Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsxRuntime.jsx("div",{className:m("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let f=!t;r(f),f&&a("all"),l(false);},className:m("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:m("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var Ox=[{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 lp(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(...lp(r.subtasks,t+1));return a}function dp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[]}){let{theme:i="dark",locale:u="en",customTranslations:d,showSearch:p=true,showHierarchy:f=true,tableColumns:v,allowColumnCustomization:w=true,allowColumnResize:g=true,enableContextMenu:y=true,showCreateTaskButton:h=false,onCreateTask:b,persistFilter:x=false,financialBlur:D}=t,N=Bs(u,d),C=i==="dark",k=react.useCallback(()=>{if(!x||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let G=localStorage.getItem(x);if(G){let q=JSON.parse(G);return {statusFilter:q.statusFilter||"all",hideCompleted:q.hideCompleted||!1}}}catch(G){console.error("Error loading persisted filter:",G);}return {statusFilter:"all",hideCompleted:false}},[x]),[R,I]=react.useState("startDate"),[T,H]=react.useState("asc"),[A,ee]=react.useState(""),[S,Y]=react.useState(()=>k().statusFilter),[ue,Pe]=react.useState(()=>k().hideCompleted),[F,pe]=react.useState(v||Ox),[J,te]=react.useState(false),[L,oe]=react.useState(false),[ie,Se]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[U,K]=react.useState(null),[le,j]=react.useState(0),[Ie,he]=react.useState(0),$e=react.useRef(null);react.useEffect(()=>{v&&pe(v);},[v]),react.useEffect(()=>{if(!(!x||typeof window>"u"))try{localStorage.setItem(x,JSON.stringify({statusFilter:S,hideCompleted:ue}));}catch(G){console.error("Error persisting filter state:",G);}},[x,S,ue]);let Xe=react.useMemo(()=>{let G=new Set;function q(ve){for(let Qe of ve)Qe.subtasks?.length&&(Qe.isExpanded!==false&&G.add(Qe.id),q(Qe.subtasks));}return q(e),G},[e]),tt=react.useMemo(()=>F.filter(G=>G.visible),[F]),Ye=react.useCallback(G=>{a.onTaskToggleExpand?.(G);},[a]),ht=react.useCallback(G=>{R===G?H(q=>q==="asc"?"desc":"asc"):(I(G),H("asc")),a.onSortChange?.({column:G,direction:T==="asc"?"desc":"asc"});},[R,T,a]),it=react.useCallback(G=>{pe(G),a.onColumnsChange?.(G);},[a]),at=react.useCallback(G=>{let q=F.map(ve=>ve.id===G?{...ve,visible:false}:ve);it(q);},[F,it]),se=react.useCallback((G,q)=>{I(G),H(q);},[]),B=react.useCallback((G,q,ve)=>{y&&(G.preventDefault(),Se({isOpen:true,x:G.clientX,y:G.clientY,type:q?"task":"header",task:q,columnId:ve}));},[y]),Z=react.useCallback(()=>{Se(G=>({...G,isOpen:false}));},[]),ge=react.useCallback((G,q)=>{if(!g)return;G.preventDefault(),G.stopPropagation();let ve=F.find(Qe=>Qe.id===q);ve&&(K(q),j(G.clientX),he(ve.width));},[F,g]);react.useEffect(()=>{if(!U)return;let G=ve=>{let Qe=ve.clientX-le,Te=Math.max(50,Ie+Qe),Ae=F.map(X=>X.id===U?{...X,width:Te}:X);pe(Ae);},q=()=>{U&&a.onColumnsChange?.(F),K(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",q),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",q);}},[U,le,Ie,F,a]);let Ce=react.useCallback(async G=>{if(a.onCreateCustomField){let q={...G,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(q);}oe(false);},[a]),Ue=react.useCallback(G=>G.progress===100||G.status==="completed"?"completed":G.progress&&G.progress>0||G.status==="in-progress"?"in-progress":"todo",[]),et=react.useMemo(()=>{let G=lp(e);if(A.trim()){let q=A.toLowerCase();G=G.filter(ve=>ve.name.toLowerCase().includes(q));}return S!=="all"&&(G=G.filter(q=>Ue(q)===S)),ue&&(G=G.filter(q=>Ue(q)!=="completed")),G.sort((q,ve)=>{let Qe,Te;switch(R){case "name":Qe=q.name.toLowerCase(),Te=ve.name.toLowerCase();break;case "startDate":Qe=q.startDate?.getTime()||0,Te=ve.startDate?.getTime()||0;break;case "endDate":Qe=q.endDate?.getTime()||0,Te=ve.endDate?.getTime()||0;break;case "progress":Qe=q.progress||0,Te=ve.progress||0;break;case "status":Qe=q.status||"todo",Te=ve.status||"todo";break;case "priority":let Ae={urgent:0,high:1,medium:2,low:3,none:4};Qe=Ae[q.priority]??4,Te=Ae[ve.priority]??4;break;default:return 0}return Qe<Te?T==="asc"?-1:1:Qe>Te?T==="asc"?1:-1:0}),G},[e,A,S,ue,R,T,Ue]),lt=react.useCallback((G,q)=>{let ve=Ae=>{a.onTaskUpdate?.({...G,...Ae});},Qe=Ae=>Ae?G.customFields?.find(We=>We.fieldId===Ae)?.value:void 0,Te=(Ae,X)=>{if(!Ae)return;let z=[...G.customFields||[]],de=z.findIndex(Be=>Be.fieldId===Ae);de>=0?z[de]={fieldId:Ae,value:X}:z.push({fieldId:Ae,value:X}),ve({customFields:z});};switch(q.type){case "name":return null;case "status":return jsxRuntime.jsx(mm,{value:G.status||(G.progress===100?"completed":G.progress&&G.progress>0?"in-progress":"todo"),onChange:X=>{ve({status:X,progress:X==="completed"?100:X==="in-progress"?50:0});},isDark:C,locale:u,translations:N.status});case "priority":return jsxRuntime.jsx(gm,{value:G.priority,onChange:X=>ve({priority:X}),isDark:C,locale:u});case "assignees":return jsxRuntime.jsx(bm,{value:G.assignees||[],availableUsers:l,onChange:X=>ve({assignees:X}),isDark:C,locale:u});case "startDate":return jsxRuntime.jsx(Us,{value:G.startDate,onChange:X=>ve({startDate:X}),isDark:C,locale:u,dateField:"start",startDate:G.startDate,endDate:G.endDate});case "endDate":return jsxRuntime.jsx(Us,{value:G.endDate,onChange:X=>ve({endDate:X}),isDark:C,locale:u,dateField:"end",startDate:G.startDate,endDate:G.endDate});case "progress":return jsxRuntime.jsx(Tm,{value:G.progress||0,onChange:X=>{let We=X===100?"completed":X>0?"in-progress":"todo";ve({progress:X,status:We});},isDark:C});case "tags":return jsxRuntime.jsx(Rm,{value:G.tags||[],isDark:C});case "text":return jsxRuntime.jsx(Sm,{value:Qe(q.customFieldId)||"",onChange:X=>Te(q.customFieldId,X),isDark:C});case "number":return jsxRuntime.jsx(Mm,{value:Qe(q.customFieldId)||0,onChange:X=>Te(q.customFieldId,X),isDark:C});case "date":let Ae=Qe(q.customFieldId);return jsxRuntime.jsx(Us,{value:Ae?new Date(Ae):void 0,onChange:X=>Te(q.customFieldId,X),isDark:C,locale:u});case "dropdown":return jsxRuntime.jsx(Fm,{value:Qe(q.customFieldId)||"",options:q.options||[],onChange:X=>Te(q.customFieldId,X),isDark:C});case "checkbox":return jsxRuntime.jsx(Lm,{value:Qe(q.customFieldId)||false,onChange:X=>Te(q.customFieldId,X),isDark:C});case "estimatedTime":{let X=G.status==="completed"||G.progress===100;return jsxRuntime.jsx(wo,{value:G.estimatedTime,onChange:We=>ve({estimatedTime:We}),isDark:C,locale:u,disabled:X})}case "quotedTime":{let X=G.status==="completed"||G.progress===100,We=D?.enabled&&(!D.columns||D.columns.includes("quotedTime"));return jsxRuntime.jsx(wo,{value:G.quotedTime,onChange:z=>ve({quotedTime:z}),isDark:C,locale:u,disabled:X,isBlurred:We})}case "elapsedTime":{let X=G.status==="completed"||G.progress===100;return jsxRuntime.jsx(wo,{value:G.elapsedTime,onChange:We=>ve({elapsedTime:We}),isDark:C,locale:u,disabled:X})}case "effortMinutes":{let X=G.status==="completed"||G.progress===100;return jsxRuntime.jsx(wo,{value:G.effortMinutes,onChange:We=>ve({effortMinutes:We}),isDark:C,locale:u,disabled:X})}case "timeLoggedMinutes":{let X=G.status==="completed"||G.progress===100;return jsxRuntime.jsx(wo,{value:G.timeLoggedMinutes,onChange:a.onLogTime?We=>{a.onLogTime?.(G,We);}:void 0,isDark:C,locale:u,placeholder:u==="es"?"Agregar":"Add",disabled:X})}case "soldEffortMinutes":{let X=G.status==="completed"||G.progress===100,We=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(wo,{value:G.soldEffortMinutes,onChange:z=>ve({soldEffortMinutes:z}),isDark:C,locale:u,disabled:X,isBlurred:We})}default:return jsxRuntime.jsx("span",{className:m("text-sm",C?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,C,u,l,N]),He=react.useCallback(G=>{let ve={name:N.columns.name,status:N.columns.status,priority:N.columns.priority,assignees:N.columns.assignees,startDate:N.columns.startDate,endDate:N.columns.endDate,progress:N.columns.progress,tags:N.columns.tags||(u==="es"?"Etiquetas":"Tags"),estimatedTime:N.columns.estimatedTime||(u==="es"?"Estimado":"Estimated"),quotedTime:N.columns.quotedTime||(u==="es"?"Ofertado":"Quoted"),elapsedTime:N.columns.elapsedTime||(u==="es"?"Tiempo":"Time Spent"),effortMinutes:N.columns.effortMinutes||(u==="es"?"Estimado":"Estimated"),timeLoggedMinutes:N.columns.timeLoggedMinutes||(u==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:N.columns.soldEffortMinutes||(u==="es"?"Ofertado":"Quoted")}[G.type]||G.label;return typeof ve=="string"?ve:String(ve||G.type)},[N,u]),ra=react.useMemo(()=>tt.reduce((G,q)=>G+q.width,0)+(w?48:0),[tt,w]);return r?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:[N.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:m("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:m("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:N.empty.noTasks}),jsxRuntime.jsx("p",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:N.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:$e,className:m("flex-1 flex flex-col w-full h-full overflow-hidden",C?"bg-[#0F1117]":"bg-white",U&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:m("flex-shrink-0 px-6 py-4 border-b",C?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(op,{value:S,hideCompleted:ue,onChange:Y,onHideCompletedChange:Pe,isDark:C,locale:u}),jsxRuntime.jsxs("div",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:[et.length," ",N.pagination.tasks]}),p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:m("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:A,onChange:G=>ee(G.target.value),placeholder:N.toolbar.searchPlaceholder,className:m("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",C?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),h&&b&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:b,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:N.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:ra},children:[jsxRuntime.jsxs("div",{className:m("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",C?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[tt.map(G=>jsxRuntime.jsxs("div",{className:m("relative flex items-center gap-2 px-4 py-3",C?"text-[#9CA3AF]":"text-gray-500"),style:{width:G.width,minWidth:G.minWidth},onContextMenu:q=>B(q,void 0,G.id),children:[G.sortable?jsxRuntime.jsxs("button",{onClick:()=>ht(G.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[He(G),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:m("w-3 h-3",R===G.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:He(G)}),g&&G.resizable&&jsxRuntime.jsx("div",{className:m("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",U===G.id&&"bg-[#3B82F6]"),onMouseDown:q=>ge(q,G.id)})]},G.id)),w&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),te(q=>!q);},className:m("p-1.5 rounded-lg transition-colors",C?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",J&&(C?"bg-white/10":"bg-gray-200")),title:u==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(Jm,{isOpen:J,onClose:()=>te(false),columns:F,customFields:c,onColumnsChange:it,onCreateCustomField:()=>{te(false),oe(true);},isDark:C,locale:u})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:et.map((G,q)=>{let ve=Xe.has(G.id),Qe=Math.min(q*.01,.2);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Qe},className:m("flex items-center border-b transition-colors",C?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(G),onDoubleClick:()=>a.onTaskDoubleClick?.(G),onContextMenu:Te=>B(Te,G),children:[tt.map(Te=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Te.width,minWidth:Te.minWidth},children:Te.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&G.level>0&&jsxRuntime.jsx("div",{style:{width:`${G.level*24}px`},className:"flex-shrink-0"}),f&&G.hasChildren&&jsxRuntime.jsx("button",{onClick:Ae=>{Ae.stopPropagation(),Ye(G.id);},className:m("p-0.5 rounded flex-shrink-0",C?"hover:bg-white/10":"hover:bg-gray-200"),children:ve?jsxRuntime.jsx(lucideReact.ChevronDown,{className:m("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")})}),f&&!G.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("span",{className:m("truncate font-medium",C?"text-white":"text-gray-900",G.progress===100&&(C?"line-through text-[#6B7280]":"line-through text-gray-400")),children:G.name})]}):lt(G,Te)},Te.id)),w&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},G.id)})}),et.length===0&&A&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:m("w-12 h-12 mx-auto mb-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:m(C?"text-[#9CA3AF]":"text-gray-600"),children:N.empty.noResults})]})})]})}),jsxRuntime.jsx(Wm,{state:ie,onClose:Z,isDark:C,locale:u,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:at,onColumnSort:se,availableUsers:l}),jsxRuntime.jsx(ep,{isOpen:L,onClose:()=>oe(false),onSave:Ce,isDark:C,locale:u})]})}var cp=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true}],up=[{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"}],mp=[{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 Yl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},ql={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"},Xl={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"},Vs={dark:Yl,light:ql,neutral:Xl};function pp(e){return Vs[e]||Vs.dark}var Jl={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Zl={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},_s={en:Jl,es:Zl};function Fn(e){return _s[e]||_s.en}function js(e,t){let a=Fn(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 gp(e){let t=Fn(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 fp(e,t=0,a=true){let r=Fn(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 xp(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 ed(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 kp({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Cp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:w,onTaskOpen:g,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,timerState:x,onLogTime:D,onUpdateEstimate:N,onUpdateSoldEffort:C,onStartTimer:k,onStopTimer:R,onDiscardTimer:I,blurFinancials:T=false}){let{theme:H="dark",locale:A="en",customTranslations:ee}=t,S=js(A,ee),Y=H==="dark",[ue,Pe]=react.useState(r||new Date),[F,pe]=react.useState(null),[J,te]=react.useState(null),[L,oe]=react.useState({}),ie=4,Se=3,[U,K]=react.useState(null),[le,j]=react.useState(""),[Ie,he]=react.useState(void 0),[$e,Xe]=react.useState(null),[tt,Ye]=react.useState(false),[ht,it]=react.useState(false),[at,se]=react.useState(null),[B,Z]=react.useState(false),[ge,Ce]=react.useState(new Date),Ue=react.useCallback(()=>{Pe(new Date(ue.getFullYear(),ue.getMonth()-1,1));},[ue]),et=react.useCallback(()=>{Pe(new Date(ue.getFullYear(),ue.getMonth()+1,1));},[ue]),lt=react.useCallback(()=>{Pe(new Date);},[]),He=react.useMemo(()=>{let q=ue.getFullYear(),ve=ue.getMonth(),Qe=new Date(q,ve,1),Te=new Date(q,ve+1,0),Ae=Qe.getDay(),X=Te.getDate(),We=xp(e),z=new Date;z.setHours(0,0,0,0);let de=[],Be=Ae,Ke=new Date(q,ve,0).getDate();for(let Oe=Be-1;Oe>=0;Oe--){let $=new Date(q,ve-1,Ke-Oe);de.push({date:$,isCurrentMonth:false,isToday:false,isWeekend:$.getDay()===0||$.getDay()===6,events:We.filter(_=>ed($,_)).map(_=>({id:_.id,title:_.name,start:_.startDate,end:_.endDate,task:_}))});}for(let Oe=1;Oe<=X;Oe++){let $=new Date(q,ve,Oe),_=$.getTime()===z.getTime();de.push({date:$,isCurrentMonth:true,isToday:_,isWeekend:$.getDay()===0||$.getDay()===6,events:We.filter(xe=>ed($,xe)).map(xe=>({id:xe.id,title:xe.name,start:xe.startDate,end:xe.endDate,task:xe}))});}let _e=42-de.length;for(let Oe=1;Oe<=_e;Oe++){let $=new Date(q,ve+1,Oe);de.push({date:$,isCurrentMonth:false,isToday:false,isWeekend:$.getDay()===0||$.getDay()===6,events:We.filter(_=>ed($,_)).map(_=>({id:_.id,title:_.name,start:_.startDate,end:_.endDate,task:_}))});}return de},[ue,e]),ra=A==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],G=ue.toLocaleDateString(A==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",Y?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:m("text-sm",Y?"text-[#9CA3AF]":"text-gray-600"),children:[S.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",Y?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:m("text-lg font-semibold mb-2",Y?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:m("text-sm",Y?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:m("flex-1 flex items-center justify-center",Y?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:m("text-lg font-semibold mb-2",Y?"text-white":"text-gray-900"),children:S.labels.noEvents}),jsxRuntime.jsx("p",{className:m("text-sm",Y?"text-[#9CA3AF]":"text-gray-600"),children:S.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:m("flex-1 flex flex-col w-full h-full overflow-auto",Y?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:m("flex-shrink-0 px-6 py-4 border-b",Y?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:m("text-xl font-semibold capitalize",Y?"text-white":"text-gray-900"),children:G}),jsxRuntime.jsx("button",{onClick:lt,className:m("px-3 py-1.5 text-sm rounded-lg transition-colors",Y?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:S.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Ue,className:m("p-2 rounded-lg transition-colors",Y?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:m("w-5 h-5",Y?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:et,className:m("p-2 rounded-lg transition-colors",Y?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:m("w-5 h-5",Y?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:ra.map(q=>jsxRuntime.jsx("div",{className:m("py-2 text-center text-xs font-medium uppercase",Y?"text-[#9CA3AF]":"text-gray-500"),children:q},q))}),jsxRuntime.jsx("div",{className:m("grid grid-cols-7 auto-rows-min gap-px rounded-lg",Y?"bg-[#2D2D2D]":"bg-gray-300"),children:He.map((q,ve)=>{let Qe=q.date.getDay()===0||q.date.getDay()===6;return jsxRuntime.jsxs("div",{className:m("min-h-[120px] p-2 transition-colors flex flex-col relative group",Y?Qe?"bg-[#1C1F26]":q.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Qe?"bg-gray-100":q.isCurrentMonth?"bg-white":"bg-gray-50",q.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Te=L[ve]||ie,Ae=q.events.slice(0,Te),X=q.events.length-Te;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Ae.map(We=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{pe(We.task),a.onEventClick?.(We),g?.(We.task.id);},whileHover:{scale:1.02},className:m("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",We.task.progress===100?Y?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":Y?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(kp,{task:We.task}),jsxRuntime.jsx("span",{className:"truncate",children:We.title})]})},We.id)),X>0&&jsxRuntime.jsxs("button",{onClick:We=>{We.stopPropagation(),oe(z=>({...z,[ve]:Te+Se}));},className:m("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",Y?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",A==="es"?"M\xC1S":"MORE"]}),Te>ie&&q.events.length>ie&&jsxRuntime.jsx("button",{onClick:We=>{We.stopPropagation(),oe(z=>({...z,[ve]:ie}));},className:m("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",Y?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:A==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Te=ve>=28,Ae=ve%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),U===ve?K(null):(K(ve),j(""),he(void 0),Xe(null),se(null),Ye(false),it(false),Z(false),Ce(q.date));},className:m("w-5 h-5 rounded flex items-center justify-center transition-all",U===ve?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",Y?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:m("w-3.5 h-3.5 transition-transform",U===ve&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U===ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{K(null),j(""),he(void 0),Xe(null),se(null),Ye(false),it(false),Z(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Te?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Te?-5:5,scale:.95},transition:{duration:.12},className:m("absolute w-[320px] rounded-lg shadow-2xl z-50",Te?"bottom-full mb-1":"top-full mt-1",Ae?"right-0":"left-0",Y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),Ye(false),it(false),Z(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:le,onChange:X=>j(X.target.value),placeholder:A==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:m("w-full bg-transparent text-sm outline-none placeholder:opacity-40",Y?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&le.trim()){let We=t.availableUsers?.find(de=>de.id===$e),z=at||q.date;a.onTaskCreate?.({name:le.trim(),startDate:z,endDate:z,priority:Ie,assignees:We?[We]:void 0}),j(""),he(void 0),Xe(null),se(null),K(null);}X.key==="Escape"&&(K(null),j(""),he(void 0),Xe(null),se(null));}})}),jsxRuntime.jsxs("div",{className:m("px-2.5 py-2 flex items-center justify-between border-t",Y?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),Ye(!tt),it(false);},className:m("p-1 rounded transition-colors",Ie?Ie==="urgent"||Ie==="high"?"text-red-400 bg-red-500/20":Ie==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":Y?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",Y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:A==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:A==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:A==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:A==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:A==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{he(X.id),Ye(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",Y?"hover:bg-white/5":"hover:bg-gray-50",Ie===X.id&&(Y?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:m("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:Y?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),Z(!B),Ye(false),it(false),Ce(at||q.date);},className:m("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",at?"bg-[#7C3AED]/20 text-[#7C3AED]":Y?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(at||q.date).toLocaleDateString(A==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",Y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:m("w-40 py-2 border-r",Y?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,We=new Date(X);We.setDate(X.getDate()+1);let z=new Date(X);z.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let de=new Date(X);de.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let Be=new Date(X);Be.setDate(X.getDate()+14);let Ke=new Date(X);return Ke.setDate(X.getDate()+28),[{label:A==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(A==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:A==="es"?"Ma\xF1ana":"Tomorrow",date:We,display:We.toLocaleDateString(A==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:A==="es"?"Este fin de semana":"This weekend",date:z,display:A==="es"?"s\xE1b.":"sat."},{label:A==="es"?"Pr\xF3xima semana":"Next week",date:de,display:A==="es"?"lun.":"mon."},{label:A==="es"?"2 semanas":"2 weeks",date:Be,display:Be.toLocaleDateString(A==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:A==="es"?"4 semanas":"4 weeks",date:Ke,display:Ke.toLocaleDateString(A==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Oe,$)=>jsxRuntime.jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",Y?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{se(Oe.date),Z(false);},children:[jsxRuntime.jsx("span",{children:Oe.label}),jsxRuntime.jsx("span",{className:m("text-[10px]",Y?"text-[#6B7280]":"text-gray-400"),children:Oe.display})]},$))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:m("text-xs font-medium",Y?"text-white":"text-gray-900"),children:ge.toLocaleDateString(A==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Ce(new Date),className:m("px-1.5 py-0.5 rounded text-[10px] transition-colors",Y?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:A==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ce(new Date(ge.getFullYear(),ge.getMonth()-1)),className:m("p-0.5 rounded",Y?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Ce(new Date(ge.getFullYear(),ge.getMonth()+1)),className:m("p-0.5 rounded",Y?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(A==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:m("w-6 h-6 flex items-center justify-center text-[10px]",Y?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=ge.getFullYear(),We=ge.getMonth(),z=new Date(X,We,1).getDay(),de=new Date(X,We+1,0).getDate(),Be=new Date(X,We,0).getDate(),Ke=new Date,_e=[];for(let $=z-1;$>=0;$--)_e.push({dayNum:Be-$,isCurrentMonth:false,date:new Date(X,We-1,Be-$)});for(let $=1;$<=de;$++)_e.push({dayNum:$,isCurrentMonth:true,date:new Date(X,We,$)});let Oe=42-_e.length;for(let $=1;$<=Oe;$++)_e.push({dayNum:$,isCurrentMonth:false,date:new Date(X,We+1,$)});return _e.map(($,_)=>{let xe=$.date.toDateString()===Ke.toDateString(),Je=(at||q.date).toDateString()===$.date.toDateString();return jsxRuntime.jsx("button",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!$.isCurrentMonth&&(Y?"text-[#4B5563]":"text-gray-300"),$.isCurrentMonth&&(Y?"text-white":"text-gray-900"),xe&&"ring-1 ring-[#3B82F6]",Je&&"bg-[#7C3AED] text-white",!Je&&(Y?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{se($.date),Z(false);},children:$.dayNum},_)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),it(!ht),Ye(false);},className:m("p-1 rounded transition-colors",$e?"text-[#7C3AED] bg-[#7C3AED]/20":Y?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:$e?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(X=>X.id===$e)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===$e)?.initials||t.availableUsers?.find(X=>X.id===$e)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ht&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",Y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{Xe(null),it(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",Y?"hover:bg-white/5":"hover:bg-gray-50",!$e&&(Y?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:m("w-5 h-5 rounded-full flex items-center justify-center",Y?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:Y?"text-[#9CA3AF]":"text-gray-500",children:A==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxRuntime.jsxs("button",{onClick:()=>{Xe(X.id),it(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",Y?"hover:bg-white/5":"hover:bg-gray-50",$e===X.id&&(Y?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:Y?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:m("px-3 py-2 text-xs",Y?"text-[#6B7280]":"text-gray-400"),children:A==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(le.trim()){let X=t.availableUsers?.find(z=>z.id===$e),We=at||q.date;a.onTaskCreate?.({name:le.trim(),startDate:We,endDate:We,priority:Ie,assignees:X?[X]:void 0}),j(""),he(void 0),Xe(null),se(null),K(null);}},disabled:!le.trim(),className:m("px-2.5 py-1 rounded text-xs font-medium transition-colors",le.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":Y?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:A==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:m("text-sm font-medium",q.isToday?"text-[#3B82F6]":q.isCurrentMonth?Y?"text-white":"text-gray-900":Y?"text-[#6B7280]":"text-gray-400"),children:q.date.getDate()})]})]},ve)})})]})}),jsxRuntime.jsx(Ir,{task:F,isOpen:!!F,onClose:()=>pe(null),onTaskUpdate:q=>{a.onTaskUpdate?.(q),pe(q);},theme:H==="dark"?"dark":"light",locale:A,availableUsers:t.availableUsers?.map(q=>({id:q.id,name:q.name,avatar:q.avatar,initials:q.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:F?u?.get(F.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:xp(e).filter(q=>q.id!==F?.id),comments:d?.filter(q=>q.taskId===F?.id).map(q=>({...q,createdAt:q.createdAt instanceof Date?q.createdAt:new Date(q.createdAt),updatedAt:q.updatedAt instanceof Date?q.updatedAt:q.updatedAt?new Date(q.updatedAt):void 0})),onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:w,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:D,onEstimateUpdate:N,onSoldEffortUpdate:C,onTimerStart:k,onTimerStop:R,onTimerDiscard:I,blurFinancials:T}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>te(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:m("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",Y?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between",Y?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:m("font-medium",Y?"text-white":"text-gray-900"),children:J.date.toLocaleDateString(A==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>te(null),className:m("p-1 rounded",Y?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:J.events.map(q=>jsxRuntime.jsxs("button",{onClick:()=>{te(null),pe(q.task),g?.(q.task.id);},className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",Y?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(kp,{task:q.task}),jsxRuntime.jsx("span",{className:m("text-sm truncate flex-1",Y?"text-white":"text-gray-900"),children:q.title}),q.task.priority==="high"||q.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},q.id))})]})]})})]})}var td={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},ad={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"},rd={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"},Ks={dark:td,light:ad,neutral:rd};function Tp(e){return Ks[e]||Ks.dark}function Kx({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=react.useState(false),u=react.useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=react.useMemo(()=>{let f=u.length,v=new Set(u.flatMap(y=>y.assignedUserIds||[])).size,w=u.map(y=>y.priority).filter(Boolean),g=new Set(u.flatMap(y=>y.labels||[])).size;return {totalCards:f,uniqueAssignees:v,priorities:w,labels:g}},[u]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:m("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:m("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:f=>{f.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:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children: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(f=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsxRuntime.jsx("h4",{children:f.title}),f.description&&jsxRuntime.jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Dp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ln(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 In(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 Sp(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 Ep({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=react.useMemo(()=>({...Dp,...n}),[n]),[i,u]=react.useState(new Set),d=react.useRef(null),p=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(b=>{let x=b.timestamp.toISOString().split("T")[0],D=h.get(x);D?D.push(b):h.set(x,[b]);}),Array.from(h.entries()).sort((b,x)=>x[0].localeCompare(b[0])).map(([b,x])=>({date:new Date(b),events:x.sort((D,N)=>N.timestamp.getTime()-D.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:f,uniqueTypes:v}=react.useMemo(()=>{let h=new Set,b=new Set;return e.forEach(x=>{h.add(x.userId),b.add(x.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(b)}},[e]),w=h=>{u(b=>{let x=new Set(b);return x.has(h)?x.delete(h):x.add(h),x});},g=h=>{let x=new Date().getTime()-h.getTime(),D=Math.floor(x/6e4),N=Math.floor(x/36e5),C=Math.floor(x/864e5);return D<1?"just now":D<60?`${D}m ago`:N<24?`${N}h ago`:C<7?`${C}d ago`:h.toLocaleDateString()},y=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:m("history-timeline-empty",l),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:m("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,types:b?[b]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(h=>jsxRuntime.jsxs("option",{value:h,children:[In(h)," ",h.replace("_"," ")]},h))]}),f.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,users:b?[b]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),f.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})})]}),y>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:p.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((b,x)=>{let D=i.has(b.id),N=s===b.id,C=Sp(b.type);return jsxRuntime.jsxs("div",{"data-event-id":b.id,className:m("history-timeline-event",D&&"expanded",N&&"selected"),onClick:()=>o?.(b),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:C},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:In(b.type)})}),x<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:C}})]}),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&&b.userAvatar&&jsxRuntime.jsx("img",{src:b.userAvatar,alt:b.userName||b.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:b.userName||b.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Ln(b)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?g(b.timestamp):b.timestamp.toLocaleString()})]}),Object.keys(b.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),w(b.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(b.changes).map(([k,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},k)),b.metadata&&Object.keys(b.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(b.metadata).map(([k,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},k))]})]})]})]},b.id)})})]},h.date?.toISOString()||"all"))})]})}function Mp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:m("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:m("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&In(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Ln(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:f=>l(parseInt(f.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((f,v)=>jsxRuntime.jsx("div",{className:m("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>l(v),title:Ln(f)},f.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(f=>jsxRuntime.jsxs("button",{className:m("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>c(f),children:[f,"x"]},f))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(f=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxRuntime.jsxs("div",{className:m("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 od(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 nd(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 Fp(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 Ap(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Qx(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})),l=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(u=>{let d=a/2,p=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(p-u.y)*o.centerForce*i,n.forEach(f=>{if(u.id===f.id)return;let v=u.x-f.x,w=u.y-f.y,g=Math.sqrt(v*v+w*w)||1,y=o.chargeStrength*i/(g*g);u.vx+=v/g*y,u.vy+=w/g*y;});}),t.forEach(u=>{let d=l.get(typeof u.source=="string"?u.source:u.source.id),p=l.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!p)return;let f=p.x-d.x,v=p.y-d.y,w=Math.sqrt(f*f+v*v)||1,g=(w-o.linkDistance)/w*o.forceStrength*i;d.vx+=f*g,d.vy+=v*g,p.vx-=f*g,p.vy-=v*g;}),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 Lp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=react.useRef(null),[u,d]=react.useState([]),[p,f]=react.useState(null),[v,w]=react.useState(null),[g,y]=react.useState(null),[h,b]=react.useState(1),[x,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let A=Qx(e,t,a.width,a.height,a,150);d(A);},[e,t,a]);let N=react.useCallback((A,ee)=>{a.enableDragging&&(ee.stopPropagation(),f(A));},[a.enableDragging]),C=react.useCallback(A=>{if(!p||!i.current)return;let S=i.current.getBoundingClientRect(),Y=(A.clientX-S.left-x.x)/h,ue=(A.clientY-S.top-x.y)/h;d(Pe=>Pe.map(F=>F.id===p?{...F,x:Y,y:ue,fx:Y,fy:ue}:F));},[p,h,x]),k=react.useCallback(()=>{f(null);},[]),R=react.useCallback((A,ee)=>{ee.stopPropagation(),l?.({type:"node-click",node:A,position:{x:ee.clientX,y:ee.clientY}});},[l]),I=react.useCallback((A,ee)=>{ee.stopPropagation(),l?.({type:"edge-click",edge:A,position:{x:ee.clientX,y:ee.clientY}});},[l]),T=react.useCallback(A=>{let ee=u.find(S=>S.id===A);return ee?{x:ee.x,y:ee.y}:{x:0,y:0}},[u]),H=react.useCallback(A=>{if(A.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return A.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let ee=A.card.priority;return ee==="URGENT"?"#ef4444":ee==="HIGH"?"#f59e0b":ee==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return A.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:m("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:m("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:()=>b(A=>Math.min(A+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(A=>Math.max(A-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{b(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(A=>A.type))).map(A=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:od(A)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Fp(A)," ",nd(A)]})]},A))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:C,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(A=>{let ee=T(typeof A.source=="string"?A.source:A.source.id),S=T(typeof A.target=="string"?A.target:A.target.id),Y=Ap(A.type),ue=g===A.id,Pe=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:m("relationships-graph-edge",ue&&"hovered",Pe&&"critical"),onMouseEnter:()=>y(A.id),onMouseLeave:()=>y(null),onClick:F=>I(A,F),children:[jsxRuntime.jsx("line",{x1:ee.x,y1:ee.y,x2:S.x,y2:S.y,stroke:od(A.type),strokeWidth:Pe?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ue?1:.6,markerEnd:Y?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ue&&jsxRuntime.jsx("text",{x:(ee.x+S.x)/2,y:(ee.y+S.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:nd(A.type)})]},A.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(A=>{let ee=v===A.id,S=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:m("relationships-graph-node",ee&&"hovered",S&&"critical"),transform:`translate(${A.x}, ${A.y})`,onMouseDown:Y=>N(A.id,Y),onMouseEnter:()=>w(A.id),onMouseLeave:()=>w(null),onClick:Y=>R(A,Y),children:[jsxRuntime.jsx("circle",{r:S?a.nodeSize*1.2:a.nodeSize,fill:H(A),stroke:S?"#fbbf24":"#ffffff",strokeWidth:S?3:2,opacity:ee?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:A.card.title.length>20?A.card.title.substring(0,20)+"...":A.card.title})]},A.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 Rp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,c]=react.useState(false),[i,u]=react.useState(null),[d,p]=react.useState(null),f=react.useRef(null),v=l||o;react.useEffect(()=>{e&&f.current&&f.current.focus();},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&!v&&w();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,v]);let w=()=>{v||(n(""),u(null),p(null),t());},g=async()=>{if(!(!s.trim()||v)){c(true),u(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},y=()=>{d&&(a(d),w());};return e?jsxRuntime.jsxs(vt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),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:w,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,b)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},b))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,b)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},b)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:f,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:v}),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,b)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},b))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&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:w,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var sd={"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 t2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},a2={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 r2(e,t,a){let r=sd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Bn(e){return `$${e.toFixed(4)}`}var id=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=r2(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),l=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=n).length,c=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:c,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},No=new id;function zp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(No.getStats()),[s,n]=react.useState(No.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(No.getStats()),n(No.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 l=No.getRecentOperations(5);return jsxRuntime.jsxs(vt,{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:Bn(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,d=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:Bn(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:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.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:l.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:Bn(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 Wp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[c,i]=react.useState(""),[u,d]=react.useState(""),[p,f]=react.useState(false),[v,w]=react.useState(null),[g,y]=react.useState(null),[h,b]=react.useState(null),x=react.useRef(null),D=p||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let I=T=>{T.key==="Escape"&&!D&&N();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,D]);let N=()=>{D||(l(""),i(""),d(""),w(null),y(null),b(null),t());},C=async()=>{if(!(!n.trim()||D)){f(true),w(null),y(null),b(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});y(I.tasks.tasks),b({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){w(I instanceof Error?I.message:"Failed to generate tasks");}finally{f(false);}}},k=()=>{g&&(a(g),N());};if(!e)return null;let R=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(vt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:N,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((I,T)=>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:["#",T+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxRuntime.jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.id))})]})}):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:x,value:n,onChange:I=>l(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),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:I=>i(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),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:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),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((I,T)=>jsxRuntime.jsx("button",{onClick:()=>l(I),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:I},T))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:N,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:C,disabled:!n.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Xs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&Vn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,h,b)=>{console.warn(`Retry attempt ${h} after ${b}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),s=react.useCallback(async(g,y,h)=>{r(b=>{let x=b.cards.find(I=>I.id===g);if(!x)return b;let D=x.columnId,N={...x,columnId:y,position:h},C=b.cards.map(I=>I.id===g?N:I),k=b.columns.map(I=>{if(I.id===D)return {...I,cardIds:I.cardIds.filter(T=>T!==g)};if(I.id===y){let T=C.filter(H=>H.columnId===y).sort((H,A)=>H.position-A.position);return {...I,cardIds:T.map(H=>H.id)}}return I}),R={...b,cards:C,columns:k};return o(R),R});},[o]),n=react.useCallback(async(g,y)=>{r(h=>{let b=h.cards.map(D=>D.id===g?{...D,...y}:D),x={...h,cards:b};return o(x),x});},[o]),l=react.useCallback(async g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y},x=h.columns.map(N=>N.id===g.columnId?{...N,cardIds:[...N.cardIds,y]}:N),D={...h,cards:[...h.cards,b],columns:x};return o(D),D});},[o]),c=react.useCallback(async g=>{r(y=>{let h=y.cards.find(N=>N.id===g);if(!h)return y;let b=y.cards.filter(N=>N.id!==g),x=y.columns.map(N=>N.id===h.columnId?{...N,cardIds:N.cardIds.filter(C=>C!==g)}:N),D={...y,cards:b,columns:x};return o(D),D});},[o]),i=react.useCallback(async g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y,cardIds:[]},x={...h,columns:[...h.columns,b]};return o(x),x});},[o]),u=react.useCallback(async(g,y)=>{r(h=>{let b=h.columns.map(D=>D.id===g?{...D,...y}:D),x={...h,columns:b};return o(x),x});},[o]),d=react.useCallback(async g=>{r(y=>{let h=y.cards.filter(D=>D.columnId!==g),b=y.columns.filter(D=>D.id!==g),x={...y,cards:h,columns:b};return o(x),x});},[o]),p=react.useCallback(g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),y},[l]),f=react.useCallback(g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),y},[i]),v=react.useCallback(()=>{r(g=>{let y={...g,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:f,deleteCard:c,deleteColumn:d,clearBoard:v}}}function Vp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Xs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.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 Rn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},jp={by:"none",order:"asc"};function Kp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Rn,...e}),[s,n]=react.useState({...jp,...t}),l=react.useCallback(w=>{o(g=>({...g,...w}));},[]),c=react.useCallback(w=>{n(g=>({...g,...w}));},[]),i=react.useCallback(()=>{o(Rn),n(jp);},[]),u=react.useCallback(()=>{a&&o({...Rn,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Rn,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...Rn,priorities:["HIGH","URGENT"]});},[]),f=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]),v=react.useCallback(w=>{let g=[...w];if(r.search){let y=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(y)||h.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,h=y.getFullYear(),b=String(y.getMonth()+1).padStart(2,"0"),x=String(y.getDate()).padStart(2,"0"),D=`${h}-${b}-${x}`;g=g.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let C=N.endDate||N.dueDate;if(!C)return false;let k;if(typeof C=="string")k=C.split("T")[0]||C;else {let R=C.getUTCFullYear(),I=String(C.getUTCMonth()+1).padStart(2,"0"),T=String(C.getUTCDate()).padStart(2,"0");k=`${R}-${I}-${T}`;}switch(r.dateFilter){case "overdue":return k<D;case "today":return k===D;case "this-week":let R=new Date(D+"T00:00:00"),I=new Date(k+"T00:00:00"),T=new Date(R);return T.setDate(T.getDate()+7),I>=R&&I<=T;case "custom":if(r.dateRange){let H=typeof C=="string"?new Date(C):C;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(g=g.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(b=>r.assignees.includes(b)))),r.labels.length>0&&(g=g.filter(y=>y.labels&&y.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(y=>r.columns.includes(y.columnId))),s.by!=="none"&&g.sort((y,h)=>{let b=0;switch(s.by){case "created":let x=y.createdAt?new Date(y.createdAt).getTime():0,D=h.createdAt?new Date(h.createdAt).getTime():0;b=x-D;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},C=N[y.priority||"LOW"],k=N[h.priority||"LOW"];b=C-k;break;case "dueDate":let R=y.endDate||y.dueDate,I=h.endDate||h.dueDate;if(!R)return 1;if(!I)return -1;let T=typeof R=="string"?new Date(R).getTime():R.getTime(),H=typeof I=="string"?new Date(I).getTime():I.getTime();b=T-H;break;case "title":b=y.title.localeCompare(h.title);break;case "estimate":let A=y.estimatedTime||0,ee=h.estimatedTime||0;b=A-ee;break;default:b=0;}return s.order==="asc"?b:-b}),g},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:p,applyFilters:v,hasActiveFilters:f}}var qp,Xp;if(typeof window<"u")try{let e=Hn("ai");qp=e.generateObject,Xp=e.generateText;}catch{}function Jp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(qp&&Xp&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let f=p instanceof Error?p:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let f=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let f=p instanceof Error?p:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let f=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[s]),u=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let f=p instanceof Error?p:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function dd(){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 Zp(e){let{cards:t}=e,[a,r]=dd(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=p.ctrlKey||p.metaKey,v=p.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(w=>w!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let w=t.find(y=>y.id===d),g=t.find(y=>y.id===a.lastSelectedCardId);if(w&&g&&w.columnId===g.columnId){let y=t.filter(k=>k.columnId===w.columnId).sort((k,R)=>k.position-R.position),h=y.findIndex(k=>k.id===a.lastSelectedCardId),b=y.findIndex(k=>k.id===d),[x,D]=h<b?[h,b]:[b,h],N=y.slice(x,D+1).map(k=>k.id),C=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:C,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),u=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var Qp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function eg(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Qp,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((w,g,y,h,b)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:w,cardIds:g,columnId:y,strategy:h,color:b,isExpanded:true,position:s.filter(D=>D.columnId===y).length,createdAt:new Date};n(D=>[...D,x]);},[o.minCardsPerStack,s]),c=react.useCallback(w=>{n(g=>g.filter(y=>y.id!==w));},[]),i=react.useCallback(w=>{n(g=>g.map(y=>y.id===w?{...y,isExpanded:!y.isExpanded}:y));},[]),u=react.useCallback((w,g)=>{n(y=>y.map(h=>h.id===w&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=react.useCallback((w,g)=>{n(y=>y.map(h=>{if(h.id===w){let b=h.cardIds.filter(x=>x!==g);return b.length<o.minCardsPerStack?null:{...h,cardIds:b}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=react.useCallback(w=>s.filter(g=>g.columnId===w).sort((g,y)=>g.position-y.position),[s]),f=react.useCallback(async w=>{let g=t.filter(D=>D.columnId===w);if(g.length<o.minCardsPerStack*2)return [];let y=[],h=new Map;g.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(D);});}),h.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:D.map(C=>C.id),columnId:w,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${N}"`,confidence:.85});});let b=new Map;g.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(N=>{b.has(N)||b.set(N,[]),b.get(N).push(D);});}),b.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:D.map(C=>C.id),columnId:w,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(g.forEach(D=>{D.priority&&(x.has(D.priority)||x.set(D.priority,[]),x.get(D.priority).push(D));}),x.forEach((D,N)=>{if(D.length>=o.minCardsPerStack){let C={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";y.push({stack:{title:`${C} ${N} Priority`,cardIds:D.map(k=>k.id),columnId:w,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of g){let C=(await r.findSimilar(D,g)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(C.length>=o.minCardsPerStack-1){let k=[D.id,...C.map(I=>I.card.id)],R=C.reduce((I,T)=>I+T.similarity,0)/C.length;y.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:k,columnId:w,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${C.length+1} similar tasks`,confidence:R});}}return y.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,N)=>N.confidence-D.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(w=>{l(w.stack.title,w.stack.cardIds,w.stack.columnId,w.stack.strategy,w.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let y=await f(g),h=y[0];y.length>0&&h&&h.confidence>=.9&&v(h);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:p,getSuggestions:f,applySuggestion:v,config:o}}var tg=react.createContext(null);function ag({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}=Hn("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Hn("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Hn("@libxai/core");l=new c(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(tg.Provider,{value:{store:o},children:e})}function Js(){let e=react.useContext(tg);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function $n(){let e=Js(),[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 l=react.useCallback(h=>{e.updateBoard(h);},[e]),c=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,b)=>{e.updateColumn(h,b);},[e]),u=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),p=react.useCallback(h=>{e.addCard(h);},[e]),f=react.useCallback((h,b)=>{e.updateCard(h,b);},[e]),v=react.useCallback(h=>{e.deleteCard(h);},[e]),w=react.useCallback((h,b,x)=>{e.moveCard(h,b,x);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),y=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:d,addCard:p,updateCard:f,deleteCard:v,moveCard:w,getCard:g,getCardsByColumn:y}}function og(e){let{cards:t}=$n();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 ng(e="position",t="asc"){let{cards:a}=$n();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?l[o.priority]:0,i=s.priority?l[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 Zs=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Wd.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},x2=new Zs;function ig({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=u.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:p,className:o,children:jsxRuntime.jsx("div",{style:f,children:d.map(v=>{let w=e[v.index];if(!w)return null;let g=c?c(w,v.index):v.index,y={position:"absolute",top:n?0:v.start,left:n?v.start:0,width:n?v.size:"100%",height:n?"100%":v.size};return jsxRuntime.jsx("div",{style:y,"data-index":v.index,children:r(w,v.index)},g)})})})}function lg(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 cg({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:c,horizontal:i=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:f,className:s,children:jsxRuntime.jsx("div",{style:v,children:p.map(w=>{let g=e[w.index];if(!g)return null;let y=c?c(g,w.index):w.index,h={position:"absolute",top:0,left:w.start,width:w.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":w.index,children:o(g,w.index)},y)})})})}function ug(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 mg(e,t=10){return e>t}var pd={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},gd={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},fd={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},hd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},bd={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},yd={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},vd={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},xd={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)"},kd={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)"},wd={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Cd={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},Td={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}},Qs={spacing:pd,borderRadius:gd,fontSize:fd,fontWeight:hd,lineHeight:bd,zIndex:yd,duration:vd,easing:xd,shadows:kd,opacity:wd,kanban:Cd,gantt:Td};function pg(e,t,a){return e[t]??a}function Nd(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)?Nd(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function C2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Dd(e="asakaa"){let t=Nd(Qs),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=C2(o);a.push(` ${s}: ${n};`);}return `:root {
404
404
  ${a.join(`
405
405
  `)}
406
406
  }`}function zn(e,t="asakaa"){let a=[],r=Nd(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
407
407
  ${a.join(`
408
408
  `)}
409
- }`}var Qs={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Sd={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Ed={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function Pd(e=Qs,t="asakaa"){let a=Dd(t),r=zn(e,t);return `${a}
409
+ }`}var ei={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Sd={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Ed={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function Pd(e=ei,t="asakaa"){let a=Dd(t),r=zn(e,t);return `${a}
410
410
 
411
411
  ${r}`}function gg(){return `/**
412
412
  * ASAKAA Design Tokens
@@ -414,7 +414,7 @@ ${r}`}function gg(){return `/**
414
414
  * Do not edit this file directly
415
415
  */
416
416
 
417
- ${Pd(Qs)}
417
+ ${Pd(ei)}
418
418
 
419
419
  /* Light theme */
420
420
  [data-theme="light"] {
@@ -429,6 +429,6 @@ ${zn(Ed,"asakaa").split(`
429
429
  `).slice(1,-1).join(`
430
430
  `)}
431
431
  }
432
- `}var C2=({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 fg({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Go();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{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 ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(C2,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
433
- 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=zp;exports.AI_FEATURES=t2;exports.AI_MODELS=sd;exports.AddCardButton=Ai;exports.AddColumnButton=Fi;exports.AttachmentUploader=Er;exports.BoardProvider=ag;exports.BulkOperationsToolbar=us;exports.BurnDownChart=Vi;exports.CUSTOM_FIELD_TYPES=mp;exports.CalendarBoard=Cp;exports.Card=Ar;exports.CardDetailModal=$i;exports.CardDetailModalV2=Hi;exports.CardHistoryReplay=Mp;exports.CardHistoryTimeline=Ep;exports.CardRelationshipsGraph=Lp;exports.CardStack=jx;exports.CardTemplateSelector=Ji;exports.CircuitBreaker=di;exports.Column=Bo;exports.ColumnManager=ys;exports.CommandPalette=Bi;exports.ConfigMenu=tl;exports.ContextMenu=jo;exports.DEFAULT_SHORTCUTS=bn;exports.DEFAULT_TABLE_COLUMNS=cp;exports.DEFAULT_TEMPLATES=Xi;exports.DateRangePicker=rn;exports.DependenciesSelector=nn;exports.DependencyLine=Cn;exports.DistributionCharts=_i;exports.EditableColumnTitle=bi;exports.ErrorBoundary=zo;exports.ExportImportModal=Qi;exports.FilterBar=el;exports.GANTT_AI_SYSTEM_PROMPT=rm;exports.GanttAIAssistant=Ps;exports.GanttBoard=Zu;exports.GanttI18nContext=_o;exports.GanttMilestone=Ds;exports.GanttToolbar=bs;exports.GenerateGanttTasksDialog=Wp;exports.GeneratePlanModal=Rp;exports.GroupBySelector=Yi;exports.HealthBar=Ti;exports.KanbanBoard=Kr;exports.KanbanToolbar=Pi;exports.KanbanViewAdapter=gn;exports.KeyboardShortcutsHelp=qi;exports.ListView=dp;exports.MenuIcons=Lt;exports.PluginManager=Js;exports.PrioritySelector=co;exports.ProfitabilityReport=Ni;exports.RATE_LIMITS=e2;exports.STANDARD_FIELDS=up;exports.SwimlaneBoardView=ji;exports.TagBadge=vi;exports.TagList=Tc;exports.TagPicker=_r;exports.TaskBar=Ts;exports.TaskDetailModal=Ir;exports.TaskFormModal=am;exports.TaskGrid=ws;exports.ThemeModal=nl;exports.ThemeProvider=vu;exports.ThemeSwitcher=fg;exports.TimeInputPopover=fo;exports.TimePill=xi;exports.TimePopover=ki;exports.Timeline=Es;exports.UserAssignmentSelector=mo;exports.VelocityChart=Gi;exports.VirtualGrid=cg;exports.VirtualList=ig;exports.aiUsageTracker=No;exports.borderRadius=gd;exports.calculatePosition=Gn;exports.calendarDarkTheme=td;exports.calendarEnTranslations=Jl;exports.calendarEsTranslations=Zl;exports.calendarLightTheme=ad;exports.calendarNeutralTheme=rd;exports.calendarThemes=js;exports.calendarTranslations=Vs;exports.cardToGanttTask=As;exports.cardsToGanttTasks=cm;exports.cn=m;exports.createKanbanView=Zc;exports.createRetryWrapper=Ug;exports.darkTheme=al;exports.darkTokenTheme=Qs;exports.defaultTheme=ps;exports.designTokens=Zs;exports.duration=vd;exports.easing=xd;exports.exportTokensToCSS=gg;exports.findTaskByName=Ur;exports.fontSize=fd;exports.fontWeight=hd;exports.formatCost=Bn;exports.ganttEnTranslations=fs;exports.ganttEsTranslations=ku;exports.ganttTaskToCardUpdate=dm;exports.ganttThemes=tt;exports.ganttTokens=Td;exports.ganttTranslations=sl;exports.ganttUtils=ke;exports.generateCSSVariables=Dd;exports.generateCompleteCSS=Pd;exports.generateInitialPositions=Rg;exports.generateTasksContext=om;exports.generateThemeVariables=zn;exports.getCalendarTheme=Tp;exports.getCalendarTranslations=Fn;exports.getListViewTheme=pp;exports.getListViewTranslations=Il;exports.getMonthNames=gp;exports.getToken=pg;exports.getTranslations=wu;exports.getWeekdayNames=fp;exports.kanbanTokens=Cd;exports.lightTheme=rl;exports.lightTokenTheme=Sd;exports.lineHeight=bd;exports.listViewDarkTheme=Yl;exports.listViewEnTranslations=Al;exports.listViewEsTranslations=Ll;exports.listViewLightTheme=ql;exports.listViewNeutralTheme=Xl;exports.listViewThemes=Gs;exports.listViewTranslations=Ls;exports.mergeCalendarTranslations=_s;exports.mergeListViewTranslations=Is;exports.mergeTranslations=il;exports.neutralTheme=ol;exports.neutralTokenTheme=Ed;exports.opacity=wd;exports.parseLocalCommand=im;exports.parseNaturalDate=Pl;exports.parseNaturalDuration=Ml;exports.parseProgress=Fl;exports.parseStatus=sm;exports.pluginManager=v2;exports.retrySyncOperation=zg;exports.retryWithBackoff=Vn;exports.shadows=kd;exports.shouldVirtualizeGrid=mg;exports.spacing=pd;exports.themes=yo;exports.useAI=Jp;exports.useBoard=Vp;exports.useBoardCore=$n;exports.useBoardStore=Xs;exports.useCardStacking=eg;exports.useDragState=Si;exports.useFilteredCards=og;exports.useFilters=Kp;exports.useGanttI18n=Zr;exports.useKanbanState=qs;exports.useKeyboardShortcuts=hu;exports.useMultiSelect=Zp;exports.useSelectionState=dd;exports.useSortedCards=ng;exports.useTheme=Go;exports.useVirtualGrid=ug;exports.useVirtualList=lg;exports.validateAIResponse=lm;exports.withErrorBoundary=Li;exports.wouldCreateCircularDependency=jn;exports.zIndex=yd;//# sourceMappingURL=index.cjs.map
432
+ `}var T2=({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 fg({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Go();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{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 ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(T2,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
433
+ 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=zp;exports.AI_FEATURES=a2;exports.AI_MODELS=sd;exports.AddCardButton=Li;exports.AddColumnButton=Ai;exports.AttachmentUploader=Er;exports.BoardProvider=ag;exports.BulkOperationsToolbar=us;exports.BurnDownChart=_i;exports.CUSTOM_FIELD_TYPES=mp;exports.CalendarBoard=Cp;exports.Card=Ar;exports.CardDetailModal=zi;exports.CardDetailModalV2=Wi;exports.CardHistoryReplay=Mp;exports.CardHistoryTimeline=Ep;exports.CardRelationshipsGraph=Lp;exports.CardStack=Kx;exports.CardTemplateSelector=Zi;exports.CircuitBreaker=ci;exports.Column=Bo;exports.ColumnManager=ys;exports.CommandPalette=Ri;exports.ConfigMenu=al;exports.ContextMenu=jo;exports.DEFAULT_SHORTCUTS=yn;exports.DEFAULT_TABLE_COLUMNS=cp;exports.DEFAULT_TEMPLATES=Ji;exports.DateRangePicker=on;exports.DependenciesSelector=sn;exports.DependencyLine=Tn;exports.DistributionCharts=ji;exports.EditableColumnTitle=yi;exports.ErrorBoundary=zo;exports.ExportImportModal=el;exports.FilterBar=tl;exports.GANTT_AI_SYSTEM_PROMPT=rm;exports.GanttAIAssistant=Ms;exports.GanttBoard=Zu;exports.GanttI18nContext=_o;exports.GanttMilestone=Ds;exports.GanttToolbar=bs;exports.GenerateGanttTasksDialog=Wp;exports.GeneratePlanModal=Rp;exports.GroupBySelector=qi;exports.HealthBar=Ni;exports.KanbanBoard=Kr;exports.KanbanToolbar=Mi;exports.KanbanViewAdapter=fn;exports.KeyboardShortcutsHelp=Xi;exports.ListView=dp;exports.MenuIcons=Lt;exports.PluginManager=Zs;exports.PrioritySelector=co;exports.ProfitabilityReport=Di;exports.RATE_LIMITS=t2;exports.STANDARD_FIELDS=up;exports.SwimlaneBoardView=Ki;exports.TagBadge=xi;exports.TagList=Tc;exports.TagPicker=_r;exports.TaskBar=Ts;exports.TaskDetailModal=Ir;exports.TaskFormModal=am;exports.TaskGrid=ws;exports.ThemeModal=sl;exports.ThemeProvider=vu;exports.ThemeSwitcher=fg;exports.TimeInputPopover=fo;exports.TimePill=ki;exports.TimePopover=wi;exports.Timeline=Ps;exports.UserAssignmentSelector=mo;exports.VelocityChart=Vi;exports.VirtualGrid=cg;exports.VirtualList=ig;exports.aiUsageTracker=No;exports.borderRadius=gd;exports.calculatePosition=Gn;exports.calendarDarkTheme=td;exports.calendarEnTranslations=Jl;exports.calendarEsTranslations=Zl;exports.calendarLightTheme=ad;exports.calendarNeutralTheme=rd;exports.calendarThemes=Ks;exports.calendarTranslations=_s;exports.cardToGanttTask=Ls;exports.cardsToGanttTasks=cm;exports.cn=m;exports.createKanbanView=Zc;exports.createRetryWrapper=Ug;exports.darkTheme=rl;exports.darkTokenTheme=ei;exports.defaultTheme=ps;exports.designTokens=Qs;exports.duration=vd;exports.easing=xd;exports.exportTokensToCSS=gg;exports.findTaskByName=Ur;exports.fontSize=fd;exports.fontWeight=hd;exports.formatCost=Bn;exports.ganttEnTranslations=fs;exports.ganttEsTranslations=ku;exports.ganttTaskToCardUpdate=dm;exports.ganttThemes=ot;exports.ganttTokens=Td;exports.ganttTranslations=il;exports.ganttUtils=we;exports.generateCSSVariables=Dd;exports.generateCompleteCSS=Pd;exports.generateInitialPositions=Rg;exports.generateTasksContext=om;exports.generateThemeVariables=zn;exports.getCalendarTheme=Tp;exports.getCalendarTranslations=Fn;exports.getListViewTheme=pp;exports.getListViewTranslations=Il;exports.getMonthNames=gp;exports.getToken=pg;exports.getTranslations=wu;exports.getWeekdayNames=fp;exports.kanbanTokens=Cd;exports.lightTheme=ol;exports.lightTokenTheme=Sd;exports.lineHeight=bd;exports.listViewDarkTheme=Yl;exports.listViewEnTranslations=Al;exports.listViewEsTranslations=Ll;exports.listViewLightTheme=ql;exports.listViewNeutralTheme=Xl;exports.listViewThemes=Vs;exports.listViewTranslations=Is;exports.mergeCalendarTranslations=js;exports.mergeListViewTranslations=Bs;exports.mergeTranslations=ll;exports.neutralTheme=nl;exports.neutralTokenTheme=Ed;exports.opacity=wd;exports.parseLocalCommand=im;exports.parseNaturalDate=Pl;exports.parseNaturalDuration=Ml;exports.parseProgress=Fl;exports.parseStatus=sm;exports.pluginManager=x2;exports.retrySyncOperation=zg;exports.retryWithBackoff=Vn;exports.shadows=kd;exports.shouldVirtualizeGrid=mg;exports.spacing=pd;exports.themes=yo;exports.useAI=Jp;exports.useBoard=Vp;exports.useBoardCore=$n;exports.useBoardStore=Js;exports.useCardStacking=eg;exports.useDragState=Ei;exports.useFilteredCards=og;exports.useFilters=Kp;exports.useGanttI18n=Zr;exports.useKanbanState=Xs;exports.useKeyboardShortcuts=hu;exports.useMultiSelect=Zp;exports.useSelectionState=dd;exports.useSortedCards=ng;exports.useTheme=Go;exports.useVirtualGrid=ug;exports.useVirtualList=lg;exports.validateAIResponse=lm;exports.withErrorBoundary=Ii;exports.wouldCreateCircularDependency=jn;exports.zIndex=yd;//# sourceMappingURL=index.cjs.map
434
434
  //# sourceMappingURL=index.cjs.map