@libxai/board 0.14.0 → 0.14.1

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,8 +1,8 @@
1
- 'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),Te=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'),tc=require('html2canvas'),jsxRuntime=require('react/jsx-runtime'),Ri=require('react-dom'),cmdk=require('cmdk'),yp=require('react-markdown'),xp=require('remark-gfm'),kp=require('rehype-sanitize'),recharts=require('recharts'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Te__namespace=/*#__PURE__*/_interopNamespace(Te);var tc__default=/*#__PURE__*/_interopDefault(tc);var Ri__namespace=/*#__PURE__*/_interopNamespace(Ri);var yp__default=/*#__PURE__*/_interopDefault(yp);var xp__default=/*#__PURE__*/_interopDefault(xp);var kp__default=/*#__PURE__*/_interopDefault(kp);var ja=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ya=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return "scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return [Ya.Translate.toString(e),Ya.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}});function ae(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function qa(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 cd(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function qn(e,t){return e.length===0?1e3:t===0?qa(null,e[0].position):t>=e.length?qa(e[e.length-1].position,null):qa(e[t-1].position,e[t].position)}function Hs(e,t=100){return e>t}var dd=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 ud(e,t,r,a){let n=t*Math.pow(r,e-1),o=n*.2*Math.random();return Math.min(n+o,a)}async function Xa(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:o=1e4,shouldRetry:s=dd,onRetry:l}=t,c,i=0;for(let u=1;u<=r;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,u===r||!s(c,u))return {error:c,attempts:i,success:false};let p=ud(u,a,n,o);if(l)try{l(c,u,p);}catch(x){console.error("Error in retry callback:",x);}await new Promise(x=>setTimeout(x,p));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function pd(e,t=3){let r;for(let a=1;a<=t;a++)try{return {data:e(),success:!0}}catch(n){if(r=n,a===t)return {error:r,success:false}}return {error:r||new Error("Unknown error"),success:false}}function md(e,t={}){return async(...r)=>Xa(()=>e(...r),t)}var Xn=class{constructor(t=5,r=6e4){this.threshold=t;this.resetTimeout=r;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 r=await t();return this.onSuccess(),r}catch(r){throw this.onFailure(),r}}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 _s=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARN=2]="WARN",o[o.ERROR=3]="ERROR",o[o.NONE=4]="NONE",o))(_s||{}),Fr=class Fr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:r,level:a,message:n,component:o,...s}=t,l=`[${r}] [${a}] [${o}]`,c=Object.keys(s).length>0;switch(a){case "DEBUG":console.debug(l,n,c?s:"");break;case "INFO":console.info(l,n,c?s:"");break;case "WARN":console.warn(l,n,c?s:"");break;case "ERROR":console.error(l,n,c?s:""),t.error?.stack&&console.error(t.error.stack);break}};let r=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(r?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Fr.globalOptions};}static configure(t){Fr.globalOptions={...Fr.globalOptions,...t};}child(t){return new Fr({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,r){this.log(0,t,r);}info(t,r){this.log(1,t,r);}warn(t,r){this.log(2,t,r);}error(t,r,a){this.log(3,t,{...a,error:r?{message:r.message,stack:r.stack,name:r.name}:void 0});}startTimer(t){return this.options.enableTiming?new Ja((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new Ja(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:_s[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};Fr.globalOptions={};var Jn=Fr,Ja=class{constructor(t,r){this.onEnd=t;this.enabled=r;this.startTime=r?performance.now():0;}end(t){if(!this.enabled)return 0;let r=Math.round(performance.now()-this.startTime);return this.onEnd(r,t),r}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Vs=new Jn;function gd(e,t){let r={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(r,null,2)}function hd(e,t){let r=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],a=e.cards.map(o=>{let s=e.columns.find(l=>l.id===o.columnId);return [o.id,Zn(o.title),Zn(o.description||""),Zn(s?.title||""),o.priority||"",(o.labels||[]).join(";"),(o.assignedUserIds||[]).join(";"),o.startDate||"",o.endDate||"",o.createdAt||"",o.updatedAt||""]});return [r.join(","),...a.map(o=>o.join(","))].join(`
2
- `)}async function vd(e,t,r){let a=t;if(!a){let s=document.querySelector(".asakaa-board");s&&(a=s.parentElement||s);}if(a)try{let s=await tc__default.default(a,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:a.scrollWidth,windowHeight:a.scrollHeight}),l=s.toDataURL("image/png"),c=297,i=210,u=s.width/s.height,d=c-20,m=d/u;m>i-20&&(m=i-20,d=m*u);let p=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});p.setFontSize(16),p.setTextColor(255,255,255),p.setFillColor(10,10,10),p.rect(0,0,c,15,"F"),p.text(e.title||"Kanban Board",10,10);let x=(c-d)/2;return p.addImage(l,"PNG",x,20,d,m),p}catch(s){console.error("Error capturing board:",s);}let n=new jspdf.jsPDF,o=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,o),o+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,o),o+=15,n.setTextColor(0,0,0),e.columns.forEach(s=>{let l=e.cards.filter(c=>c.columnId===s.id);o>250&&(n.addPage(),o=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(s.title,20,o),o+=8,l.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,o),n.setTextColor(0,0,0),o+=10):l.forEach(c=>{if(o>260&&(n.addPage(),o=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(c.title,25,o),o+=6,c.description){n.setFontSize(9),n.setFont("helvetica","normal");let u=n.splitTextToSize(c.description,160);n.text(u,25,o),o+=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&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,o),n.setTextColor(0,0,0),o+=5),o+=5;}),o+=5;}),n}function Zn(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function js(e,t,r,a){switch(t){case "json":return gd(e,a);case "csv":return hd(e);case "pdf":return await vd(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function Ys(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${a}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let o=`${a}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,s={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:s[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=o,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function bd(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 r={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:r.cards.length,columnsImported:r.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function yd(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 r=qs(t[0]),a=[],n=new Map,o=[];for(let s=1;s<t.length;s++)try{let l=qs(t[s]||"");if(l.length>r.length){o.push(`Line ${s+1}: Too many columns`);continue}if(r.length-l.length>3){o.push(`Line ${s+1}: Column count mismatch (expected ${r.length}, got ${l.length})`);continue}for(;l.length<r.length;)l.push("");let i={};r.forEach((p,x)=>{i[p]=l[x]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let d=n.get(u),m={id:i["Card ID"]||`card-${s}`,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};a.push(m),d.cardIds.push(m.id);}catch(l){o.push(`Line ${s+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...o]}:{success:!0,cardsImported:a.length,columnsImported:n.size,errors:o.length>0?o:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function qs(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let o=e[n],s=e[n+1];o==='"'&&a&&s==='"'?(r+='"',n++):o==='"'?a=!a:o===","&&!a?(t.push(r),r=""):r+=o;}return t.push(r),t}function Xs(e,t){switch(t){case "json":return bd(e);case "csv":return yd(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Js(e){return new Promise((t,r)=>{let a=new FileReader;a.onload=n=>{n.target?.result?t(n.target.result):r(new Error("Failed to read file"));},a.onerror=()=>r(new Error("Failed to read file")),a.readAsText(e);})}function Za(){return typeof window<"u"}function xr(e){return eo(e)?(e.nodeName||"").toLowerCase():"#document"}function kt(e){var t;return (e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ht(e){var t;return (t=(eo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function eo(e){return Za()?e instanceof Node||e instanceof kt(e).Node:false}function pt(e){return Za()?e instanceof Element||e instanceof kt(e).Element:false}function Ot(e){return Za()?e instanceof HTMLElement||e instanceof kt(e).HTMLElement:false}function Qn(e){return !Za()||typeof ShadowRoot>"u"?false:e instanceof ShadowRoot||e instanceof kt(e).ShadowRoot}var xd=new Set(["inline","contents"]);function Jr(e){let{overflow:t,overflowX:r,overflowY:a,display:n}=Dt(e);return /auto|scroll|overlay|hidden|clip/.test(t+a+r)&&!xd.has(n)}var kd=new Set(["table","td","th"]);function Zs(e){return kd.has(xr(e))}var wd=[":popover-open",":modal"];function ha(e){return wd.some(t=>{try{return e.matches(t)}catch{return false}})}var Cd=["transform","translate","scale","rotate","perspective"],Td=["transform","translate","scale","rotate","perspective","filter"],Sd=["paint","layout","strict","content"];function Qa(e){let t=va(),r=pt(e)?Dt(e):e;return Cd.some(a=>r[a]?r[a]!=="none":false)||(r.containerType?r.containerType!=="normal":false)||!t&&(r.backdropFilter?r.backdropFilter!=="none":false)||!t&&(r.filter?r.filter!=="none":false)||Td.some(a=>(r.willChange||"").includes(a))||Sd.some(a=>(r.contain||"").includes(a))}function Qs(e){let t=ar(e);for(;Ot(t)&&!kr(t);){if(Qa(t))return t;if(ha(t))return null;t=ar(t);}return null}function va(){return typeof CSS>"u"||!CSS.supports?false:CSS.supports("-webkit-backdrop-filter","none")}var Dd=new Set(["html","body","#document"]);function kr(e){return Dd.has(xr(e))}function Dt(e){return kt(e).getComputedStyle(e)}function ba(e){return pt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ar(e){if(xr(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Qn(e)&&e.host||Ht(e);return Qn(t)?t.host:t}function ei(e){let t=ar(e);return kr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ot(t)&&Jr(t)?t:ei(t)}function pr(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=true);let n=ei(e),o=n===((a=e.ownerDocument)==null?void 0:a.body),s=kt(n);if(o){let l=en(s);return t.concat(s,s.visualViewport||[],Jr(n)?n:[],l&&r?pr(l):[])}return t.concat(n,pr(n,[],r))}function en(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var nr=Math.min,wt=Math.max,xa=Math.round,ka=Math.floor,_t=e=>({x:e,y:e}),Nd={left:"right",right:"left",bottom:"top",top:"bottom"},Ed={start:"end",end:"start"};function rn(e,t,r){return wt(e,nr(t,r))}function Br(e,t){return typeof e=="function"?e(t):e}function mr(e){return e.split("-")[0]}function Or(e){return e.split("-")[1]}function to(e){return e==="x"?"y":"x"}function an(e){return e==="y"?"height":"width"}var Rd=new Set(["top","bottom"]);function or(e){return Rd.has(mr(e))?"y":"x"}function nn(e){return to(or(e))}function ai(e,t,r){r===void 0&&(r=false);let a=Or(e),n=nn(e),o=an(n),s=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=ya(s)),[s,ya(s)]}function ni(e){let t=ya(e);return [tn(e),t,tn(t)]}function tn(e){return e.replace(/start|end/g,t=>Ed[t])}var ti=["left","right"],ri=["right","left"],Pd=["top","bottom"],Id=["bottom","top"];function Md(e,t,r){switch(e){case "top":case "bottom":return r?t?ri:ti:t?ti:ri;case "left":case "right":return t?Pd:Id;default:return []}}function oi(e,t,r,a){let n=Or(e),o=Md(mr(e),r==="start",a);return n&&(o=o.map(s=>s+"-"+n),t&&(o=o.concat(o.map(tn)))),o}function ya(e){return e.replace(/left|right|bottom|top/g,t=>Nd[t])}function Ad(e){return {top:0,right:0,bottom:0,left:0,...e}}function ro(e){return typeof e!="number"?Ad(e):{top:e,right:e,bottom:e,left:e}}function zr(e){let{x:t,y:r,width:a,height:n}=e;return {width:a,height:n,top:r,left:t,right:t+a,bottom:r+n,x:t,y:r}}var Fd=typeof document<"u",Bd=function(){},Ca=Fd?Te.useLayoutEffect:Bd,Od={...Te__namespace};var zd=Od.useInsertionEffect,Ud=zd||(e=>e());function si(e){let t=Te__namespace.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Ud(()=>{t.current=e;}),Te__namespace.useCallback(function(){for(var r=arguments.length,a=new Array(r),n=0;n<r;n++)a[n]=arguments[n];return t.current==null?void 0:t.current(...a)},[])}function ii(e,t,r){let{reference:a,floating:n}=e,o=or(t),s=nn(t),l=an(s),c=mr(t),i=o==="y",u=a.x+a.width/2-n.width/2,d=a.y+a.height/2-n.height/2,m=a[l]/2-n[l]/2,p;switch(c){case "top":p={x:u,y:a.y-n.height};break;case "bottom":p={x:u,y:a.y+a.height};break;case "right":p={x:a.x+a.width,y:d};break;case "left":p={x:a.x-n.width,y:d};break;default:p={x:a.x,y:a.y};}switch(Or(t)){case "start":p[s]-=m*(r&&i?-1:1);break;case "end":p[s]+=m*(r&&i?-1:1);break}return p}var li=async(e,t,r)=>{let{placement:a="bottom",strategy:n="absolute",middleware:o=[],platform:s}=r,l=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t)),i=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:d}=ii(i,a,c),m=a,p={},x=0;for(let b=0;b<l.length;b++){let{name:v,fn:g}=l[b],{x:h,y:f,data:w,reset:k}=await g({x:u,y:d,initialPlacement:a,placement:m,strategy:n,middlewareData:p,rects:i,platform:s,elements:{reference:e,floating:t}});u=h??u,d=f??d,p={...p,[v]:{...p[v],...w}},k&&x<=50&&(x++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(i=k.rects===true?await s.getElementRects({reference:e,floating:t,strategy:n}):k.rects),{x:u,y:d}=ii(i,m,c)),b=-1);}return {x:u,y:d,placement:m,strategy:n,middlewareData:p}};async function on(e,t){var r;t===void 0&&(t={});let{x:a,y:n,platform:o,rects:s,elements:l,strategy:c}=e,{boundary:i="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=false,padding:p=0}=Br(t,e),x=ro(p),v=l[m?d==="floating"?"reference":"floating":d],g=zr(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(v)))==null||r?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:i,rootBoundary:u,strategy:c})),h=d==="floating"?{x:a,y:n,width:s.floating.width,height:s.floating.height}:s.reference,f=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),w=await(o.isElement==null?void 0:o.isElement(f))?await(o.getScale==null?void 0:o.getScale(f))||{x:1,y:1}:{x:1,y:1},k=zr(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:h,offsetParent:f,strategy:c}):h);return {top:(g.top-k.top+x.top)/w.y,bottom:(k.bottom-g.bottom+x.bottom)/w.y,left:(g.left-k.left+x.left)/w.x,right:(k.right-g.right+x.right)/w.x}}var ci=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:a,placement:n,rects:o,platform:s,elements:l,middlewareData:c}=t,{element:i,padding:u=0}=Br(e,t)||{};if(i==null)return {};let d=ro(u),m={x:r,y:a},p=nn(n),x=an(p),b=await s.getDimensions(i),v=p==="y",g=v?"top":"left",h=v?"bottom":"right",f=v?"clientHeight":"clientWidth",w=o.reference[x]+o.reference[p]-m[p]-o.floating[x],k=m[p]-o.reference[p],y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i)),T=y?y[f]:0;(!T||!await(s.isElement==null?void 0:s.isElement(y)))&&(T=l.floating[f]||o.floating[x]);let C=w/2-k/2,D=T/2-b[x]/2-1,R=nr(d[g],D),U=nr(d[h],D),W=R,I=T-b[x]-U,O=T/2-b[x]/2+C,E=rn(W,O,I),B=!c.arrow&&Or(n)!=null&&O!==E&&o.reference[x]/2-(O<W?R:U)-b[x]/2<0,$=B?O<W?O-W:O-I:0;return {[p]:m[p]+$,data:{[p]:E,centerOffset:O-E-$,...B&&{alignmentOffset:$}},reset:B}}});var di=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,a;let{placement:n,middlewareData:o,rects:s,initialPlacement:l,platform:c,elements:i}=t,{mainAxis:u=true,crossAxis:d=true,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:b=true,...v}=Br(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return {};let g=mr(n),h=or(l),f=mr(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(i.floating)),k=m||(f||!b?[ya(l)]:ni(l)),y=x!=="none";!m&&y&&k.push(...oi(l,b,x,w));let T=[l,...k],C=await on(t,v),D=[],R=((a=o.flip)==null?void 0:a.overflows)||[];if(u&&D.push(C[g]),d){let O=ai(n,s,w);D.push(C[O[0]],C[O[1]]);}if(R=[...R,{placement:n,overflows:D}],!D.every(O=>O<=0)){var U,W;let O=(((U=o.flip)==null?void 0:U.index)||0)+1,E=T[O];if(E&&(!(d==="alignment"?h!==or(E):false)||R.every(z=>or(z.placement)===h?z.overflows[0]>0:true)))return {data:{index:O,overflows:R},reset:{placement:E}};let B=(W=R.filter($=>$.overflows[0]<=0).sort(($,z)=>$.overflows[1]-z.overflows[1])[0])==null?void 0:W.placement;if(!B)switch(p){case "bestFit":{var I;let $=(I=R.filter(z=>{if(y){let L=or(z.placement);return L===h||L==="y"}return true}).map(z=>[z.placement,z.overflows.filter(L=>L>0).reduce((L,re)=>L+re,0)]).sort((z,L)=>z[1]-L[1])[0])==null?void 0:I[0];$&&(B=$);break}case "initialPlacement":B=l;break}if(n!==B)return {reset:{placement:B}}}return {}}}};var Wd=new Set(["left","top"]);async function $d(e,t){let{placement:r,platform:a,elements:n}=e,o=await(a.isRTL==null?void 0:a.isRTL(n.floating)),s=mr(r),l=Or(r),c=or(r)==="y",i=Wd.has(s)?-1:1,u=o&&c?-1:1,d=Br(t,e),{mainAxis:m,crossAxis:p,alignmentAxis:x}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof x=="number"&&(p=l==="end"?x*-1:x),c?{x:p*u,y:m*i}:{x:m*i,y:p*u}}var ui=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,a;let{x:n,y:o,placement:s,middlewareData:l}=t,c=await $d(t,e);return s===((r=l.offset)==null?void 0:r.placement)&&(a=l.arrow)!=null&&a.alignmentOffset?{}:{x:n+c.x,y:o+c.y,data:{...c,placement:s}}}}},pi=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:a,placement:n}=t,{mainAxis:o=true,crossAxis:s=false,limiter:l={fn:v=>{let{x:g,y:h}=v;return {x:g,y:h}}},...c}=Br(e,t),i={x:r,y:a},u=await on(t,c),d=or(mr(n)),m=to(d),p=i[m],x=i[d];if(o){let v=m==="y"?"top":"left",g=m==="y"?"bottom":"right",h=p+u[v],f=p-u[g];p=rn(h,p,f);}if(s){let v=d==="y"?"top":"left",g=d==="y"?"bottom":"right",h=x+u[v],f=x-u[g];x=rn(h,x,f);}let b=l.fn({...t,[m]:p,[d]:x});return {...b,data:{x:b.x-r,y:b.y-a,enabled:{[m]:o,[d]:s}}}}}};var mi=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,a;let{placement:n,rects:o,platform:s,elements:l}=t,{apply:c=()=>{},...i}=Br(e,t),u=await on(t,i),d=mr(n),m=Or(n),p=or(n)==="y",{width:x,height:b}=o.floating,v,g;d==="top"||d==="bottom"?(v=d,g=m===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(g=d,v=m==="end"?"top":"bottom");let h=b-u.top-u.bottom,f=x-u.left-u.right,w=nr(b-u[v],h),k=nr(x-u[g],f),y=!t.middlewareData.shift,T=w,C=k;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(C=f),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(T=h),y&&!m){let R=wt(u.left,0),U=wt(u.right,0),W=wt(u.top,0),I=wt(u.bottom,0);p?C=x-2*(R!==0||U!==0?R+U:wt(u.left,u.right)):T=b-2*(W!==0||I!==0?W+I:wt(u.top,u.bottom));}await c({...t,availableWidth:C,availableHeight:T});let D=await s.getDimensions(l.floating);return x!==D.width||b!==D.height?{reset:{rects:true}}:{}}}};function vi(e){let t=Dt(e),r=parseFloat(t.width)||0,a=parseFloat(t.height)||0,n=Ot(e),o=n?e.offsetWidth:r,s=n?e.offsetHeight:a,l=xa(r)!==o||xa(a)!==s;return l&&(r=o,a=s),{width:r,height:a,$:l}}function no(e){return pt(e)?e:e.contextElement}function Zr(e){let t=no(e);if(!Ot(t))return _t(1);let r=t.getBoundingClientRect(),{width:a,height:n,$:o}=vi(t),s=(o?xa(r.width):r.width)/a,l=(o?xa(r.height):r.height)/n;return (!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}var Gd=_t(0);function bi(e){let t=kt(e);return !va()||!t.visualViewport?Gd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Hd(e,t,r){return t===void 0&&(t=false),!r||t&&r!==kt(e)?false:t}function Ur(e,t,r,a){t===void 0&&(t=false),r===void 0&&(r=false);let n=e.getBoundingClientRect(),o=no(e),s=_t(1);t&&(a?pt(a)&&(s=Zr(a)):s=Zr(e));let l=Hd(o,r,a)?bi(o):_t(0),c=(n.left+l.x)/s.x,i=(n.top+l.y)/s.y,u=n.width/s.x,d=n.height/s.y;if(o){let m=kt(o),p=a&&pt(a)?kt(a):a,x=m,b=en(x);for(;b&&a&&p!==x;){let v=Zr(b),g=b.getBoundingClientRect(),h=Dt(b),f=g.left+(b.clientLeft+parseFloat(h.paddingLeft))*v.x,w=g.top+(b.clientTop+parseFloat(h.paddingTop))*v.y;c*=v.x,i*=v.y,u*=v.x,d*=v.y,c+=f,i+=w,x=kt(b),b=en(x);}}return zr({width:u,height:d,x:c,y:i})}function sn(e,t){let r=ba(e).scrollLeft;return t?t.left+r:Ur(Ht(e)).left+r}function yi(e,t){let r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-sn(e,r),n=r.top+t.scrollTop;return {x:a,y:n}}function _d(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e,o=n==="fixed",s=Ht(a),l=t?ha(t.floating):false;if(a===s||l&&o)return r;let c={scrollLeft:0,scrollTop:0},i=_t(1),u=_t(0),d=Ot(a);if((d||!d&&!o)&&((xr(a)!=="body"||Jr(s))&&(c=ba(a)),Ot(a))){let p=Ur(a);i=Zr(a),u.x=p.x+a.clientLeft,u.y=p.y+a.clientTop;}let m=s&&!d&&!o?yi(s,c):_t(0);return {width:r.width*i.x,height:r.height*i.y,x:r.x*i.x-c.scrollLeft*i.x+u.x+m.x,y:r.y*i.y-c.scrollTop*i.y+u.y+m.y}}function Vd(e){return Array.from(e.getClientRects())}function Kd(e){let t=Ht(e),r=ba(e),a=e.ownerDocument.body,n=wt(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),o=wt(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),s=-r.scrollLeft+sn(e),l=-r.scrollTop;return Dt(a).direction==="rtl"&&(s+=wt(t.clientWidth,a.clientWidth)-n),{width:n,height:o,x:s,y:l}}var fi=25;function jd(e,t){let r=kt(e),a=Ht(e),n=r.visualViewport,o=a.clientWidth,s=a.clientHeight,l=0,c=0;if(n){o=n.width,s=n.height;let u=va();(!u||u&&t==="fixed")&&(l=n.offsetLeft,c=n.offsetTop);}let i=sn(a);if(i<=0){let u=a.ownerDocument,d=u.body,m=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(a.clientWidth-d.clientWidth-p);x<=fi&&(o-=x);}else i<=fi&&(o+=i);return {width:o,height:s,x:l,y:c}}var Yd=new Set(["absolute","fixed"]);function qd(e,t){let r=Ur(e,true,t==="fixed"),a=r.top+e.clientTop,n=r.left+e.clientLeft,o=Ot(e)?Zr(e):_t(1),s=e.clientWidth*o.x,l=e.clientHeight*o.y,c=n*o.x,i=a*o.y;return {width:s,height:l,x:c,y:i}}function gi(e,t,r){let a;if(t==="viewport")a=jd(e,r);else if(t==="document")a=Kd(Ht(e));else if(pt(t))a=qd(t,r);else {let n=bi(e);a={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height};}return zr(a)}function xi(e,t){let r=ar(e);return r===t||!pt(r)||kr(r)?false:Dt(r).position==="fixed"||xi(r,t)}function Xd(e,t){let r=t.get(e);if(r)return r;let a=pr(e,[],false).filter(l=>pt(l)&&xr(l)!=="body"),n=null,o=Dt(e).position==="fixed",s=o?ar(e):e;for(;pt(s)&&!kr(s);){let l=Dt(s),c=Qa(s);!c&&l.position==="fixed"&&(n=null),(o?!c&&!n:!c&&l.position==="static"&&!!n&&Yd.has(n.position)||Jr(s)&&!c&&xi(e,s))?a=a.filter(u=>u!==s):n=l,s=ar(s);}return t.set(e,a),a}function Jd(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e,s=[...r==="clippingAncestors"?ha(t)?[]:Xd(t,this._c):[].concat(r),a],l=s[0],c=s.reduce((i,u)=>{let d=gi(t,u,n);return i.top=wt(d.top,i.top),i.right=nr(d.right,i.right),i.bottom=nr(d.bottom,i.bottom),i.left=wt(d.left,i.left),i},gi(t,l,n));return {width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Zd(e){let{width:t,height:r}=vi(e);return {width:t,height:r}}function Qd(e,t,r){let a=Ot(t),n=Ht(t),o=r==="fixed",s=Ur(e,true,o,t),l={scrollLeft:0,scrollTop:0},c=_t(0);function i(){c.x=sn(n);}if(a||!a&&!o)if((xr(t)!=="body"||Jr(n))&&(l=ba(t)),a){let p=Ur(t,true,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop;}else n&&i();o&&!a&&n&&i();let u=n&&!a&&!o?yi(n,l):_t(0),d=s.left+l.scrollLeft-c.x-u.x,m=s.top+l.scrollTop-c.y-u.y;return {x:d,y:m,width:s.width,height:s.height}}function ao(e){return Dt(e).position==="static"}function hi(e,t){if(!Ot(e)||Dt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Ht(e)===r&&(r=r.ownerDocument.body),r}function ki(e,t){let r=kt(e);if(ha(e))return r;if(!Ot(e)){let n=ar(e);for(;n&&!kr(n);){if(pt(n)&&!ao(n))return n;n=ar(n);}return r}let a=hi(e,t);for(;a&&Zs(a)&&ao(a);)a=hi(a,t);return a&&kr(a)&&ao(a)&&!Qa(a)?r:a||Qs(e)||r}var eu=async function(e){let t=this.getOffsetParent||ki,r=this.getDimensions,a=await r(e.floating);return {reference:Qd(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function tu(e){return Dt(e).direction==="rtl"}var oo={convertOffsetParentRelativeRectToViewportRelativeRect:_d,getDocumentElement:Ht,getClippingRect:Jd,getOffsetParent:ki,getElementRects:eu,getClientRects:Vd,getDimensions:Zd,getScale:Zr,isElement:pt,isRTL:tu};function wi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ru(e,t){let r=null,a,n=Ht(e);function o(){var l;clearTimeout(a),(l=r)==null||l.disconnect(),r=null;}function s(l,c){l===void 0&&(l=false),c===void 0&&(c=1),o();let i=e.getBoundingClientRect(),{left:u,top:d,width:m,height:p}=i;if(l||t(),!m||!p)return;let x=ka(d),b=ka(n.clientWidth-(u+m)),v=ka(n.clientHeight-(d+p)),g=ka(u),f={rootMargin:-x+"px "+-b+"px "+-v+"px "+-g+"px",threshold:wt(0,nr(1,c))||1},w=true;function k(y){let T=y[0].intersectionRatio;if(T!==c){if(!w)return s();T?s(false,T):a=setTimeout(()=>{s(false,1e-7);},1e3);}T===1&&!wi(i,e.getBoundingClientRect())&&s(),w=false;}try{r=new IntersectionObserver(k,{...f,root:n.ownerDocument});}catch{r=new IntersectionObserver(k,f);}r.observe(e);}return s(true),o}function ln(e,t,r,a){a===void 0&&(a={});let{ancestorScroll:n=true,ancestorResize:o=true,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=false}=a,i=no(e),u=n||o?[...i?pr(i):[],...pr(t)]:[];u.forEach(g=>{n&&g.addEventListener("scroll",r,{passive:true}),o&&g.addEventListener("resize",r);});let d=i&&l?ru(i,r):null,m=-1,p=null;s&&(p=new ResizeObserver(g=>{let[h]=g;h&&h.target===i&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var f;(f=p)==null||f.observe(t);})),r();}),i&&!c&&p.observe(i),p.observe(t));let x,b=c?Ur(e):null;c&&v();function v(){let g=Ur(e);b&&!wi(b,g)&&r(),b=g,x=requestAnimationFrame(v);}return r(),()=>{var g;u.forEach(h=>{n&&h.removeEventListener("scroll",r),o&&h.removeEventListener("resize",r);}),d?.(),(g=p)==null||g.disconnect(),p=null,c&&cancelAnimationFrame(x);}}var Ci=ui;var Ti=pi,Si=di,Di=mi;var so=ci;var cn=(e,t,r)=>{let a=new Map,n={platform:oo,...r},o={...n.platform,_c:a};return li(e,t,{...n,platform:o})};var nu=typeof document<"u",ou=function(){},dn=nu?Te.useLayoutEffect:ou;function un(e,t){if(e===t)return true;if(typeof e!=typeof t)return false;if(typeof e=="function"&&e.toString()===t.toString())return true;let r,a,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return false;for(a=r;a--!==0;)if(!un(e[a],t[a]))return false;return true}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return false;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(t,n[a]))return false;for(a=r;a--!==0;){let o=n[a];if(!(o==="_owner"&&e.$$typeof)&&!un(e[o],t[o]))return false}return true}return e!==e&&t!==t}function Pi(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ni(e,t){let r=Pi(e);return Math.round(t*r)/r}function io(e){let t=Te__namespace.useRef(e);return dn(()=>{t.current=e;}),t}function Ii(e){e===void 0&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:o,floating:s}={},transform:l=true,whileElementsMounted:c,open:i}=e,[u,d]=Te__namespace.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:false}),[m,p]=Te__namespace.useState(a);un(m,a)||p(a);let[x,b]=Te__namespace.useState(null),[v,g]=Te__namespace.useState(null),h=Te__namespace.useCallback(z=>{z!==y.current&&(y.current=z,b(z));},[]),f=Te__namespace.useCallback(z=>{z!==T.current&&(T.current=z,g(z));},[]),w=o||x,k=s||v,y=Te__namespace.useRef(null),T=Te__namespace.useRef(null),C=Te__namespace.useRef(u),D=c!=null,R=io(c),U=io(n),W=io(i),I=Te__namespace.useCallback(()=>{if(!y.current||!T.current)return;let z={placement:t,strategy:r,middleware:m};U.current&&(z.platform=U.current),cn(y.current,T.current,z).then(L=>{let re={...L,isPositioned:W.current!==false};O.current&&!un(C.current,re)&&(C.current=re,Ri__namespace.flushSync(()=>{d(re);}));});},[m,t,r,U,W]);dn(()=>{i===false&&C.current.isPositioned&&(C.current.isPositioned=false,d(z=>({...z,isPositioned:false})));},[i]);let O=Te__namespace.useRef(false);dn(()=>(O.current=true,()=>{O.current=false;}),[]),dn(()=>{if(w&&(y.current=w),k&&(T.current=k),w&&k){if(R.current)return R.current(w,k,I);I();}},[w,k,I,R,D]);let E=Te__namespace.useMemo(()=>({reference:y,floating:T,setReference:h,setFloating:f}),[h,f]),B=Te__namespace.useMemo(()=>({reference:w,floating:k}),[w,k]),$=Te__namespace.useMemo(()=>{let z={position:r,left:0,top:0};if(!B.floating)return z;let L=Ni(B.floating,u.x),re=Ni(B.floating,u.y);return l?{...z,transform:"translate("+L+"px, "+re+"px)",...Pi(B.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:L,top:re}},[r,l,B.floating,u.x,u.y]);return Te__namespace.useMemo(()=>({...u,update:I,refs:E,elements:B,floatingStyles:$}),[u,I,E,B,$])}var su=e=>{function t(r){return {}.hasOwnProperty.call(r,"current")}return {name:"arrow",options:e,fn(r){let{element:a,padding:n}=typeof e=="function"?e(r):e;return a&&t(a)?a.current!=null?so({element:a.current,padding:n}).fn(r):{}:a?so({element:a,padding:n}).fn(r):{}}}},pn=(e,t)=>({...Ci(e),options:[e,t]}),lo=(e,t)=>({...Ti(e),options:[e,t]});var co=(e,t)=>({...Si(e),options:[e,t]}),uo=(e,t)=>({...Di(e),options:[e,t]});var po=(e,t)=>({...su(e),options:[e,t]});function Fi(e){let t=Te__namespace.useRef(void 0),r=Te__namespace.useCallback(a=>{let n=e.map(o=>{if(o!=null){if(typeof o=="function"){let s=o,l=s(a);return typeof l=="function"?l:()=>{s(null);}}return o.current=a,()=>{o.current=null;}}});return ()=>{n.forEach(o=>o?.());}},e);return Te__namespace.useMemo(()=>e.every(a=>a==null)?null:a=>{t.current&&(t.current(),t.current=void 0),a!=null&&(t.current=r(a));},e)}var fu={...Te__namespace},Mi=false,gu=0,Ai=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+gu++;function hu(){let[e,t]=Te__namespace.useState(()=>Mi?Ai():void 0);return Ca(()=>{e==null&&t(Ai());},[]),Te__namespace.useEffect(()=>{Mi=true;},[]),e}var vu=fu.useId,Bi=vu||hu,Ta;process.env.NODE_ENV!=="production"&&(Ta=new Set);function bu(){for(var e,t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];let n="Floating UI: "+r.join(" ");if(!((e=Ta)!=null&&e.has(n))){var o;(o=Ta)==null||o.add(n),console.warn(n);}}function yu(){for(var e,t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];let n="Floating UI: "+r.join(" ");if(!((e=Ta)!=null&&e.has(n))){var o;(o=Ta)==null||o.add(n),console.error(n);}}var Oi=Te__namespace.forwardRef(function(t,r){let{context:{placement:a,elements:{floating:n},middlewareData:{arrow:o,shift:s}},width:l=14,height:c=7,tipRadius:i=0,strokeWidth:u=0,staticOffset:d,stroke:m,d:p,style:{transform:x,...b}={},...v}=t;process.env.NODE_ENV!=="production"&&(r||bu("The `ref` prop is required for `FloatingArrow`."));let g=Bi(),[h,f]=Te__namespace.useState(false);if(Ca(()=>{if(!n)return;Dt(n).direction==="rtl"&&f(true);},[n]),!n)return null;let[w,k]=a.split("-"),y=w==="top"||w==="bottom",T=d;(y&&s!=null&&s.x||!y&&s!=null&&s.y)&&(T=null);let C=u*2,D=C/2,R=l/2*(i/-8+1),U=c/2*i/4,W=!!p,I=T&&k==="end"?"bottom":"top",O=T&&k==="end"?"right":"left";T&&h&&(O=k==="end"?"left":"right");let E=o?.x!=null?T||o.x:"",B=o?.y!=null?T||o.y:"",$=p||"M0,0"+(" H"+l)+(" L"+(l-R)+","+(c-U))+(" Q"+l/2+","+c+" "+R+","+(c-U))+" Z",z={top:W?"rotate(180deg)":"",left:W?"rotate(90deg)":"rotate(-90deg)",bottom:W?"":"rotate(180deg)",right:W?"rotate(-90deg)":"rotate(90deg)"}[w];return jsxRuntime.jsxs("svg",{...v,"aria-hidden":true,ref:r,width:W?l:l+C,height:l,viewBox:"0 0 "+l+" "+(c>l?c:l),style:{position:"absolute",pointerEvents:"none",[O]:E,[I]:B,[w]:y||W?"100%":"calc(100% - "+C/2+"px)",transform:[z,x].filter(L=>!!L).join(" "),...b},children:[C>0&&jsxRuntime.jsx("path",{clipPath:"url(#"+g+")",fill:"none",stroke:m,strokeWidth:C+(p?0:1),d:$}),jsxRuntime.jsx("path",{stroke:C&&!p?v.fill:"none",d:$}),jsxRuntime.jsx("clipPath",{id:g,children:jsxRuntime.jsx("rect",{x:-D,y:D*(W?-1:1),width:l+C,height:l})})]})});function xu(){let e=new Map;return {emit(t,r){var a;(a=e.get(t))==null||a.forEach(n=>n(r));},on(t,r){e.has(t)||e.set(t,new Set),e.get(t).add(r);},off(t,r){var a;(a=e.get(t))==null||a.delete(r);}}}var ku=Te__namespace.createContext(null),wu=Te__namespace.createContext(null),Cu=()=>{var e;return ((e=Te__namespace.useContext(ku))==null?void 0:e.id)||null},Tu=()=>Te__namespace.useContext(wu);function Su(e){let{open:t=false,onOpenChange:r,elements:a}=e,n=Bi(),o=Te__namespace.useRef({}),[s]=Te__namespace.useState(()=>xu()),l=Cu()!=null;if(process.env.NODE_ENV!=="production"){let p=a.reference;p&&!pt(p)&&yu("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.");}let[c,i]=Te__namespace.useState(a.reference),u=si((p,x,b)=>{o.current.openEvent=p?x:void 0,s.emit("openchange",{open:p,event:x,reason:b,nested:l}),r?.(p,x,b);}),d=Te__namespace.useMemo(()=>({setPositionReference:i}),[]),m=Te__namespace.useMemo(()=>({reference:c||a.reference||null,floating:a.floating||null,domReference:a.reference}),[c,a.reference,a.floating]);return Te__namespace.useMemo(()=>({dataRef:o,open:t,onOpenChange:u,elements:m,events:s,floatingId:n,refs:d}),[t,u,m,s,n,d])}function zi(e){e===void 0&&(e={});let{nodeId:t}=e,r=Su({...e,elements:{reference:null,floating:null,...e.elements}}),a=e.rootContext||r,n=a.elements,[o,s]=Te__namespace.useState(null),[l,c]=Te__namespace.useState(null),u=n?.domReference||o,d=Te__namespace.useRef(null),m=Tu();Ca(()=>{u&&(d.current=u);},[u]);let p=Ii({...e,elements:{...n,...l&&{reference:l}}}),x=Te__namespace.useCallback(f=>{let w=pt(f)?{getBoundingClientRect:()=>f.getBoundingClientRect(),getClientRects:()=>f.getClientRects(),contextElement:f}:f;c(w),p.refs.setReference(w);},[p.refs]),b=Te__namespace.useCallback(f=>{(pt(f)||f===null)&&(d.current=f,s(f)),(pt(p.refs.reference.current)||p.refs.reference.current===null||f!==null&&!pt(f))&&p.refs.setReference(f);},[p.refs]),v=Te__namespace.useMemo(()=>({...p.refs,setReference:b,setPositionReference:x,domReference:d}),[p.refs,b,x]),g=Te__namespace.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),h=Te__namespace.useMemo(()=>({...p,...a,refs:v,elements:g,nodeId:t}),[p,v,g,t,a]);return Ca(()=>{a.dataRef.current.floatingContext=h;let f=m?.nodesRef.current.find(w=>w.id===t);f&&(f.context=h);}),Te__namespace.useMemo(()=>({...p,context:h,refs:v,elements:g}),[p,v,g,h])}var mo=Te.createContext(null);function Ui(){return Te.useContext(mo)}function Ke({children:e,container:t}){let[r,a]=Te.useState(false),n=Ui();if(Te.useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:s,themeName:l}=n,c={"--asakaa-color-background-primary":s.bgPrimary,"--asakaa-color-background-secondary":s.bgSecondary,"--asakaa-color-background-card":s.bgGrid,"--asakaa-color-background-hover":s.hoverBg,"--asakaa-color-text-primary":s.textPrimary,"--asakaa-color-text-secondary":s.textSecondary,"--asakaa-color-text-tertiary":s.textTertiary,"--asakaa-color-text-inverse":s.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":s.border,"--asakaa-color-border-hover":s.borderLight,"--asakaa-color-border-subtle":s.borderLight,"--asakaa-color-interactive-primary":s.accent,"--asakaa-color-interactive-primaryHover":s.accentHover,"--asakaa-color-interactive-primaryBorder":`${s.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${s.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${s.accent}33`,"--asakaa-color-status-success":s.statusCompleted,"--asakaa-color-status-warning":s.milestone,"--asakaa-color-status-error":s.criticalPath,"--asakaa-color-danger":s.criticalPath,"--asakaa-color-danger-border":`${s.criticalPath}4D`,"--asakaa-color-danger-background":`${s.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${s.criticalPath}26`};return Ri.createPortal(jsxRuntime.jsx("div",{"data-theme":l,"data-gantt-portal":"true",style:c,children:e}),o)}return Ri.createPortal(e,o)}function $i(e,t,r=true){Te.useEffect(()=>{if(!r)return;let a=o=>{(Array.isArray(e)?e:[e]).some(c=>{let i=c.current;if(!i)return false;let u=o.target;return i===u||i.contains(u)})||t(o);},n=setTimeout(()=>{document.addEventListener("mousedown",a),document.addEventListener("touchstart",a);},0);return ()=>{clearTimeout(n),document.removeEventListener("mousedown",a),document.removeEventListener("touchstart",a);}},[e,t,r]);}function Hi({itemCount:e,onSelect:t,onEscape:r,enabled:a=true,loop:n=true,containerRef:o}){let[s,l]=Te.useState(-1);Te.useEffect(()=>{if(!a||s===-1||!o?.current)return;let d=o.current.querySelector(`[data-index="${s}"]`);d&&d.scrollIntoView({block:"nearest",behavior:"smooth"});},[s,a,o]);let c=Te.useCallback(u=>{if(a)switch(u.key){case "ArrowDown":u.preventDefault(),l(d=>d===-1?0:d===e-1?n?0:d:d+1);break;case "ArrowUp":u.preventDefault(),l(d=>d===-1?e-1:d===0?n?e-1:d:d-1);break;case "Enter":case " ":u.preventDefault(),s!==-1&&t&&t(s);break;case "Escape":u.preventDefault(),r&&r();break;case "Home":u.preventDefault(),l(0);break;case "End":u.preventDefault(),l(e-1);break;}},[a,s,e,n,t,r]),i=Te.useCallback(u=>({"data-active":u===s,"data-index":u,role:"option",tabIndex:-1}),[s]);return {activeIndex:s,setActiveIndex:l,handleKeyDown:c,getItemProps:i}}function fr({trigger:e,children:t,isOpen:r,onOpenChange:a,placement:n="bottom-start",offsetDistance:o=8,maxHeight:s=320,minWidth:l="trigger",maxWidth:c,showArrow:i=false,className:u="",triggerClassName:d="",disableClickOutside:m=false,disableKeyboardNav:p=false,itemCount:x=0,onSelectItem:b,onOpen:v,onClose:g,animationDuration:h=200,zIndex:f=1e3}){let[w,k]=Te.useState(false),y=r!==void 0?r:w,T=Te.useCallback(ie=>{let P=y;r===void 0&&k(ie),a?.(ie),ie&&!P?v?.():!ie&&P&&g?.();},[r,a,v,g,y]),C=Te.useCallback(()=>{T(!y);},[y,T]),D=Te.useCallback(()=>{T(false);},[T]),R=Te.useRef(null),U=Te.useRef(null),W=Te.useRef(null),{refs:I,floatingStyles:O,context:E}=zi({open:y,onOpenChange:T,placement:n,middleware:[pn(o),co({padding:8}),lo({padding:8}),uo({apply({rects:ie,elements:P}){Object.assign(P.floating.style,{minWidth:l==="trigger"?`${ie.reference.width}px`:l?`${l}px`:void 0,maxWidth:c?`${c}px`:void 0,maxHeight:`${s}px`});},padding:8}),i?po({element:W}):null].filter(Boolean),whileElementsMounted:ln}),B=Fi([R,I.setReference]);$i([R,U],D,y&&!m);let{activeIndex:$,setActiveIndex:z,handleKeyDown:L}=Hi({itemCount:x,onSelect:b,onEscape:D,enabled:y&&!p,loop:true,containerRef:U}),re=()=>typeof e=="function"?e({isOpen:y,toggle:C}):e,J=()=>typeof t=="function"?t({activeIndex:$,setActiveIndex:z,close:D}):t;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:B,className:`dropdown-trigger ${d}`,onClick:C,children:re()}),y&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:I.setFloating,style:{...O,zIndex:f},className:`dropdown-content ${u}`,role:"menu","aria-orientation":"vertical",onKeyDown:L,children:[jsxRuntime.jsx("div",{ref:U,className:"dropdown-inner",children:J()}),i&&jsxRuntime.jsx(Oi,{ref:W,context:E,className:"dropdown-arrow"})]})})]})}var Vi={URGENT:{label:"Urgent",color:"#E74C3C",darkColor:"#ff6b6b"},HIGH:{label:"High",color:"#E67E22",darkColor:"#ffa94d"},MEDIUM:{label:"Normal",color:"#F1C40F",darkColor:"#ffd43b"},LOW:{label:"Low",color:"#2ECC71",darkColor:"#51cf66"}},Bu="#BDC3C7",Ou="#868e96",zu=({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"})]}),Ki=()=>jsxRuntime.jsx("svg",{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:"var(--asakaa-color-interactive-primary, #1976d2)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})});function Da({priority:e,onChange:t,className:r}){let a=e?Vi[e]:null,n=document.documentElement.getAttribute("data-theme")==="dark",o=a?n?a.darkColor:a.color:n?Ou:Bu,s=c=>{t(c);},l=Object.entries(Vi);return jsxRuntime.jsx(fr,{trigger:({isOpen:c})=>jsxRuntime.jsx("button",{className:`flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95 ${r||""}`,style:{background:e?`${o}10`:"transparent",boxShadow:e?`0 0 0 2px ${o}30 inset`:"none",transform:c?"scale(1.1)":"scale(1)"},title:a?.label||"Set priority","aria-label":"Select priority","aria-expanded":c,"aria-haspopup":"menu",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:o,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:o,fillOpacity:e?"0.6":"0.4"})})}),placement:"bottom-start",minWidth:180,maxHeight:280,itemCount:l.length+1,onSelectItem:c=>{let i=l[c];s(i?i[0]:void 0);},children:({activeIndex:c,close:i})=>jsxRuntime.jsxs("div",{className:"priority-dropdown",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",children:"Priority"}),jsxRuntime.jsxs("div",{className:"dropdown-section",children:[l.map(([u,d],m)=>{let p=n?d.darkColor:d.color,x=c===m,b=e===u;return jsxRuntime.jsxs("button",{onClick:()=>{s(u),i();},className:"dropdown-item","data-active":x,"data-index":m,role:"option","aria-selected":b,style:{color:x?p:"inherit",fontWeight:b?600:400},children:[jsxRuntime.jsx(zu,{color:p}),jsxRuntime.jsx("span",{children:d.label}),b&&jsxRuntime.jsx(Ki,{})]},u)}),jsxRuntime.jsx("div",{style:{borderTop:"1px solid var(--asakaa-color-border-default, #e0e0e0)",marginTop:"4px",paddingTop:"4px"},children:jsxRuntime.jsxs("button",{onClick:()=>{s(void 0),i();},className:"dropdown-item","data-active":c===l.length,"data-index":l.length,role:"option","aria-selected":!e,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:"var(--asakaa-color-text-tertiary, #9e9e9e)",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{children:"Clear"}),!e&&jsxRuntime.jsx(Ki,{})]})})]})]})})}var Yi=[{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 Na({startDate:e,endDate:t,onChange:r,className:a}){let[n,o]=Te.useState(e||""),[s,l]=Te.useState(t||""),c=(x,b)=>{let v=new Date,g=new Date(v);g.setDate(g.getDate()+x);let h=v.toISOString().split("T")[0]||"",f=g.toISOString().split("T")[0]||"";o(h),l(f),r(h,f),b();},i=x=>{r(n||void 0,s||void 0),x();},u=()=>{if(!e||!t)return "Set date";let x=h=>{if(h instanceof Date)return h;if(typeof h!="string"||!h.match(/^\d{4}-\d{2}-\d{2}$/))return null;let f=h.split("-").map(Number);if(f.length!==3||f.some(T=>isNaN(T)))return null;let w=f[0],k=f[1],y=f[2];return w===void 0||k===void 0||y===void 0?null:new Date(w,k-1,y)},b=x(e),v=x(t);if(!b||!v||isNaN(b.getTime())||isNaN(v.getTime()))return "Set date";let g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${g[b.getMonth()]} ${b.getDate()} \u2013 ${g[v.getMonth()]} ${v.getDate()}`},d=e&&t,p=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,b=new Date;return b.setHours(0,0,0,0),x<b})();return jsxRuntime.jsx(fr,{trigger:({isOpen:x})=>jsxRuntime.jsxs("button",{className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${p?"asakaa-date-overdue":"asakaa-date"} ${a||""}`,style:{transform:x?"scale(1.05)":"scale(1)"},title:d?`${u()}`:"Set date range","aria-label":"Select date range","aria-expanded":x,"aria-haspopup":"menu",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:u()})]}),placement:"bottom-start",minWidth:320,maxHeight:480,itemCount:Yi.length,onOpen:()=>{o(e||""),l(t||"");},children:({activeIndex:x,close:b})=>jsxRuntime.jsxs("div",{className:"date-range-picker-dropdown",children:[jsxRuntime.jsxs("div",{className:"dropdown-button-wrapper",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",style:{marginBottom:"12px"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"dropdown-quick-grid",children:Yi.map((v,g)=>jsxRuntime.jsx("button",{onClick:()=>c(v.days,b),className:"dropdown-quick-button","data-active":x===g,"data-index":g,role:"option",children:v.label},v.label))})]}),jsxRuntime.jsxs("div",{className:"dropdown-button-wrapper",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",style:{marginBottom:"12px"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"dropdown-form-actions",children:[jsxRuntime.jsxs("div",{className:"dropdown-form-group",children:[jsxRuntime.jsx("label",{className:"dropdown-label",children:"Start Date"}),jsxRuntime.jsx("input",{type:"date",value:n,onChange:v=>o(v.target.value),className:"dropdown-input"})]}),jsxRuntime.jsxs("div",{className:"dropdown-form-group",children:[jsxRuntime.jsx("label",{className:"dropdown-label",children:"End Date"}),jsxRuntime.jsx("input",{type:"date",value:s,onChange:v=>l(v.target.value),className:"dropdown-input"})]}),jsxRuntime.jsx("button",{onClick:()=>i(b),className:"dropdown-primary-button",children:"Apply"}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{o(""),l(""),r(void 0,void 0),b();},className:"dropdown-danger-button",children:"Clear Dates"})]})]})]})})}function Wr({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[o,s]=Te.useState(""),l=d=>{let m=e.some(p=>p.id===d.id);r(m?e.filter(p=>p.id!==d.id):[...e,d]);},c=t.filter(d=>d.name.toLowerCase().includes(o.toLowerCase())),i=e.slice(0,n),u=e.length-n;return jsxRuntime.jsx(fr,{trigger:({isOpen:d})=>jsxRuntime.jsx("button",{className:`dropdown-avatar-trigger ${a||""}`,style:{transform:d?"scale(1.05)":"scale(1)"},title:e.length>0?`${e.length} assigned`:"Assign users","aria-label":"Assign users","aria-expanded":d,"aria-haspopup":"menu",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[i.map(m=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:m.name,style:{backgroundColor:m.color,color:"#fff"},children:m.avatar?jsxRuntime.jsx("img",{src:m.avatar,alt:m.name,className:"asakaa-avatar-img"}):m.initials},m.id)),u>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar dropdown-avatar-overflow",children:["+",u]})]}):jsxRuntime.jsx("div",{className:"dropdown-avatar-empty-trigger",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"})]})})}),placement:"bottom-start",minWidth:300,maxHeight:350,itemCount:c.length,onSelectItem:d=>{let m=c[d];m&&l(m);},onClose:()=>s(""),children:({activeIndex:d,close:m})=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",children:"Assign Users"}),jsxRuntime.jsx("div",{className:"dropdown-search-wrapper",children:jsxRuntime.jsx("input",{type:"text",value:o,onChange:p=>s(p.target.value),placeholder:"Search users...",className:"dropdown-search-input",autoFocus:true})}),jsxRuntime.jsx("div",{className:"dropdown-list",children:c.length===0?jsxRuntime.jsx("div",{className:"dropdown-empty",children:"No users found"}):c.map((p,x)=>{let b=e.some(v=>v.id===p.id);return jsxRuntime.jsxs("button",{onClick:()=>{l(p);},className:"dropdown-item","data-active":d===x,"data-index":x,role:"option","aria-selected":b,children:[jsxRuntime.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:700,flexShrink:0,backgroundColor:p.color,color:"#fff",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},children:p.avatar?jsxRuntime.jsx("img",{src:p.avatar,alt:p.name,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}):p.initials}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:600},children:p.name}),b&&jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 9L7.5 12.5L14 6",stroke:"var(--asakaa-color-interactive-primary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m();},className:"dropdown-danger-button",children:"Clear All"})})]})})}function Ra({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n}){let[o,s]=Te.useState(""),[l,c]=Te.useState(t.length>0),i=p=>{if(t.includes(p)){let b=t.filter(v=>v!==p);a(b),b.length===0&&c(false);}else a([...t,p]),c(true);},u=()=>{let p=!l;c(p),p||a([]);},d=r.filter(p=>p.id!==e).filter(p=>p.title.toLowerCase().includes(o.toLowerCase())||p.id.toLowerCase().includes(o.toLowerCase())),m=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsx(fr,{trigger:({isOpen:p})=>jsxRuntime.jsxs("button",{className:`flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5 ${n||""}`,style:{transform:p?"scale(1.05)":"scale(1)"},title:t.length>0?`${t.length} dependencies`:"Add dependencies","aria-label":"Select dependencies","aria-expanded":p,"aria-haspopup":"menu",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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:m},children:t.length})]}),placement:"bottom-start",minWidth:300,maxHeight:350,itemCount:l?d.length:0,onSelectItem:p=>{let x=d[p];x&&i(x.id);},onClose:()=>s(""),onOpen:()=>c(t.length>0),children:({activeIndex:p,close:x})=>jsxRuntime.jsxs("div",{className:"dependencies-dropdown",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",children:"Task Dependencies"}),jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",style:{borderBottom:"1px solid var(--asakaa-color-border-subtle)"},children:jsxRuntime.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},onClick:u,children:[jsxRuntime.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s",border:l?"2px solid var(--asakaa-color-interactive-primary)":"2px solid var(--asakaa-color-border-default)",background:l?"var(--asakaa-color-interactive-primary)":"transparent"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{fontSize:"13px",fontWeight:600,color:"var(--asakaa-color-text-primary)"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"dropdown-search-wrapper",children:jsxRuntime.jsx("input",{type:"text",value:o,onChange:b=>s(b.target.value),placeholder:"Search by name or ID...",className:"dropdown-search-input",autoFocus:true})}),jsxRuntime.jsx("div",{className:"dropdown-list",children:d.length===0?jsxRuntime.jsx("div",{className:"dropdown-empty",children:"No tasks found"}):d.map((b,v)=>{let g=t.includes(b.id);return jsxRuntime.jsxs("button",{onClick:()=>i(b.id),className:"dropdown-item","data-active":p===v,"data-index":v,role:"option","aria-selected":g,children:[jsxRuntime.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginTop:"2px",transition:"all 0.15s",border:g?"2px solid var(--asakaa-color-interactive-primary)":"2px solid var(--asakaa-color-border-default)",background:g?"var(--asakaa-color-interactive-primary)":"transparent"},children:g&&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",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:600,color:"var(--asakaa-color-text-primary)"},children:b.title}),jsxRuntime.jsx("div",{style:{fontSize:"11px",marginTop:"2px",color:"var(--asakaa-color-text-secondary)"},children:b.id})]})]},b.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),c(false),x();},className:"dropdown-danger-button",children:"Clear All Dependencies"})})]})})}var gr=Te.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:o,onUpdate:s,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:m,transition:p,isDragging:x}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),b={transform:Ya.Transform.toString(m),transition:p};if(t)return jsxRuntime.jsx("div",{ref:d,style:b,...i,...u,onClick:()=>r?.(e),children:t(e)});let v=l.filter(g=>e.assignedUserIds?.includes(g.id));return jsxRuntime.jsxs("div",{ref:d,style:b,className:ae("asakaa-card",x&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",o),...i,...u,onClick:g=>{g.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(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:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",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:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Da,{priority:e.priority,onChange:g=>s?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Na,{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:(g,h)=>s?.(e.id,{startDate:g,endDate:h})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Wr,{assignedUsers:v,availableUsers:l,onChange:g=>s?.(e.id,{assignedUserIds:g.map(h=>h.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Ra,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:c,onChange:g=>s?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))})]})},(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.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));gr.displayName="Card";function Ji({columnTitle:e,onRename:t,className:r}){let[a,n]=Te.useState(false),[o,s]=Te.useState(false),[l,c]=Te.useState(e),[i,u]=Te.useState({top:0,left:0}),d=Te.useRef(null),m=Te.useRef(null),p=Te.useRef(null);Te.useEffect(()=>{if(a&&m.current){let g=m.current.getBoundingClientRect();u({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[a]),Te.useEffect(()=>{let g=h=>{d.current&&!d.current.contains(h.target)&&!m.current?.contains(h.target)&&(n(false),s(false));};if(a)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[a]),Te.useEffect(()=>{let g=h=>{h.key==="Escape"&&(n(false),s(false),c(e));};if(a)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[a,e]),Te.useEffect(()=>{o&&p.current&&(p.current.focus(),p.current.select());},[o]);let x=()=>{s(true),c(e);},b=()=>{let g=l.trim();g&&g!==e&&t(g),s(false),n(false),c(e);},v=g=>{g.key==="Enter"?b():g.key==="Escape"&&(s(false),c(e));};return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>n(!a),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"})]})}),a&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{ref:d,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${i.top}px`,left:`${i.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:o?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:p,type:"text",value:l,onChange:g=>c(g.target.value),onKeyDown:v,onBlur:b,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.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:x,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"})]})})})})]})}var ea=Te.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:o,onCardClick:s,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:m,onToggleCollapse:p,onColumnRename:x,className:b})=>{let{setNodeRef:v,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),h=Te.useRef(null),f=u??Hs(t.length),w=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>h.current,estimateSize:()=>d,enabled:f});if(r)return jsxRuntime.jsx("div",{ref:v,className:b,children:r(e,t)});let y=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let D=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:D}:D>=80?{state:"warning",percentage:D}:D>=60?{state:"approaching",percentage:D}:{state:"ok",percentage:D}})(),T=y.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:v,className:ae("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",T&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(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:ae(C()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&y.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${y.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[y.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"})]}),y.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"})]}),y.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"})}),y.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),x&&jsxRuntime.jsx(Ji,{columnTitle:e.title,onRename:D=>x(e.id,D)}),p&&jsxRuntime.jsx("button",{onClick:p,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),!m&&jsxRuntime.jsx("div",{ref:h,className:"asakaa-column-cards",style:{maxHeight:f?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(D=>D.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?o?o(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):f?jsxRuntime.jsx("div",{style:{height:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(D=>{let R=t[D.index];return R?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${D.start}px)`},children:jsxRuntime.jsx(gr,{card:R,render:a,onClick:s,onUpdate:l,availableUsers:c,allCards:i})},R.id):null})}):t.map(D=>jsxRuntime.jsx(gr,{card:D,render:a,onClick:s,onUpdate:l,availableUsers:c,allCards:i},D.id))})})]})});ea.displayName="Column";function vo({title:e,onSave:t,className:r}){let[a,n]=Te.useState(false),[o,s]=Te.useState(e),l=Te.useRef(null);Te.useEffect(()=>{a&&l.current&&(l.current.focus(),l.current.select());},[a]);let c=()=>{let u=o.trim();u&&u!==e?t(u):s(e),n(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(s(e),n(false));};return a?jsxRuntime.jsx("input",{ref:l,type:"text",value:o,onChange:u=>s(u.target.value),onBlur:c,onKeyDown:i,className:ae("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",r),maxLength:50}):jsxRuntime.jsx("h2",{className:ae("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function yo(){let[e,t]=Te.useState(()=>core.dragStore.getState());Te.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let r=Te.useCallback(a=>{core.dragStore.setState(a);},[]);return [e,r]}function Tr({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:o=[],className:s,style:l,isLoading:c,error:i,children:u}){let[d,m]=yo(),p=Te.useCallback((k,y)=>{t.onCardUpdate?.(k,y);},[t]),x=Te.useCallback((k,y)=>{t.onColumnUpdate?.(k,{title:y});},[t]),b=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),v=Te.useMemo(()=>{let k=new Map;return e.columns.forEach(y=>{let T=y.cardIds.map(C=>e.cards.find(D=>D.id===C)).filter(C=>C!==void 0).sort((C,D)=>C.position-D.position);k.set(y.id,T);}),k},[e.cards,e.columns]),g=Te.useCallback(k=>{let{active:y}=k,T=e.cards.find(C=>C.id===y.id);T&&m({isDragging:true,draggedCardId:T.id,sourceColumnId:T.columnId,targetColumnId:T.columnId});},[e.cards,m]),h=Te.useCallback(k=>{let{active:y,over:T}=k;if(!T||!e.cards.find(R=>R.id===y.id))return;let D=null;T.data.current?.type==="column"?D=T.id:T.data.current?.type==="card"&&(D=e.cards.find(U=>U.id===T.id)?.columnId||null),D&&D!==d.targetColumnId&&m({...d,targetColumnId:D});},[e.cards,d,m]),f=Te.useCallback(async k=>{let{active:y,over:T}=k;if(m({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!T)return;let C=e.cards.find(W=>W.id===y.id);if(!C)return;let D,R;if(T.data.current?.type==="column"){D=T.id;let W=v.get(D)||[];R=qn(W,0);}else {let W=e.cards.find(E=>E.id===T.id);if(!W)return;D=W.columnId;let I=v.get(D)||[],O=I.findIndex(E=>E.id===T.id);R=qn(I,O);}let U=e.columns.find(W=>W.id===D);if(U&&U.wipLimit&&U.wipLimitType==="hard"){let W=v.get(D)||[];if(C.columnId!==D&&W.length>=U.wipLimit){t.onWipLimitExceeded?.(U,C);return}}(C.columnId!==D||C.position!==R)&&await t.onCardMove?.(C.id,D,R);},[e.cards,e.columns,v,t,m]),w=Te.useCallback(k=>{r?.(k);},[r]);return c?jsxRuntime.jsx("div",{className:ae("asakaa-board",s),style:l,children:jsxRuntime.jsx(lp,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:ae("asakaa-board",s),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(core$1.DndContext,{sensors:b,collisionDetection:core$1.closestCorners,onDragStart:g,onDragOver:h,onDragEnd:f,children:[jsxRuntime.jsxs("div",{className:ae("asakaa-board",s),style:l,children:[e.columns.sort((k,y)=>k.position-y.position).map(k=>{let y=v.get(k.id)||[];return jsxRuntime.jsx(ea,{column:k,cards:y,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,onCardClick:w,onCardUpdate:p,onColumnRename:x,availableUsers:o,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight},k.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:d.draggedCardId?jsxRuntime.jsx(gr,{card:e.cards.find(k=>k.id===d.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})}function lp({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,r)=>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"})]})]},r))})}var Ia=class extends core.BaseViewAdapter{constructor(r={}){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=r,this.options={animations:r.viewOptions?.animations??true,virtualScrolling:r.viewOptions?.virtualScrolling??false,theme:r.viewOptions?.theme??"dark",readonly:r.viewOptions?.readonly??false};}mount(r,a){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=r,this.data=a,this.root=client.createRoot(r),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(r){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=r,this.render(),this.emit("view:updated",{viewId:this.id,data:r});}configure(r){this.options={...this.options,...r},this.isMounted()&&this.render();}async export(r){if(!this.data)throw new Error("No data to export");switch(r){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: ${r}`)}}render(){if(!this.root||!this.data)return;let r={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(Tr,{board:r,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 r=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(a=>{let n=this.data.columns.find(o=>o.id===a.columnId);r.push([a.id,a.title,n?.title||"",a.description||"",a.labels?.join(", ")||"",a.assignedUserIds?.join(", ")||a.assigneeId||"",a.dueDate?.toString()||"",a.position.toString()]);}),r.map(a=>a.map(n=>`"${n}"`).join(",")).join(`
5
- `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let a=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,o)=>{a.toBlob(s=>{s?n(s):o(new Error("Failed to create PNG blob"));},"image/png");})}};function tl(e={}){return new Ia(e)}var ra=class extends Te.Component{constructor(r){super(r);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,a){let{onError:n,componentName:o}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${o||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(s){console.error("Error in error handler:",s);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:o,componentName:s}=this.props;return r&&a?o?o(a,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:s?`Error in ${s}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:a.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:a.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"})]})]})}):n}};function xo(e,t){let r=a=>jsxRuntime.jsx(ra,{...t,children:jsxRuntime.jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function wo({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:o,onGeneratePlan:s,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[d,m]=Te.useState(false),[p,x]=Te.useState(""),[b,v]=Te.useState("home"),[g,h]=Te.useState(""),[f,w]=Te.useState("");Te.useEffect(()=>{let C=D=>{(D.metaKey||D.ctrlKey)&&D.key===i&&(D.preventDefault(),m(R=>!R)),D.key==="Escape"&&(m(false),v("home"),x(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),Te.useEffect(()=>{d||(v("home"),x(""),h(""),w(""));},[d]);let k=Te.useCallback(()=>{m(false);},[]),y=Te.useCallback(C=>{let[D,R]=C.split(":");switch(D){case "create-card":v("create-card");break;case "create-card-in":h(R||"");break;case "navigate":R?(r?.(R),k()):v("navigate");break;case "search":a?.(p),k();break;case "priority":v("priority");break;case "set-priority":f&&R&&(n?.(f,R),k());break;case "assign":v("assign");break;case "assign-user":f&&R&&(o?.(f,R),k());break;case "ai":v("ai");break;case "ai-generate-plan":s?.(),k();break;case "ai-predict-risks":l?.(),k();break;case "ai-usage":c?.(),k();break;case "back":v("home");break;}},[p,f,t,r,a,n,o,s,l,c,k]),T=Te.useCallback(()=>{g&&p.trim()&&(t?.(g,p.trim()),k());},[g,p,t,k]);return d?jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:p,onValueChange:x,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:b==="create-card"&&g?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&b==="create-card"&&g&&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."}),b==="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:y,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:y,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:y,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:y,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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:D},D))})]},C.id))})]}),b==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.id}`,onSelect:y,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:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),b==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,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(C=>{let D=e.columns.find(R=>R.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:y,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:D?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},C.id)})})]}),b==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,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:y,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:y,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:y,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 gp(e){if(e===0)return "0 Bytes";let t=1024,r=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,a)*100)/100+" "+r[a]}function hp(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 vp(e){return e.startsWith("image/")}function Aa({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:o=10}){let[s,l]=Te.useState(false),[c,i]=Te.useState(false),[u,d]=Te.useState(null),m=Te.useRef(null),p=Te.useCallback(y=>{let T=[],C=[];return e.length+y.length>o?(C.push(`Maximum ${o} files allowed`),{valid:T,errors:C}):(y.forEach(D=>{if(D.size/1048576>a){C.push(`${D.name} is too large (max ${a}MB)`);return}if(n&&!n.some(U=>D.type.match(U))){C.push(`${D.name} has invalid file type`);return}T.push(D);}),{valid:T,errors:C})},[e.length,o,a,n]),x=Te.useCallback(async y=>{let{valid:T,errors:C}=p(y);if(C.length>0){d(C.join(", ")),setTimeout(()=>d(null),5e3);return}if(T.length!==0){i(true),d(null);try{await t?.(T);}catch(D){d(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[p,t]),b=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation(),l(true);},[]),v=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation(),l(false);},[]),g=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation();},[]),h=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation(),l(false);let T=Array.from(y.dataTransfer.files);x(T);},[x]),f=Te.useCallback(y=>{let T=y.target.files?Array.from(y.target.files):[];x(T),m.current&&(m.current.value="");},[x]),w=Te.useCallback(()=>{m.current?.click();},[]),k=Te.useCallback(y=>{confirm("Are you sure you want to delete this attachment?")&&r?.(y);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${s?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:v,onDragOver:g,onDrop:h,onClick:w,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:f,style:{display:"none"},accept:n?.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:s?"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 ",a,"MB \u2022 ",e.length,"/",o," 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(y=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:vp(y.type)&&y.url?jsxRuntime.jsx("img",{src:y.thumbnailUrl||y.url,alt:y.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:hp(y.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:y.name,children:y.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:gp(y.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(y.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(y.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"})})})]},y.id))})]})}function To({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:p,onSuggestAssignee:x,onGenerateSubtasks:b,onEstimateEffort:v,currentUserId:g="user-1"}){let[h,f]=Te.useState("details"),[w,k]=Te.useState(false),[y,T]=Te.useState({}),[C,D]=Te.useState(""),[R,U]=Te.useState(false),[W,I]=Te.useState({});if(!t||!e)return null;let O=Te.useCallback(()=>{k(false),T({}),f("details"),D(""),I({}),r();},[r]),E=Te.useCallback(()=>{a&&Object.keys(y).length>0&&(a(e.id,y),T({}),k(false));},[e.id,y,a]),B=Te.useCallback(()=>{n&&window.confirm("Are you sure you want to delete this card?")&&(n(e.id),O());},[e.id,n,O]),$=Te.useCallback(()=>{u&&C.trim()&&(u(e.id,C.trim()),D(""));},[e.id,C,u]),z=Te.useCallback(async()=>{if(x){U(true);try{let P=await x(e);I(pe=>({...pe,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{U(false);}}},[e,x]),L=Te.useCallback(async()=>{if(b){U(true);try{let P=await b(e);I(pe=>({...pe,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{U(false);}}},[e,b]),re=Te.useCallback(async()=>{if(v){U(true);try{let P=await v(e);I(pe=>({...pe,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{U(false);}}},[e,v]),J={...e,...y},ie=o.filter(P=>J.assignedUserIds?.includes(P.id));return jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:O,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:P=>P.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"}}),w?jsxRuntime.jsx("input",{type:"text",value:y.title??J.title,onChange:P=>T({...y,title:P.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:[w?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:E,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{k(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>k(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:B,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:O,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:()=>f("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:()=>f("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",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("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:()=>f("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:()=>f("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"}),w?jsxRuntime.jsx("textarea",{value:y.description??J.description??"",onChange:P=>T({...y,description:P.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"}),w?jsxRuntime.jsx("select",{multiple:true,value:y.assignedUserIds??J.assignedUserIds??[],onChange:P=>{let pe=Array.from(P.target.selectedOptions,ne=>ne.value);T({...y,assignedUserIds:pe});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:o.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:ie.length>0?ie.map(P=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsx("span",{children:P.name})]},P.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"}),w?jsxRuntime.jsxs("select",{value:y.priority??J.priority??"",onChange:P=>T({...y,priority:P.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(P=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:P},P)):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"}),w?jsxRuntime.jsx("input",{type:"date",value:y.startDate?new Date(y.startDate).toISOString().split("T")[0]:J.startDate?new Date(J.startDate).toISOString().split("T")[0]:"",onChange:P=>T({...y,startDate:P.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"}),w?jsxRuntime.jsx("input",{type:"date",value:y.endDate?new Date(y.endDate).toISOString().split("T")[0]:J.endDate?new Date(J.endDate).toISOString().split("T")[0]:"",onChange:P=>T({...y,endDate:P.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"}),w?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:y.estimatedTime??J.estimatedTime??"",onChange:P=>T({...y,estimatedTime:P.target.value?parseFloat(P.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(P=>{let pe=typeof P=="string"?P:P.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",pe.slice(-4)]},pe)}):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:C,onChange:P=>D(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:$,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:s.length>0?s.map(P=>{let pe=o.find(ne=>ne.id===P.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:[pe&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:pe.color},children:pe.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:pe?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(P.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:P.content})]},P.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(P=>{let pe=o.find(ne=>ne.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.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:pe?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.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(Aa,{cardId:e.id,attachments:i,onUpload:m?P=>m(e.id,P):void 0,onDelete:p,currentUserId:g,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:z,disabled:R||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:L,disabled:R||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:re,disabled:R||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),W.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((P,pe)=>{let ne=o.find(ze=>ze.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ne&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ne.color},children:ne.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ne?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},pe)})]}),W.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((P,pe)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},pe))]}),W.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[W.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(P=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!W.assignees&&!W.subtasks&&!W.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"})]})]})]})]})})})}var wp=["LOW","MEDIUM","HIGH","URGENT"],Cp=["todo","in-progress","review","done"];function Do({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:p,availableColumns:x=[],availableLabels:b=[]}){let[v,g]=Te.useState(e),[h,f]=Te.useState(false),[w,k]=Te.useState([]),[y,T]=Te.useState(false),[C,D]=Te.useState(""),[R,U]=Te.useState(""),[W,I]=Te.useState("all"),[O,E]=Te.useState(false),[B,$]=Te.useState(false),[z,L]=Te.useState(false),[re,J]=Te.useState(false),[ie,P]=Te.useState(false),[pe,ne]=Te.useState(false),ze=Te.useRef(null),Qe=Te.useRef(null),St=Te.useRef(null),ke=Te.useRef(null),bt=Te.useRef(null),te=Te.useRef(null),ce=Te.useRef(null),Ft=Te.useRef(null);Te.useEffect(()=>{e&&!v?g({...e}):e&&v&&e.id!==v.id&&g({...e});},[e,v]),Te.useEffect(()=>{let S=_=>{let ue=_.target;ke.current&&!ke.current.contains(ue)&&E(false),bt.current&&!bt.current.contains(ue)&&$(false),te.current&&!te.current.contains(ue)&&L(false),ce.current&&!ce.current.contains(ue)&&J(false);};if(O||B||z||re)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[O,B,z,re]),Te.useEffect(()=>{if(!t)return;let S=_=>{let ue=_.target,Pe=ue.tagName==="INPUT"||ue.tagName==="TEXTAREA"||ue.isContentEditable;if(_.key==="Escape"){_.preventDefault(),O||B||z||re||ie||pe?(E(false),$(false),L(false),J(false),P(false),ne(false)):Pe||r();return}if(Pe&&_.key!=="Escape")return;let Be=_.metaKey||_.ctrlKey;switch(_.key.toLowerCase()){case "s":_.preventDefault(),E(true);break;case "a":_.preventDefault(),L(true);break;case "p":_.preventDefault(),$(true);break;case "l":_.preventDefault(),J(true);break;case "d":Be||(_.preventDefault(),P(true),setTimeout(()=>Ft.current?.focus(),0));break;case "e":Be||(_.preventDefault(),ne(true));break;case "i":_.preventDefault(),f(true),setTimeout(()=>Qe.current?.focus(),0);break;case "t":_.preventDefault(),T(true);break;case "c":_.preventDefault(),St.current?.focus();break}};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[t,r,O,B,z,re,ie,pe]);let dr=Te.useCallback(S=>{let _=S.currentTarget.textContent?.trim()||"";if(v&&_!==v.title){let ue={...v,title:_};g(ue),a?.(v.id,{title:_});}},[v,a]),gt=Te.useCallback(S=>{S.key==="Enter"&&(S.preventDefault(),S.currentTarget.blur()),S.key==="Escape"&&(S.preventDefault(),S.currentTarget.textContent=v?.title||"",S.currentTarget.blur());},[v]),et=Te.useCallback(()=>{v&&e&&v.description!==e.description&&a?.(v.id,{description:v.description}),f(false);},[v,e,a]),tr=Te.useCallback(S=>{if(v){let _={...v,columnId:S};g(_),a?.(v.id,{columnId:S}),E(false);}},[v,a]),$t=Te.useCallback(S=>{if(v){let _={...v,priority:S};g(_),a?.(v.id,{priority:S}),$(false);}},[v,a]),yr=Te.useCallback(S=>{if(v){let _=v.assignedUserIds||[],ue=_.includes(S)?_.filter(Be=>Be!==S):[..._,S],Pe={...v,assignedUserIds:ue};g(Pe),a?.(v.id,{assignedUserIds:ue});}},[v,a]),Gt=Te.useCallback(S=>{if(v){let _=v.labels||[],ue=_.includes(S)?_.filter(Be=>Be!==S):[..._,S],Pe={...v,labels:ue};g(Pe),a?.(v.id,{labels:ue});}},[v,a]),K=Te.useCallback(S=>{if(v){let _=S.target.value,ue={...v,endDate:_};g(ue),a?.(v.id,{endDate:_}),P(false);}},[v,a]),G=Te.useCallback(S=>{if(v){let _={...v,estimatedTime:parseFloat(S)||0};g(_),a?.(v.id,{estimatedTime:parseFloat(S)||0});}},[v,a]),we=Te.useCallback(()=>{if(C.trim()){let S={id:`subtask-${Date.now()}`,title:C.trim(),completed:false};k([...w,S]),D(""),T(false);}},[C,w]),Ae=Te.useCallback(S=>{k(w.map(_=>_.id===S?{..._,completed:!_.completed}:_));},[w]),de=Te.useCallback(S=>{k(w.filter(_=>_.id!==S));},[w]),ge=Te.useCallback(()=>{R.trim()&&v&&c&&(c(v.id,R.trim()),U(""));},[R,v,c]),he=Te.useCallback(S=>{(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),ge());},[ge]),rr=S=>jsxRuntime.jsx(yp__default.default,{remarkPlugins:[xp__default.default],rehypePlugins:[kp__default.default],components:{a:({node:_,...ue})=>jsxRuntime.jsx("a",{...ue,target:"_blank",rel:"noopener noreferrer"})},children:S}),se=l.filter(S=>W==="comments"?S.type.includes("COMMENT"):W==="history"?!S.type.includes("COMMENT"):true);if(!t||!e)return null;let ye=v||e,j=o.filter(S=>ye.assignedUserIds?.includes(S.id)),Ce=w.filter(S=>S.completed).length;return jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:r,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:S=>S.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:ze,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:dr,onKeyDown:gt,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:r,"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"})]})})]}),ye.coverImage&&jsxRuntime.jsx("div",{className:"modal-v2-cover",children:jsxRuntime.jsx("img",{src:ye.coverImage,alt:`Cover for ${ye.title}`,className:"w-full max-h-96 object-cover",onError:S=>{S.currentTarget.style.display="none";}})}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ke,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>E(!O),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"})]}),O&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(x.length>0?x:Cp.map(S=>({id:S,title:S}))).map(S=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ye.columnId===S.id?"active":""}`,onClick:()=>tr(S.id),children:S.title},S.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:te,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>L(!z),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:j.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:j.map(S=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:S.color},title:S.name,children:S.initials},S.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),z&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:o.map(S=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ye.assignedUserIds?.includes(S.id)?"active":""}`,onClick:()=>yr(S.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:S.color},children:S.initials}),S.name,ye.assignedUserIds?.includes(S.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"})})]},S.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:bt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>$(!B),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"})]}),B&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[wp.map(S=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${S.toLowerCase()} ${ye.priority===S?"active":""}`,onClick:()=>$t(S),children:S},S)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>$t(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ce,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>J(!re),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ye.labels&&ye.labels.length>0?jsxRuntime.jsx("span",{children:ye.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),re&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(S=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ye.labels?.includes(S)?"active":""}`,onClick:()=>Gt(S),children:[S,ye.labels?.includes(S)&&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"})})]},S))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{P(!ie),setTimeout(()=>Ft.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:Ft,type:"date",value:typeof ye.endDate=="string"?ye.endDate.split("T")[0]:ye.endDate?(()=>{let S=new Date(ye.endDate),_=S.getUTCFullYear(),ue=String(S.getUTCMonth()+1).padStart(2,"0"),Pe=String(S.getUTCDate()).padStart(2,"0");return `${_}-${ue}-${Pe}`})():"",onChange:K,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ne(!pe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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"})]}),pe&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ye.estimatedTime||"",onChange:S=>G(S.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ne(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"}),jsxRuntime.jsxs("button",{className:"modal-v2-ai-button",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 Assist"]})]}),h?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ye.description||"",onChange:S=>{if(v){let _={...v,description:S.target.value};g(_);}},onBlur:et,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>f(true),children:ye.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:rr(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"}),w.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Ce,"/",w.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>T(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:[w.map(S=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${S.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ae(S.id),children:S.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:S.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>de(S.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"})]})})]},S.id)),y&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:C,onChange:S=>D(S.target.value),onKeyDown:S=>{S.key==="Enter"&&we(),S.key==="Escape"&&(T(false),D(""));},onBlur:we,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),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 ${W==="all"?"active":""}`,onClick:()=>I("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${W==="comments"?"active":""}`,onClick:()=>I("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${W==="history"?"active":""}`,onClick:()=>I("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:St,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:R,onChange:S=>U(S.target.value),onKeyDown:he,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:!R.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[se.map(S=>{let _=o.find(Pe=>Pe.id===S.userId);if(S.type.includes("COMMENT")){let Pe=s.find(Be=>Be.id===S.metadata?.commentId);return Pe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[_&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:_.color},children:_.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:_?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(S.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Pe.content})]})]},S.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.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:_?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)}),se.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 Mp({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((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," cards"]},a))]})}function Eo({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let o=e.map(s=>({...s,average:s.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:r,children:jsxRuntime.jsxs(recharts.LineChart,{data:o,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(Mp,{})}),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}}),n&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),a&&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((s,l)=>s+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((s,l)=>s+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(s=>s.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((s,l)=>s+(l.planned||0),0)})]})]})]})}function $p({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((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," tasks"]},a))]})}function Ro({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let o=a??(e[0]?.ideal||e[0]?.remaining||0),s=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=o>0?(o-s)/o*100:0,i=s<=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:r,children:jsxRuntime.jsxs(n?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($p,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?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:s})]}),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 Xp={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},dl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Jp({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:o}){let s=a+(n-a)*.5,l=e+s*Math.cos(-r*(Math.PI/180)),c=t+s*Math.sin(-r*(Math.PI/180));return o<.05?null:jsxRuntime.jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(o*100).toFixed(0)}%`})}function ul({active:e,payload:t}){if(!e||!t||!t.length)return null;let r=t[0].payload,a=t[0].payload.totalValue||0,n=a>0?(r.value/a*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:r.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[n,"%"]})]})]})}function Po({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let o=e.reduce((c,i)=>c+i.value,0),s=e.map(c=>({...c,totalValue:o,color:c.color||Xp[c.name]||dl[e.indexOf(c)%dl.length]})),l=s.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:a,children:r==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:s,cx:"50%",cy:"50%",labelLine:false,label:n?Jp:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:s.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ul,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,d=o>0?(u.value/o*100).toFixed(0):"0";return `${c} (${u.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{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:"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(ul,{})}),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:s.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:o})]}),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 kn=Te.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:o=[]})=>{let[s,l]=Te.useState(false),[c,i]=Te.useState(false),[u,d]=Te.useState(false),[m,p]=Te.useState(false);if(e.length===0)return null;let x=e.map(w=>w.id),b=w=>{a.onBulkUpdate?.(x,{priority:w}),l(false);},v=w=>{a.onBulkMove?.(x,w),i(false),r();},g=w=>{a.onBulkUpdate?.(x,{assignedUserIds:w}),d(false);},h=w=>{let k=new Set;e.forEach(T=>{T.labels?.forEach(C=>k.add(C));});let y=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(x,{labels:y}),p(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(x),r());};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(!s),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),s&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(w),children:[jsxRuntime.jsx("span",{className:ae("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.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:n.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(w.id),children:w.title},w.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(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([w.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!m),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});kn.displayName="BulkOperationsToolbar";function rm(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let o,s,l,c,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(p=>{let x=r?.find(b=>b.id===p);s=`assignee-${p}`,l=x?.name||`User ${p}`,c=x?.color,i=x?.avatar,a.has(s)||a.set(s,{id:s,title:l,groupValue:p,cardIds:[],color:c,icon:i}),a.get(s).cardIds.push(n.id);}):(s="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",a.has(s)||a.set(s,{id:s,title:l,groupValue:null,cardIds:[],color:c,icon:i}),a.get(s).cardIds.push(n.id));break;case "priority":o=n.priority||"NONE",s=`priority-${o}`;let m={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[o];l=m.title,c=m.color,a.has(s)||a.set(s,{id:s,title:l,groupValue:o,cardIds:[],color:c}),a.get(s).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(p=>{s=`label-${p}`,l=p,c="#6b7280",a.has(s)||a.set(s,{id:s,title:l,groupValue:p,cardIds:[],color:c}),a.get(s).cardIds.push(n.id);}):(s="label-none",l="No Labels",c="#6b7280",a.has(s)||a.set(s,{id:s,title:l,groupValue:null,cardIds:[],color:c}),a.get(s).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,o)=>n.title.localeCompare(o.title))}function Io({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n}){let[o,s]=Te.useState(new Set),l=Te.useMemo(()=>rm(e.cards,t.groupBy,r),[e.cards,t.groupBy,r]),c=Te.useCallback(i=>{s(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(Tr,{board:e,callbacks:a,availableUsers:r,className:n}):jsxRuntime.jsxs("div",{className:ae("asakaa-swimlane-view",n),children:[l.map(i=>{let u=o.has(i.id),d=e.cards.filter(p=>i.cardIds.includes(p.id)),m={...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(Tr,{board:m,callbacks:a,availableUsers:r})})]},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 Mo=[{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 Ao({value:e,onChange:t,className:r}){let[a,n]=Te.useState(false),o=Te.useRef(null),s=Te.useRef(null),l=Mo.find(i=>i.value===e)||Mo[0];Te.useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{className:ae("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>n(!a),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:ae("w-4 h-4 transition-transform",a&&"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"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,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:Mo.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:ae("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 La=[{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 om(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},o=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,s=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return o&&s&&l&&c}function hl(e={}){let{shortcuts:t=La,enabled:r=true,preventDefault:a=true}=e,n=Te.useRef(t),o=Te.useRef(r);Te.useEffect(()=>{n.current=t,o.current=r;},[t,r]);let s=Te.useCallback(c=>{n.current=[...n.current,c];},[]),l=Te.useCallback(c=>{n.current=n.current.filter(i=>i.action!==c);},[]);return Te.useEffect(()=>{function c(i){if(!o.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 n.current)if(om(i,d)){a&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),{registerShortcut:s,unregisterShortcut:l,isEnabled:r}}function im(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function lm(e){let t=[],r=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(r?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(r?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function cm(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=lm(e),a=t?im(t):"";return r?`${r} + ${a}`:a}function dm(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(r=>{r.action.includes("navigate")?t.Navigation?.push(r):r.action.includes("select")?t.Selection?.push(r):["undo","redo","save"].includes(r.action)?t.Editing?.push(r):t.Actions?.push(r);}),t}function Lo({shortcuts:e=La,isOpen:t,onClose:r,className:a}){let[n,o]=Te.useState(false);if(Te.useEffect(()=>{o(true);},[]),Te.useEffect(()=>{function l(c){c.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,r]),!n||!t)return null;let s=dm(e);return jsxRuntime.jsxs("div",{className:ae("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:r}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(s).map(([l,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),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 bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:cm(i)})]},i.action))})]},l))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Fo=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
1
+ 'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),Te=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'),oc=require('html2canvas'),jsxRuntime=require('react/jsx-runtime'),Li=require('react-dom'),cmdk=require('cmdk'),Rp=require('react-markdown'),Pp=require('remark-gfm'),Ip=require('rehype-sanitize'),recharts=require('recharts'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Te__namespace=/*#__PURE__*/_interopNamespace(Te);var oc__default=/*#__PURE__*/_interopDefault(oc);var Li__namespace=/*#__PURE__*/_interopNamespace(Li);var Rp__default=/*#__PURE__*/_interopDefault(Rp);var Pp__default=/*#__PURE__*/_interopDefault(Pp);var Ip__default=/*#__PURE__*/_interopDefault(Ip);var Ya=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var qa=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return "scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return [qa.Translate.toString(e),qa.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}});function ae(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Xa(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 yd(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function Jn(e,t){return e.length===0?1e3:t===0?Xa(null,e[0].position):t>=e.length?Xa(e[e.length-1].position,null):Xa(e[t-1].position,e[t].position)}function Ys(e,t=100){return e>t}var xd=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 kd(e,t,r,a){let n=t*Math.pow(r,e-1),o=n*.2*Math.random();return Math.min(n+o,a)}async function Ja(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:o=1e4,shouldRetry:i=xd,onRetry:c}=t,l,s=0;for(let u=1;u<=r;u++){s=u;try{return {data:await e(),attempts:s,success:!0}}catch(d){if(l=d,u===r||!i(l,u))return {error:l,attempts:s,success:false};let m=kd(u,a,n,o);if(c)try{c(l,u,m);}catch(x){console.error("Error in retry callback:",x);}await new Promise(x=>setTimeout(x,m));}}return {error:l||new Error("Unknown error"),attempts:s,success:false}}function wd(e,t=3){let r;for(let a=1;a<=t;a++)try{return {data:e(),success:!0}}catch(n){if(r=n,a===t)return {error:r,success:false}}return {error:r||new Error("Unknown error"),success:false}}function Cd(e,t={}){return async(...r)=>Ja(()=>e(...r),t)}var Zn=class{constructor(t=5,r=6e4){this.threshold=t;this.resetTimeout=r;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 r=await t();return this.onSuccess(),r}catch(r){throw this.onFailure(),r}}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 qs=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARN=2]="WARN",o[o.ERROR=3]="ERROR",o[o.NONE=4]="NONE",o))(qs||{}),Br=class Br{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:r,level:a,message:n,component:o,...i}=t,c=`[${r}] [${a}] [${o}]`,l=Object.keys(i).length>0;switch(a){case "DEBUG":console.debug(c,n,l?i:"");break;case "INFO":console.info(c,n,l?i:"");break;case "WARN":console.warn(c,n,l?i:"");break;case "ERROR":console.error(c,n,l?i:""),t.error?.stack&&console.error(t.error.stack);break}};let r=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(r?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Br.globalOptions};}static configure(t){Br.globalOptions={...Br.globalOptions,...t};}child(t){return new Br({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,r){this.log(0,t,r);}info(t,r){this.log(1,t,r);}warn(t,r){this.log(2,t,r);}error(t,r,a){this.log(3,t,{...a,error:r?{message:r.message,stack:r.stack,name:r.name}:void 0});}startTimer(t){return this.options.enableTiming?new Za((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new Za(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:qs[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};Br.globalOptions={};var Qn=Br,Za=class{constructor(t,r){this.onEnd=t;this.enabled=r;this.startTime=r?performance.now():0;}end(t){if(!this.enabled)return 0;let r=Math.round(performance.now()-this.startTime);return this.onEnd(r,t),r}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Xs=new Qn;function Sd(e,t){let r={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(r,null,2)}function Dd(e,t){let r=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],a=e.cards.map(o=>{let i=e.columns.find(c=>c.id===o.columnId);return [o.id,eo(o.title),eo(o.description||""),eo(i?.title||""),o.priority||"",(o.labels||[]).join(";"),(o.assignedUserIds||[]).join(";"),o.startDate||"",o.endDate||"",o.createdAt||"",o.updatedAt||""]});return [r.join(","),...a.map(o=>o.join(","))].join(`
2
+ `)}async function Nd(e,t,r){let a=t;if(!a){let i=document.querySelector(".asakaa-board");i&&(a=i.parentElement||i);}if(a)try{let i=await oc__default.default(a,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:a.scrollWidth,windowHeight:a.scrollHeight}),c=i.toDataURL("image/png"),l=297,s=210,u=i.width/i.height,d=l-20,p=d/u;p>s-20&&(p=s-20,d=p*u);let m=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});m.setFontSize(16),m.setTextColor(255,255,255),m.setFillColor(10,10,10),m.rect(0,0,l,15,"F"),m.text(e.title||"Kanban Board",10,10);let x=(l-d)/2;return m.addImage(c,"PNG",x,20,d,p),m}catch(i){console.error("Error capturing board:",i);}let n=new jspdf.jsPDF,o=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,o),o+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,o),o+=15,n.setTextColor(0,0,0),e.columns.forEach(i=>{let c=e.cards.filter(l=>l.columnId===i.id);o>250&&(n.addPage(),o=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(i.title,20,o),o+=8,c.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,o),n.setTextColor(0,0,0),o+=10):c.forEach(l=>{if(o>260&&(n.addPage(),o=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(l.title,25,o),o+=6,l.description){n.setFontSize(9),n.setFont("helvetica","normal");let u=n.splitTextToSize(l.description,160);n.text(u,25,o),o+=u.length*5;}let s=[];if(l.priority&&s.push(`Priority: ${l.priority}`),l.labels&&l.labels.length>0&&s.push(`Labels: ${l.labels.join(", ")}`),l.assignedUserIds&&l.assignedUserIds.length>0&&s.push(`Assigned: ${l.assignedUserIds.length} user(s)`),l.startDate||l.endDate){let u=[];l.startDate&&u.push(`Start: ${l.startDate}`),l.endDate&&u.push(`End: ${l.endDate}`),s.push(u.join(" \u2192 "));}s.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(s.join(" \u2022 "),25,o),n.setTextColor(0,0,0),o+=5),o+=5;}),o+=5;}),n}function eo(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function Zs(e,t,r,a){switch(t){case "json":return Sd(e,a);case "csv":return Dd(e);case "pdf":return await Nd(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function Qs(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${a}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let o=`${a}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,i={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:i[t]}),l=URL.createObjectURL(c),s=document.createElement("a");s.href=l,s.download=o,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(l);}function Ed(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 r={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:r.cards.length,columnsImported:r.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Rd(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 r=ei(t[0]),a=[],n=new Map,o=[];for(let i=1;i<t.length;i++)try{let c=ei(t[i]||"");if(c.length>r.length){o.push(`Line ${i+1}: Too many columns`);continue}if(r.length-c.length>3){o.push(`Line ${i+1}: Column count mismatch (expected ${r.length}, got ${c.length})`);continue}for(;c.length<r.length;)c.push("");let s={};r.forEach((m,x)=>{s[m]=c[x]||"";});let u=s.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let d=n.get(u),p={id:s["Card ID"]||`card-${i}`,title:s.Title||"Untitled",description:s.Description?s.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:s.Priority||void 0,labels:s.Labels?s.Labels.split(";").filter(Boolean):void 0,assignedUserIds:s["Assigned Users"]?s["Assigned Users"].split(";").filter(Boolean):void 0,startDate:s["Start Date"]?s["Start Date"]:void 0,endDate:s["End Date"]?s["End Date"]:void 0,createdAt:s["Created At"]?s["Created At"]:void 0,updatedAt:s["Updated At"]?s["Updated At"]:void 0};a.push(p),d.cardIds.push(p.id);}catch(c){o.push(`Line ${i+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...o]}:{success:!0,cardsImported:a.length,columnsImported:n.size,errors:o.length>0?o:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function ei(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let o=e[n],i=e[n+1];o==='"'&&a&&i==='"'?(r+='"',n++):o==='"'?a=!a:o===","&&!a?(t.push(r),r=""):r+=o;}return t.push(r),t}function ti(e,t){switch(t){case "json":return Ed(e);case "csv":return Rd(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ri(e){return new Promise((t,r)=>{let a=new FileReader;a.onload=n=>{n.target?.result?t(n.target.result):r(new Error("Failed to read file"));},a.onerror=()=>r(new Error("Failed to read file")),a.readAsText(e);})}function Qa(){return typeof window<"u"}function kr(e){return ro(e)?(e.nodeName||"").toLowerCase():"#document"}function kt(e){var t;return (e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Gt(e){var t;return (t=(ro(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ro(e){return Qa()?e instanceof Node||e instanceof kt(e).Node:false}function pt(e){return Qa()?e instanceof Element||e instanceof kt(e).Element:false}function Ot(e){return Qa()?e instanceof HTMLElement||e instanceof kt(e).HTMLElement:false}function to(e){return !Qa()||typeof ShadowRoot>"u"?false:e instanceof ShadowRoot||e instanceof kt(e).ShadowRoot}var Pd=new Set(["inline","contents"]);function Zr(e){let{overflow:t,overflowX:r,overflowY:a,display:n}=Dt(e);return /auto|scroll|overlay|hidden|clip/.test(t+a+r)&&!Pd.has(n)}var Id=new Set(["table","td","th"]);function ai(e){return Id.has(kr(e))}var Md=[":popover-open",":modal"];function va(e){return Md.some(t=>{try{return e.matches(t)}catch{return false}})}var Ad=["transform","translate","scale","rotate","perspective"],Ld=["transform","translate","scale","rotate","perspective","filter"],Fd=["paint","layout","strict","content"];function en(e){let t=ba(),r=pt(e)?Dt(e):e;return Ad.some(a=>r[a]?r[a]!=="none":false)||(r.containerType?r.containerType!=="normal":false)||!t&&(r.backdropFilter?r.backdropFilter!=="none":false)||!t&&(r.filter?r.filter!=="none":false)||Ld.some(a=>(r.willChange||"").includes(a))||Fd.some(a=>(r.contain||"").includes(a))}function ni(e){let t=ar(e);for(;Ot(t)&&!wr(t);){if(en(t))return t;if(va(t))return null;t=ar(t);}return null}function ba(){return typeof CSS>"u"||!CSS.supports?false:CSS.supports("-webkit-backdrop-filter","none")}var Bd=new Set(["html","body","#document"]);function wr(e){return Bd.has(kr(e))}function Dt(e){return kt(e).getComputedStyle(e)}function ya(e){return pt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ar(e){if(kr(e)==="html")return e;let t=e.assignedSlot||e.parentNode||to(e)&&e.host||Gt(e);return to(t)?t.host:t}function oi(e){let t=ar(e);return wr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ot(t)&&Zr(t)?t:oi(t)}function pr(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=true);let n=oi(e),o=n===((a=e.ownerDocument)==null?void 0:a.body),i=kt(n);if(o){let c=tn(i);return t.concat(i,i.visualViewport||[],Zr(n)?n:[],c&&r?pr(c):[])}return t.concat(n,pr(n,[],r))}function tn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var nr=Math.min,wt=Math.max,ka=Math.round,wa=Math.floor,Ht=e=>({x:e,y:e}),Od={left:"right",right:"left",bottom:"top",top:"bottom"},zd={start:"end",end:"start"};function an(e,t,r){return wt(e,nr(t,r))}function Or(e,t){return typeof e=="function"?e(t):e}function mr(e){return e.split("-")[0]}function zr(e){return e.split("-")[1]}function ao(e){return e==="x"?"y":"x"}function nn(e){return e==="y"?"height":"width"}var $d=new Set(["top","bottom"]);function or(e){return $d.has(mr(e))?"y":"x"}function on(e){return ao(or(e))}function li(e,t,r){r===void 0&&(r=false);let a=zr(e),n=on(e),o=nn(n),i=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=xa(i)),[i,xa(i)]}function ci(e){let t=xa(e);return [rn(e),t,rn(t)]}function rn(e){return e.replace(/start|end/g,t=>zd[t])}var si=["left","right"],ii=["right","left"],_d=["top","bottom"],Ud=["bottom","top"];function Wd(e,t,r){switch(e){case "top":case "bottom":return r?t?ii:si:t?si:ii;case "left":case "right":return t?_d:Ud;default:return []}}function di(e,t,r,a){let n=zr(e),o=Wd(mr(e),r==="start",a);return n&&(o=o.map(i=>i+"-"+n),t&&(o=o.concat(o.map(rn)))),o}function xa(e){return e.replace(/left|right|bottom|top/g,t=>Od[t])}function Gd(e){return {top:0,right:0,bottom:0,left:0,...e}}function no(e){return typeof e!="number"?Gd(e):{top:e,right:e,bottom:e,left:e}}function $r(e){let{x:t,y:r,width:a,height:n}=e;return {width:a,height:n,top:r,left:t,right:t+a,bottom:r+n,x:t,y:r}}var Vd=typeof document<"u",Kd=function(){},Ta=Vd?Te.useLayoutEffect:Kd,jd={...Te__namespace};var Yd=jd.useInsertionEffect,qd=Yd||(e=>e());function ui(e){let t=Te__namespace.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return qd(()=>{t.current=e;}),Te__namespace.useCallback(function(){for(var r=arguments.length,a=new Array(r),n=0;n<r;n++)a[n]=arguments[n];return t.current==null?void 0:t.current(...a)},[])}function pi(e,t,r){let{reference:a,floating:n}=e,o=or(t),i=on(t),c=nn(i),l=mr(t),s=o==="y",u=a.x+a.width/2-n.width/2,d=a.y+a.height/2-n.height/2,p=a[c]/2-n[c]/2,m;switch(l){case "top":m={x:u,y:a.y-n.height};break;case "bottom":m={x:u,y:a.y+a.height};break;case "right":m={x:a.x+a.width,y:d};break;case "left":m={x:a.x-n.width,y:d};break;default:m={x:a.x,y:a.y};}switch(zr(t)){case "start":m[i]-=p*(r&&s?-1:1);break;case "end":m[i]+=p*(r&&s?-1:1);break}return m}var mi=async(e,t,r)=>{let{placement:a="bottom",strategy:n="absolute",middleware:o=[],platform:i}=r,c=o.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t)),s=await i.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:d}=pi(s,a,l),p=a,m={},x=0;for(let b=0;b<c.length;b++){let{name:v,fn:g}=c[b],{x:h,y:f,data:w,reset:k}=await g({x:u,y:d,initialPlacement:a,placement:p,strategy:n,middlewareData:m,rects:s,platform:i,elements:{reference:e,floating:t}});u=h??u,d=f??d,m={...m,[v]:{...m[v],...w}},k&&x<=50&&(x++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(s=k.rects===true?await i.getElementRects({reference:e,floating:t,strategy:n}):k.rects),{x:u,y:d}=pi(s,p,l)),b=-1);}return {x:u,y:d,placement:p,strategy:n,middlewareData:m}};async function sn(e,t){var r;t===void 0&&(t={});let{x:a,y:n,platform:o,rects:i,elements:c,strategy:l}=e,{boundary:s="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=false,padding:m=0}=Or(t,e),x=no(m),v=c[p?d==="floating"?"reference":"floating":d],g=$r(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(v)))==null||r?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:s,rootBoundary:u,strategy:l})),h=d==="floating"?{x:a,y:n,width:i.floating.width,height:i.floating.height}:i.reference,f=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),w=await(o.isElement==null?void 0:o.isElement(f))?await(o.getScale==null?void 0:o.getScale(f))||{x:1,y:1}:{x:1,y:1},k=$r(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:h,offsetParent:f,strategy:l}):h);return {top:(g.top-k.top+x.top)/w.y,bottom:(k.bottom-g.bottom+x.bottom)/w.y,left:(g.left-k.left+x.left)/w.x,right:(k.right-g.right+x.right)/w.x}}var fi=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:a,placement:n,rects:o,platform:i,elements:c,middlewareData:l}=t,{element:s,padding:u=0}=Or(e,t)||{};if(s==null)return {};let d=no(u),p={x:r,y:a},m=on(n),x=nn(m),b=await i.getDimensions(s),v=m==="y",g=v?"top":"left",h=v?"bottom":"right",f=v?"clientHeight":"clientWidth",w=o.reference[x]+o.reference[m]-p[m]-o.floating[x],k=p[m]-o.reference[m],y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s)),T=y?y[f]:0;(!T||!await(i.isElement==null?void 0:i.isElement(y)))&&(T=c.floating[f]||o.floating[x]);let C=w/2-k/2,D=T/2-b[x]/2-1,R=nr(d[g],D),$=nr(d[h],D),_=R,I=T-b[x]-$,O=T/2-b[x]/2+C,E=an(_,O,I),B=!l.arrow&&zr(n)!=null&&O!==E&&o.reference[x]/2-(O<_?R:$)-b[x]/2<0,U=B?O<_?O-_:O-I:0;return {[m]:p[m]+U,data:{[m]:E,centerOffset:O-E-U,...B&&{alignmentOffset:U}},reset:B}}});var gi=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,a;let{placement:n,middlewareData:o,rects:i,initialPlacement:c,platform:l,elements:s}=t,{mainAxis:u=true,crossAxis:d=true,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:b=true,...v}=Or(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return {};let g=mr(n),h=or(c),f=mr(c)===c,w=await(l.isRTL==null?void 0:l.isRTL(s.floating)),k=p||(f||!b?[xa(c)]:ci(c)),y=x!=="none";!p&&y&&k.push(...di(c,b,x,w));let T=[c,...k],C=await sn(t,v),D=[],R=((a=o.flip)==null?void 0:a.overflows)||[];if(u&&D.push(C[g]),d){let O=li(n,i,w);D.push(C[O[0]],C[O[1]]);}if(R=[...R,{placement:n,overflows:D}],!D.every(O=>O<=0)){var $,_;let O=((($=o.flip)==null?void 0:$.index)||0)+1,E=T[O];if(E&&(!(d==="alignment"?h!==or(E):false)||R.every(z=>or(z.placement)===h?z.overflows[0]>0:true)))return {data:{index:O,overflows:R},reset:{placement:E}};let B=(_=R.filter(U=>U.overflows[0]<=0).sort((U,z)=>U.overflows[1]-z.overflows[1])[0])==null?void 0:_.placement;if(!B)switch(m){case "bestFit":{var I;let U=(I=R.filter(z=>{if(y){let L=or(z.placement);return L===h||L==="y"}return true}).map(z=>[z.placement,z.overflows.filter(L=>L>0).reduce((L,re)=>L+re,0)]).sort((z,L)=>z[1]-L[1])[0])==null?void 0:I[0];U&&(B=U);break}case "initialPlacement":B=c;break}if(n!==B)return {reset:{placement:B}}}return {}}}};var Xd=new Set(["left","top"]);async function Jd(e,t){let{placement:r,platform:a,elements:n}=e,o=await(a.isRTL==null?void 0:a.isRTL(n.floating)),i=mr(r),c=zr(r),l=or(r)==="y",s=Xd.has(i)?-1:1,u=o&&l?-1:1,d=Or(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:x}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof x=="number"&&(m=c==="end"?x*-1:x),l?{x:m*u,y:p*s}:{x:p*s,y:m*u}}var hi=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,a;let{x:n,y:o,placement:i,middlewareData:c}=t,l=await Jd(t,e);return i===((r=c.offset)==null?void 0:r.placement)&&(a=c.arrow)!=null&&a.alignmentOffset?{}:{x:n+l.x,y:o+l.y,data:{...l,placement:i}}}}},vi=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:a,placement:n}=t,{mainAxis:o=true,crossAxis:i=false,limiter:c={fn:v=>{let{x:g,y:h}=v;return {x:g,y:h}}},...l}=Or(e,t),s={x:r,y:a},u=await sn(t,l),d=or(mr(n)),p=ao(d),m=s[p],x=s[d];if(o){let v=p==="y"?"top":"left",g=p==="y"?"bottom":"right",h=m+u[v],f=m-u[g];m=an(h,m,f);}if(i){let v=d==="y"?"top":"left",g=d==="y"?"bottom":"right",h=x+u[v],f=x-u[g];x=an(h,x,f);}let b=c.fn({...t,[p]:m,[d]:x});return {...b,data:{x:b.x-r,y:b.y-a,enabled:{[p]:o,[d]:i}}}}}};var bi=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,a;let{placement:n,rects:o,platform:i,elements:c}=t,{apply:l=()=>{},...s}=Or(e,t),u=await sn(t,s),d=mr(n),p=zr(n),m=or(n)==="y",{width:x,height:b}=o.floating,v,g;d==="top"||d==="bottom"?(v=d,g=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(g=d,v=p==="end"?"top":"bottom");let h=b-u.top-u.bottom,f=x-u.left-u.right,w=nr(b-u[v],h),k=nr(x-u[g],f),y=!t.middlewareData.shift,T=w,C=k;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(C=f),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(T=h),y&&!p){let R=wt(u.left,0),$=wt(u.right,0),_=wt(u.top,0),I=wt(u.bottom,0);m?C=x-2*(R!==0||$!==0?R+$:wt(u.left,u.right)):T=b-2*(_!==0||I!==0?_+I:wt(u.top,u.bottom));}await l({...t,availableWidth:C,availableHeight:T});let D=await i.getDimensions(c.floating);return x!==D.width||b!==D.height?{reset:{rects:true}}:{}}}};function wi(e){let t=Dt(e),r=parseFloat(t.width)||0,a=parseFloat(t.height)||0,n=Ot(e),o=n?e.offsetWidth:r,i=n?e.offsetHeight:a,c=ka(r)!==o||ka(a)!==i;return c&&(r=o,a=i),{width:r,height:a,$:c}}function so(e){return pt(e)?e:e.contextElement}function Qr(e){let t=so(e);if(!Ot(t))return Ht(1);let r=t.getBoundingClientRect(),{width:a,height:n,$:o}=wi(t),i=(o?ka(r.width):r.width)/a,c=(o?ka(r.height):r.height)/n;return (!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}var Zd=Ht(0);function Ci(e){let t=kt(e);return !ba()||!t.visualViewport?Zd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Qd(e,t,r){return t===void 0&&(t=false),!r||t&&r!==kt(e)?false:t}function _r(e,t,r,a){t===void 0&&(t=false),r===void 0&&(r=false);let n=e.getBoundingClientRect(),o=so(e),i=Ht(1);t&&(a?pt(a)&&(i=Qr(a)):i=Qr(e));let c=Qd(o,r,a)?Ci(o):Ht(0),l=(n.left+c.x)/i.x,s=(n.top+c.y)/i.y,u=n.width/i.x,d=n.height/i.y;if(o){let p=kt(o),m=a&&pt(a)?kt(a):a,x=p,b=tn(x);for(;b&&a&&m!==x;){let v=Qr(b),g=b.getBoundingClientRect(),h=Dt(b),f=g.left+(b.clientLeft+parseFloat(h.paddingLeft))*v.x,w=g.top+(b.clientTop+parseFloat(h.paddingTop))*v.y;l*=v.x,s*=v.y,u*=v.x,d*=v.y,l+=f,s+=w,x=kt(b),b=tn(x);}}return $r({width:u,height:d,x:l,y:s})}function ln(e,t){let r=ya(e).scrollLeft;return t?t.left+r:_r(Gt(e)).left+r}function Ti(e,t){let r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-ln(e,r),n=r.top+t.scrollTop;return {x:a,y:n}}function eu(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e,o=n==="fixed",i=Gt(a),c=t?va(t.floating):false;if(a===i||c&&o)return r;let l={scrollLeft:0,scrollTop:0},s=Ht(1),u=Ht(0),d=Ot(a);if((d||!d&&!o)&&((kr(a)!=="body"||Zr(i))&&(l=ya(a)),Ot(a))){let m=_r(a);s=Qr(a),u.x=m.x+a.clientLeft,u.y=m.y+a.clientTop;}let p=i&&!d&&!o?Ti(i,l):Ht(0);return {width:r.width*s.x,height:r.height*s.y,x:r.x*s.x-l.scrollLeft*s.x+u.x+p.x,y:r.y*s.y-l.scrollTop*s.y+u.y+p.y}}function tu(e){return Array.from(e.getClientRects())}function ru(e){let t=Gt(e),r=ya(e),a=e.ownerDocument.body,n=wt(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),o=wt(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),i=-r.scrollLeft+ln(e),c=-r.scrollTop;return Dt(a).direction==="rtl"&&(i+=wt(t.clientWidth,a.clientWidth)-n),{width:n,height:o,x:i,y:c}}var yi=25;function au(e,t){let r=kt(e),a=Gt(e),n=r.visualViewport,o=a.clientWidth,i=a.clientHeight,c=0,l=0;if(n){o=n.width,i=n.height;let u=ba();(!u||u&&t==="fixed")&&(c=n.offsetLeft,l=n.offsetTop);}let s=ln(a);if(s<=0){let u=a.ownerDocument,d=u.body,p=getComputedStyle(d),m=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,x=Math.abs(a.clientWidth-d.clientWidth-m);x<=yi&&(o-=x);}else s<=yi&&(o+=s);return {width:o,height:i,x:c,y:l}}var nu=new Set(["absolute","fixed"]);function ou(e,t){let r=_r(e,true,t==="fixed"),a=r.top+e.clientTop,n=r.left+e.clientLeft,o=Ot(e)?Qr(e):Ht(1),i=e.clientWidth*o.x,c=e.clientHeight*o.y,l=n*o.x,s=a*o.y;return {width:i,height:c,x:l,y:s}}function xi(e,t,r){let a;if(t==="viewport")a=au(e,r);else if(t==="document")a=ru(Gt(e));else if(pt(t))a=ou(t,r);else {let n=Ci(e);a={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height};}return $r(a)}function Si(e,t){let r=ar(e);return r===t||!pt(r)||wr(r)?false:Dt(r).position==="fixed"||Si(r,t)}function su(e,t){let r=t.get(e);if(r)return r;let a=pr(e,[],false).filter(c=>pt(c)&&kr(c)!=="body"),n=null,o=Dt(e).position==="fixed",i=o?ar(e):e;for(;pt(i)&&!wr(i);){let c=Dt(i),l=en(i);!l&&c.position==="fixed"&&(n=null),(o?!l&&!n:!l&&c.position==="static"&&!!n&&nu.has(n.position)||Zr(i)&&!l&&Si(e,i))?a=a.filter(u=>u!==i):n=c,i=ar(i);}return t.set(e,a),a}function iu(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e,i=[...r==="clippingAncestors"?va(t)?[]:su(t,this._c):[].concat(r),a],c=i[0],l=i.reduce((s,u)=>{let d=xi(t,u,n);return s.top=wt(d.top,s.top),s.right=nr(d.right,s.right),s.bottom=nr(d.bottom,s.bottom),s.left=wt(d.left,s.left),s},xi(t,c,n));return {width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function lu(e){let{width:t,height:r}=wi(e);return {width:t,height:r}}function cu(e,t,r){let a=Ot(t),n=Gt(t),o=r==="fixed",i=_r(e,true,o,t),c={scrollLeft:0,scrollTop:0},l=Ht(0);function s(){l.x=ln(n);}if(a||!a&&!o)if((kr(t)!=="body"||Zr(n))&&(c=ya(t)),a){let m=_r(t,true,o,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop;}else n&&s();o&&!a&&n&&s();let u=n&&!a&&!o?Ti(n,c):Ht(0),d=i.left+c.scrollLeft-l.x-u.x,p=i.top+c.scrollTop-l.y-u.y;return {x:d,y:p,width:i.width,height:i.height}}function oo(e){return Dt(e).position==="static"}function ki(e,t){if(!Ot(e)||Dt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Gt(e)===r&&(r=r.ownerDocument.body),r}function Di(e,t){let r=kt(e);if(va(e))return r;if(!Ot(e)){let n=ar(e);for(;n&&!wr(n);){if(pt(n)&&!oo(n))return n;n=ar(n);}return r}let a=ki(e,t);for(;a&&ai(a)&&oo(a);)a=ki(a,t);return a&&wr(a)&&oo(a)&&!en(a)?r:a||ni(e)||r}var du=async function(e){let t=this.getOffsetParent||Di,r=this.getDimensions,a=await r(e.floating);return {reference:cu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function uu(e){return Dt(e).direction==="rtl"}var io={convertOffsetParentRelativeRectToViewportRelativeRect:eu,getDocumentElement:Gt,getClippingRect:iu,getOffsetParent:Di,getElementRects:du,getClientRects:tu,getDimensions:lu,getScale:Qr,isElement:pt,isRTL:uu};function Ni(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pu(e,t){let r=null,a,n=Gt(e);function o(){var c;clearTimeout(a),(c=r)==null||c.disconnect(),r=null;}function i(c,l){c===void 0&&(c=false),l===void 0&&(l=1),o();let s=e.getBoundingClientRect(),{left:u,top:d,width:p,height:m}=s;if(c||t(),!p||!m)return;let x=wa(d),b=wa(n.clientWidth-(u+p)),v=wa(n.clientHeight-(d+m)),g=wa(u),f={rootMargin:-x+"px "+-b+"px "+-v+"px "+-g+"px",threshold:wt(0,nr(1,l))||1},w=true;function k(y){let T=y[0].intersectionRatio;if(T!==l){if(!w)return i();T?i(false,T):a=setTimeout(()=>{i(false,1e-7);},1e3);}T===1&&!Ni(s,e.getBoundingClientRect())&&i(),w=false;}try{r=new IntersectionObserver(k,{...f,root:n.ownerDocument});}catch{r=new IntersectionObserver(k,f);}r.observe(e);}return i(true),o}function cn(e,t,r,a){a===void 0&&(a={});let{ancestorScroll:n=true,ancestorResize:o=true,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=false}=a,s=so(e),u=n||o?[...s?pr(s):[],...pr(t)]:[];u.forEach(g=>{n&&g.addEventListener("scroll",r,{passive:true}),o&&g.addEventListener("resize",r);});let d=s&&c?pu(s,r):null,p=-1,m=null;i&&(m=new ResizeObserver(g=>{let[h]=g;h&&h.target===s&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var f;(f=m)==null||f.observe(t);})),r();}),s&&!l&&m.observe(s),m.observe(t));let x,b=l?_r(e):null;l&&v();function v(){let g=_r(e);b&&!Ni(b,g)&&r(),b=g,x=requestAnimationFrame(v);}return r(),()=>{var g;u.forEach(h=>{n&&h.removeEventListener("scroll",r),o&&h.removeEventListener("resize",r);}),d?.(),(g=m)==null||g.disconnect(),m=null,l&&cancelAnimationFrame(x);}}var Ei=hi;var Ri=vi,Pi=gi,Ii=bi;var lo=fi;var dn=(e,t,r)=>{let a=new Map,n={platform:io,...r},o={...n.platform,_c:a};return mi(e,t,{...n,platform:o})};var fu=typeof document<"u",gu=function(){},un=fu?Te.useLayoutEffect:gu;function pn(e,t){if(e===t)return true;if(typeof e!=typeof t)return false;if(typeof e=="function"&&e.toString()===t.toString())return true;let r,a,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return false;for(a=r;a--!==0;)if(!pn(e[a],t[a]))return false;return true}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return false;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(t,n[a]))return false;for(a=r;a--!==0;){let o=n[a];if(!(o==="_owner"&&e.$$typeof)&&!pn(e[o],t[o]))return false}return true}return e!==e&&t!==t}function Fi(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mi(e,t){let r=Fi(e);return Math.round(t*r)/r}function co(e){let t=Te__namespace.useRef(e);return un(()=>{t.current=e;}),t}function Bi(e){e===void 0&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:o,floating:i}={},transform:c=true,whileElementsMounted:l,open:s}=e,[u,d]=Te__namespace.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:false}),[p,m]=Te__namespace.useState(a);pn(p,a)||m(a);let[x,b]=Te__namespace.useState(null),[v,g]=Te__namespace.useState(null),h=Te__namespace.useCallback(z=>{z!==y.current&&(y.current=z,b(z));},[]),f=Te__namespace.useCallback(z=>{z!==T.current&&(T.current=z,g(z));},[]),w=o||x,k=i||v,y=Te__namespace.useRef(null),T=Te__namespace.useRef(null),C=Te__namespace.useRef(u),D=l!=null,R=co(l),$=co(n),_=co(s),I=Te__namespace.useCallback(()=>{if(!y.current||!T.current)return;let z={placement:t,strategy:r,middleware:p};$.current&&(z.platform=$.current),dn(y.current,T.current,z).then(L=>{let re={...L,isPositioned:_.current!==false};O.current&&!pn(C.current,re)&&(C.current=re,Li__namespace.flushSync(()=>{d(re);}));});},[p,t,r,$,_]);un(()=>{s===false&&C.current.isPositioned&&(C.current.isPositioned=false,d(z=>({...z,isPositioned:false})));},[s]);let O=Te__namespace.useRef(false);un(()=>(O.current=true,()=>{O.current=false;}),[]),un(()=>{if(w&&(y.current=w),k&&(T.current=k),w&&k){if(R.current)return R.current(w,k,I);I();}},[w,k,I,R,D]);let E=Te__namespace.useMemo(()=>({reference:y,floating:T,setReference:h,setFloating:f}),[h,f]),B=Te__namespace.useMemo(()=>({reference:w,floating:k}),[w,k]),U=Te__namespace.useMemo(()=>{let z={position:r,left:0,top:0};if(!B.floating)return z;let L=Mi(B.floating,u.x),re=Mi(B.floating,u.y);return c?{...z,transform:"translate("+L+"px, "+re+"px)",...Fi(B.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:L,top:re}},[r,c,B.floating,u.x,u.y]);return Te__namespace.useMemo(()=>({...u,update:I,refs:E,elements:B,floatingStyles:U}),[u,I,E,B,U])}var hu=e=>{function t(r){return {}.hasOwnProperty.call(r,"current")}return {name:"arrow",options:e,fn(r){let{element:a,padding:n}=typeof e=="function"?e(r):e;return a&&t(a)?a.current!=null?lo({element:a.current,padding:n}).fn(r):{}:a?lo({element:a,padding:n}).fn(r):{}}}},mn=(e,t)=>({...Ei(e),options:[e,t]}),uo=(e,t)=>({...Ri(e),options:[e,t]});var po=(e,t)=>({...Pi(e),options:[e,t]}),mo=(e,t)=>({...Ii(e),options:[e,t]});var fo=(e,t)=>({...hu(e),options:[e,t]});function _i(e){let t=Te__namespace.useRef(void 0),r=Te__namespace.useCallback(a=>{let n=e.map(o=>{if(o!=null){if(typeof o=="function"){let i=o,c=i(a);return typeof c=="function"?c:()=>{i(null);}}return o.current=a,()=>{o.current=null;}}});return ()=>{n.forEach(o=>o?.());}},e);return Te__namespace.useMemo(()=>e.every(a=>a==null)?null:a=>{t.current&&(t.current(),t.current=void 0),a!=null&&(t.current=r(a));},e)}var Tu={...Te__namespace},Oi=false,Su=0,zi=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Su++;function Du(){let[e,t]=Te__namespace.useState(()=>Oi?zi():void 0);return Ta(()=>{e==null&&t(zi());},[]),Te__namespace.useEffect(()=>{Oi=true;},[]),e}var Nu=Tu.useId,Ui=Nu||Du,Sa;process.env.NODE_ENV!=="production"&&(Sa=new Set);function Eu(){for(var e,t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];let n="Floating UI: "+r.join(" ");if(!((e=Sa)!=null&&e.has(n))){var o;(o=Sa)==null||o.add(n),console.warn(n);}}function Ru(){for(var e,t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];let n="Floating UI: "+r.join(" ");if(!((e=Sa)!=null&&e.has(n))){var o;(o=Sa)==null||o.add(n),console.error(n);}}var Wi=Te__namespace.forwardRef(function(t,r){let{context:{placement:a,elements:{floating:n},middlewareData:{arrow:o,shift:i}},width:c=14,height:l=7,tipRadius:s=0,strokeWidth:u=0,staticOffset:d,stroke:p,d:m,style:{transform:x,...b}={},...v}=t;process.env.NODE_ENV!=="production"&&(r||Eu("The `ref` prop is required for `FloatingArrow`."));let g=Ui(),[h,f]=Te__namespace.useState(false);if(Ta(()=>{if(!n)return;Dt(n).direction==="rtl"&&f(true);},[n]),!n)return null;let[w,k]=a.split("-"),y=w==="top"||w==="bottom",T=d;(y&&i!=null&&i.x||!y&&i!=null&&i.y)&&(T=null);let C=u*2,D=C/2,R=c/2*(s/-8+1),$=l/2*s/4,_=!!m,I=T&&k==="end"?"bottom":"top",O=T&&k==="end"?"right":"left";T&&h&&(O=k==="end"?"left":"right");let E=o?.x!=null?T||o.x:"",B=o?.y!=null?T||o.y:"",U=m||"M0,0"+(" H"+c)+(" L"+(c-R)+","+(l-$))+(" Q"+c/2+","+l+" "+R+","+(l-$))+" Z",z={top:_?"rotate(180deg)":"",left:_?"rotate(90deg)":"rotate(-90deg)",bottom:_?"":"rotate(180deg)",right:_?"rotate(-90deg)":"rotate(90deg)"}[w];return jsxRuntime.jsxs("svg",{...v,"aria-hidden":true,ref:r,width:_?c:c+C,height:c,viewBox:"0 0 "+c+" "+(l>c?l:c),style:{position:"absolute",pointerEvents:"none",[O]:E,[I]:B,[w]:y||_?"100%":"calc(100% - "+C/2+"px)",transform:[z,x].filter(L=>!!L).join(" "),...b},children:[C>0&&jsxRuntime.jsx("path",{clipPath:"url(#"+g+")",fill:"none",stroke:p,strokeWidth:C+(m?0:1),d:U}),jsxRuntime.jsx("path",{stroke:C&&!m?v.fill:"none",d:U}),jsxRuntime.jsx("clipPath",{id:g,children:jsxRuntime.jsx("rect",{x:-D,y:D*(_?-1:1),width:c+C,height:c})})]})});function Pu(){let e=new Map;return {emit(t,r){var a;(a=e.get(t))==null||a.forEach(n=>n(r));},on(t,r){e.has(t)||e.set(t,new Set),e.get(t).add(r);},off(t,r){var a;(a=e.get(t))==null||a.delete(r);}}}var Iu=Te__namespace.createContext(null),Mu=Te__namespace.createContext(null),Au=()=>{var e;return ((e=Te__namespace.useContext(Iu))==null?void 0:e.id)||null},Lu=()=>Te__namespace.useContext(Mu);function Fu(e){let{open:t=false,onOpenChange:r,elements:a}=e,n=Ui(),o=Te__namespace.useRef({}),[i]=Te__namespace.useState(()=>Pu()),c=Au()!=null;if(process.env.NODE_ENV!=="production"){let m=a.reference;m&&!pt(m)&&Ru("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.");}let[l,s]=Te__namespace.useState(a.reference),u=ui((m,x,b)=>{o.current.openEvent=m?x:void 0,i.emit("openchange",{open:m,event:x,reason:b,nested:c}),r?.(m,x,b);}),d=Te__namespace.useMemo(()=>({setPositionReference:s}),[]),p=Te__namespace.useMemo(()=>({reference:l||a.reference||null,floating:a.floating||null,domReference:a.reference}),[l,a.reference,a.floating]);return Te__namespace.useMemo(()=>({dataRef:o,open:t,onOpenChange:u,elements:p,events:i,floatingId:n,refs:d}),[t,u,p,i,n,d])}function Gi(e){e===void 0&&(e={});let{nodeId:t}=e,r=Fu({...e,elements:{reference:null,floating:null,...e.elements}}),a=e.rootContext||r,n=a.elements,[o,i]=Te__namespace.useState(null),[c,l]=Te__namespace.useState(null),u=n?.domReference||o,d=Te__namespace.useRef(null),p=Lu();Ta(()=>{u&&(d.current=u);},[u]);let m=Bi({...e,elements:{...n,...c&&{reference:c}}}),x=Te__namespace.useCallback(f=>{let w=pt(f)?{getBoundingClientRect:()=>f.getBoundingClientRect(),getClientRects:()=>f.getClientRects(),contextElement:f}:f;l(w),m.refs.setReference(w);},[m.refs]),b=Te__namespace.useCallback(f=>{(pt(f)||f===null)&&(d.current=f,i(f)),(pt(m.refs.reference.current)||m.refs.reference.current===null||f!==null&&!pt(f))&&m.refs.setReference(f);},[m.refs]),v=Te__namespace.useMemo(()=>({...m.refs,setReference:b,setPositionReference:x,domReference:d}),[m.refs,b,x]),g=Te__namespace.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),h=Te__namespace.useMemo(()=>({...m,...a,refs:v,elements:g,nodeId:t}),[m,v,g,t,a]);return Ta(()=>{a.dataRef.current.floatingContext=h;let f=p?.nodesRef.current.find(w=>w.id===t);f&&(f.context=h);}),Te__namespace.useMemo(()=>({...m,context:h,refs:v,elements:g}),[m,v,g,h])}var go=Te.createContext(null);function Hi(){return Te.useContext(go)}function Ke({children:e,container:t}){let[r,a]=Te.useState(false),n=Hi();if(Te.useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:i,themeName:c}=n,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return Li.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),o)}return Li.createPortal(e,o)}function Ki(e,t,r=true){Te.useEffect(()=>{if(!r)return;let a=o=>{(Array.isArray(e)?e:[e]).some(l=>{let s=l.current;if(!s)return false;let u=o.target;return s===u||s.contains(u)})||t(o);},n=setTimeout(()=>{document.addEventListener("mousedown",a),document.addEventListener("touchstart",a);},0);return ()=>{clearTimeout(n),document.removeEventListener("mousedown",a),document.removeEventListener("touchstart",a);}},[e,t,r]);}function Yi({itemCount:e,onSelect:t,onEscape:r,enabled:a=true,loop:n=true,containerRef:o}){let[i,c]=Te.useState(-1);Te.useEffect(()=>{if(!a||i===-1||!o?.current)return;let d=o.current.querySelector(`[data-index="${i}"]`);d&&d.scrollIntoView({block:"nearest",behavior:"smooth"});},[i,a,o]);let l=Te.useCallback(u=>{if(a)switch(u.key){case "ArrowDown":u.preventDefault(),c(d=>d===-1?0:d===e-1?n?0:d:d+1);break;case "ArrowUp":u.preventDefault(),c(d=>d===-1?e-1:d===0?n?e-1:d:d-1);break;case "Enter":case " ":u.preventDefault(),i!==-1&&t&&t(i);break;case "Escape":u.preventDefault(),r&&r();break;case "Home":u.preventDefault(),c(0);break;case "End":u.preventDefault(),c(e-1);break;}},[a,i,e,n,t,r]),s=Te.useCallback(u=>({"data-active":u===i,"data-index":u,role:"option",tabIndex:-1}),[i]);return {activeIndex:i,setActiveIndex:c,handleKeyDown:l,getItemProps:s}}function fr({trigger:e,children:t,isOpen:r,onOpenChange:a,placement:n="bottom-start",offsetDistance:o=8,maxHeight:i=320,minWidth:c="trigger",maxWidth:l,showArrow:s=false,className:u="",triggerClassName:d="",disableClickOutside:p=false,disableKeyboardNav:m=false,itemCount:x=0,onSelectItem:b,onOpen:v,onClose:g,animationDuration:h=200,zIndex:f=1e3}){let[w,k]=Te.useState(false),y=r!==void 0?r:w,T=Te.useCallback(ie=>{let P=y;r===void 0&&k(ie),a?.(ie),ie&&!P?v?.():!ie&&P&&g?.();},[r,a,v,g,y]),C=Te.useCallback(()=>{T(!y);},[y,T]),D=Te.useCallback(()=>{T(false);},[T]),R=Te.useRef(null),$=Te.useRef(null),_=Te.useRef(null),{refs:I,floatingStyles:O,context:E}=Gi({open:y,onOpenChange:T,placement:n,middleware:[mn(o),po({padding:8}),uo({padding:8}),mo({apply({rects:ie,elements:P}){Object.assign(P.floating.style,{minWidth:c==="trigger"?`${ie.reference.width}px`:c?`${c}px`:void 0,maxWidth:l?`${l}px`:void 0,maxHeight:`${i}px`});},padding:8}),s?fo({element:_}):null].filter(Boolean),whileElementsMounted:cn}),B=_i([R,I.setReference]);Ki([R,$],D,y&&!p);let{activeIndex:U,setActiveIndex:z,handleKeyDown:L}=Yi({itemCount:x,onSelect:b,onEscape:D,enabled:y&&!m,loop:true,containerRef:$}),re=()=>typeof e=="function"?e({isOpen:y,toggle:C}):e,J=()=>typeof t=="function"?t({activeIndex:U,setActiveIndex:z,close:D}):t;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:B,className:`dropdown-trigger ${d}`,onClick:C,children:re()}),y&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:I.setFloating,style:{...O,zIndex:f},className:`dropdown-content ${u}`,role:"menu","aria-orientation":"vertical",onKeyDown:L,children:[jsxRuntime.jsx("div",{ref:$,className:"dropdown-inner",children:J()}),s&&jsxRuntime.jsx(Wi,{ref:_,context:E,className:"dropdown-arrow"})]})})]})}var Xi={URGENT:{label:"Urgent",color:"#E74C3C",darkColor:"#ff6b6b"},HIGH:{label:"High",color:"#E67E22",darkColor:"#ffa94d"},MEDIUM:{label:"Normal",color:"#F1C40F",darkColor:"#ffd43b"},LOW:{label:"Low",color:"#2ECC71",darkColor:"#51cf66"}},Ku="#BDC3C7",ju="#868e96",Yu=({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"})]}),Ji=()=>jsxRuntime.jsx("svg",{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:"var(--asakaa-color-interactive-primary, #1976d2)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})});function Na({priority:e,onChange:t,className:r}){let a=e?Xi[e]:null,n=document.documentElement.getAttribute("data-theme")==="dark",o=a?n?a.darkColor:a.color:n?ju:Ku,i=l=>{t(l);},c=Object.entries(Xi);return jsxRuntime.jsx(fr,{trigger:({isOpen:l})=>jsxRuntime.jsx("button",{className:`flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95 ${r||""}`,style:{background:e?`${o}10`:"transparent",boxShadow:e?`0 0 0 2px ${o}30 inset`:"none",transform:l?"scale(1.1)":"scale(1)"},title:a?.label||"Set priority","aria-label":"Select priority","aria-expanded":l,"aria-haspopup":"menu",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:o,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:o,fillOpacity:e?"0.6":"0.4"})})}),placement:"bottom-start",minWidth:180,maxHeight:280,itemCount:c.length+1,onSelectItem:l=>{let s=c[l];i(s?s[0]:void 0);},children:({activeIndex:l,close:s})=>jsxRuntime.jsxs("div",{className:"priority-dropdown",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",children:"Priority"}),jsxRuntime.jsxs("div",{className:"dropdown-section",children:[c.map(([u,d],p)=>{let m=n?d.darkColor:d.color,x=l===p,b=e===u;return jsxRuntime.jsxs("button",{onClick:()=>{i(u),s();},className:"dropdown-item","data-active":x,"data-index":p,role:"option","aria-selected":b,style:{color:x?m:"inherit",fontWeight:b?600:400},children:[jsxRuntime.jsx(Yu,{color:m}),jsxRuntime.jsx("span",{children:d.label}),b&&jsxRuntime.jsx(Ji,{})]},u)}),jsxRuntime.jsx("div",{style:{borderTop:"1px solid var(--asakaa-color-border-default, #e0e0e0)",marginTop:"4px",paddingTop:"4px"},children:jsxRuntime.jsxs("button",{onClick:()=>{i(void 0),s();},className:"dropdown-item","data-active":l===c.length,"data-index":c.length,role:"option","aria-selected":!e,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:"var(--asakaa-color-text-tertiary, #9e9e9e)",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{children:"Clear"}),!e&&jsxRuntime.jsx(Ji,{})]})})]})]})})}var Qi=[{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 Ea({startDate:e,endDate:t,onChange:r,className:a}){let[n,o]=Te.useState(e||""),[i,c]=Te.useState(t||""),l=(x,b)=>{let v=new Date,g=new Date(v);g.setDate(g.getDate()+x);let h=v.toISOString().split("T")[0]||"",f=g.toISOString().split("T")[0]||"";o(h),c(f),r(h,f),b();},s=x=>{r(n||void 0,i||void 0),x();},u=()=>{if(!e||!t)return "Set date";let x=h=>{if(h instanceof Date)return h;if(typeof h!="string"||!h.match(/^\d{4}-\d{2}-\d{2}$/))return null;let f=h.split("-").map(Number);if(f.length!==3||f.some(T=>isNaN(T)))return null;let w=f[0],k=f[1],y=f[2];return w===void 0||k===void 0||y===void 0?null:new Date(w,k-1,y)},b=x(e),v=x(t);if(!b||!v||isNaN(b.getTime())||isNaN(v.getTime()))return "Set date";let g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${g[b.getMonth()]} ${b.getDate()} \u2013 ${g[v.getMonth()]} ${v.getDate()}`},d=e&&t,m=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,b=new Date;return b.setHours(0,0,0,0),x<b})();return jsxRuntime.jsx(fr,{trigger:({isOpen:x})=>jsxRuntime.jsxs("button",{className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${m?"asakaa-date-overdue":"asakaa-date"} ${a||""}`,style:{transform:x?"scale(1.05)":"scale(1)"},title:d?`${u()}`:"Set date range","aria-label":"Select date range","aria-expanded":x,"aria-haspopup":"menu",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:u()})]}),placement:"bottom-start",minWidth:320,maxHeight:480,itemCount:Qi.length,onOpen:()=>{o(e||""),c(t||"");},children:({activeIndex:x,close:b})=>jsxRuntime.jsxs("div",{className:"date-range-picker-dropdown",children:[jsxRuntime.jsxs("div",{className:"dropdown-button-wrapper",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",style:{marginBottom:"12px"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"dropdown-quick-grid",children:Qi.map((v,g)=>jsxRuntime.jsx("button",{onClick:()=>l(v.days,b),className:"dropdown-quick-button","data-active":x===g,"data-index":g,role:"option",children:v.label},v.label))})]}),jsxRuntime.jsxs("div",{className:"dropdown-button-wrapper",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",style:{marginBottom:"12px"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"dropdown-form-actions",children:[jsxRuntime.jsxs("div",{className:"dropdown-form-group",children:[jsxRuntime.jsx("label",{className:"dropdown-label",children:"Start Date"}),jsxRuntime.jsx("input",{type:"date",value:n,onChange:v=>o(v.target.value),className:"dropdown-input"})]}),jsxRuntime.jsxs("div",{className:"dropdown-form-group",children:[jsxRuntime.jsx("label",{className:"dropdown-label",children:"End Date"}),jsxRuntime.jsx("input",{type:"date",value:i,onChange:v=>c(v.target.value),className:"dropdown-input"})]}),jsxRuntime.jsx("button",{onClick:()=>s(b),className:"dropdown-primary-button",children:"Apply"}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{o(""),c(""),r(void 0,void 0),b();},className:"dropdown-danger-button",children:"Clear Dates"})]})]})]})})}function Ur({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[o,i]=Te.useState(""),c=d=>{let p=e.some(m=>m.id===d.id);r(p?e.filter(m=>m.id!==d.id):[...e,d]);},l=t.filter(d=>d.name.toLowerCase().includes(o.toLowerCase())),s=e.slice(0,n),u=e.length-n;return jsxRuntime.jsx(fr,{trigger:({isOpen:d})=>jsxRuntime.jsx("button",{className:`dropdown-avatar-trigger ${a||""}`,style:{transform:d?"scale(1.05)":"scale(1)"},title:e.length>0?`${e.length} assigned`:"Assign users","aria-label":"Assign users","aria-expanded":d,"aria-haspopup":"menu",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[s.map(p=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:p.name,style:{backgroundColor:p.color,color:"#fff"},children:p.avatar?jsxRuntime.jsx("img",{src:p.avatar,alt:p.name,className:"asakaa-avatar-img"}):p.initials},p.id)),u>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar dropdown-avatar-overflow",children:["+",u]})]}):jsxRuntime.jsx("div",{className:"dropdown-avatar-empty-trigger",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"})]})})}),placement:"bottom-start",minWidth:300,maxHeight:350,itemCount:l.length,onSelectItem:d=>{let p=l[d];p&&c(p);},onClose:()=>i(""),children:({activeIndex:d,close:p})=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",children:"Assign Users"}),jsxRuntime.jsx("div",{className:"dropdown-search-wrapper",children:jsxRuntime.jsx("input",{type:"text",value:o,onChange:m=>i(m.target.value),placeholder:"Search users...",className:"dropdown-search-input",autoFocus:true})}),jsxRuntime.jsx("div",{className:"dropdown-list",children:l.length===0?jsxRuntime.jsx("div",{className:"dropdown-empty",children:"No users found"}):l.map((m,x)=>{let b=e.some(v=>v.id===m.id);return jsxRuntime.jsxs("button",{onClick:()=>{c(m);},className:"dropdown-item","data-active":d===x,"data-index":x,role:"option","aria-selected":b,children:[jsxRuntime.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:700,flexShrink:0,backgroundColor:m.color,color:"#fff",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},children:m.avatar?jsxRuntime.jsx("img",{src:m.avatar,alt:m.name,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}):m.initials}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:600},children:m.name}),b&&jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 9L7.5 12.5L14 6",stroke:"var(--asakaa-color-interactive-primary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p();},className:"dropdown-danger-button",children:"Clear All"})})]})})}function Pa({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n}){let[o,i]=Te.useState(""),[c,l]=Te.useState(t.length>0),s=m=>{if(t.includes(m)){let b=t.filter(v=>v!==m);a(b),b.length===0&&l(false);}else a([...t,m]),l(true);},u=()=>{let m=!c;l(m),m||a([]);},d=r.filter(m=>m.id!==e).filter(m=>m.title.toLowerCase().includes(o.toLowerCase())||m.id.toLowerCase().includes(o.toLowerCase())),p=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsx(fr,{trigger:({isOpen:m})=>jsxRuntime.jsxs("button",{className:`flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5 ${n||""}`,style:{transform:m?"scale(1.05)":"scale(1)"},title:t.length>0?`${t.length} dependencies`:"Add dependencies","aria-label":"Select dependencies","aria-expanded":m,"aria-haspopup":"menu",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:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:p},children:t.length})]}),placement:"bottom-start",minWidth:300,maxHeight:350,itemCount:c?d.length:0,onSelectItem:m=>{let x=d[m];x&&s(x.id);},onClose:()=>i(""),onOpen:()=>l(t.length>0),children:({activeIndex:m,close:x})=>jsxRuntime.jsxs("div",{className:"dependencies-dropdown",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",children:"Task Dependencies"}),jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",style:{borderBottom:"1px solid var(--asakaa-color-border-subtle)"},children:jsxRuntime.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},onClick:u,children:[jsxRuntime.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s",border:c?"2px solid var(--asakaa-color-interactive-primary)":"2px solid var(--asakaa-color-border-default)",background:c?"var(--asakaa-color-interactive-primary)":"transparent"},children:c&&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",{style:{fontSize:"13px",fontWeight:600,color:"var(--asakaa-color-text-primary)"},children:"Has dependencies"})]})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"dropdown-search-wrapper",children:jsxRuntime.jsx("input",{type:"text",value:o,onChange:b=>i(b.target.value),placeholder:"Search by name or ID...",className:"dropdown-search-input",autoFocus:true})}),jsxRuntime.jsx("div",{className:"dropdown-list",children:d.length===0?jsxRuntime.jsx("div",{className:"dropdown-empty",children:"No tasks found"}):d.map((b,v)=>{let g=t.includes(b.id);return jsxRuntime.jsxs("button",{onClick:()=>s(b.id),className:"dropdown-item","data-active":m===v,"data-index":v,role:"option","aria-selected":g,children:[jsxRuntime.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginTop:"2px",transition:"all 0.15s",border:g?"2px solid var(--asakaa-color-interactive-primary)":"2px solid var(--asakaa-color-border-default)",background:g?"var(--asakaa-color-interactive-primary)":"transparent"},children:g&&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",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:600,color:"var(--asakaa-color-text-primary)"},children:b.title}),jsxRuntime.jsx("div",{style:{fontSize:"11px",marginTop:"2px",color:"var(--asakaa-color-text-secondary)"},children:b.id})]})]},b.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),l(false),x();},className:"dropdown-danger-button",children:"Clear All Dependencies"})})]})})}var gr=Te.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:o,onUpdate:i,availableUsers:c=[],allCards:l=[]})=>{let{attributes:s,listeners:u,setNodeRef:d,transform:p,transition:m,isDragging:x}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),b={transform:qa.Transform.toString(p),transition:m};if(t)return jsxRuntime.jsx("div",{ref:d,style:b,...s,...u,onClick:()=>r?.(e),children:t(e)});let v=c.filter(g=>e.assignedUserIds?.includes(g.id));return jsxRuntime.jsxs("div",{ref:d,style:b,className:ae("asakaa-card",x&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",o),...s,...u,onClick:g=>{g.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(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:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",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:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Na,{priority:e.priority,onChange:g=>i?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ea,{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:(g,h)=>i?.(e.id,{startDate:g,endDate:h})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ur,{assignedUsers:v,availableUsers:c,onChange:g=>i?.(e.id,{assignedUserIds:g.map(h=>h.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Pa,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:l,onChange:g=>i?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))})]})},(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.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));gr.displayName="Card";function rl({columnTitle:e,onRename:t,className:r}){let[a,n]=Te.useState(false),[o,i]=Te.useState(false),[c,l]=Te.useState(e),[s,u]=Te.useState({top:0,left:0}),d=Te.useRef(null),p=Te.useRef(null),m=Te.useRef(null);Te.useEffect(()=>{if(a&&p.current){let g=p.current.getBoundingClientRect();u({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[a]),Te.useEffect(()=>{let g=h=>{d.current&&!d.current.contains(h.target)&&!p.current?.contains(h.target)&&(n(false),i(false));};if(a)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[a]),Te.useEffect(()=>{let g=h=>{h.key==="Escape"&&(n(false),i(false),l(e));};if(a)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[a,e]),Te.useEffect(()=>{o&&m.current&&(m.current.focus(),m.current.select());},[o]);let x=()=>{i(true),l(e);},b=()=>{let g=c.trim();g&&g!==e&&t(g),i(false),n(false),l(e);},v=g=>{g.key==="Enter"?b():g.key==="Escape"&&(i(false),l(e));};return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>n(!a),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"})]})}),a&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{ref:d,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${s.top}px`,left:`${s.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:o?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:m,type:"text",value:c,onChange:g=>l(g.target.value),onKeyDown:v,onBlur:b,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.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:x,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"})]})})})})]})}var ta=Te.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:o,onCardClick:i,onCardUpdate:c,availableUsers:l,allCards:s,enableVirtualization:u,cardHeight:d=120,isCollapsed:p,onToggleCollapse:m,onColumnRename:x,className:b})=>{let{setNodeRef:v,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),h=Te.useRef(null),f=u??Ys(t.length),w=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>h.current,estimateSize:()=>d,enabled:f});if(r)return jsxRuntime.jsx("div",{ref:v,className:b,children:r(e,t)});let y=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let D=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:D}:D>=80?{state:"warning",percentage:D}:D>=60?{state:"approaching",percentage:D}:{state:"ok",percentage:D}})(),T=y.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:v,className:ae("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",T&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(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:ae(C()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&y.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${y.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[y.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"})]}),y.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"})]}),y.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"})}),y.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),x&&jsxRuntime.jsx(rl,{columnTitle:e.title,onRename:D=>x(e.id,D)}),m&&jsxRuntime.jsx("button",{onClick:m,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:h,className:"asakaa-column-cards",style:{maxHeight:f?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(D=>D.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?o?o(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):f?jsxRuntime.jsx("div",{style:{height:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(D=>{let R=t[D.index];return R?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${D.start}px)`},children:jsxRuntime.jsx(gr,{card:R,render:a,onClick:i,onUpdate:c,availableUsers:l,allCards:s})},R.id):null})}):t.map(D=>jsxRuntime.jsx(gr,{card:D,render:a,onClick:i,onUpdate:c,availableUsers:l,allCards:s},D.id))})})]})});ta.displayName="Column";function yo({title:e,onSave:t,className:r}){let[a,n]=Te.useState(false),[o,i]=Te.useState(e),c=Te.useRef(null);Te.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.select());},[a]);let l=()=>{let u=o.trim();u&&u!==e?t(u):i(e),n(false);},s=u=>{u.key==="Enter"?l():u.key==="Escape"&&(i(e),n(false));};return a?jsxRuntime.jsx("input",{ref:c,type:"text",value:o,onChange:u=>i(u.target.value),onBlur:l,onKeyDown:s,className:ae("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",r),maxLength:50}):jsxRuntime.jsx("h2",{className:ae("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function ko(){let[e,t]=Te.useState(()=>core.dragStore.getState());Te.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let r=Te.useCallback(a=>{core.dragStore.setState(a);},[]);return [e,r]}function Sr({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:o=[],className:i,style:c,isLoading:l,error:s,children:u}){let[d,p]=ko(),m=Te.useCallback((k,y)=>{t.onCardUpdate?.(k,y);},[t]),x=Te.useCallback((k,y)=>{t.onColumnUpdate?.(k,{title:y});},[t]),b=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),v=Te.useMemo(()=>{let k=new Map;return e.columns.forEach(y=>{let T=y.cardIds.map(C=>e.cards.find(D=>D.id===C)).filter(C=>C!==void 0).sort((C,D)=>C.position-D.position);k.set(y.id,T);}),k},[e.cards,e.columns]),g=Te.useCallback(k=>{let{active:y}=k,T=e.cards.find(C=>C.id===y.id);T&&p({isDragging:true,draggedCardId:T.id,sourceColumnId:T.columnId,targetColumnId:T.columnId});},[e.cards,p]),h=Te.useCallback(k=>{let{active:y,over:T}=k;if(!T||!e.cards.find(R=>R.id===y.id))return;let D=null;T.data.current?.type==="column"?D=T.id:T.data.current?.type==="card"&&(D=e.cards.find($=>$.id===T.id)?.columnId||null),D&&D!==d.targetColumnId&&p({...d,targetColumnId:D});},[e.cards,d,p]),f=Te.useCallback(async k=>{let{active:y,over:T}=k;if(p({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!T)return;let C=e.cards.find(_=>_.id===y.id);if(!C)return;let D,R;if(T.data.current?.type==="column"){D=T.id;let _=v.get(D)||[];R=Jn(_,0);}else {let _=e.cards.find(E=>E.id===T.id);if(!_)return;D=_.columnId;let I=v.get(D)||[],O=I.findIndex(E=>E.id===T.id);R=Jn(I,O);}let $=e.columns.find(_=>_.id===D);if($&&$.wipLimit&&$.wipLimitType==="hard"){let _=v.get(D)||[];if(C.columnId!==D&&_.length>=$.wipLimit){t.onWipLimitExceeded?.($,C);return}}(C.columnId!==D||C.position!==R)&&await t.onCardMove?.(C.id,D,R);},[e.cards,e.columns,v,t,p]),w=Te.useCallback(k=>{r?.(k);},[r]);return l?jsxRuntime.jsx("div",{className:ae("asakaa-board",i),style:c,children:jsxRuntime.jsx(bp,{columnCount:3})}):s?jsxRuntime.jsx("div",{className:ae("asakaa-board",i),style:c,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 s=="string"?s:s.message})]})})}):jsxRuntime.jsxs(core$1.DndContext,{sensors:b,collisionDetection:core$1.closestCorners,onDragStart:g,onDragOver:h,onDragEnd:f,children:[jsxRuntime.jsxs("div",{className:ae("asakaa-board",i),style:c,children:[e.columns.sort((k,y)=>k.position-y.position).map(k=>{let y=v.get(k.id)||[];return jsxRuntime.jsx(ta,{column:k,cards:y,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,onCardClick:w,onCardUpdate:m,onColumnRename:x,availableUsers:o,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight},k.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:d.draggedCardId?jsxRuntime.jsx(gr,{card:e.cards.find(k=>k.id===d.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})}function bp({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,r)=>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"})]})]},r))})}var Ma=class extends core.BaseViewAdapter{constructor(r={}){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=r,this.options={animations:r.viewOptions?.animations??true,virtualScrolling:r.viewOptions?.virtualScrolling??false,theme:r.viewOptions?.theme??"dark",readonly:r.viewOptions?.readonly??false};}mount(r,a){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=r,this.data=a,this.root=client.createRoot(r),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(r){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=r,this.render(),this.emit("view:updated",{viewId:this.id,data:r});}configure(r){this.options={...this.options,...r},this.isMounted()&&this.render();}async export(r){if(!this.data)throw new Error("No data to export");switch(r){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: ${r}`)}}render(){if(!this.root||!this.data)return;let r={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(Sr,{board:r,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 r=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(a=>{let n=this.data.columns.find(o=>o.id===a.columnId);r.push([a.id,a.title,n?.title||"",a.description||"",a.labels?.join(", ")||"",a.assignedUserIds?.join(", ")||a.assigneeId||"",a.dueDate?.toString()||"",a.position.toString()]);}),r.map(a=>a.map(n=>`"${n}"`).join(",")).join(`
5
+ `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let a=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,o)=>{a.toBlob(i=>{i?n(i):o(new Error("Failed to create PNG blob"));},"image/png");})}};function sl(e={}){return new Ma(e)}var aa=class extends Te.Component{constructor(r){super(r);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,a){let{onError:n,componentName:o}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${o||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(i){console.error("Error in error handler:",i);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:o,componentName:i}=this.props;return r&&a?o?o(a,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:i?`Error in ${i}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:a.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:a.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"})]})]})}):n}};function wo(e,t){let r=a=>jsxRuntime.jsx(aa,{...t,children:jsxRuntime.jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function To({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:o,onGeneratePlan:i,onPredictRisks:c,onOpenAIUsage:l,shortcut:s="k",className:u=""}){let[d,p]=Te.useState(false),[m,x]=Te.useState(""),[b,v]=Te.useState("home"),[g,h]=Te.useState(""),[f,w]=Te.useState("");Te.useEffect(()=>{let C=D=>{(D.metaKey||D.ctrlKey)&&D.key===s&&(D.preventDefault(),p(R=>!R)),D.key==="Escape"&&(p(false),v("home"),x(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[s]),Te.useEffect(()=>{d||(v("home"),x(""),h(""),w(""));},[d]);let k=Te.useCallback(()=>{p(false);},[]),y=Te.useCallback(C=>{let[D,R]=C.split(":");switch(D){case "create-card":v("create-card");break;case "create-card-in":h(R||"");break;case "navigate":R?(r?.(R),k()):v("navigate");break;case "search":a?.(m),k();break;case "priority":v("priority");break;case "set-priority":f&&R&&(n?.(f,R),k());break;case "assign":v("assign");break;case "assign-user":f&&R&&(o?.(f,R),k());break;case "ai":v("ai");break;case "ai-generate-plan":i?.(),k();break;case "ai-predict-risks":c?.(),k();break;case "ai-usage":l?.(),k();break;case "back":v("home");break;}},[m,f,t,r,a,n,o,i,c,l,k]),T=Te.useCallback(()=>{g&&m.trim()&&(t?.(g,m.trim()),k());},[g,m,t,k]);return d?jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:m,onValueChange:x,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:b==="create-card"&&g?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&b==="create-card"&&g&&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."}),b==="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:y,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:y,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:y,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:y,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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:D},D))})]},C.id))})]}),b==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.id}`,onSelect:y,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:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),b==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,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(C=>{let D=e.columns.find(R=>R.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:y,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:D?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},C.id)})})]}),b==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,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:y,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:y,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:y,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 Sp(e){if(e===0)return "0 Bytes";let t=1024,r=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,a)*100)/100+" "+r[a]}function Dp(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 Np(e){return e.startsWith("image/")}function La({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:o=10}){let[i,c]=Te.useState(false),[l,s]=Te.useState(false),[u,d]=Te.useState(null),p=Te.useRef(null),m=Te.useCallback(y=>{let T=[],C=[];return e.length+y.length>o?(C.push(`Maximum ${o} files allowed`),{valid:T,errors:C}):(y.forEach(D=>{if(D.size/1048576>a){C.push(`${D.name} is too large (max ${a}MB)`);return}if(n&&!n.some($=>D.type.match($))){C.push(`${D.name} has invalid file type`);return}T.push(D);}),{valid:T,errors:C})},[e.length,o,a,n]),x=Te.useCallback(async y=>{let{valid:T,errors:C}=m(y);if(C.length>0){d(C.join(", ")),setTimeout(()=>d(null),5e3);return}if(T.length!==0){s(true),d(null);try{await t?.(T);}catch(D){d(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{s(false);}}},[m,t]),b=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(true);},[]),v=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(false);},[]),g=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation();},[]),h=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(false);let T=Array.from(y.dataTransfer.files);x(T);},[x]),f=Te.useCallback(y=>{let T=y.target.files?Array.from(y.target.files):[];x(T),p.current&&(p.current.value="");},[x]),w=Te.useCallback(()=>{p.current?.click();},[]),k=Te.useCallback(y=>{confirm("Are you sure you want to delete this attachment?")&&r?.(y);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${i?"dragging":""} ${l?"uploading":""}`,onDragEnter:b,onDragLeave:v,onDragOver:g,onDrop:h,onClick:w,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:f,style:{display:"none"},accept:n?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:l?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:i?"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 ",a,"MB \u2022 ",e.length,"/",o," 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(y=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Np(y.type)&&y.url?jsxRuntime.jsx("img",{src:y.thumbnailUrl||y.url,alt:y.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Dp(y.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:y.name,children:y.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Sp(y.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(y.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(y.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"})})})]},y.id))})]})}function Do({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:i=[],activities:c=[],aiInsights:l=[],attachments:s=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:m,onSuggestAssignee:x,onGenerateSubtasks:b,onEstimateEffort:v,currentUserId:g="user-1"}){let[h,f]=Te.useState("details"),[w,k]=Te.useState(false),[y,T]=Te.useState({}),[C,D]=Te.useState(""),[R,$]=Te.useState(false),[_,I]=Te.useState({});if(!t||!e)return null;let O=Te.useCallback(()=>{k(false),T({}),f("details"),D(""),I({}),r();},[r]),E=Te.useCallback(()=>{a&&Object.keys(y).length>0&&(a(e.id,y),T({}),k(false));},[e.id,y,a]),B=Te.useCallback(()=>{n&&window.confirm("Are you sure you want to delete this card?")&&(n(e.id),O());},[e.id,n,O]),U=Te.useCallback(()=>{u&&C.trim()&&(u(e.id,C.trim()),D(""));},[e.id,C,u]),z=Te.useCallback(async()=>{if(x){$(true);try{let P=await x(e);I(pe=>({...pe,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{$(false);}}},[e,x]),L=Te.useCallback(async()=>{if(b){$(true);try{let P=await b(e);I(pe=>({...pe,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{$(false);}}},[e,b]),re=Te.useCallback(async()=>{if(v){$(true);try{let P=await v(e);I(pe=>({...pe,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{$(false);}}},[e,v]),J={...e,...y},ie=o.filter(P=>J.assignedUserIds?.includes(P.id));return jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:O,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:P=>P.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"}}),w?jsxRuntime.jsx("input",{type:"text",value:y.title??J.title,onChange:P=>T({...y,title:P.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:[w?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:E,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{k(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>k(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:B,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:O,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:()=>f("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:()=>f("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",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("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",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("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"}),w?jsxRuntime.jsx("textarea",{value:y.description??J.description??"",onChange:P=>T({...y,description:P.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"}),w?jsxRuntime.jsx("select",{multiple:true,value:y.assignedUserIds??J.assignedUserIds??[],onChange:P=>{let pe=Array.from(P.target.selectedOptions,ne=>ne.value);T({...y,assignedUserIds:pe});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:o.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:ie.length>0?ie.map(P=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsx("span",{children:P.name})]},P.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"}),w?jsxRuntime.jsxs("select",{value:y.priority??J.priority??"",onChange:P=>T({...y,priority:P.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(P=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:P},P)):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"}),w?jsxRuntime.jsx("input",{type:"date",value:y.startDate?new Date(y.startDate).toISOString().split("T")[0]:J.startDate?new Date(J.startDate).toISOString().split("T")[0]:"",onChange:P=>T({...y,startDate:P.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"}),w?jsxRuntime.jsx("input",{type:"date",value:y.endDate?new Date(y.endDate).toISOString().split("T")[0]:J.endDate?new Date(J.endDate).toISOString().split("T")[0]:"",onChange:P=>T({...y,endDate:P.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"}),w?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:y.estimatedTime??J.estimatedTime??"",onChange:P=>T({...y,estimatedTime:P.target.value?parseFloat(P.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(P=>{let pe=typeof P=="string"?P:P.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",pe.slice(-4)]},pe)}):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:C,onChange:P=>D(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:U,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:i.length>0?i.map(P=>{let pe=o.find(ne=>ne.id===P.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:[pe&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:pe.color},children:pe.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:pe?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(P.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:P.content})]},P.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(P=>{let pe=o.find(ne=>ne.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.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:pe?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.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(La,{cardId:e.id,attachments:s,onUpload:p?P=>p(e.id,P):void 0,onDelete:m,currentUserId:g,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:z,disabled:R||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:L,disabled:R||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:re,disabled:R||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),_.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),_.assignees.map((P,pe)=>{let ne=o.find(ze=>ze.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ne&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ne.color},children:ne.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ne?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},pe)})]}),_.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),_.subtasks.map((P,pe)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},pe))]}),_.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[_.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(_.effort.confidence*100).toFixed(0),"%"]})]})]}),l.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),l.map(P=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!_.assignees&&!_.subtasks&&!_.effort&&l.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"})]})]})]})]})})})}var Mp=["LOW","MEDIUM","HIGH","URGENT"],Ap=["todo","in-progress","review","done"];function Eo({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:i=[],activities:c=[],onAddComment:l,onDeleteComment:s,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:m,availableColumns:x=[],availableLabels:b=[]}){let[v,g]=Te.useState(e),[h,f]=Te.useState(false),[w,k]=Te.useState([]),[y,T]=Te.useState(false),[C,D]=Te.useState(""),[R,$]=Te.useState(""),[_,I]=Te.useState("all"),[O,E]=Te.useState(false),[B,U]=Te.useState(false),[z,L]=Te.useState(false),[re,J]=Te.useState(false),[ie,P]=Te.useState(false),[pe,ne]=Te.useState(false),ze=Te.useRef(null),Qe=Te.useRef(null),St=Te.useRef(null),ke=Te.useRef(null),bt=Te.useRef(null),te=Te.useRef(null),ce=Te.useRef(null),Ft=Te.useRef(null);Te.useEffect(()=>{e&&!v?g({...e}):e&&v&&e.id!==v.id&&g({...e});},[e,v]),Te.useEffect(()=>{let S=H=>{let ue=H.target;ke.current&&!ke.current.contains(ue)&&E(false),bt.current&&!bt.current.contains(ue)&&U(false),te.current&&!te.current.contains(ue)&&L(false),ce.current&&!ce.current.contains(ue)&&J(false);};if(O||B||z||re)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[O,B,z,re]),Te.useEffect(()=>{if(!t)return;let S=H=>{let ue=H.target,Pe=ue.tagName==="INPUT"||ue.tagName==="TEXTAREA"||ue.isContentEditable;if(H.key==="Escape"){H.preventDefault(),O||B||z||re||ie||pe?(E(false),U(false),L(false),J(false),P(false),ne(false)):Pe||r();return}if(Pe&&H.key!=="Escape")return;let Be=H.metaKey||H.ctrlKey;switch(H.key.toLowerCase()){case "s":H.preventDefault(),E(true);break;case "a":H.preventDefault(),L(true);break;case "p":H.preventDefault(),U(true);break;case "l":H.preventDefault(),J(true);break;case "d":Be||(H.preventDefault(),P(true),setTimeout(()=>Ft.current?.focus(),0));break;case "e":Be||(H.preventDefault(),ne(true));break;case "i":H.preventDefault(),f(true),setTimeout(()=>Qe.current?.focus(),0);break;case "t":H.preventDefault(),T(true);break;case "c":H.preventDefault(),St.current?.focus();break}};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[t,r,O,B,z,re,ie,pe]);let dr=Te.useCallback(S=>{let H=S.currentTarget.textContent?.trim()||"";if(v&&H!==v.title){let ue={...v,title:H};g(ue),a?.(v.id,{title:H});}},[v,a]),gt=Te.useCallback(S=>{S.key==="Enter"&&(S.preventDefault(),S.currentTarget.blur()),S.key==="Escape"&&(S.preventDefault(),S.currentTarget.textContent=v?.title||"",S.currentTarget.blur());},[v]),et=Te.useCallback(()=>{v&&e&&v.description!==e.description&&a?.(v.id,{description:v.description}),f(false);},[v,e,a]),tr=Te.useCallback(S=>{if(v){let H={...v,columnId:S};g(H),a?.(v.id,{columnId:S}),E(false);}},[v,a]),Ut=Te.useCallback(S=>{if(v){let H={...v,priority:S};g(H),a?.(v.id,{priority:S}),U(false);}},[v,a]),xr=Te.useCallback(S=>{if(v){let H=v.assignedUserIds||[],ue=H.includes(S)?H.filter(Be=>Be!==S):[...H,S],Pe={...v,assignedUserIds:ue};g(Pe),a?.(v.id,{assignedUserIds:ue});}},[v,a]),Wt=Te.useCallback(S=>{if(v){let H=v.labels||[],ue=H.includes(S)?H.filter(Be=>Be!==S):[...H,S],Pe={...v,labels:ue};g(Pe),a?.(v.id,{labels:ue});}},[v,a]),K=Te.useCallback(S=>{if(v){let H=S.target.value,ue={...v,endDate:H};g(ue),a?.(v.id,{endDate:H}),P(false);}},[v,a]),W=Te.useCallback(S=>{if(v){let H={...v,estimatedTime:parseFloat(S)||0};g(H),a?.(v.id,{estimatedTime:parseFloat(S)||0});}},[v,a]),we=Te.useCallback(()=>{if(C.trim()){let S={id:`subtask-${Date.now()}`,title:C.trim(),completed:false};k([...w,S]),D(""),T(false);}},[C,w]),Ae=Te.useCallback(S=>{k(w.map(H=>H.id===S?{...H,completed:!H.completed}:H));},[w]),de=Te.useCallback(S=>{k(w.filter(H=>H.id!==S));},[w]),ge=Te.useCallback(()=>{R.trim()&&v&&l&&(l(v.id,R.trim()),$(""));},[R,v,l]),he=Te.useCallback(S=>{(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),ge());},[ge]),rr=S=>jsxRuntime.jsx(Rp__default.default,{remarkPlugins:[Pp__default.default],rehypePlugins:[Ip__default.default],components:{a:({node:H,...ue})=>jsxRuntime.jsx("a",{...ue,target:"_blank",rel:"noopener noreferrer"})},children:S}),se=c.filter(S=>_==="comments"?S.type.includes("COMMENT"):_==="history"?!S.type.includes("COMMENT"):true);if(!t||!e)return null;let ye=v||e,j=o.filter(S=>ye.assignedUserIds?.includes(S.id)),Ce=w.filter(S=>S.completed).length;return jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:r,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:S=>S.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:ze,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:dr,onKeyDown:gt,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:r,"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"})]})})]}),ye.coverImage&&jsxRuntime.jsx("div",{className:"modal-v2-cover",children:jsxRuntime.jsx("img",{src:ye.coverImage,alt:`Cover for ${ye.title}`,className:"w-full max-h-96 object-cover",onError:S=>{S.currentTarget.style.display="none";}})}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ke,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>E(!O),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"})]}),O&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(x.length>0?x:Ap.map(S=>({id:S,title:S}))).map(S=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ye.columnId===S.id?"active":""}`,onClick:()=>tr(S.id),children:S.title},S.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:te,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>L(!z),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:j.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:j.map(S=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:S.color},title:S.name,children:S.initials},S.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),z&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:o.map(S=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ye.assignedUserIds?.includes(S.id)?"active":""}`,onClick:()=>xr(S.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:S.color},children:S.initials}),S.name,ye.assignedUserIds?.includes(S.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"})})]},S.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:bt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>U(!B),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"})]}),B&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[Mp.map(S=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${S.toLowerCase()} ${ye.priority===S?"active":""}`,onClick:()=>Ut(S),children:S},S)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ut(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ce,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>J(!re),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ye.labels&&ye.labels.length>0?jsxRuntime.jsx("span",{children:ye.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),re&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(S=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ye.labels?.includes(S)?"active":""}`,onClick:()=>Wt(S),children:[S,ye.labels?.includes(S)&&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"})})]},S))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{P(!ie),setTimeout(()=>Ft.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:Ft,type:"date",value:typeof ye.endDate=="string"?ye.endDate.split("T")[0]:ye.endDate?(()=>{let S=new Date(ye.endDate),H=S.getUTCFullYear(),ue=String(S.getUTCMonth()+1).padStart(2,"0"),Pe=String(S.getUTCDate()).padStart(2,"0");return `${H}-${ue}-${Pe}`})():"",onChange:K,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ne(!pe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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"})]}),pe&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ye.estimatedTime||"",onChange:S=>W(S.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ne(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"}),jsxRuntime.jsxs("button",{className:"modal-v2-ai-button",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 Assist"]})]}),h?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ye.description||"",onChange:S=>{if(v){let H={...v,description:S.target.value};g(H);}},onBlur:et,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>f(true),children:ye.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:rr(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"}),w.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Ce,"/",w.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>T(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:[w.map(S=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${S.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ae(S.id),children:S.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:S.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>de(S.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"})]})})]},S.id)),y&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:C,onChange:S=>D(S.target.value),onKeyDown:S=>{S.key==="Enter"&&we(),S.key==="Escape"&&(T(false),D(""));},onBlur:we,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),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 ${_==="all"?"active":""}`,onClick:()=>I("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${_==="comments"?"active":""}`,onClick:()=>I("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${_==="history"?"active":""}`,onClick:()=>I("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:St,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:R,onChange:S=>$(S.target.value),onKeyDown:he,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:!R.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[se.map(S=>{let H=o.find(Pe=>Pe.id===S.userId);if(S.type.includes("COMMENT")){let Pe=i.find(Be=>Be.id===S.metadata?.commentId);return Pe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[H&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:H.color},children:H.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:H?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(S.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Pe.content})]})]},S.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.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:H?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)}),se.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 Wp({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((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," cards"]},a))]})}function Po({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let o=e.map(i=>({...i,average:i.average??e.reduce((c,l)=>c+l.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:r,children:jsxRuntime.jsxs(recharts.LineChart,{data:o,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(Wp,{})}),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}}),n&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),a&&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((i,c)=>i+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((i,c)=>i+c.completed,0)/e.length).toFixed(1)})]}),n&&e.some(i=>i.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((i,c)=>i+(c.planned||0),0)})]})]})]})}function Jp({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((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," tasks"]},a))]})}function Io({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let o=a??(e[0]?.ideal||e[0]?.remaining||0),i=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,l=o>0?(o-i)/o*100:0,s=i<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(n?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(Jp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?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:s?"#10B981":"#EF4444",fill:s?"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:s?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:s?"#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:l>=50?"#10B981":"#F59E0B"},children:[l.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:s?"#10B981":"#EF4444"},children:i})]}),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:s?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:s?"#10B981":"#EF4444"},children:s?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var sm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},gl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function im({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:o}){let i=a+(n-a)*.5,c=e+i*Math.cos(-r*(Math.PI/180)),l=t+i*Math.sin(-r*(Math.PI/180));return o<.05?null:jsxRuntime.jsx("text",{x:c,y:l,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(o*100).toFixed(0)}%`})}function hl({active:e,payload:t}){if(!e||!t||!t.length)return null;let r=t[0].payload,a=t[0].payload.totalValue||0,n=a>0?(r.value/a*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:r.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[n,"%"]})]})]})}function Mo({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let o=e.reduce((l,s)=>l+s.value,0),i=e.map(l=>({...l,totalValue:o,color:l.color||sm[l.name]||gl[e.indexOf(l)%gl.length]})),c=i.map(l=>l.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:a,children:r==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:i,cx:"50%",cy:"50%",labelLine:false,label:n?im:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:i.map((l,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[s]},`cell-${s}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(hl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(l,s)=>{let u=s.payload,d=o>0?(u.value/o*100).toFixed(0):"0";return `${l} (${u.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:i,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(hl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:i.map((l,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[s]},`cell-${s}`))})]})}),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:o})]}),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((l,s)=>s.value>l.value?s:l).name})]})]})]})}var wn=Te.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:o=[]})=>{let[i,c]=Te.useState(false),[l,s]=Te.useState(false),[u,d]=Te.useState(false),[p,m]=Te.useState(false);if(e.length===0)return null;let x=e.map(w=>w.id),b=w=>{a.onBulkUpdate?.(x,{priority:w}),c(false);},v=w=>{a.onBulkMove?.(x,w),s(false),r();},g=w=>{a.onBulkUpdate?.(x,{assignedUserIds:w}),d(false);},h=w=>{let k=new Set;e.forEach(T=>{T.labels?.forEach(C=>k.add(C));});let y=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(x,{labels:y}),m(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(x),r());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!i),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(w),children:[jsxRuntime.jsx("span",{className:ae("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>s(!l),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(w.id),children:w.title},w.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(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([w.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});wn.displayName="BulkOperationsToolbar";function pm(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let o,i,c,l,s;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let x=r?.find(b=>b.id===m);i=`assignee-${m}`,c=x?.name||`User ${m}`,l=x?.color,s=x?.avatar,a.has(i)||a.set(i,{id:i,title:c,groupValue:m,cardIds:[],color:l,icon:s}),a.get(i).cardIds.push(n.id);}):(i="assignee-unassigned",c="Unassigned",l="#6b7280",s="\u{1F464}",a.has(i)||a.set(i,{id:i,title:c,groupValue:null,cardIds:[],color:l,icon:s}),a.get(i).cardIds.push(n.id));break;case "priority":o=n.priority||"NONE",i=`priority-${o}`;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"}}[o];c=p.title,l=p.color,a.has(i)||a.set(i,{id:i,title:c,groupValue:o,cardIds:[],color:l}),a.get(i).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{i=`label-${m}`,c=m,l="#6b7280",a.has(i)||a.set(i,{id:i,title:c,groupValue:m,cardIds:[],color:l}),a.get(i).cardIds.push(n.id);}):(i="label-none",c="No Labels",l="#6b7280",a.has(i)||a.set(i,{id:i,title:c,groupValue:null,cardIds:[],color:l}),a.get(i).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,o)=>n.title.localeCompare(o.title))}function Ao({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n}){let[o,i]=Te.useState(new Set),c=Te.useMemo(()=>pm(e.cards,t.groupBy,r),[e.cards,t.groupBy,r]),l=Te.useCallback(s=>{i(u=>{let d=new Set(u);return d.has(s)?d.delete(s):d.add(s),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Sr,{board:e,callbacks:a,availableUsers:r,className:n}):jsxRuntime.jsxs("div",{className:ae("asakaa-swimlane-view",n),children:[c.map(s=>{let u=o.has(s.id),d=e.cards.filter(m=>s.cardIds.includes(m.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&&l(s.id),style:{borderLeft:s.color?`4px solid ${s.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[s.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:s.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:s.color},children:s.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",s.cardIds.length," ",s.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(Sr,{board:p,callbacks:a,availableUsers:r})})]},s.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Lo=[{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 Fo({value:e,onChange:t,className:r}){let[a,n]=Te.useState(false),o=Te.useRef(null),i=Te.useRef(null),c=Lo.find(s=>s.value===e)||Lo[0];Te.useEffect(()=>{function s(u){o.current&&!o.current.contains(u.target)&&i.current&&!i.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[a]);let l=s=>{t(s),n(false);};return jsxRuntime.jsxs("div",{className:ae("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:ae("w-4 h-4 transition-transform",a&&"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"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,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:Lo.map(s=>jsxRuntime.jsxs("button",{onClick:()=>l(s.value),className:ae("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===s.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:s.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:s.label}),e===s.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:s.description})]})]},s.value))})]})]})}var Fa=[{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 gm(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(s=>e.key===s||e.code===s))return false;let n=t.modifiers||{},o=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,i=n.shift?e.shiftKey:!e.shiftKey,c=n.alt?e.altKey:!e.altKey,l=n.meta?e.metaKey:true;return o&&i&&c&&l}function kl(e={}){let{shortcuts:t=Fa,enabled:r=true,preventDefault:a=true}=e,n=Te.useRef(t),o=Te.useRef(r);Te.useEffect(()=>{n.current=t,o.current=r;},[t,r]);let i=Te.useCallback(l=>{n.current=[...n.current,l];},[]),c=Te.useCallback(l=>{n.current=n.current.filter(s=>s.action!==l);},[]);return Te.useEffect(()=>{function l(s){if(!o.current)return;let u=s.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&s.key!=="Escape"&&!s.ctrlKey&&!s.metaKey)){for(let d of n.current)if(gm(s,d)){a&&s.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a]),{registerShortcut:i,unregisterShortcut:c,isEnabled:r}}function vm(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function bm(e){let t=[],r=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(r?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(r?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function ym(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=bm(e),a=t?vm(t):"";return r?`${r} + ${a}`:a}function xm(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(r=>{r.action.includes("navigate")?t.Navigation?.push(r):r.action.includes("select")?t.Selection?.push(r):["undo","redo","save"].includes(r.action)?t.Editing?.push(r):t.Actions?.push(r);}),t}function Bo({shortcuts:e=Fa,isOpen:t,onClose:r,className:a}){let[n,o]=Te.useState(false);if(Te.useEffect(()=>{o(true);},[]),Te.useEffect(()=>{function c(l){l.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r]),!n||!t)return null;let i=xm(e);return jsxRuntime.jsxs("div",{className:ae("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:r}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(i).map(([c,l])=>l.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:l.map(s=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:s.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:ym(s)})]},s.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Oo=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
6
6
  1.
7
7
 
8
8
  **Expected behavior:**
@@ -42,8 +42,8 @@
42
42
  1.
43
43
 
44
44
  **Action items:**
45
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Bo({templates:e,onSelectTemplate:t,className:r}){let[a,n]=Te.useState(false),o=Te.useRef(null),s=Te.useRef(null);Te.useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(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:ae("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>n(!a),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:ae("w-4 h-4 transition-transform",a&&"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"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children: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 zo({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,l]=Te.useState("export"),[c,i]=Te.useState("json"),[u,d]=Te.useState(null),m=Te.useRef(null);if(!t)return null;let p=async()=>{let b=n?.current||void 0,v=await js(e,c,b);Ys(v,c);},x=async b=>{let v=b.target.files?.[0];if(v){try{let g=await Js(v),h=v.name.endsWith(".json")?"json":"csv",f=Xs(g,h);d(f),f.success&&a&&a(f,g);}catch(g){d({success:false,errors:[`Failed to read file: ${g instanceof Error?g.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:ae("fixed inset-0 z-[9999] flex items-center justify-center",o),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),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:r,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:ae("flex-1 px-6 py-4 font-semibold transition-colors",s==="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:ae("flex-1 px-6 py-4 font-semibold transition-colors",s==="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:[s==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(b=>jsxRuntime.jsxs("button",{onClick:()=>i(b),className:ae("p-4 rounded-lg border-2 transition-all text-center",c===b?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:p,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"})]}),s==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:m,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:ae("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:ae("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},v))})]})]})]})]})]})}var gm=["URGENT","HIGH","MEDIUM","LOW"],hm=[{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"}],vm=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Uo({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:s,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:m=false,groupBy:p="none",onGroupByChange:x}){let[b,v]=Te.useState(true),g=Te.useCallback(y=>{r({search:y.target.value});},[r]),h=Te.useCallback(y=>{r({dateFilter:y.target.value});},[r]),f=Te.useCallback(y=>{a({by:y.target.value});},[a]),w=Te.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!b&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsxRuntime.jsx("button",{onClick:s,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:g,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:y=>{let T=y.target.value;r({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),gm.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:y=>{let T=y.target.value;r({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(y=>jsxRuntime.jsx("option",{value:y.id,children:y.name},y.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:y=>{let T=y.target.value;r({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),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:f,className:"filter-bar__select filter-bar__select--sm",children:hm.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:p,onChange:y=>x(y.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:vm.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Wo({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:s,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=Te.useState(false),d=Te.useRef(null);Te.useEffect(()=>{let p=x=>{d.current&&!d.current.contains(x.target)&&u(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let m=p=>{p(),u(false);};return jsxRuntime.jsxs("div",{className:ae("relative",a),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.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:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await o?.()),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await 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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await 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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>m(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>m(r),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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 $o={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"}},Go={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"}},Ho={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"}},Hr={dark:$o,light:Go,neutral:Ho},Cn="dark";var Tn=Te.createContext(void 0),Nm="asakaa-theme";function yl({children:e,defaultTheme:t=Cn,storageKey:r=Nm}){let[a,n]=Te.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(r);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),o=Te.useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(r,l);},[r]);Te.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=Hr[a];Object.entries(c.colors).forEach(([u,d])=>{d&&l.style.setProperty(`--theme-${Em(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 m=c.colors[u];m&&l.style.setProperty(d,m);}),l.setAttribute("data-theme",a),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:Hr};return jsxRuntime.jsx(Tn.Provider,{value:s,children:e})}function sa(){let e=Te.useContext(Tn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Em(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function _o({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=sa();return e?jsxRuntime.jsxs("div",{className:ae("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick: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(Hr).map(([o,s])=>jsxRuntime.jsxs("button",{onClick:()=>{n(o),t();},className:ae("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===o?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===o?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:s.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[o==="dark"&&"Default dark theme with Linear-inspired colors",o==="light"&&"Clean light theme with high contrast",o==="neutral"&&"Monochrome zen theme"]})]}),a===o&&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"})})]},o))})]})]}):null}var xe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1E2228",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FCFCFD",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FEFEFE",bgWeekend:"rgba(41, 37, 36, 0.025)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function xl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return xe[e]||xe.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",xe[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",xe[e].bgSecondary),bgGrid:a("--theme-bg-card",xe[e].bgGrid),bgWeekend:a("--theme-bg-hover",xe[e].bgWeekend),border:a("--theme-border-primary",xe[e].border),borderLight:a("--theme-border-subtle",xe[e].borderLight),textPrimary:a("--theme-text-primary",xe[e].textPrimary),textSecondary:a("--theme-text-secondary",xe[e].textSecondary),textTertiary:a("--theme-text-tertiary",xe[e].textTertiary),accent:a("--theme-accent-primary",xe[e].accent),accentHover:a("--theme-accent-hover",xe[e].accentHover),accentLight:a("--theme-accent-primary",xe[e].accentLight),taskBarPrimary:a("--theme-accent-primary",xe[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",xe[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",xe[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",xe[e].dependency),dependencyHover:a("--theme-border-secondary",xe[e].dependencyHover),criticalPath:a("--theme-error",xe[e].criticalPath),criticalPathLight:a("--theme-error",xe[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",xe[e].today):e==="neutral"?a("--theme-text-primary",xe[e].today):a("--theme-error",xe[e].today),todayLight:e==="light"?a("--theme-accent-primary",xe[e].todayLight):e==="neutral"?a("--theme-text-primary",xe[e].todayLight):a("--theme-error",xe[e].todayLight),milestone:a("--theme-warning",xe[e].milestone),milestoneLight:a("--theme-warning",xe[e].milestoneLight),statusTodo:a("--theme-text-tertiary",xe[e].statusTodo),statusInProgress:a("--theme-accent-primary",xe[e].statusInProgress),statusCompleted:a("--theme-success",xe[e].statusCompleted),hoverBg:a("--theme-bg-hover",xe[e].hoverBg),focusRing:a("--theme-accent-primary",xe[e].focusRing)}}function Hm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:o,onExportMSProject:s}){let[l,c]=Te.useState(false),[i,u]=Te.useState(null),d=Te.useRef(null);if(Te.useEffect(()=>{let b=v=>{d.current&&!d.current.contains(v.target)&&c(false);};return l&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),!(t||r||a||n||o||s))return null;let p=[{id:"png",label:"Image",description:"PNG screenshot",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document format",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet format",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data format",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:o},{id:"msproject",label:"MS Project",description:"Project XML format",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:s}].filter(b=>b.handler),x=async(b,v)=>{if(v){u(b);try{await v();}catch(g){console.error(`Export ${b} failed:`,g);}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:"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:p.map((b,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>x(b.id,b.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===b.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):b.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function jo({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(n=>{let o=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.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:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"activeSegment",className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.label})]},n.value)})})}function Sn({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:s,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=true,onExportPNG:u,onExportPDF:d,onExportExcel:m,onExportCSV:p,onExportJSON:x,onExportMSProject:b}){let v=u||d||m||p||x||b,g=[{value:"day",label:"Day",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"week",label:"Week",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"month",label:"Month",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})}],h=[{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"})}],f=[{value:"compact",label:"Compact",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"comfortable",label:"Comfortable",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"spacious",label:"Spacious",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-14 px-6 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(jo,{options:g,value:t,onChange:w=>r(w),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})}),jsxRuntime.jsxs("div",{className:"px-3 py-1 rounded-md text-xs tabular-nums min-w-[50px] text-center",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`,color:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(jo,{options:f,value:l,onChange:w=>c(w),theme:e})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hm,{theme:e,onExportPNG:u,onExportPDF:d,onExportExcel:m,onExportCSV:p,onExportJSON:x,onExportMSProject:b}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(jo,{options:h,value:o,onChange:w=>s(w),theme:e})]})]})}function Dn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=Te.useState(false),[o,s]=Te.useState({x:0,y:0}),l=Te.useRef(null),c=Te.useRef(null);Te.useEffect(()=>{if(!a)return;let u=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let u=c.current.getBoundingClientRect();s({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(Ke,{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:`${o.x}px`,top:`${o.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.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:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=r.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:r.accent}})]},u.id))]})})})})]})}function la({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=Te.useRef(null);return Te.useEffect(()=>{if(!e)return;let l=i=>{s.current&&!s.current.contains(i.target)&&n();},c=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",c);}},[e,n]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:s,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 shadow-xl",style:{left:`${t}px`,top:`${r}px`,backgroundColor:o.bgSecondary,border:`1px solid ${o.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(l=>jsxRuntime.jsxs("div",{children:[l.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:o.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{l.disabled||(l.onClick(),n());},disabled:l.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:l.disabled?o.textTertiary:o.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:l.disabled?"not-allowed":"pointer",opacity:l.disabled?.5:1},onMouseEnter:c=>{l.disabled||(c.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[l.icon&&jsxRuntime.jsx("span",{style:{color:o.textSecondary},children:l.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:l.label}),l.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:o.textTertiary}})]})]},l.id))})})}):null}var Pt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{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"}),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"})};function El({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:m=true}){let p=Te.useRef(false),x=Te.useCallback(f=>{p.current=f;},[]),b=Te.useCallback(f=>{let w=[],k=y=>{for(let T of y)w.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&k(T.subtasks);};return k(f),w},[]),v=Te.useCallback(()=>{let f=b(e);for(let w of f)if(t.has(w.id))return w;return null},[e,t,b]),g=Te.useCallback((f,w)=>{let k=b(e);if(k.length===0)return;let y=v();if(!y){r(k[0].id,false);return}let T=k.findIndex(R=>R.id===y.id);if(T===-1)return;let C=f==="up"?T-1:T+1;if(C<0||C>=k.length)return;let D=k[C];r(D.id,w);},[e,v,b,r]),h=Te.useCallback(f=>{if(!m)return;let w=f.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){f.key==="Escape"&&(w.blur(),p.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,C=Array.from(t),D=v();if(f.key==="ArrowUp"){f.preventDefault(),g("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),g("down",f.shiftKey);return}if(D&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!D.isExpanded||f.key==="ArrowLeft"&&D.isExpanded)&&u(D.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){C.length>0&&(f.preventDefault(),s(C,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){C.length>0&&(f.preventDefault(),l(C));return}if(f.key==="Tab"&&f.shiftKey){C.length>0&&(f.preventDefault(),c(C));return}if(f.key==="Enter"&&!f.shiftKey&&!T){D&&(f.preventDefault(),a(D.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!T){D&&(f.preventDefault(),a(D.id,"above"));return}if(f.key==="Enter"&&T){D&&(f.preventDefault(),d(D.id));return}if(f.key==="F2"){D&&(f.preventDefault(),i(D.id));return}if(f.key==="Delete"||f.key==="Backspace"&&T){C.length>0&&(f.preventDefault(),n(C));return}if(f.key==="d"&&T&&!f.shiftKey){C.length>0&&(f.preventDefault(),o(C));return}},[m,t,v,g,a,n,o,s,l,c,i,u,d]);return Te.useEffect(()=>{if(m)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[m,h]),{setIsEditing:x}}function Pl(){let[e,t]=Te.useState(new Set),[r,a]=Te.useState(null),n=Te.useCallback(d=>{t(new Set([d])),a(d);},[]),o=Te.useCallback(d=>{t(m=>{let p=new Set(m);return p.has(d)?p.delete(d):p.add(d),p}),a(d);},[]),s=Te.useCallback((d,m)=>{if(!r){n(d);return}let p=m.indexOf(r),x=m.indexOf(d);if(p===-1||x===-1){n(d);return}let b=Math.min(p,x),v=Math.max(p,x),g=m.slice(b,v+1);t(new Set(g)),a(d);},[r,n]),l=Te.useCallback((d,m,p,x)=>{x?s(d,m):p?o(d):n(d);},[n,o,s]),c=Te.useCallback((d,m)=>{m?t(p=>{let x=new Set(p);return x.add(d),x}):n(d);},[n]),i=Te.useCallback(()=>{t(new Set),a(null);},[]),u=Te.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function ca(e){let t=[],r=(a,n,o=0)=>{for(let s=0;s<a.length;s++){let l={...a[s],parentId:n,level:o,position:s};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,o+1);}};return r(e),t}function qo(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=qo(r.subtasks,t);if(a)return a}return null}function Xo(e,t){if(t.length===0)return e;let r=ca(e),a=t[0],n=r.findIndex(d=>d.id===a);if(n<=0)return e;let o=r[n-1],s=(d,m)=>{let p=[];return {tasks:d.filter(b=>{if(m.has(b.id))return p.push(b),false;if(b.subtasks){let v=s(b.subtasks,m);b.subtasks=v.tasks,p.push(...v.removed);}return true}),removed:p}},l=(d,m,p)=>d.map(x=>x.id===m?{...x,subtasks:[...x.subtasks||[],...p],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,m,p)}:x),c=new Set(t),{tasks:i,removed:u}=s(e,c);return l(i,o.id,u)}function Jo(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=qo(r,a);if(!n)continue;let o=qo(r,n.id),s=(i,u,d)=>{for(let m=0;m<i.length;m++){let p=i[m];if(p.id===u&&p.subtasks){let x=p.subtasks.findIndex(b=>b.id===d);if(x!==-1){let[b]=p.subtasks.splice(x,1);return b}}if(p.subtasks){let x=s(p.subtasks,u,d);if(x)return x}}return null},l=(i,u,d)=>{let m=i.findIndex(p=>p.id===u);if(m!==-1)return i.splice(m+1,0,d),i;for(let p of i)p.subtasks&&l(p.subtasks,u,d);return i},c=s(r,n.id,a);c&&(o&&o.subtasks?l(o.subtasks,n.id,c):l(r,n.id,c));}return r}function Zo(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,l,c)=>{let i=s.findIndex(d=>d.id===l);if(i===-1){for(let d of s)if(d.subtasks&&o(d.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=s.length?false:([s[i],s[u]]=[s[u],s[i]],true)};return o(a,n,r),a}function Nn(e,t){let r=new Set(t),a=n=>n.filter(o=>!r.has(o.id)).map(o=>o.subtasks?{...o,subtasks:a(o.subtasks)}:o);return a(e)}function Qo(e,t){let r=[...e];for(let a of t){let n=s=>{let l=s.findIndex(u=>u.id===a);if(l===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let c=s[l],i={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?o(c.subtasks):void 0};return s.splice(l+1,0,i),true},o=s=>s.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?o(l.subtasks):void 0}));n(r);}return r}function Il(e,t,r){let a=[...e],n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:o,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=r==="above"?i:i+1;return c.splice(u,0,s),true};return l(a),{tasks:a,newTask:s}}function es(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:es(a.subtasks,t,r)}:a)}function ts(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:ts(r.subtasks,t)}:r)}function rs(e,t){let r=new Date,a=new Date(r);a.setDate(a.getDate()+7);let n=c=>{for(let i of c){if(i.id===t)return i;if(i.subtasks){let u=n(i.subtasks);if(u)return u}}return null},o=n(e),s={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:r,endDate:a,color:o?.color||"#6366F1"},l=c=>c.map(i=>{if(i.id===t){let u=i.subtasks||[];return {...i,subtasks:[...u,s],isExpanded:true}}return i.subtasks?{...i,subtasks:l(i.subtasks)}:i});return {tasks:l(e),newTask:s}}var Ll={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"}},Fl=({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 Bl({status:e="todo",onChange:t,className:r}){let[a,n]=Te.useState(false),[o,s]=Te.useState({top:0,left:0}),l=Te.useRef(null),c=Te.useRef(null);Te.useEffect(()=>{if(a&&c.current){let m=c.current.getBoundingClientRect();s({top:m.bottom+window.scrollY+8,left:m.left+window.scrollX});}},[a]),Te.useEffect(()=>{let m=p=>{l.current&&!l.current.contains(p.target)&&!c.current?.contains(p.target)&&n(false);};if(a)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[a]),Te.useEffect(()=>{let m=p=>{p.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a]);let i=m=>{t(m),n(false);},u=Ll[e],d=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>n(!a),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:`${d}10`,boxShadow:`0 0 0 2px ${d}30 inset`},title:u.label,children:jsxRuntime.jsx(Fl,{icon:u.icon,color:d})}),a&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:l,className:"status-selector-menu",style:{position:"absolute",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",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:Object.entries(Ll).map(([m,p])=>jsxRuntime.jsxs("button",{onClick:()=>i(m),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:p.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Fl,{icon:p.icon,color:p.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:p.label}),e===m&&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"})})]},m))})]})})]})}function En({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:s,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:m,onTaskUpdate:p,onTaskIndent:x,onTaskOutdent:b,onTaskMove:v,onMultiTaskDelete:g,onTaskDuplicate:h,onTaskCreate:f,onTaskRename:w,onCreateSubtask:k,onOpenTaskModal:y}){let[T,C]=Te.useState(null),[D,R]=Te.useState(false),[U,W]=Te.useState(null),[I,O]=Te.useState(""),E=Te.useRef(null),B=Te.useRef(null),[$,z]=Te.useState(null),[L,re]=Te.useState(0),[J,ie]=Te.useState(0),[P,pe]=Te.useState({isOpen:false,x:0,y:0,type:"header"});Te.useEffect(()=>{function K(G){E.current&&!E.current.contains(G.target)&&R(false);}if(D)return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[D]),Te.useEffect(()=>{U&&B.current&&(B.current.focus(),B.current.select());},[U]),Te.useEffect(()=>{if(!$)return;let K=we=>{let Ae=we.clientX-L,de=J+Ae;m?.($,de);},G=()=>{z(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",G),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",G),document.body.style.cursor="",document.body.style.userSelect="";}},[$,L,J,m]);let{selectedTaskIds:ne,handleTaskClick:ze,isTaskSelected:Qe}=Pl(),{setIsEditing:St}=El({tasks:e,selectedTaskIds:ne,onTaskSelect:(K,G)=>{let Ae=ca(e).map(de=>de.id);ze(K,Ae,G||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:K=>{let G=ca(e).find(we=>we.id===K);G&&Ft(G);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:K=>{let G=ca(e).find(we=>we.id===K);G&&y&&y(G);},enableKeyboard:true}),ke=(K,G=0)=>{let we=[];for(let Ae of K)we.push({task:Ae,level:G}),Ae.subtasks&&Ae.subtasks.length>0&&Ae.isExpanded&&we.push(...ke(Ae.subtasks,G+1));return we},bt=ke(e),te=48,ce=K=>!K.startDate||!K.endDate?"-":`${Math.ceil((K.endDate.getTime()-K.startDate.getTime())/(1e3*60*60*24))}d`,Ft=K=>{W(K.id),O(K.name),St(true);},dr=K=>{I.trim()&&I!==e.find(G=>G.id===K)?.name&&w?.(K,I.trim()),W(null),O(""),St(false);},gt=()=>{W(null),O(""),St(false);},et=(K,G)=>{G.stopPropagation(),k?.(K.id);},tr=(K,G,we)=>{switch(K.id){case "name":let Ae=U===G.id,de=T===G.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${we*20}px`},children:[G.subtasks&&G.subtasks.length>0?jsxRuntime.jsx("button",{onClick:se=>{se.stopPropagation(),c?.(G.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:G.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"}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:G.color||"#6366F1",opacity:G.parentId?.6:1,borderColor:G.isMilestone?t.accent:"transparent",borderWidth:G.isMilestone?"2px":"0px"},title:G.isMilestone?"Milestone":G.parentId?"Subtask":"Task"}),Ae?jsxRuntime.jsx("input",{ref:B,type:"text",value:I,onChange:se=>O(se.target.value),onKeyDown:se=>{se.key==="Enter"?dr(G.id):se.key==="Escape"&&gt();},onBlur:()=>dr(G.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:se=>se.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:we===0?"14px":we===1?"13px":"12px",fontWeight:G.isMilestone?600:G.subtasks&&G.subtasks.length>0?500:400,opacity:we===0?1:we===1?.95:.88},title:G.name,children:G.name}),de&&!Ae&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:se=>et(G,se),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:se=>{se.stopPropagation(),Ft(G);},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":let ge=G.startDate?typeof G.startDate=="string"?G.startDate:G.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ge||"",onChange:se=>{p?.(G.id,{startDate:se.target.value?new Date(se.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let he=G.endDate?typeof G.endDate=="string"?G.endDate:G.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:he||"",onChange:se=>{p?.(G.id,{endDate:se.target.value?new Date(se.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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:ce(G)})});case "assignees":let rr=a.filter(se=>G.assignees?.some(ye=>ye.name===se.name||ye.initials===se.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(Wr,{assignedUsers:rr,availableUsers:a,onChange:se=>{let ye=se.map(j=>({id:j.id,name:j.name,initials:j.initials,color:j.color}));p?.(G.id,{assignees:ye.length>0?ye:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(Bl,{status:G.status||"todo",onChange:se=>{p?.(G.id,{status:se,progress:se==="completed"?100:G.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:`${G.progress}%`,backgroundColor:G.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:[G.progress,"%"]})]});default:return null}},$t=K=>[{id:"hide",label:"Hide Column",icon:Pt.Hide,onClick:()=>d(K),disabled:K==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Pt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Pt.SortDesc,onClick:()=>{}}],yr=K=>[{id:"edit",label:"Edit Task",icon:Pt.Edit,onClick:()=>{}},{id:"addSubtask",label:"Add Subtask",icon:Pt.Add,onClick:()=>{}},{id:"addDependency",label:"Add Dependency",icon:Pt.Link,onClick:()=>{}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markComplete",label:K.status==="completed"?"Mark Incomplete":"Mark Complete",icon:Pt.Progress,onClick:()=>{let G=K.status==="completed"?"in-progress":"completed",we=K.status==="completed"?K.progress:100;p?.(K.id,{status:G,progress:we});}},{id:"setInProgress",label:"Set In Progress",icon:Pt.Progress,onClick:()=>{p?.(K.id,{status:"in-progress"});},disabled:K.status==="in-progress"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"delete",label:"Delete Task",icon:Pt.Delete,onClick:()=>{window.confirm(`Delete task "${K.name}"?`)&&g?.([K.id]);}}],Gt=u.filter(K=>K.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary,borderRight:`1px solid ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border,height:`${te}px`,marginLeft:"3px"},children:[Gt.map(K=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative ${K.id==="name"?"justify-start":"justify-center"}`,style:{width:`${K.width}px`,minWidth:`${K.width}px`,maxWidth:`${K.width}px`,borderColor:t.borderLight,height:"100%",boxSizing:"border-box"},onContextMenu:G=>{G.preventDefault(),pe({isOpen:true,x:G.clientX,y:G.clientY,type:"header",columnId:K.id});},onMouseEnter:G=>{G.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:G=>{G.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:K.label}),K.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500 transition-colors group",style:{backgroundColor:$===K.id?t.accent:"transparent"},onMouseDown:G=>{G.preventDefault(),G.stopPropagation(),z(K.id),re(G.clientX),ie(K.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute right-0 top-2 bottom-2 w-0.5 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:t.accent}})})]},K.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(Dn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>R(!D),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:[jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"}),D&&jsxRuntime.jsxs("div",{ref:E,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:K=>K.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:()=>R(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:bt.map(({task:K,level:G},we)=>{let Ae=Qe(K.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center border-b cursor-pointer group",style:{height:`${r}px`,borderTop:`1px solid ${Ae?t.accent:t.borderLight}`,borderRight:`1px solid ${Ae?t.accent:t.borderLight}`,borderBottom:`1px solid ${Ae?t.accent:t.borderLight}`,borderLeft:Ae?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ae?t.accentLight:we%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>C(K.id),onMouseLeave:()=>C(null),onClick:de=>{let he=ca(e).map(ye=>ye.id),se=navigator.platform.toUpperCase().indexOf("MAC")>=0?de.metaKey:de.ctrlKey;ze(K.id,he,se,de.shiftKey),o?.(K);},onDoubleClick:de=>{de.stopPropagation(),s?.(K);},onContextMenu:de=>{de.preventDefault(),pe({isOpen:true,x:de.clientX,y:de.clientY,type:"task",task:K}),l?.(K,de);},whileHover:{backgroundColor:Ae?t.accentLight:t.hoverBg},children:Gt.map(de=>jsxRuntime.jsx("div",{className:`px-4 border-r flex items-center ${de.id==="name"?"justify-start":"justify-center"}`,style:{width:`${de.width}px`,minWidth:`${de.width}px`,maxWidth:`${de.width}px`,borderColor:T===K.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:tr(de,K,de.id==="name"?G:0)},`${K.id}-${de.id}`))},K.id)})}),jsxRuntime.jsx(la,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?$t(P.columnId):P.type==="task"&&P.task?yr(P.task):[],onClose:()=>pe({...P,isOpen:false}),theme:t})]})}function zl(e,t){let[r,a]=Te.useState("none"),[n,o]=Te.useState(0),[s,l]=Te.useState(e),[c,i]=Te.useState(t),[u,d]=Te.useState(null),[m,p]=Te.useState(null),[x,b]=Te.useState(null),[v,g]=Te.useState(null),[h,f]=Te.useState(0),[w,k]=Te.useState(0),[y,T]=Te.useState(null),[C,D]=Te.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:p,activeZone:x,setActiveZone:b,draggedSegmentIndex:v,setDraggedSegmentIndex:g,draggedSegmentStartX:h,setDraggedSegmentStartX:f,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:y,setHoveredSegmentIndex:T,isHovered:C,setIsHovered:D,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(O,E)=>{a("none"),d(null),p(null),l(O),i(E),k(0),g(null),f(0);}}}function Rn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:m,allTaskPositions:p=[],onDragMove:x}){let b=zl(t,a),v=Te.useRef(null),{dragMode:g,setDragMode:h,dragOffset:f,setDragOffset:w,ghostX:k,setGhostX:y,ghostWidth:T,setGhostWidth:C,connectionLine:D,setConnectionLine:R,hoveredTaskId:U,setHoveredTaskId:W,activeZone:I,setActiveZone:O,draggedSegmentIndex:E,setDraggedSegmentIndex:B,draggedSegmentStartX:$,setDraggedSegmentStartX:z,segmentDragOffsetX:L,setSegmentDragOffsetX:re,hoveredSegmentIndex:J,setHoveredSegmentIndex:ie,isHovered:P,setIsHovered:pe,isDragging:ne,isResizing:ze,isConnecting:Qe,resetDragState:St}=b,ke=32,bt=8,te=e.endDate&&e.endDate<new Date&&e.progress<100,ce=e.isCriticalPath,Ft=n.name==="neutral"||n.today==="#1C1917",gt=(j=>j>=80?20:j>=60?15:j>=50?12:10)(a),et=a<50,tr=a<40,$t=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),yr=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Gt=j=>Math.round(j/o)*o,K=j=>{let Ce=Math.round(j/o),S=new Date(s);return S.setDate(S.getDate()+Ce),S},G=(j,Ce)=>{for(let S of p){if(S.id===e.id)continue;let _=5;if(j>=S.x-_&&j<=S.x+S.width+_&&Ce>=S.y-_&&Ce<=S.y+S.height+_)return S.id}return null},we=Te.useCallback((j,Ce,S)=>{j.preventDefault(),j.stopPropagation();let _=v.current?.ownerSVGElement;if(!_)return;let ue=_.createSVGPoint();ue.x=j.clientX,ue.y=j.clientY;let Pe=ue.matrixTransform(_.getScreenCTM()?.inverse()),Be=S!==void 0?S:t,He=Ce;if(!He){let Mt=Pe.x-Be;j.shiftKey?(He="connect",R({x:t+a,y:r+ke/2})):j.ctrlKey||j.metaKey?He="move":j.altKey?He=Mt<a/2?"resize-start":"resize-end":tr?Mt<a/2?He="move":He="resize-end":et?Mt<=gt/2?He="resize-start":Mt>=a-gt/2?He="resize-end":He="move":Mt<=gt?He="resize-start":Mt>=a-gt?He="resize-end":He="move";}h(He),pe(false),O(null),He==="move"?w(Pe.x-Be):He==="connect"?R({x:t+a,y:r+ke/2}):w(0),y(Be),C(a);},[t,a,r,ke]),Ae=Te.useCallback(j=>{if(g==="none")return;let Ce=v.current?.ownerSVGElement;if(!Ce)return;let S=Ce.createSVGPoint();S.x=j.clientX,S.y=j.clientY;let _=S.matrixTransform(Ce.getScreenCTM()?.inverse());if(g==="connect"){R({x:_.x,y:_.y});let ue=G(_.x,_.y);W(ue);}else if(g==="move"){let ue=_.x-f,Pe=Gt(ue);y(Pe),C(a);let Be=Math.round((Pe-t)/o);if(x?.(e.id,Be,true),e.segments&&e.segments.length>0&&E!==null){let He=Pe-$;re(He);}}else if(g==="resize-start"){let ue=_.x,Pe=Gt(ue),Be=t+a-Pe;Be>=o&&(y(Pe),C(Be));}else if(g==="resize-end"){let ue=_.x,Be=Gt(ue)-t;Be>=o&&C(Be);}},[g,t,a,o,f,e,Gt,E,$,G,W,R,y,C,re,x]),de=Te.useCallback(()=>{if(g!=="none"){if(g==="connect")U&&m&&m(e,U),R(null),W(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),Ce,S,_=true;if(g==="move"){if(Ce=K(k),S=new Date(Ce.getTime()+j),e.segments&&e.segments.length>0&&E!==null){let ue=Math.round(L/o),Pe=e.segments.map((Bt,jn)=>{if(jn===E){let fa=new Date(Bt.startDate),ga=new Date(Bt.endDate);return fa.setDate(fa.getDate()+ue),ga.setDate(ga.getDate()+ue),{startDate:fa,endDate:ga}}return Bt}),Be=Pe.flatMap(Bt=>[Bt.startDate,Bt.endDate]),He=new Date(Math.min(...Be.map(Bt=>Bt.getTime()))),Mt=new Date(Math.max(...Be.map(Bt=>Bt.getTime())));d?.({...e,segments:Pe},He,Mt),St(t,a);return}}else g==="resize-start"?(Ce=K(k),S=e.endDate,Ce>=S&&(console.warn("Invalid date range: start date must be before end date"),_=false)):g==="resize-end"?(Ce=e.startDate,S=K(k+T),S<=Ce&&(console.warn("Invalid date range: end date must be after start date"),_=false)):_=false;_&&Ce&&S&&(S.getTime()-Ce.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,Ce,S));}x?.(e.id,0,false),St(t,a);}},[g,k,T,e,d,U,m,t,a,o,K,L,E,St,x]);Te.useEffect(()=>{if(g==="none")return;let j=S=>{Ae(S);},Ce=()=>{de();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",Ce),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",Ce);}},[g,Ae,de]);let ge=ne&&!Qe?k:t,he=ne&&!Qe?T:a,rr=l.taskTooltip(e),se=typeof rr=="string"?rr:"",ye=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,onMouseEnter:()=>!ne&&pe(true),onMouseLeave:()=>{ne||(pe(false),O(null));},onClick:()=>!ne&&c?.(e),onDoubleClick:j=>{ne||(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},children:[se&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:se}}),P&&!ne&&!et&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:gt,height:ke,fill:I==="resize-start"?n.accent:"transparent",opacity:I==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-start"),onMouseDown:j=>we(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+gt,y:r,width:a-gt*2,height:ke,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:j=>we(j,"move")}),jsxRuntime.jsx("rect",{x:t+a-gt,y:r,width:gt,height:ke,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:j=>we(j,"resize-end")})]}),P&&!ne&&tr&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:ke,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:j=>we(j,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:ke,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:j=>we(j,"resize-end")}),P&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+ke-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ne&&!Qe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:r,width:T,height:ke,rx:bt,fill:n.accent,opacity:.5,stroke:n.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:ge,y:r,width:he,height:ke,rx:bt,fill:e.isCriticalPath||te?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":ye,initial:{opacity:0,scale:.95},animate:{opacity:ne&&!Qe?.15:e.parentId?.6:P?.9:.8,scale:P&&!ne?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>we(j),style:{cursor:ne?Qe?"crosshair":ze?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ge,y:r,width:he*(e.progress/100),height:ke,rx:bt,fill:e.isCriticalPath||te?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((j,Ce)=>{let S=(j.startDate.getTime()-s.getTime())/864e5*o,ue=(j.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-S+o,Pe=ne&&g==="move"&&E===Ce,Be=J===Ce,He=Pe?S+L:S;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ne&&ie(Ce),onMouseLeave:()=>!ne&&ie(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:He,y:r,width:ue,height:ke,rx:bt,fill:e.isCriticalPath||te?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:Pe||e.parentId?.6:Be?.9:.8,scale:Be&&!ne?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Mt=>{Mt.stopPropagation(),B(Ce),z(S),we(Mt,void 0,S);},style:{cursor:ne?Qe?"crosshair":ze?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:He,y:r,width:ue*(e.progress/100),height:ke,rx:bt,fill:e.isCriticalPath||te?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ce}`)}),Ft&&(te||ce)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ce&&!te&&jsxRuntime.jsx("rect",{x:ge,y:r,width:he,height:ke,rx:bt,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),te&&jsxRuntime.jsx("rect",{x:ge,y:r,width:he,height:ke,rx:bt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),he>60&&!e.segments&&(()=>{let j=l.taskLabel(e),Ce=typeof j=="string"?j:e.name,S=Ce.length>Math.floor(he/8)?`${Ce.substring(0,Math.floor(he/8))}...`:Ce;return jsxRuntime.jsx("text",{x:ge+12,y:r+ke/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S})})(),he>100&&e.progress>0&&e.progress<100&&!ne&&!e.segments&&jsxRuntime.jsxs("text",{x:ge+he-12,y:r+ke/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&&he>80&&!ne&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ge+he-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ge+he-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(P||ze)&&!Qe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:et?ge-15:ge-10,y:r-5,width:et?25:20,height:ke+10,fill:"transparent",onMouseDown:j=>we(j,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:et?ge-8:ge-3,y:r+6,width:et?8:6,height:et?ke-12:ke-16,rx:3,fill:g==="resize-start"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ge+he-10,y:r-5,width:et?25:20,height:ke+10,fill:"transparent",onMouseDown:j=>we(j,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:et?ge+he:ge+he-3,y:r+6,width:et?8:6,height:et?ke-12:ke-16,rx:3,fill:g==="resize-end"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!ne&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+8,cy:r+ke/2,r:6,fill:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:j=>{j.stopPropagation(),we(j,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+ke/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Qe&&D&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+ke/2,x2:D.x,y2:D.y,stroke:U?n.statusCompleted:n.accent,strokeWidth:U?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:U?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:D.x,cy:D.y,r:U?8:6,fill:U?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),U&&jsxRuntime.jsx(framerMotion.motion.text,{x:D.x+15,y:D.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:D.x+10},animate:{opacity:1,x:D.x+15},transition:{duration:.2},children:"Connect"})]}),(P||ne)&&!Qe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ge-2,y:r-2,width:he+4,height:ke+4,rx:bt+2,fill:"none",stroke:ne?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:ne?.6:.4,initial:{opacity:0},animate:{opacity:ne?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+T,y1:0,x2:k+T,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!ne&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:ge+he/2-120,y:r-95,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${ge+he/2-6} ${r-13} L ${ge+he/2} ${r-3} L ${ge+he/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:ge+he/2,y:r-73,textAnchor:"middle",fill:n.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:ge+he/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ge+he/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.startDate)}),jsxRuntime.jsx("text",{x:ge+he/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ge+he/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.endDate)}),jsxRuntime.jsx("text",{x:ge+he/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ge+he/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:yr()}),jsxRuntime.jsx("text",{x:ge+he/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ge+he/2+65,y:r-40,fill:n.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:ge+he/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ge+he/2-50,y:r-25,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(j=>j.name).join(", ").substring(0,30),e.assignees.map(j=>j.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:ge+he/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:tr?"Left: move \u2022 Right: resize":et?"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 In({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[s,l]=Te.useState(false),c=r-e,i=a-t,u=e+c/2,d=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,m=6,p=Math.atan2(i,c),x=r-m*Math.cos(p-Math.PI/6),b=a-m*Math.sin(p-Math.PI/6),v=r-m*Math.cos(p+Math.PI/6),g=a-m*Math.sin(p+Math.PI/6),h=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),children:[jsxRuntime.jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d,fill:"none",stroke:h,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:s?1:.6,strokeWidth:s?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${r} ${a} L ${x} ${b} M ${r} ${a} L ${v} ${g}`,fill:"none",stroke:h,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:s?1:.6,scale:s?1.1:1,strokeWidth:s?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:h,initial:{scale:0},animate:{scale:s?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),s&&o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:f=>{f.stopPropagation(),o();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:u,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:u-4,y1:(t+a)/2-4,x2:u+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:u+4,y1:(t+a)/2-4,x2:u-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function An({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=Te.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:l+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:r+16-l/2,width:l,height:l,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:r+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&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:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.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:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var V={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let s=new Set,l=new Set,c=i=>{if(!s.has(i)){s.add(i),l.add(i);let u=a.get(i)||[];for(let d of u){if(!s.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(r)},flattenTasks:e=>{let t=[],r=a=>{a.forEach(n=>{t.push(n),n.subtasks&&n.subtasks.length>0&&r(n.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=V.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=V.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=V.findTaskById(e,n);if(o)r.unshift(o),n=o.parentId;else break}return r},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((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: 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=V.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
46
- `)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=V.flattenTasks(e).filter(a=>a.startDate);return r.length===0?null:new Date(Math.min(...r.map(a=>a.startDate.getTime())))},getLatestEndDate:e=>{let r=V.flattenTasks(e).filter(a=>a.endDate);return r.length===0?null:new Date(Math.max(...r.map(a=>a.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)=>V.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=V.findTaskById(e,t);return !r||!r.dependencies?[]:V.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>V.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>V.flattenTasks(e).filter(a=>!a.startDate||!a.endDate?false:a.startDate<=r&&a.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.startDate||!a.startDate)return 0;let n=r.startDate.getTime()-a.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.endDate||!a.endDate)return 0;let n=r.endDate.getTime()-a.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((r,a)=>{let n=r.progress-a.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=V.flattenTasks(e);if(t.length===0)return 0;let r=t.reduce((a,n)=>a+n.progress,0);return Math.round(r/t.length)},getTaskByPath:(e,t)=>{let r=e,a;for(let n=0;n<t.length;n++){let o=t[n];if(!r||o===void 0||o>=r.length||(a=r[o],!a))return;n<t.length-1&&(r=a.subtasks||[]);}return a},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(r=>V.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable'),n=new r,o=V.flattenTasks(e);if(o.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let s=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=o.map(c=>{let i=c.startDate&&c.endDate?V.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?V.formatDate(c.startDate):"N/A",c.endDate?V.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});a(n,{head:s,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}}}),n.save(t);}catch(r){throw r}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let r=await import('xlsx'),n=V.flattenTasks(e).map(c=>{let i=c.startDate&&c.endDate?V.calculateDuration(c.startDate,c.endDate):0;return {"Task ID":c.id,"Task Name":c.name,"Start Date":c.startDate?V.formatDate(c.startDate):"","End Date":c.endDate?V.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}}),o=r.utils.json_to_sheet(n),s=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];o["!cols"]=s;let l=r.utils.book_new();r.utils.book_append_sheet(l,o,"Gantt Tasks"),r.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=V.flattenTasks(e),n=new Map;a.forEach((m,p)=>{n.set(m.id,p+1);});let o=m=>m.toISOString().replace("Z",""),s=V.getEarliestStartDate(e)||new Date,l=V.getLatestEndDate(e)||new Date,c=a.map((m,p)=>{let x=n.get(m.id),b=m.startDate&&m.endDate?V.calculateDuration(m.startDate,m.endDate):0,v=(m.dependencies||[]).filter(g=>n.has(g)).map(g=>`
45
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function zo({templates:e,onSelectTemplate:t,className:r}){let[a,n]=Te.useState(false),o=Te.useRef(null),i=Te.useRef(null);Te.useEffect(()=>{function s(u){o.current&&!o.current.contains(u.target)&&i.current&&!i.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[a]);let c=s=>{t(s),n(false);},l=e.reduce((s,u)=>{let d=u.category||"Other";return s[d]||(s[d]=[]),s[d].push(u),s},{});return jsxRuntime.jsxs("div",{className:ae("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>n(!a),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:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",s.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",s.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:ae("w-4 h-4 transition-transform",a&&"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"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,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(l).map(([s,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:s})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>c(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter: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))})]},s)),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 _o({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[i,c]=Te.useState("export"),[l,s]=Te.useState("json"),[u,d]=Te.useState(null),p=Te.useRef(null);if(!t)return null;let m=async()=>{let b=n?.current||void 0,v=await Zs(e,l,b);Qs(v,l);},x=async b=>{let v=b.target.files?.[0];if(v){try{let g=await ri(v),h=v.name.endsWith(".json")?"json":"csv",f=ti(g,h);d(f),f.success&&a&&a(f,g);}catch(g){d({success:false,errors:[`Failed to read file: ${g instanceof Error?g.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:ae("fixed inset-0 z-[9999] flex items-center justify-center",o),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),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:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:ae("flex-1 px-6 py-4 font-semibold transition-colors",i==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:ae("flex-1 px-6 py-4 font-semibold transition-colors",i==="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:[i==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(b=>jsxRuntime.jsxs("button",{onClick:()=>s(b),className:ae("p-4 rounded-lg border-2 transition-all text-center",l===b?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:m,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"})]}),i==="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:x,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:ae("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:ae("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,v)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},v))})]})]})]})]})]})}var Sm=["URGENT","HIGH","MEDIUM","LOW"],Dm=[{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"}],Nm=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Uo({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:i,onFilterHighPriority:c,availableUsers:l=[],availableLabels:s=[],availableColumns:u=[],showQuickFilters:d=true,compact:p=false,groupBy:m="none",onGroupByChange:x}){let[b,v]=Te.useState(true),g=Te.useCallback(y=>{r({search:y.target.value});},[r]),h=Te.useCallback(y=>{r({dateFilter:y.target.value});},[r]),f=Te.useCallback(y=>{a({by:y.target.value});},[a]),w=Te.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>v(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!b&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:g,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:y=>{let T=y.target.value;r({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Sm.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:y=>{let T=y.target.value;r({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),l.map(y=>jsxRuntime.jsx("option",{value:y.id,children:y.name},y.id))]})}),s.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:y=>{let T=y.target.value;r({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),s.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),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:f,className:"filter-bar__select filter-bar__select--sm",children:Dm.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:m,onChange:y=>x(y.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Nm.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Wo({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:i,onExportGanttPNG:c,onExportGanttCSV:l}){let[s,u]=Te.useState(false),d=Te.useRef(null);Te.useEffect(()=>{let m=x=>{d.current&&!d.current.contains(x.target)&&u(false);};return s&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[s]);let p=m=>{m(),u(false);};return jsxRuntime.jsxs("div",{className:ae("relative",a),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!s),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":s,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"})]}),s&&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:[n==="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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 o?.()),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 i?.()),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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(()=>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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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(r),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 Go={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"}},Ho={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"}},Vo={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"}},Hr={dark:Go,light:Ho,neutral:Vo},Tn="dark";var Sn=Te.createContext(void 0),Om="asakaa-theme";function Tl({children:e,defaultTheme:t=Tn,storageKey:r=Om}){let[a,n]=Te.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),o=Te.useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);Te.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,l=Hr[a];Object.entries(l.colors).forEach(([u,d])=>{d&&c.style.setProperty(`--theme-${zm(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=l.colors[u];p&&c.style.setProperty(d,p);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let i={theme:a,setTheme:o,themes:Hr};return jsxRuntime.jsx(Sn.Provider,{value:i,children:e})}function ia(){let e=Te.useContext(Sn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function zm(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ko({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=ia();return e?jsxRuntime.jsxs("div",{className:ae("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick: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(Hr).map(([o,i])=>jsxRuntime.jsxs("button",{onClick:()=>{n(o),t();},className:ae("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===o?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===o?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:i.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:i.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[o==="dark"&&"Default dark theme with Linear-inspired colors",o==="light"&&"Clean light theme with high contrast",o==="neutral"&&"Monochrome zen theme"]})]}),a===o&&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"})})]},o))})]})]}):null}var xe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1E2228",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FCFCFD",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FEFEFE",bgWeekend:"rgba(41, 37, 36, 0.025)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function Sl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return xe[e]||xe.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,i)=>r.getPropertyValue(o).trim()||i;return {bgPrimary:a("--theme-bg-primary",xe[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",xe[e].bgSecondary),bgGrid:a("--theme-bg-card",xe[e].bgGrid),bgWeekend:a("--theme-bg-hover",xe[e].bgWeekend),border:a("--theme-border-primary",xe[e].border),borderLight:a("--theme-border-subtle",xe[e].borderLight),textPrimary:a("--theme-text-primary",xe[e].textPrimary),textSecondary:a("--theme-text-secondary",xe[e].textSecondary),textTertiary:a("--theme-text-tertiary",xe[e].textTertiary),accent:a("--theme-accent-primary",xe[e].accent),accentHover:a("--theme-accent-hover",xe[e].accentHover),accentLight:a("--theme-accent-primary",xe[e].accentLight),taskBarPrimary:a("--theme-accent-primary",xe[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",xe[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",xe[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",xe[e].dependency),dependencyHover:a("--theme-border-secondary",xe[e].dependencyHover),criticalPath:a("--theme-error",xe[e].criticalPath),criticalPathLight:a("--theme-error",xe[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",xe[e].today):e==="neutral"?a("--theme-text-primary",xe[e].today):a("--theme-error",xe[e].today),todayLight:e==="light"?a("--theme-accent-primary",xe[e].todayLight):e==="neutral"?a("--theme-text-primary",xe[e].todayLight):a("--theme-error",xe[e].todayLight),milestone:a("--theme-warning",xe[e].milestone),milestoneLight:a("--theme-warning",xe[e].milestoneLight),statusTodo:a("--theme-text-tertiary",xe[e].statusTodo),statusInProgress:a("--theme-accent-primary",xe[e].statusInProgress),statusCompleted:a("--theme-success",xe[e].statusCompleted),hoverBg:a("--theme-bg-hover",xe[e].hoverBg),focusRing:a("--theme-accent-primary",xe[e].focusRing)}}function Qm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:o,onExportMSProject:i}){let[c,l]=Te.useState(false),[s,u]=Te.useState(null),d=Te.useRef(null);if(Te.useEffect(()=>{let b=v=>{d.current&&!d.current.contains(v.target)&&l(false);};return c&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[c]),!(t||r||a||n||o||i))return null;let m=[{id:"png",label:"Image",description:"PNG screenshot",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document format",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet format",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data format",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:o},{id:"msproject",label:"MS Project",description:"Project XML format",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:i}].filter(b=>b.handler),x=async(b,v)=>{if(v){u(b);try{await v();}catch(g){console.error(`Export ${b} failed:`,g);}finally{u(null),l(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Export"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((b,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>x(b.id,b.handler),disabled:s!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<m.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:s===b.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):b.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function qo({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(n=>{let o=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.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:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"activeSegment",className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.label})]},n.value)})})}function Dn({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:i,rowDensity:c,onRowDensityChange:l,showThemeSelector:s=true,onExportPNG:u,onExportPDF:d,onExportExcel:p,onExportCSV:m,onExportJSON:x,onExportMSProject:b}){let v=u||d||p||m||x||b,g=[{value:"day",label:"Day",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"week",label:"Week",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"month",label:"Month",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})}],h=[{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"})}],f=[{value:"compact",label:"Compact",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"comfortable",label:"Comfortable",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"spacious",label:"Spacious",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-14 px-6 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(qo,{options:g,value:t,onChange:w=>r(w),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})}),jsxRuntime.jsxs("div",{className:"px-3 py-1 rounded-md text-xs tabular-nums min-w-[50px] text-center",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`,color:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(qo,{options:f,value:c,onChange:w=>l(w),theme:e})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Qm,{theme:e,onExportPNG:u,onExportPDF:d,onExportExcel:p,onExportCSV:m,onExportJSON:x,onExportMSProject:b}),s&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),s&&jsxRuntime.jsx(qo,{options:h,value:o,onChange:w=>i(w),theme:e})]})]})}function Nn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=Te.useState(false),[o,i]=Te.useState({x:0,y:0}),c=Te.useRef(null),l=Te.useRef(null);Te.useEffect(()=>{if(!a)return;let u=d=>{c.current&&!c.current.contains(d.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let s=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:l,onClick:()=>{if(!a&&l.current){let u=l.current.getBoundingClientRect();i({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${o.x}px`,top:`${o.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),s.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:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=r.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:r.accent}})]},u.id))]})})})})]})}function ca({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let i=Te.useRef(null);return Te.useEffect(()=>{if(!e)return;let c=s=>{i.current&&!i.current.contains(s.target)&&n();},l=s=>{s.key==="Escape"&&n();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",l);}},[e,n]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:i,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 shadow-xl",style:{left:`${t}px`,top:`${r}px`,backgroundColor:o.bgSecondary,border:`1px solid ${o.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:o.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),n());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?o.textTertiary:o.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:l=>{c.disabled||(l.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:o.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:o.textTertiary}})]})]},c.id))})})}):null}var Pt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{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"}),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"})};function Al({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:i,onTaskIndent:c,onTaskOutdent:l,onTaskRename:s,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:p=true}){let m=Te.useRef(false),x=Te.useCallback(f=>{m.current=f;},[]),b=Te.useCallback(f=>{let w=[],k=y=>{for(let T of y)w.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&k(T.subtasks);};return k(f),w},[]),v=Te.useCallback(()=>{let f=b(e);for(let w of f)if(t.has(w.id))return w;return null},[e,t,b]),g=Te.useCallback((f,w)=>{let k=b(e);if(k.length===0)return;let y=v();if(!y){r(k[0].id,false);return}let T=k.findIndex(R=>R.id===y.id);if(T===-1)return;let C=f==="up"?T-1:T+1;if(C<0||C>=k.length)return;let D=k[C];r(D.id,w);},[e,v,b,r]),h=Te.useCallback(f=>{if(!p)return;let w=f.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){f.key==="Escape"&&(w.blur(),m.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,C=Array.from(t),D=v();if(f.key==="ArrowUp"){f.preventDefault(),g("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),g("down",f.shiftKey);return}if(D&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!D.isExpanded||f.key==="ArrowLeft"&&D.isExpanded)&&u(D.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){C.length>0&&(f.preventDefault(),i(C,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){C.length>0&&(f.preventDefault(),c(C));return}if(f.key==="Tab"&&f.shiftKey){C.length>0&&(f.preventDefault(),l(C));return}if(f.key==="Enter"&&!f.shiftKey&&!T){D&&(f.preventDefault(),a(D.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!T){D&&(f.preventDefault(),a(D.id,"above"));return}if(f.key==="Enter"&&T){D&&(f.preventDefault(),d(D.id));return}if(f.key==="F2"){D&&(f.preventDefault(),s(D.id));return}if(f.key==="Delete"||f.key==="Backspace"&&T){C.length>0&&(f.preventDefault(),n(C));return}if(f.key==="d"&&T&&!f.shiftKey){C.length>0&&(f.preventDefault(),o(C));return}},[p,t,v,g,a,n,o,i,c,l,s,u,d]);return Te.useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:x}}function Fl(){let[e,t]=Te.useState(new Set),[r,a]=Te.useState(null),n=Te.useCallback(d=>{t(new Set([d])),a(d);},[]),o=Te.useCallback(d=>{t(p=>{let m=new Set(p);return m.has(d)?m.delete(d):m.add(d),m}),a(d);},[]),i=Te.useCallback((d,p)=>{if(!r){n(d);return}let m=p.indexOf(r),x=p.indexOf(d);if(m===-1||x===-1){n(d);return}let b=Math.min(m,x),v=Math.max(m,x),g=p.slice(b,v+1);t(new Set(g)),a(d);},[r,n]),c=Te.useCallback((d,p,m,x)=>{x?i(d,p):m?o(d):n(d);},[n,o,i]),l=Te.useCallback((d,p)=>{p?t(m=>{let x=new Set(m);return x.add(d),x}):n(d);},[n]),s=Te.useCallback(()=>{t(new Set),a(null);},[]),u=Te.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:i,handleTaskClick:c,handleKeyboardSelection:l,clearSelection:s,isTaskSelected:u}}function da(e){let t=[],r=(a,n,o=0)=>{for(let i=0;i<a.length;i++){let c={...a[i],parentId:n,level:o,position:i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&r(c.subtasks,c.id,o+1);}};return r(e),t}function Jo(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=Jo(r.subtasks,t);if(a)return a}return null}function Zo(e,t){if(t.length===0)return e;let r=da(e),a=t[0],n=r.findIndex(d=>d.id===a);if(n<=0)return e;let o=r[n-1],i=(d,p)=>{let m=[];return {tasks:d.filter(b=>{if(p.has(b.id))return m.push(b),false;if(b.subtasks){let v=i(b.subtasks,p);b.subtasks=v.tasks,m.push(...v.removed);}return true}),removed:m}},c=(d,p,m)=>d.map(x=>x.id===p?{...x,subtasks:[...x.subtasks||[],...m],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,p,m)}:x),l=new Set(t),{tasks:s,removed:u}=i(e,l);return c(s,o.id,u)}function Qo(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=Jo(r,a);if(!n)continue;let o=Jo(r,n.id),i=(s,u,d)=>{for(let p=0;p<s.length;p++){let m=s[p];if(m.id===u&&m.subtasks){let x=m.subtasks.findIndex(b=>b.id===d);if(x!==-1){let[b]=m.subtasks.splice(x,1);return b}}if(m.subtasks){let x=i(m.subtasks,u,d);if(x)return x}}return null},c=(s,u,d)=>{let p=s.findIndex(m=>m.id===u);if(p!==-1)return s.splice(p+1,0,d),s;for(let m of s)m.subtasks&&c(m.subtasks,u,d);return s},l=i(r,n.id,a);l&&(o&&o.subtasks?c(o.subtasks,n.id,l):c(r,n.id,l));}return r}function es(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(i,c,l)=>{let s=i.findIndex(d=>d.id===c);if(s===-1){for(let d of i)if(d.subtasks&&o(d.subtasks,c,l))return true;return false}let u=l==="up"?s-1:s+1;return u<0||u>=i.length?false:([i[s],i[u]]=[i[u],i[s]],true)};return o(a,n,r),a}function En(e,t){let r=new Set(t),a=n=>n.filter(o=>!r.has(o.id)).map(o=>o.subtasks?{...o,subtasks:a(o.subtasks)}:o);return a(e)}function ts(e,t){let r=[...e];for(let a of t){let n=i=>{let c=i.findIndex(u=>u.id===a);if(c===-1){for(let u of i)if(u.subtasks&&n(u.subtasks))return true;return false}let l=i[c],s={...l,id:`${l.id}-copy-${Date.now()}`,name:`${l.name} (Copy)`,subtasks:l.subtasks?o(l.subtasks):void 0};return i.splice(c+1,0,s),true},o=i=>i.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?o(c.subtasks):void 0}));n(r);}return r}function Bl(e,t,r){let a=[...e],n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let i={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:o,color:"#6366F1"},c=l=>{let s=l.findIndex(d=>d.id===t);if(s===-1){for(let d of l)if(d.subtasks&&c(d.subtasks))return true;return false}let u=r==="above"?s:s+1;return l.splice(u,0,i),true};return c(a),{tasks:a,newTask:i}}function rs(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:rs(a.subtasks,t,r)}:a)}function as(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:as(r.subtasks,t)}:r)}function ns(e,t){let r=new Date,a=new Date(r);a.setDate(a.getDate()+7);let n=l=>{for(let s of l){if(s.id===t)return s;if(s.subtasks){let u=n(s.subtasks);if(u)return u}}return null},o=n(e),i={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:r,endDate:a,color:o?.color||"#6366F1"},c=l=>l.map(s=>{if(s.id===t){let u=s.subtasks||[];return {...s,subtasks:[...u,i],isExpanded:true}}return s.subtasks?{...s,subtasks:c(s.subtasks)}:s});return {tasks:c(e),newTask:i}}var $l={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"}},_l=({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 Ul({status:e="todo",onChange:t,className:r}){let[a,n]=Te.useState(false),[o,i]=Te.useState({top:0,left:0}),c=Te.useRef(null),l=Te.useRef(null);Te.useEffect(()=>{if(a&&l.current){let p=l.current.getBoundingClientRect();i({top:p.bottom+window.scrollY+8,left:p.left+window.scrollX});}},[a]),Te.useEffect(()=>{let p=m=>{c.current&&!c.current.contains(m.target)&&!l.current?.contains(m.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),Te.useEffect(()=>{let p=m=>{m.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let s=p=>{t(p),n(false);},u=$l[e],d=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>n(!a),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:`${d}10`,boxShadow:`0 0 0 2px ${d}30 inset`},title:u.label,children:jsxRuntime.jsx(_l,{icon:u.icon,color:d})}),a&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"absolute",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",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:Object.entries($l).map(([p,m])=>jsxRuntime.jsxs("button",{onClick:()=>s(p),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:m.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(_l,{icon:m.icon,color:m.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:m.label}),e===p&&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"})})]},p))})]})})]})}function Rn({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:i,onTaskContextMenu:c,onTaskToggle:l,scrollTop:s,columns:u,onToggleColumn:d,onColumnResize:p,onTaskUpdate:m,onTaskIndent:x,onTaskOutdent:b,onTaskMove:v,onMultiTaskDelete:g,onTaskDuplicate:h,onTaskCreate:f,onTaskRename:w,onCreateSubtask:k,onOpenTaskModal:y}){let[T,C]=Te.useState(null),[D,R]=Te.useState(false),[$,_]=Te.useState(null),[I,O]=Te.useState(""),E=Te.useRef(null),B=Te.useRef(null),[U,z]=Te.useState(null),[L,re]=Te.useState(0),[J,ie]=Te.useState(0),[P,pe]=Te.useState({isOpen:false,x:0,y:0,type:"header"});Te.useEffect(()=>{function K(W){E.current&&!E.current.contains(W.target)&&R(false);}if(D)return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[D]),Te.useEffect(()=>{$&&B.current&&(B.current.focus(),B.current.select());},[$]),Te.useEffect(()=>{if(!U)return;let K=we=>{let Ae=we.clientX-L,de=J+Ae;p?.(U,de);},W=()=>{z(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",W),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",W),document.body.style.cursor="",document.body.style.userSelect="";}},[U,L,J,p]);let{selectedTaskIds:ne,handleTaskClick:ze,isTaskSelected:Qe}=Fl(),{setIsEditing:St}=Al({tasks:e,selectedTaskIds:ne,onTaskSelect:(K,W)=>{let Ae=da(e).map(de=>de.id);ze(K,Ae,W||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:K=>{let W=da(e).find(we=>we.id===K);W&&Ft(W);},onTaskToggleExpand:l||(()=>{}),onOpenTaskModal:K=>{let W=da(e).find(we=>we.id===K);W&&y&&y(W);},enableKeyboard:true}),ke=(K,W=0)=>{let we=[];for(let Ae of K)we.push({task:Ae,level:W}),Ae.subtasks&&Ae.subtasks.length>0&&Ae.isExpanded&&we.push(...ke(Ae.subtasks,W+1));return we},bt=ke(e),te=48,ce=K=>!K.startDate||!K.endDate?"-":`${Math.ceil((K.endDate.getTime()-K.startDate.getTime())/(1e3*60*60*24))}d`,Ft=K=>{_(K.id),O(K.name),St(true);},dr=K=>{I.trim()&&I!==e.find(W=>W.id===K)?.name&&w?.(K,I.trim()),_(null),O(""),St(false);},gt=()=>{_(null),O(""),St(false);},et=(K,W)=>{W.stopPropagation(),k?.(K.id);},tr=(K,W,we)=>{switch(K.id){case "name":let Ae=$===W.id,de=T===W.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${we*20}px`},children:[W.subtasks&&W.subtasks.length>0?jsxRuntime.jsx("button",{onClick:se=>{se.stopPropagation(),l?.(W.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:W.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"}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:W.color||"#6366F1",opacity:W.parentId?.6:1,borderColor:W.isMilestone?t.accent:"transparent",borderWidth:W.isMilestone?"2px":"0px"},title:W.isMilestone?"Milestone":W.parentId?"Subtask":"Task"}),Ae?jsxRuntime.jsx("input",{ref:B,type:"text",value:I,onChange:se=>O(se.target.value),onKeyDown:se=>{se.key==="Enter"?dr(W.id):se.key==="Escape"&&gt();},onBlur:()=>dr(W.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:se=>se.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:we===0?"14px":we===1?"13px":"12px",fontWeight:W.isMilestone?600:W.subtasks&&W.subtasks.length>0?500:400,opacity:we===0?1:we===1?.95:.88},title:W.name,children:W.name}),de&&!Ae&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:se=>et(W,se),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:se=>{se.stopPropagation(),Ft(W);},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":let ge=W.startDate?typeof W.startDate=="string"?W.startDate:W.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ge||"",onChange:se=>{m?.(W.id,{startDate:se.target.value?new Date(se.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let he=W.endDate?typeof W.endDate=="string"?W.endDate:W.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:he||"",onChange:se=>{m?.(W.id,{endDate:se.target.value?new Date(se.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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:ce(W)})});case "assignees":let rr=a.filter(se=>W.assignees?.some(ye=>ye.name===se.name||ye.initials===se.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(Ur,{assignedUsers:rr,availableUsers:a,onChange:se=>{let ye=se.map(j=>({id:j.id,name:j.name,initials:j.initials,color:j.color}));m?.(W.id,{assignees:ye.length>0?ye:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(Ul,{status:W.status||"todo",onChange:se=>{m?.(W.id,{status:se,progress:se==="completed"?100:W.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:`${W.progress}%`,backgroundColor:W.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:[W.progress,"%"]})]});default:return null}},Ut=K=>[{id:"hide",label:"Hide Column",icon:Pt.Hide,onClick:()=>d(K),disabled:K==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Pt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Pt.SortDesc,onClick:()=>{}}],xr=K=>[{id:"edit",label:"Edit Task",icon:Pt.Edit,onClick:()=>{}},{id:"addSubtask",label:"Add Subtask",icon:Pt.Add,onClick:()=>{}},{id:"addDependency",label:"Add Dependency",icon:Pt.Link,onClick:()=>{}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markComplete",label:K.status==="completed"?"Mark Incomplete":"Mark Complete",icon:Pt.Progress,onClick:()=>{let W=K.status==="completed"?"in-progress":"completed",we=K.status==="completed"?K.progress:100;m?.(K.id,{status:W,progress:we});}},{id:"setInProgress",label:"Set In Progress",icon:Pt.Progress,onClick:()=>{m?.(K.id,{status:"in-progress"});},disabled:K.status==="in-progress"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"delete",label:"Delete Task",icon:Pt.Delete,onClick:()=>{window.confirm(`Delete task "${K.name}"?`)&&g?.([K.id]);}}],Wt=u.filter(K=>K.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary,borderRight:`1px solid ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border,height:`${te}px`,marginLeft:"3px"},children:[Wt.map(K=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative ${K.id==="name"?"justify-start":"justify-center"}`,style:{width:`${K.width}px`,minWidth:`${K.width}px`,maxWidth:`${K.width}px`,borderColor:t.borderLight,height:"100%",boxSizing:"border-box"},onContextMenu:W=>{W.preventDefault(),pe({isOpen:true,x:W.clientX,y:W.clientY,type:"header",columnId:K.id});},onMouseEnter:W=>{W.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:W=>{W.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:K.label}),K.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500 transition-colors group",style:{backgroundColor:U===K.id?t.accent:"transparent"},onMouseDown:W=>{W.preventDefault(),W.stopPropagation(),z(K.id),re(W.clientX),ie(K.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute right-0 top-2 bottom-2 w-0.5 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:t.accent}})})]},K.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(Nn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>R(!D),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:[jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"}),D&&jsxRuntime.jsxs("div",{ref:E,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:K=>K.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:()=>R(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:bt.map(({task:K,level:W},we)=>{let Ae=Qe(K.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center border-b cursor-pointer group",style:{height:`${r}px`,borderTop:`1px solid ${Ae?t.accent:t.borderLight}`,borderRight:`1px solid ${Ae?t.accent:t.borderLight}`,borderBottom:`1px solid ${Ae?t.accent:t.borderLight}`,borderLeft:Ae?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ae?t.accentLight:we%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>C(K.id),onMouseLeave:()=>C(null),onClick:de=>{let he=da(e).map(ye=>ye.id),se=navigator.platform.toUpperCase().indexOf("MAC")>=0?de.metaKey:de.ctrlKey;ze(K.id,he,se,de.shiftKey),o?.(K);},onDoubleClick:de=>{de.stopPropagation(),i?.(K);},onContextMenu:de=>{de.preventDefault(),pe({isOpen:true,x:de.clientX,y:de.clientY,type:"task",task:K}),c?.(K,de);},whileHover:{backgroundColor:Ae?t.accentLight:t.hoverBg},children:Wt.map(de=>jsxRuntime.jsx("div",{className:`px-4 border-r flex items-center ${de.id==="name"?"justify-start":"justify-center"}`,style:{width:`${de.width}px`,minWidth:`${de.width}px`,maxWidth:`${de.width}px`,borderColor:T===K.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:tr(de,K,de.id==="name"?W:0)},`${K.id}-${de.id}`))},K.id)})}),jsxRuntime.jsx(ca,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?Ut(P.columnId):P.type==="task"&&P.task?xr(P.task):[],onClose:()=>pe({...P,isOpen:false}),theme:t})]})}function Gl(e,t){let[r,a]=Te.useState("none"),[n,o]=Te.useState(0),[i,c]=Te.useState(e),[l,s]=Te.useState(t),[u,d]=Te.useState(null),[p,m]=Te.useState(null),[x,b]=Te.useState(null),[v,g]=Te.useState(null),[h,f]=Te.useState(0),[w,k]=Te.useState(0),[y,T]=Te.useState(null),[C,D]=Te.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:i,setGhostX:c,ghostWidth:l,setGhostWidth:s,connectionLine:u,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:m,activeZone:x,setActiveZone:b,draggedSegmentIndex:v,setDraggedSegmentIndex:g,draggedSegmentStartX:h,setDraggedSegmentStartX:f,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:y,setHoveredSegmentIndex:T,isHovered:C,setIsHovered:D,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(O,E)=>{a("none"),d(null),m(null),c(O),s(E),k(0),g(null),f(0);}}}function Pn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:i,templates:c,onClick:l,onDoubleClick:s,onContextMenu:u,onDateChange:d,onDependencyCreate:p,allTaskPositions:m=[],onDragMove:x}){let b=Gl(t,a),v=Te.useRef(null),{dragMode:g,setDragMode:h,dragOffset:f,setDragOffset:w,ghostX:k,setGhostX:y,ghostWidth:T,setGhostWidth:C,connectionLine:D,setConnectionLine:R,hoveredTaskId:$,setHoveredTaskId:_,activeZone:I,setActiveZone:O,draggedSegmentIndex:E,setDraggedSegmentIndex:B,draggedSegmentStartX:U,setDraggedSegmentStartX:z,segmentDragOffsetX:L,setSegmentDragOffsetX:re,hoveredSegmentIndex:J,setHoveredSegmentIndex:ie,isHovered:P,setIsHovered:pe,isDragging:ne,isResizing:ze,isConnecting:Qe,resetDragState:St}=b,ke=32,bt=8,te=e.endDate&&e.endDate<new Date&&e.progress<100,ce=e.isCriticalPath,Ft=n.name==="neutral"||n.today==="#1C1917",gt=(j=>j>=80?20:j>=60?15:j>=50?12:10)(a),et=a<50,tr=a<40,Ut=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),xr=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Wt=j=>Math.round(j/o)*o,K=j=>{let Ce=Math.round(j/o),S=new Date(i);return S.setDate(S.getDate()+Ce),S},W=(j,Ce)=>{for(let S of m){if(S.id===e.id)continue;let H=5;if(j>=S.x-H&&j<=S.x+S.width+H&&Ce>=S.y-H&&Ce<=S.y+S.height+H)return S.id}return null},we=Te.useCallback((j,Ce,S)=>{j.preventDefault(),j.stopPropagation();let H=v.current?.ownerSVGElement;if(!H)return;let ue=H.createSVGPoint();ue.x=j.clientX,ue.y=j.clientY;let Pe=ue.matrixTransform(H.getScreenCTM()?.inverse()),Be=S!==void 0?S:t,Ge=Ce;if(!Ge){let Mt=Pe.x-Be;j.shiftKey?(Ge="connect",R({x:t+a,y:r+ke/2})):j.ctrlKey||j.metaKey?Ge="move":j.altKey?Ge=Mt<a/2?"resize-start":"resize-end":tr?Mt<a/2?Ge="move":Ge="resize-end":et?Mt<=gt/2?Ge="resize-start":Mt>=a-gt/2?Ge="resize-end":Ge="move":Mt<=gt?Ge="resize-start":Mt>=a-gt?Ge="resize-end":Ge="move";}h(Ge),pe(false),O(null),Ge==="move"?w(Pe.x-Be):Ge==="connect"?R({x:t+a,y:r+ke/2}):w(0),y(Be),C(a);},[t,a,r,ke]),Ae=Te.useCallback(j=>{if(g==="none")return;let Ce=v.current?.ownerSVGElement;if(!Ce)return;let S=Ce.createSVGPoint();S.x=j.clientX,S.y=j.clientY;let H=S.matrixTransform(Ce.getScreenCTM()?.inverse());if(g==="connect"){R({x:H.x,y:H.y});let ue=W(H.x,H.y);_(ue);}else if(g==="move"){let ue=H.x-f,Pe=Wt(ue);y(Pe),C(a);let Be=Math.round((Pe-t)/o);if(x?.(e.id,Be,true),e.segments&&e.segments.length>0&&E!==null){let Ge=Pe-U;re(Ge);}}else if(g==="resize-start"){let ue=H.x,Pe=Wt(ue),Be=t+a-Pe;Be>=o&&(y(Pe),C(Be));}else if(g==="resize-end"){let ue=H.x,Be=Wt(ue)-t;Be>=o&&C(Be);}},[g,t,a,o,f,e,Wt,E,U,W,_,R,y,C,re,x]),de=Te.useCallback(()=>{if(g!=="none"){if(g==="connect")$&&p&&p(e,$),R(null),_(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),Ce,S,H=true;if(g==="move"){if(Ce=K(k),S=new Date(Ce.getTime()+j),e.segments&&e.segments.length>0&&E!==null){let ue=Math.round(L/o),Pe=e.segments.map((Bt,qn)=>{if(qn===E){let ga=new Date(Bt.startDate),ha=new Date(Bt.endDate);return ga.setDate(ga.getDate()+ue),ha.setDate(ha.getDate()+ue),{startDate:ga,endDate:ha}}return Bt}),Be=Pe.flatMap(Bt=>[Bt.startDate,Bt.endDate]),Ge=new Date(Math.min(...Be.map(Bt=>Bt.getTime()))),Mt=new Date(Math.max(...Be.map(Bt=>Bt.getTime())));d?.({...e,segments:Pe},Ge,Mt),St(t,a);return}}else g==="resize-start"?(Ce=K(k),S=e.endDate,Ce>=S&&(console.warn("Invalid date range: start date must be before end date"),H=false)):g==="resize-end"?(Ce=e.startDate,S=K(k+T),S<=Ce&&(console.warn("Invalid date range: end date must be after start date"),H=false)):H=false;H&&Ce&&S&&(S.getTime()-Ce.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,Ce,S));}x?.(e.id,0,false),St(t,a);}},[g,k,T,e,d,$,p,t,a,o,K,L,E,St,x]);Te.useEffect(()=>{if(g==="none")return;let j=S=>{Ae(S);},Ce=()=>{de();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",Ce),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",Ce);}},[g,Ae,de]);let ge=ne&&!Qe?k:t,he=ne&&!Qe?T:a,rr=c.taskTooltip(e),se=typeof rr=="string"?rr:"",ye=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,onMouseEnter:()=>!ne&&pe(true),onMouseLeave:()=>{ne||(pe(false),O(null));},onClick:()=>!ne&&l?.(e),onDoubleClick:j=>{ne||(j.stopPropagation(),s?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},children:[se&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:se}}),P&&!ne&&!et&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:gt,height:ke,fill:I==="resize-start"?n.accent:"transparent",opacity:I==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-start"),onMouseDown:j=>we(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+gt,y:r,width:a-gt*2,height:ke,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:j=>we(j,"move")}),jsxRuntime.jsx("rect",{x:t+a-gt,y:r,width:gt,height:ke,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:j=>we(j,"resize-end")})]}),P&&!ne&&tr&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:ke,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:j=>we(j,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:ke,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:j=>we(j,"resize-end")}),P&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+ke-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ne&&!Qe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:r,width:T,height:ke,rx:bt,fill:n.accent,opacity:.5,stroke:n.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:ge,y:r,width:he,height:ke,rx:bt,fill:e.isCriticalPath||te?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":ye,initial:{opacity:0,scale:.95},animate:{opacity:ne&&!Qe?.15:e.parentId?.6:P?.9:.8,scale:P&&!ne?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>we(j),style:{cursor:ne?Qe?"crosshair":ze?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ge,y:r,width:he*(e.progress/100),height:ke,rx:bt,fill:e.isCriticalPath||te?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((j,Ce)=>{let S=(j.startDate.getTime()-i.getTime())/864e5*o,ue=(j.endDate.getTime()-i.getTime())/(1e3*60*60*24)*o-S+o,Pe=ne&&g==="move"&&E===Ce,Be=J===Ce,Ge=Pe?S+L:S;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ne&&ie(Ce),onMouseLeave:()=>!ne&&ie(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Ge,y:r,width:ue,height:ke,rx:bt,fill:e.isCriticalPath||te?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:Pe||e.parentId?.6:Be?.9:.8,scale:Be&&!ne?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Mt=>{Mt.stopPropagation(),B(Ce),z(S),we(Mt,void 0,S);},style:{cursor:ne?Qe?"crosshair":ze?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Ge,y:r,width:ue*(e.progress/100),height:ke,rx:bt,fill:e.isCriticalPath||te?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ce}`)}),Ft&&(te||ce)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ce&&!te&&jsxRuntime.jsx("rect",{x:ge,y:r,width:he,height:ke,rx:bt,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),te&&jsxRuntime.jsx("rect",{x:ge,y:r,width:he,height:ke,rx:bt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),he>60&&!e.segments&&(()=>{let j=c.taskLabel(e),Ce=typeof j=="string"?j:e.name,S=Ce.length>Math.floor(he/8)?`${Ce.substring(0,Math.floor(he/8))}...`:Ce;return jsxRuntime.jsx("text",{x:ge+12,y:r+ke/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S})})(),he>100&&e.progress>0&&e.progress<100&&!ne&&!e.segments&&jsxRuntime.jsxs("text",{x:ge+he-12,y:r+ke/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&&he>80&&!ne&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ge+he-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ge+he-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(P||ze)&&!Qe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:et?ge-15:ge-10,y:r-5,width:et?25:20,height:ke+10,fill:"transparent",onMouseDown:j=>we(j,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:et?ge-8:ge-3,y:r+6,width:et?8:6,height:et?ke-12:ke-16,rx:3,fill:g==="resize-start"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ge+he-10,y:r-5,width:et?25:20,height:ke+10,fill:"transparent",onMouseDown:j=>we(j,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:et?ge+he:ge+he-3,y:r+6,width:et?8:6,height:et?ke-12:ke-16,rx:3,fill:g==="resize-end"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!ne&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+8,cy:r+ke/2,r:6,fill:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:j=>{j.stopPropagation(),we(j,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+ke/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Qe&&D&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+ke/2,x2:D.x,y2:D.y,stroke:$?n.statusCompleted:n.accent,strokeWidth:$?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:$?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:D.x,cy:D.y,r:$?8:6,fill:$?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),$&&jsxRuntime.jsx(framerMotion.motion.text,{x:D.x+15,y:D.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:D.x+10},animate:{opacity:1,x:D.x+15},transition:{duration:.2},children:"Connect"})]}),(P||ne)&&!Qe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ge-2,y:r-2,width:he+4,height:ke+4,rx:bt+2,fill:"none",stroke:ne?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:ne?.6:.4,initial:{opacity:0},animate:{opacity:ne?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+T,y1:0,x2:k+T,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!ne&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:ge+he/2-120,y:r-95,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${ge+he/2-6} ${r-13} L ${ge+he/2} ${r-3} L ${ge+he/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:ge+he/2,y:r-73,textAnchor:"middle",fill:n.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:ge+he/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ge+he/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ut(e.startDate)}),jsxRuntime.jsx("text",{x:ge+he/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ge+he/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ut(e.endDate)}),jsxRuntime.jsx("text",{x:ge+he/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ge+he/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:xr()}),jsxRuntime.jsx("text",{x:ge+he/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ge+he/2+65,y:r-40,fill:n.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:ge+he/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ge+he/2-50,y:r-25,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(j=>j.name).join(", ").substring(0,30),e.assignees.map(j=>j.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:ge+he/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:tr?"Left: move \u2022 Right: resize":et?"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 Mn({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[i,c]=Te.useState(false),l=r-e,s=a-t,u=e+l/2,d=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,p=6,m=Math.atan2(s,l),x=r-p*Math.cos(m-Math.PI/6),b=a-p*Math.sin(m-Math.PI/6),v=r-p*Math.cos(m+Math.PI/6),g=a-p*Math.sin(m+Math.PI/6),h=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),children:[jsxRuntime.jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d,fill:"none",stroke:h,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:i?1:.6,strokeWidth:i?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${r} ${a} L ${x} ${b} M ${r} ${a} L ${v} ${g}`,fill:"none",stroke:h,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:i?1:.6,scale:i?1.1:1,strokeWidth:i?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:h,initial:{scale:0},animate:{scale:i?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),i&&o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:f=>{f.stopPropagation(),o();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:u,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:u-4,y1:(t+a)/2-4,x2:u+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:u+4,y1:(t+a)/2-4,x2:u-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Ln({task:e,x:t,y:r,theme:a,onClick:n}){let[o,i]=Te.useState(false),c=16,l=s=>s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:c+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:r+16-c/2,width:c,height:c,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:r+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&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:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.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:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:l(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var V={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=s=>{s.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let i=new Set,c=new Set,l=s=>{if(!i.has(s)){i.add(s),c.add(s);let u=a.get(s)||[];for(let d of u){if(!i.has(d)&&l(d))return true;if(c.has(d))return true}}return c.delete(s),false};return l(r)},flattenTasks:e=>{let t=[],r=a=>{a.forEach(n=>{t.push(n),n.subtasks&&n.subtasks.length>0&&r(n.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=V.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=V.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=V.findTaskById(e,n);if(o)r.unshift(o),n=o.parentId;else break}return r},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((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: 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=V.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
46
+ `)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=V.flattenTasks(e).filter(a=>a.startDate);return r.length===0?null:new Date(Math.min(...r.map(a=>a.startDate.getTime())))},getLatestEndDate:e=>{let r=V.flattenTasks(e).filter(a=>a.endDate);return r.length===0?null:new Date(Math.max(...r.map(a=>a.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)=>V.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=V.findTaskById(e,t);return !r||!r.dependencies?[]:V.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>V.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>V.flattenTasks(e).filter(a=>!a.startDate||!a.endDate?false:a.startDate<=r&&a.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.startDate||!a.startDate)return 0;let n=r.startDate.getTime()-a.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.endDate||!a.endDate)return 0;let n=r.endDate.getTime()-a.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((r,a)=>{let n=r.progress-a.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=V.flattenTasks(e);if(t.length===0)return 0;let r=t.reduce((a,n)=>a+n.progress,0);return Math.round(r/t.length)},getTaskByPath:(e,t)=>{let r=e,a;for(let n=0;n<t.length;n++){let o=t[n];if(!r||o===void 0||o>=r.length||(a=r[o],!a))return;n<t.length-1&&(r=a.subtasks||[]);}return a},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(r=>V.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable'),n=new r,o=V.flattenTasks(e);if(o.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let i=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=o.map(l=>{let s=l.startDate&&l.endDate?V.calculateDuration(l.startDate,l.endDate):0;return [l.name,l.startDate?V.formatDate(l.startDate):"N/A",l.endDate?V.formatDate(l.endDate):"N/A",s>0?`${s} days`:"N/A",`${l.progress}%`,l.status||"N/A"]});a(n,{head:i,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(r){throw r}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let r=await import('xlsx'),n=V.flattenTasks(e).map(l=>{let s=l.startDate&&l.endDate?V.calculateDuration(l.startDate,l.endDate):0;return {"Task ID":l.id,"Task Name":l.name,"Start Date":l.startDate?V.formatDate(l.startDate):"","End Date":l.endDate?V.formatDate(l.endDate):"","Duration (days)":s>0?s:"","Progress (%)":l.progress,Status:l.status||"",Assignees:l.assignees?.map(u=>u.name).join(", ")||"",Dependencies:l.dependencies?.join(", ")||"","Is Milestone":l.isMilestone?"Yes":"No","Parent ID":l.parentId||"",Level:l.level||0}}),o=r.utils.json_to_sheet(n),i=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];o["!cols"]=i;let c=r.utils.book_new();r.utils.book_append_sheet(c,o,"Gantt Tasks"),r.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=V.flattenTasks(e),n=new Map;a.forEach((p,m)=>{n.set(p.id,m+1);});let o=p=>p.toISOString().replace("Z",""),i=V.getEarliestStartDate(e)||new Date,c=V.getLatestEndDate(e)||new Date,l=a.map((p,m)=>{let x=n.get(p.id),b=p.startDate&&p.endDate?V.calculateDuration(p.startDate,p.endDate):0,v=(p.dependencies||[]).filter(g=>n.has(g)).map(g=>`
47
47
  <PredecessorLink>
48
48
  <PredecessorUID>${n.get(g)}</PredecessorUID>
49
49
  <Type>1</Type>
@@ -53,37 +53,37 @@
53
53
  </PredecessorLink>`).join("");return `
54
54
  <Task>
55
55
  <UID>${x}</UID>
56
- <ID>${p+1}</ID>
57
- <Name>${m.name.replace(/[<>&'"]/g,g=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[g]||g)}</Name>
56
+ <ID>${m+1}</ID>
57
+ <Name>${p.name.replace(/[<>&'"]/g,g=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[g]||g)}</Name>
58
58
  <Type>0</Type>
59
59
  <IsNull>0</IsNull>
60
60
  <CreateDate>${o(new Date)}</CreateDate>
61
- <WBS>${p+1}</WBS>
62
- <OutlineNumber>${p+1}</OutlineNumber>
63
- <OutlineLevel>${m.level||0}</OutlineLevel>
61
+ <WBS>${m+1}</WBS>
62
+ <OutlineNumber>${m+1}</OutlineNumber>
63
+ <OutlineLevel>${p.level||0}</OutlineLevel>
64
64
  <Priority>500</Priority>
65
- <Start>${m.startDate?o(m.startDate):""}</Start>
66
- <Finish>${m.endDate?o(m.endDate):""}</Finish>
65
+ <Start>${p.startDate?o(p.startDate):""}</Start>
66
+ <Finish>${p.endDate?o(p.endDate):""}</Finish>
67
67
  <Duration>PT${b*8}H0M0S</Duration>
68
68
  <DurationFormat>7</DurationFormat>
69
69
  <Work>PT${b*8}H0M0S</Work>
70
- <Stop>${m.endDate?o(m.endDate):""}</Stop>
71
- <Resume>${m.startDate?o(m.startDate):""}</Resume>
70
+ <Stop>${p.endDate?o(p.endDate):""}</Stop>
71
+ <Resume>${p.startDate?o(p.startDate):""}</Resume>
72
72
  <ResumeValid>0</ResumeValid>
73
73
  <EffortDriven>1</EffortDriven>
74
74
  <Recurring>0</Recurring>
75
75
  <OverAllocated>0</OverAllocated>
76
76
  <Estimated>0</Estimated>
77
- <Milestone>${m.isMilestone?"1":"0"}</Milestone>
78
- <Summary>${m.subtasks&&m.subtasks.length>0?"1":"0"}</Summary>
79
- <Critical>${m.isCriticalPath?"1":"0"}</Critical>
77
+ <Milestone>${p.isMilestone?"1":"0"}</Milestone>
78
+ <Summary>${p.subtasks&&p.subtasks.length>0?"1":"0"}</Summary>
79
+ <Critical>${p.isCriticalPath?"1":"0"}</Critical>
80
80
  <IsSubproject>0</IsSubproject>
81
81
  <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
82
82
  <ExternalTask>0</ExternalTask>
83
- <EarlyStart>${m.startDate?o(m.startDate):""}</EarlyStart>
84
- <EarlyFinish>${m.endDate?o(m.endDate):""}</EarlyFinish>
85
- <LateStart>${m.startDate?o(m.startDate):""}</LateStart>
86
- <LateFinish>${m.endDate?o(m.endDate):""}</LateFinish>
83
+ <EarlyStart>${p.startDate?o(p.startDate):""}</EarlyStart>
84
+ <EarlyFinish>${p.endDate?o(p.endDate):""}</EarlyFinish>
85
+ <LateStart>${p.startDate?o(p.startDate):""}</LateStart>
86
+ <LateFinish>${p.endDate?o(p.endDate):""}</LateFinish>
87
87
  <StartVariance>0</StartVariance>
88
88
  <FinishVariance>0</FinishVariance>
89
89
  <WorkVariance>0</WorkVariance>
@@ -91,22 +91,22 @@
91
91
  <TotalSlack>0</TotalSlack>
92
92
  <FixedCost>0</FixedCost>
93
93
  <FixedCostAccrual>3</FixedCostAccrual>
94
- <PercentComplete>${m.progress}</PercentComplete>
95
- <PercentWorkComplete>${m.progress}</PercentWorkComplete>
94
+ <PercentComplete>${p.progress}</PercentComplete>
95
+ <PercentWorkComplete>${p.progress}</PercentWorkComplete>
96
96
  <Cost>0</Cost>
97
97
  <OvertimeCost>0</OvertimeCost>
98
98
  <OvertimeWork>PT0H0M0S</OvertimeWork>
99
- <ActualStart>${m.progress>0&&m.startDate?o(m.startDate):""}</ActualStart>
100
- <ActualFinish>${m.progress===100&&m.endDate?o(m.endDate):""}</ActualFinish>
101
- <ActualDuration>PT${Math.round(b*m.progress/100)*8}H0M0S</ActualDuration>
99
+ <ActualStart>${p.progress>0&&p.startDate?o(p.startDate):""}</ActualStart>
100
+ <ActualFinish>${p.progress===100&&p.endDate?o(p.endDate):""}</ActualFinish>
101
+ <ActualDuration>PT${Math.round(b*p.progress/100)*8}H0M0S</ActualDuration>
102
102
  <ActualCost>0</ActualCost>
103
103
  <ActualOvertimeCost>0</ActualOvertimeCost>
104
- <ActualWork>PT${Math.round(b*m.progress/100)*8}H0M0S</ActualWork>
104
+ <ActualWork>PT${Math.round(b*p.progress/100)*8}H0M0S</ActualWork>
105
105
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
106
106
  <RegularWork>PT${b*8}H0M0S</RegularWork>
107
- <RemainingDuration>PT${Math.round(b*(100-m.progress)/100)*8}H0M0S</RemainingDuration>
107
+ <RemainingDuration>PT${Math.round(b*(100-p.progress)/100)*8}H0M0S</RemainingDuration>
108
108
  <RemainingCost>0</RemainingCost>
109
- <RemainingWork>PT${Math.round(b*(100-m.progress)/100)*8}H0M0S</RemainingWork>
109
+ <RemainingWork>PT${Math.round(b*(100-p.progress)/100)*8}H0M0S</RemainingWork>
110
110
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
111
111
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
112
112
  <ACWP>0</ACWP>
@@ -126,16 +126,16 @@
126
126
  <EarnedValueMethod>0</EarnedValueMethod>
127
127
  <IsPublished>1</IsPublished>
128
128
  <CommitmentType>0</CommitmentType>${v}
129
- </Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
129
+ </Task>`}).join(""),s=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
130
130
  <Project xmlns="http://schemas.microsoft.com/project">
131
131
  <SaveVersion>14</SaveVersion>
132
- <Name>${t.replace(/[<>&'"]/g,m=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[m]||m)}</Name>
133
- <Title>${t.replace(/[<>&'"]/g,m=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[m]||m)}</Title>
132
+ <Name>${t.replace(/[<>&'"]/g,p=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[p]||p)}</Name>
133
+ <Title>${t.replace(/[<>&'"]/g,p=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[p]||p)}</Title>
134
134
  <CreationDate>${o(new Date)}</CreationDate>
135
135
  <LastSaved>${o(new Date)}</LastSaved>
136
136
  <ScheduleFromStart>1</ScheduleFromStart>
137
- <StartDate>${o(s)}</StartDate>
138
- <FinishDate>${o(l)}</FinishDate>
137
+ <StartDate>${o(i)}</StartDate>
138
+ <FinishDate>${o(c)}</FinishDate>
139
139
  <FYStartDate>1</FYStartDate>
140
140
  <CriticalSlackLimit>0</CriticalSlackLimit>
141
141
  <CurrencyDigits>2</CurrencyDigits>
@@ -271,39 +271,84 @@
271
271
  </WeekDays>
272
272
  </Calendar>
273
273
  </Calendars>
274
- <Tasks>${c}
274
+ <Tasks>${l}
275
275
  </Tasks>
276
- </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=r,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=V.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let u=i.startDate&&i.endDate?V.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let p of i.dependencies){let x=t.find(b=>b.id===p);if(x){n(x);let b=a.get(p)?.ef||0;d=Math.max(d,b);}}let m=d+u;a.set(i.id,{es:d,ef:m});};r.forEach(n);let o=Math.max(...Array.from(a.values()).map(i=>i.ef)),s=new Map,l=i=>{if(s.has(i.id))return;let u=i.startDate&&i.endDate?V.calculateDuration(i.startDate,i.endDate):0,d=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),m=o;if(d.length>0)for(let x of d){l(x);let b=s.get(x.id)?.ls||0;m=Math.min(m,b);}let p=m-u;s.set(i.id,{ls:p,lf:m});};r.forEach(l);let c=[];for(let i of r){let u=a.get(i.id),d=s.get(i.id);if(u&&d){let m=d.ls-u.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateSlack:(e,t)=>{let r=V.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(V.calculateCriticalPath(e).includes(t))return 0;let n=V.getDependentTasks(e,t);if(n.length===0){let l=V.getLatestEndDate(e);if(!l)return null;let c=V.calculateDuration(r.endDate,l);return Math.max(0,c)}let o=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!o)return null;let s=V.calculateDuration(r.endDate,new Date(o));return Math.max(0,s)},isOnCriticalPath:(e,t)=>V.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r)=>{let a=V.findTaskById(e,t);if(!a||!a.endDate)return e;let n=V.getDependentTasks(e,t);if(n.length===0)return e;let o=[...e];for(let s of n){if(!s.startDate||!s.endDate)continue;let l=V.calculateDuration(s.startDate,s.endDate),c;r!==void 0?(c=new Date(s.startDate),c.setDate(c.getDate()+r)):(c=new Date(a.endDate),c.setDate(c.getDate()+1));let i=V.calculateEndDate(c,l),u=d=>d.map(m=>m.id===s.id?{...m,startDate:c,endDate:i}:m.subtasks?{...m,subtasks:u(m.subtasks)}:m);o=u(o),o=V.autoScheduleDependents(o,s.id,r);}return o},calculateCascadePreview:(e,t,r,a,n,o,s,l)=>{if(r===0)return [];let c=[],i=n.getTime(),u=1e3*60*60*24,d=V.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(p,x,b=new Set)=>{if(b.has(p))return;b.add(p);let v=V.getDependentTasks(e,p);for(let g of v){if(!g.startDate||!g.endDate)continue;let h=a.findIndex(U=>U.id===g.id);if(h===-1)continue;let f=g.startDate.getTime(),k=(g.endDate.getTime()-f)/u,T=(f-i)/u*o,C=T+x*o,D=Math.max(k*o,o),R=l+h*s+12;c.push({taskId:g.id,taskName:g.name,originalX:T,previewX:C,width:D,y:R,rowIndex:h,daysDelta:x,color:g.color}),m(g.id,x,b);}};return m(t,r),c},splitTask:(e,t,r,a=3)=>{let n=V.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let o=new Date(r);o.setDate(o.getDate()-1);let s=new Date(r);s.setDate(s.getDate()+a);let l=new Date(n.endDate);l.setDate(l.getDate()+a);let c=[{startDate:new Date(n.startDate),endDate:o},{startDate:s,endDate:l}],i=u=>u.map(d=>d.id===n.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Bn({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:s,templates:l,onTaskClick:c,onTaskDblClick:i,onTaskContextMenu:u,onTaskDateChange:d,onDependencyCreate:m,onDependencyDelete:p}){let[b,v]=Te.useState([]),g=Math.ceil((o.getTime()-n.getTime())/(1e3*60*60*24)),h=a==="day"?60:a==="week"?20:8,f=g*h*s,w=E=>{let B=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),$=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-$);let z=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-z.getTime())/864e5+1)/7)},k=E=>{let B=E.getDay();return B===0||B===6},y=Te.useCallback(E=>{let B=Math.round(E/(h*s)),$=new Date(n);return $.setDate($.getDate()+B),$},[n,h,s]),T=Te.useCallback((E,B)=>{if(B.startDate&&B.endDate)return;let $=E.currentTarget.ownerSVGElement;if(!$)return;let z=$.createSVGPoint();z.x=E.clientX,z.y=E.clientY;let L=z.matrixTransform($.getScreenCTM()?.inverse()),re=y(L.x),J=new Date(re);J.setDate(J.getDate()+1),d?.(B,re,J);},[y,d]),C=Te.useMemo(()=>{let E=L=>L.map(re=>{if(re.subtasks&&re.subtasks.length>0){let J=E(re.subtasks),ie=J.filter(P=>P.startDate&&P.endDate);if(ie.length>0){let P=ie.map(Qe=>Qe.startDate.getTime()),pe=ie.map(Qe=>Qe.endDate.getTime()),ne=new Date(Math.min(...P)),ze=new Date(Math.max(...pe));return {...re,subtasks:J,startDate:ne,endDate:ze}}return {...re,subtasks:J}}return re}),B=(L,re=[])=>{for(let J of L)re.push(J),J.subtasks&&J.subtasks.length>0&&(J.isExpanded===void 0||J.isExpanded)&&B(J.subtasks,re);return re},$=E(e);return B($)},[e]),D=Te.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let B=E.startDate.getTime(),$=E.endDate.getTime(),z=n.getTime(),L=(B-z)/(1e3*60*60*24),re=($-B)/(1e3*60*60*24),J=L*h*s,ie=Math.max(h*s,40),P=Math.max(re*h*s,ie);return {x:J,width:P}},[n,h,s]),R=Te.useMemo(()=>C.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:B,width:$}=D(E),L=C.findIndex(re=>re.id===E.id)*r+12;return {id:E.id,x:B,y:L,width:$,height:32}}),[C,D]),U=Te.useCallback((E,B,$)=>{if(!$||B===0){v([]);return}let z=V.calculateCascadePreview(e,E,B,C,n,h*s,r,48);v(z);},[e,C,n,h,s,r,48]),W=Te.useMemo(()=>{let E=[],B=new Date(n);for(;B<=o;){let L=(B.getTime()-n.getTime())/864e5*h*s;if(a==="day")E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:L}),B.setDate(B.getDate()+1);else if(a==="week"){let re=w(B);E.push({date:new Date(B),label:`Week ${re}`,x:L}),B.setDate(B.getDate()+7);}else E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:L}),B.setMonth(B.getMonth()+1);}return E},[n,o,a,h,s]),I=Te.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*h*s,[n,h,s]),O=Math.max(C.length*r,552);return jsxRuntime.jsxs("div",{className:"w-full h-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,borderBottom:`1px solid ${t.border}`},children:jsxRuntime.jsxs("svg",{width:Math.max(f,1e3),height:48,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(f,1e3),height:48,fill:t.bgGrid}),W.map((E,B)=>jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:E.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:E.label})]},`header-${B}`)),I>=0&&I<=f&&jsxRuntime.jsx("circle",{cx:I,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(f,1e3),height:O,style:{display:"block",flexShrink:0},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(f,1e3),height:O,fill:t.bgPrimary}),W.map((E,B)=>{let $=W[B+1]?.x||f,z=k(E.date);return jsxRuntime.jsxs("g",{children:[z&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:$-E.x,height:C.length*r,fill:t.bgWeekend,opacity:1}),jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:C.length*r,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),I>=0&&I<=f&&jsxRuntime.jsx("line",{x1:I,y1:0,x2:I,y2:C.length*r,stroke:t.today,strokeWidth:2,opacity:1}),C.map((E,B)=>{let $=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:B*r,width:f,height:r,fill:B%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:B*r,width:f,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:z=>T(z,E),onMouseEnter:z=>{z.currentTarget.setAttribute("fill",t.accentLight),z.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:z=>{z.currentTarget.setAttribute("fill","transparent"),z.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:I>0?I:100,y:B*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${E.id}`)]})]},`row-group-${E.id}`)}),C.map((E,B)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map($=>{let z=C.find(ie=>ie.id===$);if(!z||!z.startDate||!z.endDate)return null;let L=C.findIndex(ie=>ie.id===$),re=D(z),J=D(E);return jsxRuntime.jsx(In,{x1:re.x+re.width,y1:L*r+r/2,x2:J.x,y2:B*r+r/2,theme:t,onDelete:()=>p?.(E.id,$)},`dep-${$}-${E.id}`)})),C.map((E,B)=>{if(!E.startDate||!E.endDate)return null;let{x:$,width:z}=D(E),L=B*r+12,re=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(An,{task:E,x:$+z/2,y:L+16,theme:t,onClick:c},E.id):re?jsxRuntime.jsxs("g",{onClick:()=>c?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:$,y:L,width:z,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:$,y1:L,x2:$+z,y2:L,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$,y1:L,x2:$,y2:L+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$+z,y1:L,x2:$+z,y2:L+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$,y1:L+32,x2:$+z,y2:L+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),z>60&&jsxRuntime.jsx("text",{x:$+12,y:L+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:E.name})]},E.id):jsxRuntime.jsx(Rn,{task:E,x:$,y:L,width:z,theme:t,dayWidth:h*s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:m,allTaskPositions:R,onDragMove:U},E.id)}),b.map(E=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:E.previewX,y:E.y-48,width:E.width,height:32,rx:8,fill:E.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(E.daysDelta)>0&&jsxRuntime.jsx("text",{x:E.previewX+E.width/2,y:E.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:E.daysDelta>0?`+${E.daysDelta}d`:`${E.daysDelta}d`})]},`cascade-preview-${E.taskId}`))]})]})}var Gl=[{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:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function Hl({value:e="#6366F1",onChange:t,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Gl.map(a=>{let n=e===a.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!r&&t(a.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:a.value,boxShadow:n?`0 0 0 2px #FFFFFF, 0 0 0 4px ${a.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:r?.5:1,cursor:r?"not-allowed":"pointer"},whileHover:r?{}:{scale:1.1},whileTap:r?{}:{scale:.95},title:a.name,disabled:r,children:n&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},a.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:Gl.find(a=>a.value===e)?.name||"Personalizado"})]})}function On({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:s=false,mode:l=r?"edit":"create",theme:c="dark"}){let i=xe[c]||xe.dark,u={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},d={color:i.textSecondary},[m,p]=Te.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[x,b]=Te.useState({});Te.useEffect(()=>{p(r?{name:r.name,startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",isMilestone:r.isMilestone||false,color:r.color||"#6366F1",assignees:r.assignees||[],dependencies:r.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[r,e]);let v=()=>{let f={};return m.name.trim()||(f.name="El nombre es requerido"),m.startDate&&m.endDate&&m.startDate>m.endDate&&(f.endDate="La fecha de fin debe ser posterior a la de inicio"),b(f),Object.keys(f).length===0},g=async f=>{if(f.preventDefault(),!!v())try{await o(m),t();}catch(w){console.error("Error submitting task:",w);}},h=(f,w)=>{p(k=>{let y={...k,[f]:w};if(f==="progress"){let T=typeof w=="number"?w:parseInt(w,10);T===100&&k.status!=="completed"?y.status="completed":T>0&&T<100&&k.status==="todo"?y.status="in-progress":T===0&&k.status==="in-progress"&&(y.status="todo");}return y}),x[f]&&b(k=>{let y={...k};return delete y[f],y});};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/50 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:.2,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-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:l==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:f=>f.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:f=>f.currentTarget.style.backgroundColor="transparent",disabled:s,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:g,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:d,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:m.name,onChange:f=>h("name",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,onFocus:f=>f.currentTarget.style.borderColor=i.accent,onBlur:f=>f.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:s}),x.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),x.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsxRuntime.jsx("input",{type:"date",value:m.startDate?m.startDate.toISOString().split("T")[0]:"",onChange:f=>h("startDate",f.target.value?new Date(f.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||m.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsxRuntime.jsx("input",{type:"date",value:m.endDate?m.endDate.toISOString().split("T")[0]:"",onChange:f=>h("endDate",f.target.value?new Date(f.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||m.isMilestone}),x.endDate&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),x.endDate]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:m.status,onChange:f=>h("status",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s,children:[jsxRuntime.jsx("option",{value:"todo",children:"Por Hacer"}),jsxRuntime.jsx("option",{value:"in-progress",children:"En Progreso"}),jsxRuntime.jsx("option",{value:"completed",children:"Completada"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-3 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(Hl,{value:m.color,onChange:f=>h("color",f),disabled:s}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:i.textTertiary},children:r?.parentId?"Esta subtarea hereda el color de su tarea padre":r?.subtasks&&r.subtasks.length>0?"Las subtareas heredar\xE1n este color con menor opacidad":"Elige un color para organizar visualmente tus tareas"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:d,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-2 py-0.5 rounded text-sm",style:{color:m.progress<30?"#EF4444":m.progress<70?"#F59E0B":"#10B981",backgroundColor:m.progress<30?"rgba(239, 68, 68, 0.1)":m.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[m.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:m.progress,onChange:f=>h("progress",parseInt(f.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:m.progress<30?"#EF4444":m.progress<70?"#F59E0B":"#10B981"},disabled:s}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${m.progress}%`,backgroundColor:m.progress<30?"rgba(239, 68, 68, 0.3)":m.progress<70?"rgba(245, 158, 11, 0.3)":"rgba(16, 185, 129, 0.3)"}})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-3 gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:i.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(f=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>h("progress",f),disabled:s,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:m.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.bgSecondary,color:m.progress===f?"#FFFFFF":i.textSecondary,border:`1px solid ${m.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.borderLight}`},children:[f,"%"]},f))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:i.textTertiary},children:[jsxRuntime.jsx("span",{children:"0%"}),jsxRuntime.jsx("span",{children:"25%"}),jsxRuntime.jsx("span",{children:"50%"}),jsxRuntime.jsx("span",{children:"75%"}),jsxRuntime.jsx("span",{children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:m.isMilestone,onChange:f=>h("isMilestone",f.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),n.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:n.map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:m.assignees?.some(w=>w.name===f.name),onChange:w=>{let k=w.target.checked?[...m.assignees||[],{name:f.name,avatar:f.avatar,initials:f.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(m.assignees||[]).filter(y=>y.name!==f.name);h("assignees",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:i.accent},children:f.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:f.name})]})]},f.id))})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:a.filter(f=>f.id!==r?.id).map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:m.dependencies?.includes(f.id),onChange:w=>{let k=w.target.checked?[...m.dependencies||[],f.id]:(m.dependencies||[]).filter(y=>y!==f.id);h("dependencies",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:f.name})]},f.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:f=>{f.currentTarget.style.color=i.textPrimary,f.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:f=>{f.currentTarget.style.color=i.textSecondary,f.currentTarget.style.backgroundColor="transparent";},disabled:s,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:g,disabled:s,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:f=>!s&&(f.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:f=>!s&&(f.currentTarget.style.backgroundColor=i.accent),children:s?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.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),l==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var $f=['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"'],Xl=()=>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"})]}),Gf=()=>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"})}),Hf=()=>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"})}),_f=()=>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"})}),Vf=()=>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 Jl({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:o,onTaskDelete:s,onDependencyCreate:l,onDependencyDelete:c}){let[i,u]=Te.useState(false),[d,m]=Te.useState(false),[p,x]=Te.useState([]),[b,v]=Te.useState(""),[g,h]=Te.useState(false),[f,w]=Te.useState(true),k=Te.useRef(null),y=Te.useRef(null),T=Te.useRef(null),{enabled:C=true,placeholder:D='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:U,suggestions:W=$f,maxHistory:I=50}=r;Te.useEffect(()=>{y.current&&y.current.scrollIntoView({behavior:"smooth"});},[p]),Te.useEffect(()=>{i&&!d&&k.current&&setTimeout(()=>k.current?.focus(),100);},[i,d]);let O=Te.useCallback(L=>{if(L.success)switch(L.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":L.taskId&&L.updates&&n?.(L.taskId,L.updates);break;case "create_task":L.newTask&&o?.(L.newTask);break;case "delete_task":L.taskId&&s?.(L.taskId);break;case "link_tasks":L.dependencyFrom&&L.dependencyTo&&l?.(L.dependencyFrom,L.dependencyTo);break;case "unlink_tasks":L.taskId&&L.dependencyFrom&&c?.(L.taskId,L.dependencyFrom);break}},[n,o,s,l,c]),E=Te.useCallback(async L=>{if(!L.trim()||g)return;let re={id:`user-${Date.now()}`,role:"user",content:L,timestamp:new Date};x(ie=>[...ie.slice(-(I-1)),re]),v(""),w(false),h(true);let J={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(ie=>[...ie,J]);try{if(U){let ie=await U(L,e);x(P=>{let pe=P.filter(ze=>!ze.isLoading),ne={id:`assistant-${Date.now()}`,role:"assistant",content:ie.message,timestamp:new Date,command:ie};return [...pe,ne]}),O(ie);}else x(ie=>[...ie.filter(pe=>!pe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(ie){x(P=>[...P.filter(ne=>!ne.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);}},[g,I,U,e,O]),B=L=>{L.preventDefault(),E(b);},$=L=>{v(L),k.current?.focus();};if(Te.useEffect(()=>{let L=re=>{(re.metaKey||re.ctrlKey)&&re.key==="k"&&(re.preventDefault(),u(J=>!J),i||m(false)),re.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[i]),!C)return null;let z={"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(Ke,{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.1},whileTap:{scale:.95},className:`fixed ${z[R]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)",color:"white",boxShadow:"0 4px 20px rgba(99, 102, 241, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(Xl,{}),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 ${z[R]} 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, #6366F1 0%, #8B5CF6 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(Xl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>m(L=>!L),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(_f,{})}),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(Hf,{})})]})]}),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:[p.length===0&&f&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((L,re)=>jsxRuntime.jsx("button",{onClick:()=>$(L),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:L.length>30?L.slice(0,30)+"...":L},re))})]}),p.map(L=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${L.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${L.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:L.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:L.role==="user"?"white":t.textPrimary},children:[L.isLoading?jsxRuntime.jsx(Vf,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:L.content}),L.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:L.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:L.command.success?"#10B981":"#EF4444"},children:[L.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:L.command.type.replace(/_/g," ")})]})]})},L.id)),jsxRuntime.jsx("div",{ref:y})]}),jsxRuntime.jsxs("form",{onSubmit:B,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:k,type:"text",value:b,onChange:L=>v(L.target.value),placeholder:D,disabled:g,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!b.trim()||g,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:b.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:b.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Gf,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Zl(e,t=50){let[r,a]=Te.useState({past:[],present:e,future:[]}),n=Te.useRef(false),o=Te.useCallback((i,u=true)=>{a(d=>{let m=typeof i=="function"?i(d.present):i;if(n.current)return {...d,present:m};if(!u)return {...d,present:m};let p=[...d.past,d.present];return p.length>t&&p.shift(),{past:p,present:m,future:[]}});},[t]),s=Te.useCallback(()=>{a(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 n.current=true,setTimeout(()=>{n.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),l=Te.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),c=Te.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:o,undo:s,redo:l,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:c}}function Ql({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){Te.useEffect(()=>{if(!n)return;let o=s=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?s.metaKey:s.ctrlKey;if(c&&s.key==="z"&&!s.shiftKey&&r){s.preventDefault(),e();return}if(a){if(!l&&c&&s.key==="y"){s.preventDefault(),t();return}if(l&&c&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var qf={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${V.formatDate(e.startDate)} - ${V.formatDate(e.endDate)}`);let r=V.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} 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 r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,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=>V.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function ec(e){return {...qf,...e}}var eg=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},ac=Te.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:o,timeScale:s="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:m=true,aiAssistant:p,onThemeChange:x,onTaskClick:b,onTaskDblClick:v,onTaskContextMenu:g,onTaskUpdate:h,onProgressChange:f,onDependencyCreate:w,onDependencyDelete:k,onBeforeTaskAdd:y,onAfterTaskAdd:T,onBeforeTaskUpdate:C,onAfterTaskUpdate:D}=r,U=Te.useContext(Tn)?.theme,[W,I]=Te.useState(U||o||"dark"),[O,E]=Te.useState(s),[B,$]=Te.useState(l),[z,L]=Te.useState(1),[re,J]=Te.useState(0),[ie,P]=Te.useState(false),[pe,ne]=Te.useState(null),[ze,Qe]=Te.useState({isOpen:false,x:0,y:0,task:null}),[St,ke]=Te.useState(null);Te.useEffect(()=>{U&&U!==W&&I(U);},[U]),Te.useEffect(()=>{o&&o!==W&&I(o);},[o]);let bt=Te.useCallback(N=>{I(N),x?.(N);},[x]),{state:te,setState:ce,undo:Ft,redo:dr,canUndo:gt,canRedo:et,clearHistory:tr}=Zl(t,50);Te.useEffect(()=>{ce(t);},[t,ce]),Te.useEffect(()=>{a&&a(te);},[te,a]);let[$t,yr]=Te.useState([{id:"name",label:"TASK NAME",width:320,minWidth:180,maxWidth:800,visible:true,sortable:true,resizable:true},{id:"startDate",label:"Start Date",width:110,visible:false,sortable:true},{id:"endDate",label:"End Date",width:110,visible:false,sortable:true},{id:"duration",label:"Duration",width:80,visible:false,sortable:true},{id:"assignees",label:"Assignees",width:120,visible:false,sortable:false},{id:"status",label:"Status",width:80,visible:false,sortable:true},{id:"progress",label:"% Complete",width:120,visible:false,sortable:true}]),Gt=Te.useMemo(()=>$t.filter(N=>N.visible).reduce((N,M)=>N+M.width,0)+60,[$t]),K=pe||Gt,G=Te.useRef(null),we=Te.useRef(null),Ae=Te.useRef(null),de=Te.useMemo(()=>xl(W),[W]),ge=Te.useMemo(()=>({theme:de,themeName:W}),[de,W]),he=Te.useMemo(()=>ec(d),[d]),rr=Te.useMemo(()=>{if(!m)return te;let N=V.calculateCriticalPath(te),M=H=>H.map(X=>({...X,isCriticalPath:N.includes(X.id),subtasks:X.subtasks?M(X.subtasks):void 0}));return M(te)},[te,m]),se=eg(B);Ql({undo:Ft,redo:dr,canUndo:gt,canRedo:et,enabled:true}),Te.useImperativeHandle(n,()=>({getTask:N=>V.findTaskById(te,N),addTask:(N,M)=>{ce(H=>{if(!M)return [...H,{...N,level:0}];let X=ee=>ee.map(oe=>oe.id===M?{...oe,subtasks:[...oe.subtasks||[],{...N,parentId:M,level:(oe.level||0)+1}],isExpanded:true}:oe.subtasks?{...oe,subtasks:X(oe.subtasks)}:oe);return X(H)});},updateTask:(N,M)=>{ce(H=>{let X=ee=>ee.map(oe=>oe.id===N?{...oe,...M}:oe.subtasks?{...oe,subtasks:X(oe.subtasks)}:oe);return X(H)});},deleteTask:N=>{ce(M=>{let H=X=>X.filter(ee=>ee.id===N?false:(ee.subtasks&&(ee.subtasks=H(ee.subtasks)),true));return H(M)});},deleteTasks:N=>{ce(M=>Nn(M,N));},duplicateTask:N=>{ce(M=>Qo(M,[N]));},splitTask:(N,M,H=3)=>{ce(X=>V.splitTask(X,N,M,H));},calculateEndDate:V.calculateEndDate,calculateDuration:V.calculateDuration,validateDependency:(N,M)=>!V.validateDependencies(te,N,M),getAllTasks:()=>V.flattenTasks(te),getTasksByStatus:N=>V.flattenTasks(te).filter(M=>M.status===N),getTasksByParent:N=>N?V.findTaskById(te,N)?.subtasks||[]:te.filter(H=>!H.parentId),getCriticalPath:()=>V.flattenTasks(te).filter(N=>N.isCriticalPath),indentTask:N=>{ce(M=>Xo(M,[N]));},outdentTask:N=>{ce(M=>Jo(M,[N]));},moveTask:(N,M)=>{ce(H=>Zo(H,[N],M));},createSubtask:async N=>{let{tasks:M,newTask:H}=rs(te,N);if(y){let X=y({...H,parentId:N});if((X instanceof Promise?await X:X)===false)return}ce(M),T&&T({...H,parentId:N});},scrollToTask:N=>{let H=V.flattenTasks(te).findIndex(X=>X.id===N);if(H!==-1&&G.current){let X=H*se;G.current.scrollTo({top:X,behavior:"smooth"}),we.current&&we.current.scrollTo({top:X,behavior:"smooth"});}},highlightTask:(N,M=2e3)=>{},expandTask:N=>{ce(M=>{let H=X=>X.map(ee=>ee.id===N?{...ee,isExpanded:true}:ee.subtasks?{...ee,subtasks:H(ee.subtasks)}:ee);return H(M)});},collapseTask:N=>{ce(M=>{let H=X=>X.map(ee=>ee.id===N?{...ee,isExpanded:false}:ee.subtasks?{...ee,subtasks:H(ee.subtasks)}:ee);return H(M)});},expandAll:()=>{ce(N=>{let M=H=>H.map(X=>({...X,isExpanded:true,subtasks:X.subtasks?M(X.subtasks):void 0}));return M(N)});},collapseAll:()=>{ce(N=>{let M=H=>H.map(X=>({...X,isExpanded:false,subtasks:X.subtasks?M(X.subtasks):void 0}));return M(N)});},undo:Ft,redo:dr,canUndo:()=>gt,canRedo:()=>et,clearHistory:tr,exportToPNG:async()=>{if(!Ae.current)throw new Error("Gantt container not found");let N=await tc__default.default(Ae.current,{backgroundColor:de.bgPrimary,scale:2});return new Promise((M,H)=>{N.toBlob(X=>{X?M(X):H(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await V.exportToPDF(te,N);},exportToExcel:async N=>{await V.exportToExcel(te,N);},exportToJSON:()=>V.exportToJSON(te),exportToCSV:()=>V.exportToCSV(te),importFromJSON:N=>{let M=V.importFromJSON(N);ce(M);},getTasks:()=>te,refresh:()=>{ce(N=>[...N]);},clearAll:()=>{ce([]);}}),[te,Ft,dr,gt,et,tr,de,se]);let ye=Te.useCallback(N=>{yr(M=>M.map(H=>H.id===N?{...H,visible:!H.visible}:H));},[]),j=Te.useCallback((N,M)=>{yr(H=>H.map(X=>{if(X.id!==N)return X;let ee=X.minWidth??100,oe=X.maxWidth??800,tt=Math.max(ee,Math.min(oe,M));return {...X,width:tt}}));},[]),Ce=Te.useCallback(N=>{ce(M=>ts(M,N)),r.onTaskToggleExpand?.(N);},[r]),S=Te.useCallback((N,M)=>{if(C&&C(N,M)===false)return;let X=V.findTaskById(te,N)?.progress,ee=tt=>tt.map(ot=>ot.id===N?{...ot,...M}:ot.subtasks?{...ot,subtasks:ee(ot.subtasks)}:ot);ce(ee(te));let oe=V.findTaskById(ee(te),N);oe&&(h?.(oe),D?.(oe),M.progress!==void 0&&X!==void 0&&M.progress!==X&&f?.(N,X,M.progress));},[te,h,C,D,f]),_=Te.useCallback(N=>{N.length!==0&&(ce(M=>Xo(M,N)),r.onTaskIndent?.(N[0]));},[r]),ue=Te.useCallback(N=>{N.length!==0&&(ce(M=>Jo(M,N)),r.onTaskOutdent?.(N[0]));},[r]),Pe=Te.useCallback((N,M)=>{N.length!==0&&(ce(H=>Zo(H,N,M)),r.onTaskMove?.(N[0],M));},[r]),Be=Te.useCallback(N=>{r.onMultiTaskDelete?r.onMultiTaskDelete(N):(ce(M=>Nn(M,N)),N.forEach(M=>r.onTaskDelete?.(M)));},[r]),He=Te.useCallback(N=>{ce(M=>Qo(M,N)),N.forEach(M=>r.onTaskDuplicate?.(M));},[r]),Mt=Te.useCallback((N,M)=>{ce(H=>{let{tasks:X,newTask:ee}=Il(H,N,M);return y&&y(ee)===false?H:(r.onTaskCreate?.(ee.parentId,ee.position||0),T?.(ee),X)});},[r,y,T]),Bt=Te.useCallback((N,M)=>{ce(H=>es(H,N,M)),r.onTaskRename?.(N,M);},[r]),jn=Te.useCallback(N=>{ce(M=>{let{tasks:H}=rs(M,N);return r.onTaskCreate?.(N,0),H});},[r]),fa=Te.useCallback((N,M,H)=>{let X=N.startDate?Math.round((M.getTime()-N.startDate.getTime())/864e5):0,ee=ot=>ot.map(ur=>ur.id===N.id?{...ur,startDate:M,endDate:H,...N.segments&&{segments:N.segments}}:ur.subtasks?{...ur,subtasks:ee(ur.subtasks)}:ur),oe=ee(te);oe=V.autoScheduleDependents(oe,N.id,X),ce(oe);let tt={...N,startDate:M,endDate:H};h?.(tt);},[te,h]),ga=Te.useCallback((N,M)=>{g?.(N,M),Qe({isOpen:true,x:M.clientX,y:M.clientY,task:N});},[g]),Jc=Te.useCallback((N,M)=>{let H=V.splitTask(te,N.id,M);ce(H),Qe({isOpen:false,x:0,y:0,task:null});},[te]),Us=Te.useCallback(N=>{v?.(N),ke(N);},[v]),Ws=Te.useCallback((N,M,H)=>{let X=new Map,ee=Ar=>{Ar.forEach(Lr=>{Lr.dependencies&&X.set(Lr.id,Lr.dependencies),Lr.subtasks&&ee(Lr.subtasks);});};ee(H);let oe=X.get(M)||[];X.set(M,[...oe,N]);let tt=new Set,ot=new Set,ur=Ar=>{if(!tt.has(Ar)){tt.add(Ar),ot.add(Ar);let Lr=X.get(Ar)||[];for(let Yn of Lr){if(!tt.has(Yn)&&ur(Yn))return true;if(ot.has(Yn))return true}}return ot.delete(Ar),false};return ur(M)},[]),$s=Te.useCallback((N,M)=>{if(Ws(N.id,M,te)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
276
+ </Project>`,u=new Blob([s],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=r,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=V.flattenTasks(e),r=t.filter(s=>s.startDate&&s.endDate);if(r.length===0)return [];let a=new Map,n=s=>{if(a.has(s.id))return;let u=s.startDate&&s.endDate?V.calculateDuration(s.startDate,s.endDate):0,d=0;if(s.dependencies&&s.dependencies.length>0)for(let m of s.dependencies){let x=t.find(b=>b.id===m);if(x){n(x);let b=a.get(m)?.ef||0;d=Math.max(d,b);}}let p=d+u;a.set(s.id,{es:d,ef:p});};r.forEach(n);let o=Math.max(...Array.from(a.values()).map(s=>s.ef)),i=new Map,c=s=>{if(i.has(s.id))return;let u=s.startDate&&s.endDate?V.calculateDuration(s.startDate,s.endDate):0,d=t.filter(x=>x.dependencies&&x.dependencies.includes(s.id)),p=o;if(d.length>0)for(let x of d){c(x);let b=i.get(x.id)?.ls||0;p=Math.min(p,b);}let m=p-u;i.set(s.id,{ls:m,lf:p});};r.forEach(c);let l=[];for(let s of r){let u=a.get(s.id),d=i.get(s.id);if(u&&d){let p=d.ls-u.es;Math.abs(p)<.01&&l.push(s.id);}}return l},calculateSlack:(e,t)=>{let r=V.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(V.calculateCriticalPath(e).includes(t))return 0;let n=V.getDependentTasks(e,t);if(n.length===0){let c=V.getLatestEndDate(e);if(!c)return null;let l=V.calculateDuration(r.endDate,c);return Math.max(0,l)}let o=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,l)=>c-l)[0];if(!o)return null;let i=V.calculateDuration(r.endDate,new Date(o));return Math.max(0,i)},isOnCriticalPath:(e,t)=>V.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r)=>{let a=V.findTaskById(e,t);if(!a||!a.endDate)return e;let n=V.getDependentTasks(e,t);if(n.length===0)return e;let o=[...e];for(let i of n){if(!i.startDate||!i.endDate)continue;let c=V.calculateDuration(i.startDate,i.endDate),l;r!==void 0?(l=new Date(i.startDate),l.setDate(l.getDate()+r)):(l=new Date(a.endDate),l.setDate(l.getDate()+1));let s=V.calculateEndDate(l,c),u=d=>d.map(p=>p.id===i.id?{...p,startDate:l,endDate:s}:p.subtasks?{...p,subtasks:u(p.subtasks)}:p);o=u(o),o=V.autoScheduleDependents(o,i.id,r);}return o},calculateCascadePreview:(e,t,r,a,n,o,i,c)=>{if(r===0)return [];let l=[],s=n.getTime(),u=1e3*60*60*24,d=V.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(m,x,b=new Set)=>{if(b.has(m))return;b.add(m);let v=V.getDependentTasks(e,m);for(let g of v){if(!g.startDate||!g.endDate)continue;let h=a.findIndex($=>$.id===g.id);if(h===-1)continue;let f=g.startDate.getTime(),k=(g.endDate.getTime()-f)/u,T=(f-s)/u*o,C=T+x*o,D=Math.max(k*o,o),R=c+h*i+12;l.push({taskId:g.id,taskName:g.name,originalX:T,previewX:C,width:D,y:R,rowIndex:h,daysDelta:x,color:g.color}),p(g.id,x,b);}};return p(t,r),l},splitTask:(e,t,r,a=3)=>{let n=V.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let o=new Date(r);o.setDate(o.getDate()-1);let i=new Date(r);i.setDate(i.getDate()+a);let c=new Date(n.endDate);c.setDate(c.getDate()+a);let l=[{startDate:new Date(n.startDate),endDate:o},{startDate:i,endDate:c}],s=u=>u.map(d=>d.id===n.id?{...d,endDate:c,segments:l}:d.subtasks?{...d,subtasks:s(d.subtasks)}:d);return s(e)}};function On({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:i,templates:c,onTaskClick:l,onTaskDblClick:s,onTaskContextMenu:u,onTaskDateChange:d,onDependencyCreate:p,onDependencyDelete:m}){let[b,v]=Te.useState([]),g=Math.ceil((o.getTime()-n.getTime())/(1e3*60*60*24)),h=a==="day"?60:a==="week"?20:8,f=g*h*i,w=E=>{let B=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),U=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-U);let z=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-z.getTime())/864e5+1)/7)},k=E=>{let B=E.getDay();return B===0||B===6},y=Te.useCallback(E=>{let B=Math.round(E/(h*i)),U=new Date(n);return U.setDate(U.getDate()+B),U},[n,h,i]),T=Te.useCallback((E,B)=>{if(B.startDate&&B.endDate)return;let U=E.currentTarget.ownerSVGElement;if(!U)return;let z=U.createSVGPoint();z.x=E.clientX,z.y=E.clientY;let L=z.matrixTransform(U.getScreenCTM()?.inverse()),re=y(L.x),J=new Date(re);J.setDate(J.getDate()+1),d?.(B,re,J);},[y,d]),C=Te.useMemo(()=>{let E=L=>L.map(re=>{if(re.subtasks&&re.subtasks.length>0){let J=E(re.subtasks),ie=J.filter(P=>P.startDate&&P.endDate);if(ie.length>0){let P=ie.map(Qe=>Qe.startDate.getTime()),pe=ie.map(Qe=>Qe.endDate.getTime()),ne=new Date(Math.min(...P)),ze=new Date(Math.max(...pe));return {...re,subtasks:J,startDate:ne,endDate:ze}}return {...re,subtasks:J}}return re}),B=(L,re=[])=>{for(let J of L)re.push(J),J.subtasks&&J.subtasks.length>0&&(J.isExpanded===void 0||J.isExpanded)&&B(J.subtasks,re);return re},U=E(e);return B(U)},[e]),D=Te.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let B=E.startDate.getTime(),U=E.endDate.getTime(),z=n.getTime(),L=(B-z)/(1e3*60*60*24),re=(U-B)/(1e3*60*60*24),J=L*h*i,ie=Math.max(h*i,40),P=Math.max(re*h*i,ie);return {x:J,width:P}},[n,h,i]),R=Te.useMemo(()=>C.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:B,width:U}=D(E),L=C.findIndex(re=>re.id===E.id)*r+12;return {id:E.id,x:B,y:L,width:U,height:32}}),[C,D]),$=Te.useCallback((E,B,U)=>{if(!U||B===0){v([]);return}let z=V.calculateCascadePreview(e,E,B,C,n,h*i,r,48);v(z);},[e,C,n,h,i,r,48]),_=Te.useMemo(()=>{let E=[],B=new Date(n);for(;B<=o;){let L=(B.getTime()-n.getTime())/864e5*h*i;if(a==="day")E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:L}),B.setDate(B.getDate()+1);else if(a==="week"){let re=w(B);E.push({date:new Date(B),label:`Week ${re}`,x:L}),B.setDate(B.getDate()+7);}else E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:L}),B.setMonth(B.getMonth()+1);}return E},[n,o,a,h,i]),I=Te.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*h*i,[n,h,i]),O=Math.max(C.length*r,552);return jsxRuntime.jsxs("div",{className:"w-full h-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,borderBottom:`1px solid ${t.border}`},children:jsxRuntime.jsxs("svg",{width:Math.max(f,1e3),height:48,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(f,1e3),height:48,fill:t.bgGrid}),_.map((E,B)=>jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:E.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:E.label})]},`header-${B}`)),I>=0&&I<=f&&jsxRuntime.jsx("circle",{cx:I,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(f,1e3),height:O,style:{display:"block",flexShrink:0},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(f,1e3),height:O,fill:t.bgPrimary}),_.map((E,B)=>{let U=_[B+1]?.x||f,z=k(E.date);return jsxRuntime.jsxs("g",{children:[z&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:U-E.x,height:C.length*r,fill:t.bgWeekend,opacity:1}),jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:C.length*r,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),I>=0&&I<=f&&jsxRuntime.jsx("line",{x1:I,y1:0,x2:I,y2:C.length*r,stroke:t.today,strokeWidth:2,opacity:1}),C.map((E,B)=>{let U=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:B*r,width:f,height:r,fill:B%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:B*r,width:f,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:z=>T(z,E),onMouseEnter:z=>{z.currentTarget.setAttribute("fill",t.accentLight),z.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:z=>{z.currentTarget.setAttribute("fill","transparent"),z.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:I>0?I:100,y:B*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${E.id}`)]})]},`row-group-${E.id}`)}),C.map((E,B)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(U=>{let z=C.find(ie=>ie.id===U);if(!z||!z.startDate||!z.endDate)return null;let L=C.findIndex(ie=>ie.id===U),re=D(z),J=D(E);return jsxRuntime.jsx(Mn,{x1:re.x+re.width,y1:L*r+r/2,x2:J.x,y2:B*r+r/2,theme:t,onDelete:()=>m?.(E.id,U)},`dep-${U}-${E.id}`)})),C.map((E,B)=>{if(!E.startDate||!E.endDate)return null;let{x:U,width:z}=D(E),L=B*r+12,re=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Ln,{task:E,x:U+z/2,y:L+16,theme:t,onClick:l},E.id):re?jsxRuntime.jsxs("g",{onClick:()=>l?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:U,y:L,width:z,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:U,y1:L,x2:U+z,y2:L,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:L,x2:U,y2:L+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U+z,y1:L,x2:U+z,y2:L+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:L+32,x2:U+z,y2:L+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),z>60&&jsxRuntime.jsx("text",{x:U+12,y:L+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:E.name})]},E.id):jsxRuntime.jsx(Pn,{task:E,x:U,y:L,width:z,theme:t,dayWidth:h*i,startDate:n,templates:c,onClick:l,onDoubleClick:s,onContextMenu:u,onDateChange:d,onDependencyCreate:p,allTaskPositions:R,onDragMove:$},E.id)}),b.map(E=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:E.previewX,y:E.y-48,width:E.width,height:32,rx:8,fill:E.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(E.daysDelta)>0&&jsxRuntime.jsx("text",{x:E.previewX+E.width/2,y:E.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:E.daysDelta>0?`+${E.daysDelta}d`:`${E.daysDelta}d`})]},`cascade-preview-${E.taskId}`))]})]})}var jl=[{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:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function Yl({value:e="#6366F1",onChange:t,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:jl.map(a=>{let n=e===a.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!r&&t(a.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:a.value,boxShadow:n?`0 0 0 2px #FFFFFF, 0 0 0 4px ${a.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:r?.5:1,cursor:r?"not-allowed":"pointer"},whileHover:r?{}:{scale:1.1},whileTap:r?{}:{scale:.95},title:a.name,disabled:r,children:n&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},a.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:jl.find(a=>a.value===e)?.name||"Personalizado"})]})}function zn({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:i=false,mode:c=r?"edit":"create",theme:l="dark"}){let s=xe[l]||xe.dark,u={backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.textPrimary},d={color:s.textSecondary},[p,m]=Te.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[x,b]=Te.useState({});Te.useEffect(()=>{m(r?{name:r.name,startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",isMilestone:r.isMilestone||false,color:r.color||"#6366F1",assignees:r.assignees||[],dependencies:r.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[r,e]);let v=()=>{let f={};return p.name.trim()||(f.name="El nombre es requerido"),p.startDate&&p.endDate&&p.startDate>p.endDate&&(f.endDate="La fecha de fin debe ser posterior a la de inicio"),b(f),Object.keys(f).length===0},g=async f=>{if(f.preventDefault(),!!v())try{await o(p),t();}catch(w){console.error("Error submitting task:",w);}},h=(f,w)=>{m(k=>{let y={...k,[f]:w};if(f==="progress"){let T=typeof w=="number"?w:parseInt(w,10);T===100&&k.status!=="completed"?y.status="completed":T>0&&T<100&&k.status==="todo"?y.status="in-progress":T===0&&k.status==="in-progress"&&(y.status="todo");}return y}),x[f]&&b(k=>{let y={...k};return delete y[f],y});};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/50 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:.2,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-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:s.bgPrimary,border:`1px solid ${s.border}`},onClick:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${s.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:s.textPrimary},children:c==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:f=>f.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:f=>f.currentTarget.style.backgroundColor="transparent",disabled:i,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:g,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:d,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:p.name,onChange:f=>h("name",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,onFocus:f=>f.currentTarget.style.borderColor=s.accent,onBlur:f=>f.currentTarget.style.borderColor=s.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:i}),x.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),x.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsxRuntime.jsx("input",{type:"date",value:p.startDate?p.startDate.toISOString().split("T")[0]:"",onChange:f=>h("startDate",f.target.value?new Date(f.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:i||p.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsxRuntime.jsx("input",{type:"date",value:p.endDate?p.endDate.toISOString().split("T")[0]:"",onChange:f=>h("endDate",f.target.value?new Date(f.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:i||p.isMilestone}),x.endDate&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),x.endDate]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:p.status,onChange:f=>h("status",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:i,children:[jsxRuntime.jsx("option",{value:"todo",children:"Por Hacer"}),jsxRuntime.jsx("option",{value:"in-progress",children:"En Progreso"}),jsxRuntime.jsx("option",{value:"completed",children:"Completada"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-3 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(Yl,{value:p.color,onChange:f=>h("color",f),disabled:i}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:s.textTertiary},children:r?.parentId?"Esta subtarea hereda el color de su tarea padre":r?.subtasks&&r.subtasks.length>0?"Las subtareas heredar\xE1n este color con menor opacidad":"Elige un color para organizar visualmente tus tareas"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:d,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-2 py-0.5 rounded text-sm",style:{color:p.progress<30?"#EF4444":p.progress<70?"#F59E0B":"#10B981",backgroundColor:p.progress<30?"rgba(239, 68, 68, 0.1)":p.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[p.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:p.progress,onChange:f=>h("progress",parseInt(f.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:s.bgSecondary,accentColor:p.progress<30?"#EF4444":p.progress<70?"#F59E0B":"#10B981"},disabled:i}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${p.progress}%`,backgroundColor:p.progress<30?"rgba(239, 68, 68, 0.3)":p.progress<70?"rgba(245, 158, 11, 0.3)":"rgba(16, 185, 129, 0.3)"}})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-3 gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:s.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(f=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>h("progress",f),disabled:i,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:p.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":s.bgSecondary,color:p.progress===f?"#FFFFFF":s.textSecondary,border:`1px solid ${p.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":s.borderLight}`},children:[f,"%"]},f))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:s.textTertiary},children:[jsxRuntime.jsx("span",{children:"0%"}),jsxRuntime.jsx("span",{children:"25%"}),jsxRuntime.jsx("span",{children:"50%"}),jsxRuntime.jsx("span",{children:"75%"}),jsxRuntime.jsx("span",{children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:p.isMilestone,onChange:f=>h("isMilestone",f.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:s.accent},disabled:i}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:s.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),n.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:n.map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.assignees?.some(w=>w.name===f.name),onChange:w=>{let k=w.target.checked?[...p.assignees||[],{name:f.name,avatar:f.avatar,initials:f.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),color:s.accent}]:(p.assignees||[]).filter(y=>y.name!==f.name);h("assignees",k);},className:"w-4 h-4 rounded",style:{accentColor:s.accent},disabled:i}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:s.accent},children:f.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:s.textPrimary},children:f.name})]})]},f.id))})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:a.filter(f=>f.id!==r?.id).map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.dependencies?.includes(f.id),onChange:w=>{let k=w.target.checked?[...p.dependencies||[],f.id]:(p.dependencies||[]).filter(y=>y!==f.id);h("dependencies",k);},className:"w-4 h-4 rounded",style:{accentColor:s.accent},disabled:i}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:s.textPrimary},children:f.name})]},f.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${s.border}`,backgroundColor:s.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:f=>{f.currentTarget.style.color=s.textPrimary,f.currentTarget.style.backgroundColor=s.hoverBg;},onMouseLeave:f=>{f.currentTarget.style.color=s.textSecondary,f.currentTarget.style.backgroundColor="transparent";},disabled:i,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:g,disabled:i,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:s.accent,color:"#FFFFFF"},onMouseEnter:f=>!i&&(f.currentTarget.style.backgroundColor=s.accentHover),onMouseLeave:f=>!i&&(f.currentTarget.style.backgroundColor=s.accent),children:i?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.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Jf=['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"'],tc=()=>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"})]}),Zf=()=>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"})}),Qf=()=>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"})}),eg=()=>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"})}),tg=()=>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 $n({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:o,onTaskDelete:i,onDependencyCreate:c,onDependencyDelete:l}){let[s,u]=Te.useState(false),[d,p]=Te.useState(false),[m,x]=Te.useState([]),[b,v]=Te.useState(""),[g,h]=Te.useState(false),[f,w]=Te.useState(true),k=Te.useRef(null),y=Te.useRef(null),T=Te.useRef(null),{enabled:C=true,placeholder:D='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:$,suggestions:_=Jf,maxHistory:I=50}=r;Te.useEffect(()=>{y.current&&y.current.scrollIntoView({behavior:"smooth"});},[m]),Te.useEffect(()=>{s&&!d&&k.current&&setTimeout(()=>k.current?.focus(),100);},[s,d]);let O=Te.useCallback(L=>{if(L.success)switch(L.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":L.taskId&&L.updates&&n?.(L.taskId,L.updates);break;case "create_task":L.newTask&&o?.(L.newTask);break;case "delete_task":L.taskId&&i?.(L.taskId);break;case "link_tasks":L.dependencyFrom&&L.dependencyTo&&c?.(L.dependencyFrom,L.dependencyTo);break;case "unlink_tasks":L.taskId&&L.dependencyFrom&&l?.(L.taskId,L.dependencyFrom);break}},[n,o,i,c,l]),E=Te.useCallback(async L=>{if(!L.trim()||g)return;let re={id:`user-${Date.now()}`,role:"user",content:L,timestamp:new Date};x(ie=>[...ie.slice(-(I-1)),re]),v(""),w(false),h(true);let J={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(ie=>[...ie,J]);try{if($){let ie=await $(L,e);x(P=>{let pe=P.filter(ze=>!ze.isLoading),ne={id:`assistant-${Date.now()}`,role:"assistant",content:ie.message,timestamp:new Date,command:ie};return [...pe,ne]}),O(ie);}else x(ie=>[...ie.filter(pe=>!pe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(ie){x(P=>[...P.filter(ne=>!ne.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);}},[g,I,$,e,O]),B=L=>{L.preventDefault(),E(b);},U=L=>{v(L),k.current?.focus();};if(Te.useEffect(()=>{let L=re=>{(re.metaKey||re.ctrlKey)&&re.key==="k"&&(re.preventDefault(),u(J=>!J),s||p(false)),re.key==="Escape"&&s&&u(false);};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[s]),!C)return null;let z={"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(Ke,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!s&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.1},whileTap:{scale:.95},className:`fixed ${z[R]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)",color:"white",boxShadow:"0 4px 20px rgba(99, 102, 241, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(tc,{}),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:s&&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 ${z[R]} 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, #6366F1 0%, #8B5CF6 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(tc,{}),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(L=>!L),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(eg,{})}),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(Qf,{})})]})]}),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:[m.length===0&&f&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:_.slice(0,4).map((L,re)=>jsxRuntime.jsx("button",{onClick:()=>U(L),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:L.length>30?L.slice(0,30)+"...":L},re))})]}),m.map(L=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${L.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${L.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:L.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:L.role==="user"?"white":t.textPrimary},children:[L.isLoading?jsxRuntime.jsx(tg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:L.content}),L.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:L.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:L.command.success?"#10B981":"#EF4444"},children:[L.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:L.command.type.replace(/_/g," ")})]})]})},L.id)),jsxRuntime.jsx("div",{ref:y})]}),jsxRuntime.jsxs("form",{onSubmit:B,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:k,type:"text",value:b,onChange:L=>v(L.target.value),placeholder:D,disabled:g,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!b.trim()||g,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:b.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:b.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Zf,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function rc(e,t=50){let[r,a]=Te.useState({past:[],present:e,future:[]}),n=Te.useRef(false),o=Te.useCallback((s,u=true)=>{a(d=>{let p=typeof s=="function"?s(d.present):s;if(n.current)return {...d,present:p};if(!u)return {...d,present:p};let m=[...d.past,d.present];return m.length>t&&m.shift(),{past:m,present:p,future:[]}});},[t]),i=Te.useCallback(()=>{a(s=>{if(s.past.length===0)return s;let u=s.past[s.past.length-1],d=s.past.slice(0,s.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:d,present:u,future:[s.present,...s.future]}});},[]),c=Te.useCallback(()=>{a(s=>{if(s.future.length===0)return s;let u=s.future[0],d=s.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...s.past,s.present],present:u,future:d}});},[]),l=Te.useCallback(()=>{a(s=>({past:[],present:s.present,future:[]}));},[]);return {state:r.present,setState:o,undo:i,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:l}}function ac({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){Te.useEffect(()=>{if(!n)return;let o=i=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,l=c?i.metaKey:i.ctrlKey;if(l&&i.key==="z"&&!i.shiftKey&&r){i.preventDefault(),e();return}if(a){if(!c&&l&&i.key==="y"){i.preventDefault(),t();return}if(c&&l&&i.shiftKey&&i.key==="z"){i.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var og={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${V.formatDate(e.startDate)} - ${V.formatDate(e.endDate)}`);let r=V.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} 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 r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,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=>V.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function nc(e){return {...og,...e}}var dg=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},ic=Te.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:o,timeScale:i="week",rowDensity:c="comfortable",showThemeSelector:l=true,showExportButton:s=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:p=true,aiAssistant:m,onThemeChange:x,onTaskClick:b,onTaskDblClick:v,onTaskContextMenu:g,onTaskUpdate:h,onProgressChange:f,onDependencyCreate:w,onDependencyDelete:k,onBeforeTaskAdd:y,onAfterTaskAdd:T,onBeforeTaskUpdate:C,onAfterTaskUpdate:D}=r,$=Te.useContext(Sn)?.theme,[_,I]=Te.useState($||o||"dark"),[O,E]=Te.useState(i),[B,U]=Te.useState(c),[z,L]=Te.useState(1),[re,J]=Te.useState(0),[ie,P]=Te.useState(false),[pe,ne]=Te.useState(null),[ze,Qe]=Te.useState({isOpen:false,x:0,y:0,task:null}),[St,ke]=Te.useState(null);Te.useEffect(()=>{$&&$!==_&&I($);},[$]),Te.useEffect(()=>{o&&o!==_&&I(o);},[o]);let bt=Te.useCallback(N=>{I(N),x?.(N);},[x]),{state:te,setState:ce,undo:Ft,redo:dr,canUndo:gt,canRedo:et,clearHistory:tr}=rc(t,50);Te.useEffect(()=>{ce(t);},[t,ce]),Te.useEffect(()=>{a&&a(te);},[te,a]);let[Ut,xr]=Te.useState([{id:"name",label:"TASK NAME",width:320,minWidth:180,maxWidth:800,visible:true,sortable:true,resizable:true},{id:"startDate",label:"Start Date",width:110,visible:false,sortable:true},{id:"endDate",label:"End Date",width:110,visible:false,sortable:true},{id:"duration",label:"Duration",width:80,visible:false,sortable:true},{id:"assignees",label:"Assignees",width:120,visible:false,sortable:false},{id:"status",label:"Status",width:80,visible:false,sortable:true},{id:"progress",label:"% Complete",width:120,visible:false,sortable:true}]),Wt=Te.useMemo(()=>Ut.filter(N=>N.visible).reduce((N,M)=>N+M.width,0)+60,[Ut]),K=pe||Wt,W=Te.useRef(null),we=Te.useRef(null),Ae=Te.useRef(null),de=Te.useMemo(()=>Sl(_),[_]),ge=Te.useMemo(()=>({theme:de,themeName:_}),[de,_]),he=Te.useMemo(()=>nc(d),[d]),rr=Te.useMemo(()=>{if(!p)return te;let N=V.calculateCriticalPath(te),M=G=>G.map(X=>({...X,isCriticalPath:N.includes(X.id),subtasks:X.subtasks?M(X.subtasks):void 0}));return M(te)},[te,p]),se=dg(B);ac({undo:Ft,redo:dr,canUndo:gt,canRedo:et,enabled:true}),Te.useImperativeHandle(n,()=>({getTask:N=>V.findTaskById(te,N),addTask:(N,M)=>{ce(G=>{if(!M)return [...G,{...N,level:0}];let X=ee=>ee.map(oe=>oe.id===M?{...oe,subtasks:[...oe.subtasks||[],{...N,parentId:M,level:(oe.level||0)+1}],isExpanded:true}:oe.subtasks?{...oe,subtasks:X(oe.subtasks)}:oe);return X(G)});},updateTask:(N,M)=>{ce(G=>{let X=ee=>ee.map(oe=>oe.id===N?{...oe,...M}:oe.subtasks?{...oe,subtasks:X(oe.subtasks)}:oe);return X(G)});},deleteTask:N=>{ce(M=>{let G=X=>X.filter(ee=>ee.id===N?false:(ee.subtasks&&(ee.subtasks=G(ee.subtasks)),true));return G(M)});},deleteTasks:N=>{ce(M=>En(M,N));},duplicateTask:N=>{ce(M=>ts(M,[N]));},splitTask:(N,M,G=3)=>{ce(X=>V.splitTask(X,N,M,G));},calculateEndDate:V.calculateEndDate,calculateDuration:V.calculateDuration,validateDependency:(N,M)=>!V.validateDependencies(te,N,M),getAllTasks:()=>V.flattenTasks(te),getTasksByStatus:N=>V.flattenTasks(te).filter(M=>M.status===N),getTasksByParent:N=>N?V.findTaskById(te,N)?.subtasks||[]:te.filter(G=>!G.parentId),getCriticalPath:()=>V.flattenTasks(te).filter(N=>N.isCriticalPath),indentTask:N=>{ce(M=>Zo(M,[N]));},outdentTask:N=>{ce(M=>Qo(M,[N]));},moveTask:(N,M)=>{ce(G=>es(G,[N],M));},createSubtask:async N=>{let{tasks:M,newTask:G}=ns(te,N);if(y){let X=y({...G,parentId:N});if((X instanceof Promise?await X:X)===false)return}ce(M),T&&T({...G,parentId:N});},scrollToTask:N=>{let G=V.flattenTasks(te).findIndex(X=>X.id===N);if(G!==-1&&W.current){let X=G*se;W.current.scrollTo({top:X,behavior:"smooth"}),we.current&&we.current.scrollTo({top:X,behavior:"smooth"});}},highlightTask:(N,M=2e3)=>{},expandTask:N=>{ce(M=>{let G=X=>X.map(ee=>ee.id===N?{...ee,isExpanded:true}:ee.subtasks?{...ee,subtasks:G(ee.subtasks)}:ee);return G(M)});},collapseTask:N=>{ce(M=>{let G=X=>X.map(ee=>ee.id===N?{...ee,isExpanded:false}:ee.subtasks?{...ee,subtasks:G(ee.subtasks)}:ee);return G(M)});},expandAll:()=>{ce(N=>{let M=G=>G.map(X=>({...X,isExpanded:true,subtasks:X.subtasks?M(X.subtasks):void 0}));return M(N)});},collapseAll:()=>{ce(N=>{let M=G=>G.map(X=>({...X,isExpanded:false,subtasks:X.subtasks?M(X.subtasks):void 0}));return M(N)});},undo:Ft,redo:dr,canUndo:()=>gt,canRedo:()=>et,clearHistory:tr,exportToPNG:async()=>{if(!Ae.current)throw new Error("Gantt container not found");let N=await oc__default.default(Ae.current,{backgroundColor:de.bgPrimary,scale:2});return new Promise((M,G)=>{N.toBlob(X=>{X?M(X):G(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await V.exportToPDF(te,N);},exportToExcel:async N=>{await V.exportToExcel(te,N);},exportToJSON:()=>V.exportToJSON(te),exportToCSV:()=>V.exportToCSV(te),importFromJSON:N=>{let M=V.importFromJSON(N);ce(M);},getTasks:()=>te,refresh:()=>{ce(N=>[...N]);},clearAll:()=>{ce([]);}}),[te,Ft,dr,gt,et,tr,de,se]);let ye=Te.useCallback(N=>{xr(M=>M.map(G=>G.id===N?{...G,visible:!G.visible}:G));},[]),j=Te.useCallback((N,M)=>{xr(G=>G.map(X=>{if(X.id!==N)return X;let ee=X.minWidth??100,oe=X.maxWidth??800,tt=Math.max(ee,Math.min(oe,M));return {...X,width:tt}}));},[]),Ce=Te.useCallback(N=>{ce(M=>as(M,N)),r.onTaskToggleExpand?.(N);},[r]),S=Te.useCallback((N,M)=>{if(C&&C(N,M)===false)return;let X=V.findTaskById(te,N)?.progress,ee=tt=>tt.map(ot=>ot.id===N?{...ot,...M}:ot.subtasks?{...ot,subtasks:ee(ot.subtasks)}:ot);ce(ee(te));let oe=V.findTaskById(ee(te),N);oe&&(h?.(oe),D?.(oe),M.progress!==void 0&&X!==void 0&&M.progress!==X&&f?.(N,X,M.progress));},[te,h,C,D,f]),H=Te.useCallback(N=>{N.length!==0&&(ce(M=>Zo(M,N)),r.onTaskIndent?.(N[0]));},[r]),ue=Te.useCallback(N=>{N.length!==0&&(ce(M=>Qo(M,N)),r.onTaskOutdent?.(N[0]));},[r]),Pe=Te.useCallback((N,M)=>{N.length!==0&&(ce(G=>es(G,N,M)),r.onTaskMove?.(N[0],M));},[r]),Be=Te.useCallback(N=>{r.onMultiTaskDelete?r.onMultiTaskDelete(N):(ce(M=>En(M,N)),N.forEach(M=>r.onTaskDelete?.(M)));},[r]),Ge=Te.useCallback(N=>{ce(M=>ts(M,N)),N.forEach(M=>r.onTaskDuplicate?.(M));},[r]),Mt=Te.useCallback((N,M)=>{ce(G=>{let{tasks:X,newTask:ee}=Bl(G,N,M);return y&&y(ee)===false?G:(r.onTaskCreate?.(ee.parentId,ee.position||0),T?.(ee),X)});},[r,y,T]),Bt=Te.useCallback((N,M)=>{ce(G=>rs(G,N,M)),r.onTaskRename?.(N,M);},[r]),qn=Te.useCallback(N=>{ce(M=>{let{tasks:G}=ns(M,N);return r.onTaskCreate?.(N,0),G});},[r]),ga=Te.useCallback((N,M,G)=>{let X=N.startDate?Math.round((M.getTime()-N.startDate.getTime())/864e5):0,ee=ot=>ot.map(ur=>ur.id===N.id?{...ur,startDate:M,endDate:G,...N.segments&&{segments:N.segments}}:ur.subtasks?{...ur,subtasks:ee(ur.subtasks)}:ur),oe=ee(te);oe=V.autoScheduleDependents(oe,N.id,X),ce(oe);let tt={...N,startDate:M,endDate:G};h?.(tt);},[te,h]),ha=Te.useCallback((N,M)=>{g?.(N,M),Qe({isOpen:true,x:M.clientX,y:M.clientY,task:N});},[g]),id=Te.useCallback((N,M)=>{let G=V.splitTask(te,N.id,M);ce(G),Qe({isOpen:false,x:0,y:0,task:null});},[te]),Hs=Te.useCallback(N=>{v?.(N),ke(N);},[v]),Vs=Te.useCallback((N,M,G)=>{let X=new Map,ee=Lr=>{Lr.forEach(Fr=>{Fr.dependencies&&X.set(Fr.id,Fr.dependencies),Fr.subtasks&&ee(Fr.subtasks);});};ee(G);let oe=X.get(M)||[];X.set(M,[...oe,N]);let tt=new Set,ot=new Set,ur=Lr=>{if(!tt.has(Lr)){tt.add(Lr),ot.add(Lr);let Fr=X.get(Lr)||[];for(let Xn of Fr){if(!tt.has(Xn)&&ur(Xn))return true;if(ot.has(Xn))return true}}return ot.delete(Lr),false};return ur(M)},[]),Ks=Te.useCallback((N,M)=>{if(Vs(N.id,M,te)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
277
277
 
278
- Task dependencies must flow in one direction only.`);return}let H=X=>X.map(ee=>{if(ee.id===M){let oe=ee.dependencies||[];if(!oe.includes(N.id))return {...ee,dependencies:[...oe,N.id]}}return ee.subtasks?{...ee,subtasks:H(ee.subtasks)}:ee});ce(H(te)),w?.(N.id,M);},[te,w,Ws]),Gs=Te.useCallback((N,M)=>{let H=X=>X.map(ee=>{if(ee.id===N&&ee.dependencies){let oe=ee.dependencies.filter(tt=>tt!==M);return {...ee,dependencies:oe}}return ee.subtasks?{...ee,subtasks:H(ee.subtasks)}:ee});ce(H(te)),k?.(N,M);},[te,k]),{startDate:Zc,endDate:Qc}=Te.useMemo(()=>{let N=te.filter(oe=>oe.startDate&&oe.endDate);if(N.length===0){let oe=new Date,tt=new Date(oe);tt.setDate(tt.getDate()-30);let ot=new Date(oe);return ot.setDate(ot.getDate()+60),{startDate:tt,endDate:ot}}let M=N.flatMap(oe=>[oe.startDate,oe.endDate]).filter(oe=>oe!==void 0),H=new Date(Math.min(...M.map(oe=>oe.getTime()))),X=new Date(Math.max(...M.map(oe=>oe.getTime()))),ee=O==="day"?7:O==="week"?14:30;return H.setDate(H.getDate()-ee),X.setDate(X.getDate()+ee),{startDate:H,endDate:X}},[te,O]),ed=Te.useCallback(async()=>{if(!Ae.current)return;let N=await tc__default.default(Ae.current,{backgroundColor:de.bgPrimary,scale:2}),M=document.createElement("a");M.download="gantt-chart.png",M.href=N.toDataURL("image/png"),M.click();},[de]),td=Te.useCallback(async()=>{await V.exportToPDF(te);},[te]),rd=Te.useCallback(async()=>{await V.exportToExcel(te);},[te]),ad=Te.useCallback(()=>{let N=V.exportToCSV(te),M=new Blob([N],{type:"text/csv;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(M),H.download="gantt-chart.csv",H.click(),URL.revokeObjectURL(H.href);},[te]),nd=Te.useCallback(()=>{let N=V.exportToJSON(te),M=new Blob([N],{type:"application/json;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(M),H.download="gantt-chart.json",H.click(),URL.revokeObjectURL(H.href);},[te]),od=Te.useCallback(()=>{V.exportToMSProject(te,"Gantt Project","project.xml");},[te]),sd=N=>{N.preventDefault(),P(true);};return Te.useEffect(()=>{let N=we.current,M=G.current;if(!N||!M)return;let H=M.querySelector(".gantt-taskgrid-content"),X=()=>{let tt=N.scrollTop;J(tt),H&&(H.style.transform=`translateY(-${tt}px)`);},ee=tt=>{if(ie){let ot=tt.clientX;ot>300&&ot<window.innerWidth-400&&ne(ot);}},oe=()=>{P(false);};return N.addEventListener("scroll",X),document.addEventListener("mousemove",ee),document.addEventListener("mouseup",oe),()=>{N.removeEventListener("scroll",X),document.removeEventListener("mousemove",ee),document.removeEventListener("mouseup",oe);}},[ie]),jsxRuntime.jsx(mo.Provider,{value:ge,children:jsxRuntime.jsxs("div",{ref:Ae,className:"flex flex-col h-full w-full",style:{backgroundColor:de.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Sn,{theme:de,timeScale:O,onTimeScaleChange:E,zoom:z,onZoomChange:L,currentTheme:W,onThemeChange:bt,rowDensity:B,onRowDensityChange:$,showThemeSelector:c,onExportPNG:i?ed:void 0,onExportPDF:i?td:void 0,onExportExcel:i?rd:void 0,onExportCSV:i?ad:void 0,onExportJSON:i?nd:void 0,onExportMSProject:i?od:void 0}),jsxRuntime.jsxs("div",{ref:G,className:"flex-1 flex min-h-0",style:{overflow:"hidden"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:K,overflow:"hidden"},children:jsxRuntime.jsx(En,{tasks:rr,theme:de,rowHeight:se,availableUsers:u,templates:he,onTaskClick:b,onTaskDblClick:Us,onTaskContextMenu:g,onTaskToggle:Ce,scrollTop:re,columns:$t,onToggleColumn:ye,onColumnResize:j,onTaskUpdate:S,onTaskIndent:_,onTaskOutdent:ue,onTaskMove:Pe,onMultiTaskDelete:Be,onTaskDuplicate:He,onTaskCreate:Mt,onTaskRename:Bt,onCreateSubtask:jn,onOpenTaskModal:b?N=>b(N):void 0})}),jsxRuntime.jsx("div",{className:"relative flex-shrink-0 cursor-col-resize group",style:{width:8,backgroundColor:ie?de.accent:de.border,transition:"background-color 0.2s"},onMouseDown:sd,children:jsxRuntime.jsx(framerMotion.motion.div,{className:"absolute inset-y-0 left-1/2 -translate-x-1/2",style:{width:2,backgroundColor:de.accent},initial:{opacity:0},animate:{opacity:ie?1:0},whileHover:{opacity:1}})}),jsxRuntime.jsx("div",{ref:we,className:"gantt-timeline-scroll flex-1 overflow-auto",style:{minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Bn,{tasks:rr,theme:de,rowHeight:se,timeScale:O,startDate:Zc,endDate:Qc,zoom:z,templates:he,onTaskClick:b,onTaskDblClick:Us,onTaskContextMenu:ga,onTaskDateChange:fa,onDependencyCreate:$s,onDependencyDelete:Gs})})]}),ze.task&&jsxRuntime.jsx(la,{isOpen:ze.isOpen,x:ze.x,y:ze.y,theme:de,onClose:()=>Qe({isOpen:false,x:0,y:0,task:null}),items:[{id:"split",label:"Split Task",icon:Pt.Split,onClick:()=>{if(!ze.task?.startDate||!ze.task?.endDate){console.warn("Cannot split task without dates");return}let N=ze.task.startDate.getTime(),M=ze.task.endDate.getTime(),H=N+(M-N)/2,X=new Date(H);Jc(ze.task,X);},disabled:!ze.task?.startDate||!ze.task?.endDate}]}),St&&jsxRuntime.jsx(On,{isOpen:true,onClose:()=>ke(null),task:St,onSubmit:N=>{S(St.id,N),ke(null);},mode:"edit",theme:W}),p?.enabled&&jsxRuntime.jsx(Jl,{tasks:te,theme:de,config:p,onTasksUpdate:ce,onTaskUpdate:S,onTaskCreate:N=>{ce(M=>[...M,N]);},onTaskDelete:N=>{ce(M=>Nn(M,[N]));},onDependencyCreate:(N,M)=>{let H=V.findTaskById(te,N);H&&$s(H,M);},onDependencyDelete:Gs})]})})});function tg(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 rg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return "TODO"}}function Un(e,t=[],r=[]){let a=e.assignedUserIds?.map(u=>{let d=r.find(m=>m.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Un(u,t,r)),o;e.dependencies&&(typeof e.dependencies[0]=="string"?o=e.dependencies:o=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let s=u=>{if(u)return typeof u=="string"?new Date(u):u},l=s(e.startDate),c=s(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:tg(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:o?.length?o:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function nc(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(o=>o.name===a.name||o.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:rg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function oc(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>Un(a,e,t))}function ng({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:o,onDeleteStack:s,className:l}){let[c,i]=Te.useState(false),u=Te.useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),d=Te.useMemo(()=>{let p=u.length,x=new Set(u.flatMap(g=>g.assignedUserIds||[])).size,b=u.map(g=>g.priority).filter(Boolean),v=new Set(u.flatMap(g=>g.labels||[])).size;return {totalCards:p,uniqueAssignees:x,priorities:b,labels:v}},[u]),m=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:ae("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:m,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:ae("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:p=>{p.stopPropagation(),s?.(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(p=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsxRuntime.jsx("h4",{children:p.title}),p.description&&jsxRuntime.jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),o?.(e.id,p.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"})]})})]},p.id))})})]})}var ic={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Wa(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 $a(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 lc(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 cc({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:o,config:s,className:l}){let c=Te.useMemo(()=>({...ic,...s}),[s]),[i,u]=Te.useState(new Set),d=Te.useRef(null),m=Te.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(f=>{let w=f.timestamp.toISOString().split("T")[0],k=h.get(w);k?k.push(f):h.set(w,[f]);}),Array.from(h.entries()).sort((f,w)=>w[0].localeCompare(f[0])).map(([f,w])=>({date:new Date(f),events:w.sort((k,y)=>y.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:p,uniqueTypes:x}=Te.useMemo(()=>{let h=new Set,f=new Set;return e.forEach(w=>{h.add(w.userId),f.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(f)}},[e]),b=h=>{u(f=>{let w=new Set(f);return w.has(h)?w.delete(h):w.add(h),w});},v=h=>{let w=new Date().getTime()-h.getTime(),k=Math.floor(w/6e4),y=Math.floor(w/36e5),T=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:y<24?`${y}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},g=Te.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 Te.useEffect(()=>{if(o&&d.current){let h=d.current.querySelector(`[data-event-id="${o}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[o]),e.length===0?jsxRuntime.jsxs("div",{className:ae("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:ae("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 f=h.target.value;r({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),x.map(h=>jsxRuntime.jsxs("option",{value:h,children:[$a(h)," ",h.replace("_"," ")]},h))]}),p.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let f=h.target.value;r({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),p.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=>r({...t,searchTerm:h.target.value})})]}),g>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",g,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:m.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((f,w)=>{let k=i.has(f.id),y=o===f.id,T=lc(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:ae("history-timeline-event",k&&"expanded",y&&"selected"),onClick:()=>n?.(f),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:$a(f.type)})}),w<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&&f.userAvatar&&jsxRuntime.jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Wa(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),b(f.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([C,D])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(D.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(D.to)})]})]},C)),f.metadata&&Object.keys(f.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(f.metadata).map(([C,D])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},C))]})]})]})]},f.id)})})]},h.date?.toISOString()||"all"))})]})}function uc({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:o,onNext:s,onGoToEvent:l,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],d=Te.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=Te.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:ae("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:ae("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&$a(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Wa(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:p=>l(parseInt(p.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((p,x)=>jsxRuntime.jsx("div",{className:ae("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>l(x),title:Wa(p)},p.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,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:n,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:s,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(p=>jsxRuntime.jsxs("button",{className:ae("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>c(p),children:[p,"x"]},p))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,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(p=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxRuntime.jsxs("div",{className:ae("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:r,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 ps(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 ms(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function pc(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function mc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function dg(e,t,r,a,n,o=100){let s=e.map(c=>({...c,x:c.x??r/2+Math.random()*100-50,y:c.y??a/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(s.map(c=>[c.id,c]));for(let c=0;c<o;c++){let i=1-c/o;s.forEach(u=>{let d=r/2,m=a/2;u.vx+=(d-u.x)*n.centerForce*i,u.vy+=(m-u.y)*n.centerForce*i,s.forEach(p=>{if(u.id===p.id)return;let x=u.x-p.x,b=u.y-p.y,v=Math.sqrt(x*x+b*b)||1,g=n.chargeStrength*i/(v*v);u.vx+=x/v*g,u.vy+=b/v*g;});}),t.forEach(u=>{let d=l.get(typeof u.source=="string"?u.source:u.source.id),m=l.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!m)return;let p=m.x-d.x,x=m.y-d.y,b=Math.sqrt(p*p+x*x)||1,v=(b-n.linkDistance)/b*n.forceStrength*i;d.vx+=p*v,d.vy+=x*v,m.vx-=p*v,m.vy-=x*v;}),s.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(n.nodeSize,Math.min(r-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return s}function fc({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:o,stats:s,onInteraction:l,className:c}){let i=Te.useRef(null),[u,d]=Te.useState([]),[m,p]=Te.useState(null),[x,b]=Te.useState(null),[v,g]=Te.useState(null),[h,f]=Te.useState(1),[w,k]=Te.useState({x:0,y:0});Te.useEffect(()=>{if(e.length===0)return;let I=dg(e,t,r.width,r.height,r,150);d(I);},[e,t,r]);let y=Te.useCallback((I,O)=>{r.enableDragging&&(O.stopPropagation(),p(I));},[r.enableDragging]),T=Te.useCallback(I=>{if(!m||!i.current)return;let E=i.current.getBoundingClientRect(),B=(I.clientX-E.left-w.x)/h,$=(I.clientY-E.top-w.y)/h;d(z=>z.map(L=>L.id===m?{...L,x:B,y:$,fx:B,fy:$}:L));},[m,h,w]),C=Te.useCallback(()=>{p(null);},[]),D=Te.useCallback((I,O)=>{O.stopPropagation(),l?.({type:"node-click",node:I,position:{x:O.clientX,y:O.clientY}});},[l]),R=Te.useCallback((I,O)=>{O.stopPropagation(),l?.({type:"edge-click",edge:I,position:{x:O.clientX,y:O.clientY}});},[l]),U=Te.useCallback(I=>{let O=u.find(E=>E.id===I);return O?{x:O.x,y:O.y}:{x:0,y:0}},[u]),W=Te.useCallback(I=>{if(I.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return I.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let O=I.card.priority;return O==="URGENT"?"#ef4444":O==="HIGH"?"#f59e0b":O==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return I.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[r.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:ae("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:ae("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:s.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:s.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),o&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(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:()=>f(I=>Math.max(I-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),k({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:ps(I)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[pc(I)," ",ms(I)]})]},I))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:T,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(I=>{let O=U(typeof I.source=="string"?I.source:I.source.id),E=U(typeof I.target=="string"?I.target:I.target.id),B=mc(I.type),$=v===I.id,z=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:ae("relationships-graph-edge",$&&"hovered",z&&"critical"),onMouseEnter:()=>g(I.id),onMouseLeave:()=>g(null),onClick:L=>R(I,L),children:[jsxRuntime.jsx("line",{x1:O.x,y1:O.y,x2:E.x,y2:E.y,stroke:ps(I.type),strokeWidth:z?r.edgeWidth*2:r.edgeWidth,strokeOpacity:$?1:.6,markerEnd:B?"url(#arrowhead)":void 0}),r.showEdgeLabels&&$&&jsxRuntime.jsx("text",{x:(O.x+E.x)/2,y:(O.y+E.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ms(I.type)})]},I.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(I=>{let O=x===I.id,E=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:ae("relationships-graph-node",O&&"hovered",E&&"critical"),transform:`translate(${I.x}, ${I.y})`,onMouseDown:B=>y(I.id,B),onMouseEnter:()=>b(I.id),onMouseLeave:()=>b(null),onClick:B=>D(I,B),children:[jsxRuntime.jsx("circle",{r:E?r.nodeSize*1.2:r.nodeSize,fill:W(I),stroke:E?"#fbbf24":"#ffffff",strokeWidth:E?3:2,opacity:O?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.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 vc({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[o,s]=Te.useState(""),[l,c]=Te.useState(false),[i,u]=Te.useState(null),[d,m]=Te.useState(null),p=Te.useRef(null),x=l||n;Te.useEffect(()=>{e&&p.current&&p.current.focus();},[e]),Te.useEffect(()=>{let h=f=>{f.key==="Escape"&&!x&&b();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,x]);let b=()=>{x||(s(""),u(null),m(null),t());},v=async()=>{if(!(!o.trim()||x)){c(true),u(null),m(null);try{let h=await a(o.trim());m(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},g=()=>{d&&(r(d),b());};return e?jsxRuntime.jsxs(Ke,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:b,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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,f)=>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},f))})]}),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,f)=>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})]})},f)),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:p,value:o,onChange:h=>s(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,f)=>jsxRuntime.jsx("button",{onClick:()=>s(h),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:g,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,disabled:!o.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var fs={"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 pg={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},mg={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 fg(e,t,r){let a=fs[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,o=r/1e3*a.costPer1kOutput;return n+o}function Ga(e){return `$${e.toFixed(4)}`}var gs=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=fg(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let a=r.length,n=r.reduce((d,m)=>d+m.cost,0),o=r.reduce((d,m)=>d+m.inputTokens,0),s=r.reduce((d,m)=>d+m.outputTokens,0),l=r.filter(d=>d.success),c=r.reduce((d,m)=>d+m.duration,0),i={},u={};return r.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:o,totalOutputTokens:s,operationsByFeature:i,costsByFeature:u,averageDuration:a>0?c/a:0,successRate:a>0?l.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],o=new Date,s=new Date;r==="month"?s.setMonth(o.getMonth()-1):s.setDate(o.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=s).length,c=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:c,percentUsed:i,isExceeded:l>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},jr=new gs;function xc({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=Te.useState(jr.getStats()),[o,s]=Te.useState(jr.checkLimit(r));if(Te.useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(jr.getStats()),s(jr.checkLimit(r));},1e3);return ()=>clearInterval(c)},[e,r]),Te.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=jr.getRecentOperations(5);return jsxRuntime.jsxs(Ke,{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 (",r.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[o.used," / ",o.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,o.percentUsed)}%`,background:o.percentUsed>90?"#EF4444":o.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[o.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:Ga(a.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:a.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:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.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:[(a.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.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(a.operationsByFeature).map(([c,i])=>{let u=a.costsByFeature[c]||0,d=a.totalOperations>0?i/a.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:Ga(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:Ga(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 Cc({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:o}){let[s,l]=Te.useState(""),[c,i]=Te.useState(""),[u,d]=Te.useState(""),[m,p]=Te.useState(false),[x,b]=Te.useState(null),[v,g]=Te.useState(null),[h,f]=Te.useState(null),w=Te.useRef(null),k=m||n;Te.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),Te.useEffect(()=>{let R=U=>{U.key==="Escape"&&!k&&y();};if(e)return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[e,k]);let y=()=>{k||(l(""),i(""),d(""),b(null),g(null),f(null),t());},T=async()=>{if(!(!s.trim()||k)){p(true),b(null),g(null),f(null);try{let R=await a({prompt:s.trim(),projectName:o||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});g(R.tasks.tasks),f({from_cache:R.from_cache,tokens_used:R.tokens_used,mock_mode:R.mock_mode,similarity:R.similarity,tokens_saved:R.tokens_saved});}catch(R){b(R instanceof Error?R.message:"Failed to generate tasks");}finally{p(false);}}},C=()=>{v&&(r(v),y());};if(!e)return null;let D=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ke,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:y}),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:R=>R.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:y,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",D,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((R,U)=>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:["#",U+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:R.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"})]}),R.start," \u2192 ",R.end]}),jsxRuntime.jsxs("span",{children:[R.duration," days"]}),R.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",R.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${R.priority==="high"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:R.priority})]})},R.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:w,value:s,onChange:R=>l(R.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:R=>i(R.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:k})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:R=>d(R.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:k})]})]}),x&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((R,U)=>jsxRuntime.jsx("button",{onClick:()=>l(R),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:R},U))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:y,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsxRuntime.jsx("button",{onClick:C,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:!s.trim()||k,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:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function Gn({initialBoard:e,onPersist:t}){let[r,a]=Te.useState(e),n=Te.useCallback(v=>{t&&Xa(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(g,h,f)=>{console.warn(`Retry attempt ${h} after ${f}ms: ${g.message}`);}}).then(g=>{g.success||console.error(`Failed to persist board after ${g.attempts} attempts:`,g.error);});},[t]),o=Te.useCallback(async(v,g,h)=>{a(f=>{let w=f.cards.find(R=>R.id===v);if(!w)return f;let k=w.columnId,y={...w,columnId:g,position:h},T=f.cards.map(R=>R.id===v?y:R),C=f.columns.map(R=>{if(R.id===k)return {...R,cardIds:R.cardIds.filter(U=>U!==v)};if(R.id===g){let U=T.filter(W=>W.columnId===g).sort((W,I)=>W.position-I.position);return {...R,cardIds:U.map(W=>W.id)}}return R}),D={...f,cards:T,columns:C};return n(D),D});},[n]),s=Te.useCallback(async(v,g)=>{a(h=>{let f=h.cards.map(k=>k.id===v?{...k,...g}:k),w={...h,cards:f};return n(w),w});},[n]),l=Te.useCallback(async v=>{let g=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let f={...v,id:g},w=h.columns.map(y=>y.id===v.columnId?{...y,cardIds:[...y.cardIds,g]}:y),k={...h,cards:[...h.cards,f],columns:w};return n(k),k});},[n]),c=Te.useCallback(async v=>{a(g=>{let h=g.cards.find(y=>y.id===v);if(!h)return g;let f=g.cards.filter(y=>y.id!==v),w=g.columns.map(y=>y.id===h.columnId?{...y,cardIds:y.cardIds.filter(T=>T!==v)}:y),k={...g,cards:f,columns:w};return n(k),k});},[n]),i=Te.useCallback(async v=>{let g=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let f={...v,id:g,cardIds:[]},w={...h,columns:[...h.columns,f]};return n(w),w});},[n]),u=Te.useCallback(async(v,g)=>{a(h=>{let f=h.columns.map(k=>k.id===v?{...k,...g}:k),w={...h,columns:f};return n(w),w});},[n]),d=Te.useCallback(async v=>{a(g=>{let h=g.cards.filter(k=>k.columnId!==v),f=g.columns.filter(k=>k.id!==v),w={...g,cards:h,columns:f};return n(w),w});},[n]),m=Te.useCallback(v=>{let g=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(v),g},[l]),p=Te.useCallback(v=>{let g=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),g},[i]),x=Te.useCallback(()=>{a(v=>{let g={...v,cards:[],columns:[]};return n(g),g});},[n]);return {board:r,callbacks:{onCardMove:o,onCardUpdate:s,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:a,helpers:{addCard:m,addColumn:p,deleteCard:c,deleteColumn:d,clearBoard:x}}}function Sc({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:o}=Gn({initialBoard:e,onPersist:r}),s=Te.useMemo(()=>({addCard:(c,i,u={})=>{o.addCard({title:i,columnId:c,position:a.cards.filter(d=>d.columnId===c).length,...u});},addColumn:(c,i)=>{let u=a.columns.length>0?Math.max(...a.columns.map(d=>d.position)):0;o.addColumn({title:c,position:i??u+1e3});},reset:o.clearBoard}),[a.cards,a.columns,o]);return {props:Te.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:s}}var Ha={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Nc={by:"none",order:"asc"};function Ec({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=Te.useState({...Ha,...e}),[o,s]=Te.useState({...Nc,...t}),l=Te.useCallback(b=>{n(v=>({...v,...b}));},[]),c=Te.useCallback(b=>{s(v=>({...v,...b}));},[]),i=Te.useCallback(()=>{n(Ha),s(Nc);},[]),u=Te.useCallback(()=>{r&&n({...Ha,assignees:[r]});},[r]),d=Te.useCallback(()=>{n({...Ha,dateFilter:"overdue"});},[]),m=Te.useCallback(()=>{n({...Ha,priorities:["HIGH","URGENT"]});},[]),p=Te.useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||o.by!=="none",[a,o]),x=Te.useCallback(b=>{let v=[...b];if(a.search){let g=a.search.toLowerCase();v=v.filter(h=>h.title.toLowerCase().includes(g)||h.description?.toLowerCase().includes(g));}if(a.dateFilter!=="all"){let g=new Date,h=g.getFullYear(),f=String(g.getMonth()+1).padStart(2,"0"),w=String(g.getDate()).padStart(2,"0"),k=`${h}-${f}-${w}`;v=v.filter(y=>{if(!y.endDate&&!y.dueDate)return false;let T=y.endDate||y.dueDate;if(!T)return false;let C;if(typeof T=="string")C=T.split("T")[0]||T;else {let D=T.getUTCFullYear(),R=String(T.getUTCMonth()+1).padStart(2,"0"),U=String(T.getUTCDate()).padStart(2,"0");C=`${D}-${R}-${U}`;}switch(a.dateFilter){case "overdue":return C<k;case "today":return C===k;case "this-week":let D=new Date(k+"T00:00:00"),R=new Date(C+"T00:00:00"),U=new Date(D);return U.setDate(U.getDate()+7),R>=D&&R<=U;case "custom":if(a.dateRange){let W=typeof T=="string"?new Date(T):T;return W>=a.dateRange.start&&W<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(v=v.filter(g=>g.priority&&a.priorities.includes(g.priority))),a.assignees.length>0&&(v=v.filter(g=>(g.assignedUserIds||(g.assigneeId?[g.assigneeId]:[])).some(f=>a.assignees.includes(f)))),a.labels.length>0&&(v=v.filter(g=>g.labels&&g.labels.some(h=>a.labels.includes(h)))),a.columns.length>0&&(v=v.filter(g=>a.columns.includes(g.columnId))),o.by!=="none"&&v.sort((g,h)=>{let f=0;switch(o.by){case "created":let w=g.createdAt?new Date(g.createdAt).getTime():0,k=h.createdAt?new Date(h.createdAt).getTime():0;f=w-k;break;case "priority":let y={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=y[g.priority||"LOW"],C=y[h.priority||"LOW"];f=T-C;break;case "dueDate":let D=g.endDate||g.dueDate,R=h.endDate||h.dueDate;if(!D)return 1;if(!R)return -1;let U=typeof D=="string"?new Date(D).getTime():D.getTime(),W=typeof R=="string"?new Date(R).getTime():R.getTime();f=U-W;break;case "title":f=g.title.localeCompare(h.title);break;case "estimate":let I=g.estimatedTime||0,O=h.estimatedTime||0;f=I-O;break;default:f=0;}return o.order==="asc"?f:-f}),v},[a,o]);return {filters:a,sort:o,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:m,applyFilters:x,hasActiveFilters:p}}var Pc,Ic;if(typeof window<"u")try{let e=ja("ai");Pc=e.generateObject,Ic=e.generateText;}catch{}function Mc(e={}){let[t,r]=Te.useState(false),[a,n]=Te.useState(null),o=!!(Pc&&Ic&&e.apiKey),s=Te.useCallback(async d=>{if(!o)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(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(m){let p=m instanceof Error?m:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[o]),l=Te.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let p=m instanceof Error?m:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[o]),c=Te.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let p=m instanceof Error?m:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[o]),i=Te.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(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(m){let p=m instanceof Error?m:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[o]),u=Te.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(m){let p=m instanceof Error?m:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[o]);return {onGeneratePlan:s,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:o,isLoading:t,error:a}}function vs(){let[e,t]=Te.useState(()=>core.selectionStore.getState());Te.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=Te.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function Ac(e){let{cards:t}=e,[r,a]=vs(),n=Te.useCallback(d=>r.selectedCardIds.includes(d),[r.selectedCardIds]),o=Te.useCallback((d,m)=>{if(!m){a({selectedCardIds:[d],lastSelectedCardId:d});return}let p=m.ctrlKey||m.metaKey,x=m.shiftKey;if(p)r.selectedCardIds.includes(d)?a({selectedCardIds:r.selectedCardIds.filter(b=>b!==d),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,d],lastSelectedCardId:d});else if(x&&r.lastSelectedCardId){let b=t.find(g=>g.id===d),v=t.find(g=>g.id===r.lastSelectedCardId);if(b&&v&&b.columnId===v.columnId){let g=t.filter(C=>C.columnId===b.columnId).sort((C,D)=>C.position-D.position),h=g.findIndex(C=>C.id===r.lastSelectedCardId),f=g.findIndex(C=>C.id===d),[w,k]=h<f?[h,f]:[f,h],y=g.slice(w,k+1).map(C=>C.id),T=Array.from(new Set([...r.selectedCardIds,...y]));a({selectedCardIds:T,lastSelectedCardId:d});}else a({selectedCardIds:[d],lastSelectedCardId:d});}else a({selectedCardIds:[d],lastSelectedCardId:d});},[t,r,a]),s=Te.useCallback(d=>{a({selectedCardIds:r.selectedCardIds.filter(m=>m!==d),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=Te.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=Te.useCallback(()=>{a({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=Te.useCallback(d=>{r.selectedCardIds.includes(d)?s(d):a({selectedCardIds:[...r.selectedCardIds,d],lastSelectedCardId:d});},[r,s,a]),u=Te.useCallback(()=>t.filter(d=>r.selectedCardIds.includes(d.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:o,deselectCard:s,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var Lc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Fc(e){let{cards:t,config:r,aiService:a}=e,n=Te.useMemo(()=>({...Lc,...r}),[r]),[o,s]=Te.useState([]),l=Te.useCallback((b,v,g,h,f)=>{if(v.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:v,columnId:g,strategy:h,color:f,isExpanded:true,position:o.filter(k=>k.columnId===g).length,createdAt:new Date};s(k=>[...k,w]);},[n.minCardsPerStack,o]),c=Te.useCallback(b=>{s(v=>v.filter(g=>g.id!==b));},[]),i=Te.useCallback(b=>{s(v=>v.map(g=>g.id===b?{...g,isExpanded:!g.isExpanded}:g));},[]),u=Te.useCallback((b,v)=>{s(g=>g.map(h=>h.id===b&&!h.cardIds.includes(v)?{...h,cardIds:[...h.cardIds,v]}:h));},[]),d=Te.useCallback((b,v)=>{s(g=>g.map(h=>{if(h.id===b){let f=h.cardIds.filter(w=>w!==v);return f.length<n.minCardsPerStack?null:{...h,cardIds:f}}return h}).filter(h=>h!==null));},[n.minCardsPerStack]),m=Te.useCallback(b=>o.filter(v=>v.columnId===b).sort((v,g)=>v.position-g.position),[o]),p=Te.useCallback(async b=>{let v=t.filter(k=>k.columnId===b);if(v.length<n.minCardsPerStack*2)return [];let g=[],h=new Map;v.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(y=>{h.has(y)||h.set(y,[]),h.get(y).push(k);});}),h.forEach((k,y)=>{k.length>=n.minCardsPerStack&&g.push({stack:{title:`\u{1F4CC} ${y}`,cardIds:k.map(T=>T.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${y}"`,confidence:.85});});let f=new Map;v.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(y=>{f.has(y)||f.set(y,[]),f.get(y).push(k);});}),f.forEach((k,y)=>{k.length>=n.minCardsPerStack&&g.push({stack:{title:`\u{1F464} Assigned to user-${y.slice(-4)}`,cardIds:k.map(T=>T.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(v.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,y)=>{if(k.length>=n.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[y.toLowerCase()]||"\u26AA";g.push({stack:{title:`${T} ${y} Priority`,cardIds:k.map(C=>C.id),columnId:b,strategy:"priority",color:y==="high"||y==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${y} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let k of v){let T=(await a.findSimilar(k,v)).filter(C=>C.similarity>=n.autoStackConfidenceThreshold);if(T.length>=n.minCardsPerStack-1){let C=[k.id,...T.map(R=>R.card.id)],D=T.reduce((R,U)=>R+U.similarity,0)/T.length;g.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:C,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:D});}}return g.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,y)=>y.confidence-k.confidence).slice(0,5)},[t,n,a]),x=Te.useCallback(b=>{l(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[l]);return Te.useEffect(()=>{n.enableAutoStacking&&o.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let g=await p(v),h=g[0];g.length>0&&h&&h.confidence>=.9&&x(h);});},[]),{stacks:o,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:m,getSuggestions:p,applySuggestion:x,config:n}}var Bc=Te.createContext(null);function Oc({children:e,initialData:t,onStateChange:r}){let a=Te.useRef();if(!a.current){let o=new Map,s=new Map;t?.columns?.forEach(c=>{let{Column:i}=ja("@libxai/core");o.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=ja("@libxai/core");s.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=ja("@libxai/core");l=new c(t.board);}a.current=new core.BoardStore({board:l,columns:o,cards:s});}let n=a.current;return Te.useEffect(()=>{if(r)return n.subscribeAll(o=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(Bc.Provider,{value:{store:n},children:e})}function Hn(){let e=Te.useContext(Bc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Va(){let e=Hn(),[t,r]=Te.useState(e.getBoard()),[a,n]=Te.useState(e.getAllColumns()),[o,s]=Te.useState(e.getAllCards());Te.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),s(e.getAllCards());}),[e]);let l=Te.useCallback(h=>{e.updateBoard(h);},[e]),c=Te.useCallback(h=>{e.addColumn(h);},[e]),i=Te.useCallback((h,f)=>{e.updateColumn(h,f);},[e]),u=Te.useCallback(h=>{e.deleteColumn(h);},[e]),d=Te.useCallback(h=>e.getColumn(h),[e]),m=Te.useCallback(h=>{e.addCard(h);},[e]),p=Te.useCallback((h,f)=>{e.updateCard(h,f);},[e]),x=Te.useCallback(h=>{e.deleteCard(h);},[e]),b=Te.useCallback((h,f,w)=>{e.moveCard(h,f,w);},[e]),v=Te.useCallback(h=>e.getCard(h),[e]),g=Te.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:a,cards:o,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:d,addCard:m,updateCard:p,deleteCard:x,moveCard:b,getCard:v,getCardsByColumn:g}}function Uc(e){let{cards:t}=Va();return Te.useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),o=r.description?.toLowerCase().includes(a);if(!n&&!o)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function Wc(e="position",t="asc"){let{cards:r}=Va();return Te.useMemo(()=>[...r].sort((n,o)=>{let s=0;switch(e){case "title":s=n.title.localeCompare(o.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=o.priority?l[o.priority]:0;s=c-i;break}case "createdAt":s=n.createdAt.getTime()-o.createdAt.getTime();break;case "updatedAt":s=n.updatedAt.getTime()-o.updatedAt.getTime();break;case "position":s=n.position-o.position;break}return t==="asc"?s:-s}),[r,e,t])}var _n=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Vs.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 r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} 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(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(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,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];if(typeof s=="function")try{let l=await Promise.resolve(s.apply(o,r));l!==void 0&&(n=l,r[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let o=n[t];typeof o=="function"&&a.push(Promise.resolve(o.apply(n,r)).catch(s=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,s,{plugin:n.id,hook:t});}));}await Promise.all(a);}},Ig=new _n;function Gc({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:o=5,horizontal:s=false,gap:l=0,getItemKey:c}){let i=Te.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:o,horizontal:s,gap:l}),d=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=s?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:n,children:jsxRuntime.jsx("div",{style:p,children:d.map(x=>{let b=e[x.index];if(!b)return null;let v=c?c(b,x.index):x.index,g={position:"absolute",top:s?0:x.start,left:s?x.start:0,width:s?x.size:"100%",height:s?"100%":x.size};return jsxRuntime.jsx("div",{style:g,"data-index":x.index,children:a(b,x.index)},v)})})})}function Hc(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function Vc({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:o="",overscan:s=3,gap:l=16,getItemKey:c,horizontal:i=true}){let u=Te.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>a,overscan:s,gap:l}),m=d.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},x={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:p,className:o,children:jsxRuntime.jsx("div",{style:x,children:m.map(b=>{let v=e[b.index];if(!v)return null;let g=c?c(v,b.index):b.index,h={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":b.index,children:n(v,b.index)},g)})})})}function Kc(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function jc(e,t=10){return e>t}var ks={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ws={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Cs={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Ts={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ss={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ds={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ns={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Es={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)"},Rs={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)"},Ps={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Is={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}},Ms={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}},Vn={spacing:ks,borderRadius:ws,fontSize:Cs,fontWeight:Ts,lineHeight:Ss,zIndex:Ds,duration:Ns,easing:Es,shadows:Rs,opacity:Ps,kanban:Is,gantt:Ms};function Yc(e,t,r){return e[t]??r}function As(e,t="",r={}){for(let[a,n]of Object.entries(e)){let o=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?As(n,o,r):(typeof n=="string"||typeof n=="number")&&(r[o]=n);}return r}function Lg(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ls(e="asakaa"){let t=As(Vn),r=[];for(let[a,n]of Object.entries(t)){let o=`--${e}-${a}`,s=Lg(n);r.push(` ${o}: ${s};`);}return `:root {
278
+ Task dependencies must flow in one direction only.`);return}let G=X=>X.map(ee=>{if(ee.id===M){let oe=ee.dependencies||[];if(!oe.includes(N.id))return {...ee,dependencies:[...oe,N.id]}}return ee.subtasks?{...ee,subtasks:G(ee.subtasks)}:ee});ce(G(te)),w?.(N.id,M);},[te,w,Vs]),js=Te.useCallback((N,M)=>{let G=X=>X.map(ee=>{if(ee.id===N&&ee.dependencies){let oe=ee.dependencies.filter(tt=>tt!==M);return {...ee,dependencies:oe}}return ee.subtasks?{...ee,subtasks:G(ee.subtasks)}:ee});ce(G(te)),k?.(N,M);},[te,k]),{startDate:ld,endDate:cd}=Te.useMemo(()=>{let N=te.filter(oe=>oe.startDate&&oe.endDate);if(N.length===0){let oe=new Date,tt=new Date(oe);tt.setDate(tt.getDate()-30);let ot=new Date(oe);return ot.setDate(ot.getDate()+60),{startDate:tt,endDate:ot}}let M=N.flatMap(oe=>[oe.startDate,oe.endDate]).filter(oe=>oe!==void 0),G=new Date(Math.min(...M.map(oe=>oe.getTime()))),X=new Date(Math.max(...M.map(oe=>oe.getTime()))),ee=O==="day"?7:O==="week"?14:30;return G.setDate(G.getDate()-ee),X.setDate(X.getDate()+ee),{startDate:G,endDate:X}},[te,O]),dd=Te.useCallback(async()=>{if(!Ae.current)return;let N=await oc__default.default(Ae.current,{backgroundColor:de.bgPrimary,scale:2}),M=document.createElement("a");M.download="gantt-chart.png",M.href=N.toDataURL("image/png"),M.click();},[de]),ud=Te.useCallback(async()=>{await V.exportToPDF(te);},[te]),pd=Te.useCallback(async()=>{await V.exportToExcel(te);},[te]),md=Te.useCallback(()=>{let N=V.exportToCSV(te),M=new Blob([N],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(M),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href);},[te]),fd=Te.useCallback(()=>{let N=V.exportToJSON(te),M=new Blob([N],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(M),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href);},[te]),gd=Te.useCallback(()=>{V.exportToMSProject(te,"Gantt Project","project.xml");},[te]),hd=N=>{N.preventDefault(),P(true);};return Te.useEffect(()=>{let N=we.current,M=W.current;if(!N||!M)return;let G=M.querySelector(".gantt-taskgrid-content"),X=()=>{let tt=N.scrollTop;J(tt),G&&(G.style.transform=`translateY(-${tt}px)`);},ee=tt=>{if(ie){let ot=tt.clientX;ot>300&&ot<window.innerWidth-400&&ne(ot);}},oe=()=>{P(false);};return N.addEventListener("scroll",X),document.addEventListener("mousemove",ee),document.addEventListener("mouseup",oe),()=>{N.removeEventListener("scroll",X),document.removeEventListener("mousemove",ee),document.removeEventListener("mouseup",oe);}},[ie]),jsxRuntime.jsx(go.Provider,{value:ge,children:jsxRuntime.jsxs("div",{ref:Ae,className:"flex flex-col h-full w-full",style:{backgroundColor:de.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Dn,{theme:de,timeScale:O,onTimeScaleChange:E,zoom:z,onZoomChange:L,currentTheme:_,onThemeChange:bt,rowDensity:B,onRowDensityChange:U,showThemeSelector:l,onExportPNG:s?dd:void 0,onExportPDF:s?ud:void 0,onExportExcel:s?pd:void 0,onExportCSV:s?md:void 0,onExportJSON:s?fd:void 0,onExportMSProject:s?gd:void 0}),jsxRuntime.jsxs("div",{ref:W,className:"flex-1 flex min-h-0",style:{overflow:"hidden"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:K,overflow:"hidden"},children:jsxRuntime.jsx(Rn,{tasks:rr,theme:de,rowHeight:se,availableUsers:u,templates:he,onTaskClick:b,onTaskDblClick:Hs,onTaskContextMenu:g,onTaskToggle:Ce,scrollTop:re,columns:Ut,onToggleColumn:ye,onColumnResize:j,onTaskUpdate:S,onTaskIndent:H,onTaskOutdent:ue,onTaskMove:Pe,onMultiTaskDelete:Be,onTaskDuplicate:Ge,onTaskCreate:Mt,onTaskRename:Bt,onCreateSubtask:qn,onOpenTaskModal:b?N=>b(N):void 0})}),jsxRuntime.jsx("div",{className:"relative flex-shrink-0 cursor-col-resize group",style:{width:8,backgroundColor:ie?de.accent:de.border,transition:"background-color 0.2s"},onMouseDown:hd,children:jsxRuntime.jsx(framerMotion.motion.div,{className:"absolute inset-y-0 left-1/2 -translate-x-1/2",style:{width:2,backgroundColor:de.accent},initial:{opacity:0},animate:{opacity:ie?1:0},whileHover:{opacity:1}})}),jsxRuntime.jsx("div",{ref:we,className:"gantt-timeline-scroll flex-1 overflow-auto",style:{minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(On,{tasks:rr,theme:de,rowHeight:se,timeScale:O,startDate:ld,endDate:cd,zoom:z,templates:he,onTaskClick:b,onTaskDblClick:Hs,onTaskContextMenu:ha,onTaskDateChange:ga,onDependencyCreate:Ks,onDependencyDelete:js})})]}),ze.task&&jsxRuntime.jsx(ca,{isOpen:ze.isOpen,x:ze.x,y:ze.y,theme:de,onClose:()=>Qe({isOpen:false,x:0,y:0,task:null}),items:[{id:"split",label:"Split Task",icon:Pt.Split,onClick:()=>{if(!ze.task?.startDate||!ze.task?.endDate){console.warn("Cannot split task without dates");return}let N=ze.task.startDate.getTime(),M=ze.task.endDate.getTime(),G=N+(M-N)/2,X=new Date(G);id(ze.task,X);},disabled:!ze.task?.startDate||!ze.task?.endDate}]}),St&&jsxRuntime.jsx(zn,{isOpen:true,onClose:()=>ke(null),task:St,onSubmit:N=>{S(St.id,N),ke(null);},mode:"edit",theme:_}),m?.enabled&&jsxRuntime.jsx($n,{tasks:te,theme:de,config:m,onTasksUpdate:ce,onTaskUpdate:S,onTaskCreate:N=>{ce(M=>[...M,N]);},onTaskDelete:N=>{ce(M=>En(M,[N]));},onDependencyCreate:(N,M)=>{let G=V.findTaskById(te,N);G&&Ks(G,M);},onDependencyDelete:js})]})})});var lc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
279
+
280
+ AVAILABLE COMMANDS:
281
+ 1. move_task - Move a task to a different date
282
+ 2. resize_task - Change task duration (extend/shorten)
283
+ 3. rename_task - Rename a task
284
+ 4. delete_task - Delete a task
285
+ 5. create_task - Create a new task
286
+ 6. link_tasks - Create dependency between tasks
287
+ 7. unlink_tasks - Remove dependency
288
+ 8. assign_task - Assign users to task
289
+ 9. set_progress - Update task progress (0-100%)
290
+ 10. set_status - Change task status (todo, in-progress, completed)
291
+
292
+ RESPONSE FORMAT (JSON):
293
+ {
294
+ "type": "command_type",
295
+ "taskId": "id of the task to modify (if found)",
296
+ "taskName": "name of the task mentioned",
297
+ "updates": { /* partial task updates */ },
298
+ "newTask": { /* for create_task only */ },
299
+ "dependencyFrom": "source task id (for link/unlink)",
300
+ "dependencyTo": "target task id (for link/unlink)",
301
+ "message": "Human-readable response explaining what was done",
302
+ "success": true/false,
303
+ "error": "error message if failed"
304
+ }
305
+
306
+ EXAMPLES:
307
+ - "Move Design to next Monday" -> move_task with startDate update
308
+ - "Extend Testing by 3 days" -> resize_task with endDate update
309
+ - "Rename 'Old Task' to 'New Task'" -> rename_task with name update
310
+ - "Set Development progress to 50%" -> set_progress with progress: 50
311
+ - "Link Design to Development" -> link_tasks
312
+ - "Create a new task called 'Review'" -> create_task
313
+
314
+ TASK DATA FORMAT:
315
+ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assignees[]
316
+
317
+ Always try to match task names case-insensitively and handle partial matches.
318
+ If you can't find a task by name, search through the provided task list.
319
+ If ambiguous, ask for clarification in the message field.`;function cc(e){return `CURRENT TASKS:
320
+ ${dc(e).map(a=>{let n=a.startDate?a.startDate.toISOString().split("T")[0]:"no date",o=a.endDate?a.endDate.toISOString().split("T")[0]:"no date",i=a.dependencies?.length?`deps: [${a.dependencies.join(", ")}]`:"";return `- ${a.id}: "${a.name}" (${n} to ${o}, ${a.progress}%, ${a.status||"todo"}) ${i}`}).join(`
321
+ `)}
322
+
323
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function dc(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function yr(e,t){let r=dc(e),a=t.toLowerCase().trim(),n=r.find(c=>c.name.toLowerCase()===a);if(n)return n;let o=r.find(c=>c.name.toLowerCase().includes(a));if(o)return o;let i=a.split(/\s+/);return r.find(c=>{let l=c.name.toLowerCase();return i.every(s=>l.includes(s))})}function fs(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let l=new Date(a);return l.setDate(l.getDate()+1),l}if(r==="yesterday"||r==="ayer"){let l=new Date(a);return l.setDate(l.getDate()-1),l}if(r==="next week"||r==="la pr\xF3xima semana"){let l=new Date(a);return l.setDate(l.getDate()+7),l}let n=r.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let s={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}[n[1].toLowerCase()];if(s!==void 0){let u=new Date(a),d=u.getDay(),p=s-d;return p<=0&&(p+=7),u.setDate(u.getDate()+p),u}}let o=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(o&&o[1]&&o[2]){let l=parseInt(o[1],10),s=o[2].toLowerCase(),u=new Date(a);return s==="day"||s==="d\xEDa"||s==="dias"?u.setDate(u.getDate()+l):s==="week"||s==="semana"||s==="semanas"?u.setDate(u.getDate()+l*7):(s==="month"||s==="mes"||s==="meses")&&u.setMonth(u.getMonth()+l),u}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let c=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let l=parseInt(c[1],10),s=parseInt(c[2],10)-1,u=parseInt(c[3],10);return new Date(u,s,l)}return null}function gs(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function hs(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function uc(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 pc(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+["""]?(.+?)["""]?\s+(?:to|a|para)\s+(.+)/i);if(a&&a[1]&&a[2]){let s=a[1].trim(),u=a[2].trim(),d=yr(t,s),p=fs(u);if(!d)return {type:"move_task",taskName:s,message:`Could not find a task named "${s}". 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 m=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(p);return x.setDate(x.getDate()+m),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:x},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let s=n[1].trim(),u=n[2].trim(),d=yr(t,s),p=gs(u);if(!d)return {type:"resize_task",taskName:s,message:`Could not find a task named "${s}".`,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 m=new Date(d.endDate);return m.setDate(m.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:m},message:`Extended "${d.name}" by ${p} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let o=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(o&&o[1]&&o[2]){let s=o[1].trim(),u=o[2].trim(),d=yr(t,s),p=hs(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:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let i=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let s=i[1].trim(),u=i[2].trim(),d=yr(t,s);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:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let c=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let s=c[1].trim(),u=c[2].trim(),d=yr(t,s),p=yr(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:s,message:`Could not find a task named "${s}".`,success:false,error:"Source task not found"}}let l=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]){let s=l[1].trim(),u=yr(t,s);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}return null}function mc(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 ug(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 pg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return "TODO"}}function Un(e,t=[],r=[]){let a=e.assignedUserIds?.map(u=>{let d=r.find(p=>p.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Un(u,t,r)),o;e.dependencies&&(typeof e.dependencies[0]=="string"?o=e.dependencies:o=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let i=u=>{if(u)return typeof u=="string"?new Date(u):u},c=i(e.startDate),l=i(e.endDate),s=e.metadata?.isMilestone===true||c&&l&&Math.abs(l.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:l,progress:e.progress||0,status:ug(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:o?.length?o:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:s,isCriticalPath:e.metadata?.isCriticalPath===true}}function fc(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(o=>o.name===a.name||o.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:pg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function gc(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>Un(a,e,t))}function fg({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:o,onDeleteStack:i,className:c}){let[l,s]=Te.useState(false),u=Te.useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),d=Te.useMemo(()=>{let m=u.length,x=new Set(u.flatMap(g=>g.assignedUserIds||[])).size,b=u.map(g=>g.priority).filter(Boolean),v=new Set(u.flatMap(g=>g.labels||[])).size;return {totalCards:m,uniqueAssignees:x,priorities:b,labels:v}},[u]),p=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:ae("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>s(true),onMouseLeave:()=>s(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:ae("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"]})]}),l&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:m=>{m.stopPropagation(),i?.(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(m=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(m),children:r(m)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(m),children:[jsxRuntime.jsx("h4",{children:m.title}),m.description&&jsxRuntime.jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),o?.(e.id,m.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"})]})})]},m.id))})})]})}var vc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ua(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 Wa(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 bc(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 yc({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:o,config:i,className:c}){let l=Te.useMemo(()=>({...vc,...i}),[i]),[s,u]=Te.useState(new Set),d=Te.useRef(null),p=Te.useMemo(()=>{if(!l.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(f=>{let w=f.timestamp.toISOString().split("T")[0],k=h.get(w);k?k.push(f):h.set(w,[f]);}),Array.from(h.entries()).sort((f,w)=>w[0].localeCompare(f[0])).map(([f,w])=>({date:new Date(f),events:w.sort((k,y)=>y.timestamp.getTime()-k.timestamp.getTime())}))},[e,l.groupByDay]),{uniqueUsers:m,uniqueTypes:x}=Te.useMemo(()=>{let h=new Set,f=new Set;return e.forEach(w=>{h.add(w.userId),f.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(f)}},[e]),b=h=>{u(f=>{let w=new Set(f);return w.has(h)?w.delete(h):w.add(h),w});},v=h=>{let w=new Date().getTime()-h.getTime(),k=Math.floor(w/6e4),y=Math.floor(w/36e5),T=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:y<24?`${y}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},g=Te.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 Te.useEffect(()=>{if(o&&d.current){let h=d.current.querySelector(`[data-event-id="${o}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[o]),e.length===0?jsxRuntime.jsxs("div",{className:ae("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:ae("history-timeline",l.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let f=h.target.value;r({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),x.map(h=>jsxRuntime.jsxs("option",{value:h,children:[Wa(h)," ",h.replace("_"," ")]},h))]}),m.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let f=h.target.value;r({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),m.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=>r({...t,searchTerm:h.target.value})})]}),g>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",g,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:p.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[l.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((f,w)=>{let k=s.has(f.id),y=o===f.id,T=bc(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:ae("history-timeline-event",k&&"expanded",y&&"selected"),onClick:()=>n?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:l.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Wa(f.type)})}),w<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:[l.showAvatars&&f.userAvatar&&jsxRuntime.jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Ua(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:l.useRelativeTime?v(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),b(f.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([C,D])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(D.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(D.to)})]})]},C)),f.metadata&&Object.keys(f.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(f.metadata).map(([C,D])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},C))]})]})]})]},f.id)})})]},h.date?.toISOString()||"all"))})]})}function kc({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:o,onNext:i,onGoToEvent:c,onSpeedChange:l,className:s}){let u=[.5,1,1.5,2,3],d=Te.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=Te.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:ae("history-replay-empty",s),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:ae("history-replay",s),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Wa(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Ua(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:m=>c(parseInt(m.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((m,x)=>jsxRuntime.jsx("div",{className:ae("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>c(x),title:Ua(m)},m.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,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:n,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:i,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(m=>jsxRuntime.jsxs("button",{className:ae("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>l(m),children:[m,"x"]},m))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,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(m=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxRuntime.jsxs("div",{className:ae("history-replay-start",s),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:r,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 vs(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 bs(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 wc(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 Cc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function xg(e,t,r,a,n,o=100){let i=e.map(l=>({...l,x:l.x??r/2+Math.random()*100-50,y:l.y??a/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(i.map(l=>[l.id,l]));for(let l=0;l<o;l++){let s=1-l/o;i.forEach(u=>{let d=r/2,p=a/2;u.vx+=(d-u.x)*n.centerForce*s,u.vy+=(p-u.y)*n.centerForce*s,i.forEach(m=>{if(u.id===m.id)return;let x=u.x-m.x,b=u.y-m.y,v=Math.sqrt(x*x+b*b)||1,g=n.chargeStrength*s/(v*v);u.vx+=x/v*g,u.vy+=b/v*g;});}),t.forEach(u=>{let d=c.get(typeof u.source=="string"?u.source:u.source.id),p=c.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!p)return;let m=p.x-d.x,x=p.y-d.y,b=Math.sqrt(m*m+x*x)||1,v=(b-n.linkDistance)/b*n.forceStrength*s;d.vx+=m*v,d.vy+=x*v,p.vx-=m*v,p.vy-=x*v;}),i.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(n.nodeSize,Math.min(r-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return i}function Tc({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:o,stats:i,onInteraction:c,className:l}){let s=Te.useRef(null),[u,d]=Te.useState([]),[p,m]=Te.useState(null),[x,b]=Te.useState(null),[v,g]=Te.useState(null),[h,f]=Te.useState(1),[w,k]=Te.useState({x:0,y:0});Te.useEffect(()=>{if(e.length===0)return;let I=xg(e,t,r.width,r.height,r,150);d(I);},[e,t,r]);let y=Te.useCallback((I,O)=>{r.enableDragging&&(O.stopPropagation(),m(I));},[r.enableDragging]),T=Te.useCallback(I=>{if(!p||!s.current)return;let E=s.current.getBoundingClientRect(),B=(I.clientX-E.left-w.x)/h,U=(I.clientY-E.top-w.y)/h;d(z=>z.map(L=>L.id===p?{...L,x:B,y:U,fx:B,fy:U}:L));},[p,h,w]),C=Te.useCallback(()=>{m(null);},[]),D=Te.useCallback((I,O)=>{O.stopPropagation(),c?.({type:"node-click",node:I,position:{x:O.clientX,y:O.clientY}});},[c]),R=Te.useCallback((I,O)=>{O.stopPropagation(),c?.({type:"edge-click",edge:I,position:{x:O.clientX,y:O.clientY}});},[c]),$=Te.useCallback(I=>{let O=u.find(E=>E.id===I);return O?{x:O.x,y:O.y}:{x:0,y:0}},[u]),_=Te.useCallback(I=>{if(I.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return I.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let O=I.card.priority;return O==="URGENT"?"#ef4444":O==="HIGH"?"#f59e0b":O==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return I.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[r.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:ae("relationships-graph-empty",l),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:ae("relationships-graph",l),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:i.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:i.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),o&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(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:()=>f(I=>Math.max(I-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),k({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:vs(I)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[wc(I)," ",bs(I)]})]},I))}),jsxRuntime.jsxs("svg",{ref:s,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:T,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(I=>{let O=$(typeof I.source=="string"?I.source:I.source.id),E=$(typeof I.target=="string"?I.target:I.target.id),B=Cc(I.type),U=v===I.id,z=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:ae("relationships-graph-edge",U&&"hovered",z&&"critical"),onMouseEnter:()=>g(I.id),onMouseLeave:()=>g(null),onClick:L=>R(I,L),children:[jsxRuntime.jsx("line",{x1:O.x,y1:O.y,x2:E.x,y2:E.y,stroke:vs(I.type),strokeWidth:z?r.edgeWidth*2:r.edgeWidth,strokeOpacity:U?1:.6,markerEnd:B?"url(#arrowhead)":void 0}),r.showEdgeLabels&&U&&jsxRuntime.jsx("text",{x:(O.x+E.x)/2,y:(O.y+E.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:bs(I.type)})]},I.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(I=>{let O=x===I.id,E=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:ae("relationships-graph-node",O&&"hovered",E&&"critical"),transform:`translate(${I.x}, ${I.y})`,onMouseDown:B=>y(I.id,B),onMouseEnter:()=>b(I.id),onMouseLeave:()=>b(null),onClick:B=>D(I,B),children:[jsxRuntime.jsx("circle",{r:E?r.nodeSize*1.2:r.nodeSize,fill:_(I),stroke:E?"#fbbf24":"#ffffff",strokeWidth:E?3:2,opacity:O?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.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 Nc({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[o,i]=Te.useState(""),[c,l]=Te.useState(false),[s,u]=Te.useState(null),[d,p]=Te.useState(null),m=Te.useRef(null),x=c||n;Te.useEffect(()=>{e&&m.current&&m.current.focus();},[e]),Te.useEffect(()=>{let h=f=>{f.key==="Escape"&&!x&&b();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,x]);let b=()=>{x||(i(""),u(null),p(null),t());},v=async()=>{if(!(!o.trim()||x)){l(true),u(null),p(null);try{let h=await a(o.trim());p(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{l(false);}}},g=()=>{d&&(r(d),b());};return e?jsxRuntime.jsxs(Ke,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:b,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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,f)=>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},f))})]}),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,f)=>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})]})},f)),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:m,value:o,onChange:h=>i(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),s&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:s}),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,f)=>jsxRuntime.jsx("button",{onClick:()=>i(h),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:g,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:v,disabled:!o.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var ys={"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 wg={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Cg={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 Tg(e,t,r){let a=ys[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,o=r/1e3*a.costPer1kOutput;return n+o}function Ga(e){return `$${e.toFixed(4)}`}var xs=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=Tg(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let a=r.length,n=r.reduce((d,p)=>d+p.cost,0),o=r.reduce((d,p)=>d+p.inputTokens,0),i=r.reduce((d,p)=>d+p.outputTokens,0),c=r.filter(d=>d.success),l=r.reduce((d,p)=>d+p.duration,0),s={},u={};return r.forEach(d=>{s[d.feature]=(s[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:o,totalOutputTokens:i,operationsByFeature:s,costsByFeature:u,averageDuration:a>0?l/a:0,successRate:a>0?c.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],o=new Date,i=new Date;r==="month"?i.setMonth(o.getMonth()-1):i.setDate(o.getDate()-1);let c=this.operations.filter(u=>u.timestamp>=i).length,l=Math.max(0,n-c),s=c/n*100;return {used:c,limit:n,remaining:l,percentUsed:s,isExceeded:c>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Yr=new xs;function Pc({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=Te.useState(Yr.getStats()),[o,i]=Te.useState(Yr.checkLimit(r));if(Te.useEffect(()=>{if(!e)return;let l=setInterval(()=>{n(Yr.getStats()),i(Yr.checkLimit(r));},1e3);return ()=>clearInterval(l)},[e,r]),Te.useEffect(()=>{let l=s=>{s.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,t]),!e)return null;let c=Yr.getRecentOperations(5);return jsxRuntime.jsxs(Ke,{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:l=>l.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 (",r.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[o.used," / ",o.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,o.percentUsed)}%`,background:o.percentUsed>90?"#EF4444":o.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[o.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:Ga(a.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:a.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:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.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:[(a.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.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(a.operationsByFeature).map(([l,s])=>{let u=a.costsByFeature[l]||0,d=a.totalOperations>0?s/a.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:l.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:[s," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ga(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}%`}})})]},l)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(l=>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:l.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(l.timestamp).toLocaleTimeString()," \u2022"," ",l.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[l.inputTokens+l.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ga(l.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${l.success?"bg-green-400":"bg-red-400"}`})]})]},l.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 Ac({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:o}){let[i,c]=Te.useState(""),[l,s]=Te.useState(""),[u,d]=Te.useState(""),[p,m]=Te.useState(false),[x,b]=Te.useState(null),[v,g]=Te.useState(null),[h,f]=Te.useState(null),w=Te.useRef(null),k=p||n;Te.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),Te.useEffect(()=>{let R=$=>{$.key==="Escape"&&!k&&y();};if(e)return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[e,k]);let y=()=>{k||(c(""),s(""),d(""),b(null),g(null),f(null),t());},T=async()=>{if(!(!i.trim()||k)){m(true),b(null),g(null),f(null);try{let R=await a({prompt:i.trim(),projectName:o||"Mi Proyecto",startDate:l||void 0,endDate:u||void 0});g(R.tasks.tasks),f({from_cache:R.from_cache,tokens_used:R.tokens_used,mock_mode:R.mock_mode,similarity:R.similarity,tokens_saved:R.tokens_saved});}catch(R){b(R instanceof Error?R.message:"Failed to generate tasks");}finally{m(false);}}},C=()=>{v&&(r(v),y());};if(!e)return null;let D=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ke,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:y}),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:R=>R.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:y,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",D,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((R,$)=>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:["#",$+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:R.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"})]}),R.start," \u2192 ",R.end]}),jsxRuntime.jsxs("span",{children:[R.duration," days"]}),R.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",R.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${R.priority==="high"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:R.priority})]})},R.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:w,value:i,onChange:R=>c(R.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:l,onChange:R=>s(R.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:k})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:R=>d(R.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:k})]})]}),x&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((R,$)=>jsxRuntime.jsx("button",{onClick:()=>c(R),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:R},$))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:y,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsxRuntime.jsx("button",{onClick:C,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:!i.trim()||k,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:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function Hn({initialBoard:e,onPersist:t}){let[r,a]=Te.useState(e),n=Te.useCallback(v=>{t&&Ja(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(g,h,f)=>{console.warn(`Retry attempt ${h} after ${f}ms: ${g.message}`);}}).then(g=>{g.success||console.error(`Failed to persist board after ${g.attempts} attempts:`,g.error);});},[t]),o=Te.useCallback(async(v,g,h)=>{a(f=>{let w=f.cards.find(R=>R.id===v);if(!w)return f;let k=w.columnId,y={...w,columnId:g,position:h},T=f.cards.map(R=>R.id===v?y:R),C=f.columns.map(R=>{if(R.id===k)return {...R,cardIds:R.cardIds.filter($=>$!==v)};if(R.id===g){let $=T.filter(_=>_.columnId===g).sort((_,I)=>_.position-I.position);return {...R,cardIds:$.map(_=>_.id)}}return R}),D={...f,cards:T,columns:C};return n(D),D});},[n]),i=Te.useCallback(async(v,g)=>{a(h=>{let f=h.cards.map(k=>k.id===v?{...k,...g}:k),w={...h,cards:f};return n(w),w});},[n]),c=Te.useCallback(async v=>{let g=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let f={...v,id:g},w=h.columns.map(y=>y.id===v.columnId?{...y,cardIds:[...y.cardIds,g]}:y),k={...h,cards:[...h.cards,f],columns:w};return n(k),k});},[n]),l=Te.useCallback(async v=>{a(g=>{let h=g.cards.find(y=>y.id===v);if(!h)return g;let f=g.cards.filter(y=>y.id!==v),w=g.columns.map(y=>y.id===h.columnId?{...y,cardIds:y.cardIds.filter(T=>T!==v)}:y),k={...g,cards:f,columns:w};return n(k),k});},[n]),s=Te.useCallback(async v=>{let g=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let f={...v,id:g,cardIds:[]},w={...h,columns:[...h.columns,f]};return n(w),w});},[n]),u=Te.useCallback(async(v,g)=>{a(h=>{let f=h.columns.map(k=>k.id===v?{...k,...g}:k),w={...h,columns:f};return n(w),w});},[n]),d=Te.useCallback(async v=>{a(g=>{let h=g.cards.filter(k=>k.columnId!==v),f=g.columns.filter(k=>k.id!==v),w={...g,cards:h,columns:f};return n(w),w});},[n]),p=Te.useCallback(v=>{let g=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(v),g},[c]),m=Te.useCallback(v=>{let g=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return s(v),g},[s]),x=Te.useCallback(()=>{a(v=>{let g={...v,cards:[],columns:[]};return n(g),g});},[n]);return {board:r,callbacks:{onCardMove:o,onCardUpdate:i,onCardCreate:c,onCardDelete:l,onColumnCreate:s,onColumnUpdate:u,onColumnDelete:d},setBoard:a,helpers:{addCard:p,addColumn:m,deleteCard:l,deleteColumn:d,clearBoard:x}}}function Fc({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:o}=Hn({initialBoard:e,onPersist:r}),i=Te.useMemo(()=>({addCard:(l,s,u={})=>{o.addCard({title:s,columnId:l,position:a.cards.filter(d=>d.columnId===l).length,...u});},addColumn:(l,s)=>{let u=a.columns.length>0?Math.max(...a.columns.map(d=>d.position)):0;o.addColumn({title:l,position:s??u+1e3});},reset:o.clearBoard}),[a.cards,a.columns,o]);return {props:Te.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:i}}var Ha={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Oc={by:"none",order:"asc"};function zc({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=Te.useState({...Ha,...e}),[o,i]=Te.useState({...Oc,...t}),c=Te.useCallback(b=>{n(v=>({...v,...b}));},[]),l=Te.useCallback(b=>{i(v=>({...v,...b}));},[]),s=Te.useCallback(()=>{n(Ha),i(Oc);},[]),u=Te.useCallback(()=>{r&&n({...Ha,assignees:[r]});},[r]),d=Te.useCallback(()=>{n({...Ha,dateFilter:"overdue"});},[]),p=Te.useCallback(()=>{n({...Ha,priorities:["HIGH","URGENT"]});},[]),m=Te.useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||o.by!=="none",[a,o]),x=Te.useCallback(b=>{let v=[...b];if(a.search){let g=a.search.toLowerCase();v=v.filter(h=>h.title.toLowerCase().includes(g)||h.description?.toLowerCase().includes(g));}if(a.dateFilter!=="all"){let g=new Date,h=g.getFullYear(),f=String(g.getMonth()+1).padStart(2,"0"),w=String(g.getDate()).padStart(2,"0"),k=`${h}-${f}-${w}`;v=v.filter(y=>{if(!y.endDate&&!y.dueDate)return false;let T=y.endDate||y.dueDate;if(!T)return false;let C;if(typeof T=="string")C=T.split("T")[0]||T;else {let D=T.getUTCFullYear(),R=String(T.getUTCMonth()+1).padStart(2,"0"),$=String(T.getUTCDate()).padStart(2,"0");C=`${D}-${R}-${$}`;}switch(a.dateFilter){case "overdue":return C<k;case "today":return C===k;case "this-week":let D=new Date(k+"T00:00:00"),R=new Date(C+"T00:00:00"),$=new Date(D);return $.setDate($.getDate()+7),R>=D&&R<=$;case "custom":if(a.dateRange){let _=typeof T=="string"?new Date(T):T;return _>=a.dateRange.start&&_<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(v=v.filter(g=>g.priority&&a.priorities.includes(g.priority))),a.assignees.length>0&&(v=v.filter(g=>(g.assignedUserIds||(g.assigneeId?[g.assigneeId]:[])).some(f=>a.assignees.includes(f)))),a.labels.length>0&&(v=v.filter(g=>g.labels&&g.labels.some(h=>a.labels.includes(h)))),a.columns.length>0&&(v=v.filter(g=>a.columns.includes(g.columnId))),o.by!=="none"&&v.sort((g,h)=>{let f=0;switch(o.by){case "created":let w=g.createdAt?new Date(g.createdAt).getTime():0,k=h.createdAt?new Date(h.createdAt).getTime():0;f=w-k;break;case "priority":let y={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=y[g.priority||"LOW"],C=y[h.priority||"LOW"];f=T-C;break;case "dueDate":let D=g.endDate||g.dueDate,R=h.endDate||h.dueDate;if(!D)return 1;if(!R)return -1;let $=typeof D=="string"?new Date(D).getTime():D.getTime(),_=typeof R=="string"?new Date(R).getTime():R.getTime();f=$-_;break;case "title":f=g.title.localeCompare(h.title);break;case "estimate":let I=g.estimatedTime||0,O=h.estimatedTime||0;f=I-O;break;default:f=0;}return o.order==="asc"?f:-f}),v},[a,o]);return {filters:a,sort:o,setFilters:c,setSort:l,resetFilters:s,filterMyTasks:u,filterOverdue:d,filterHighPriority:p,applyFilters:x,hasActiveFilters:m}}var _c,Uc;if(typeof window<"u")try{let e=Ya("ai");_c=e.generateObject,Uc=e.generateText;}catch{}function Wc(e={}){let[t,r]=Te.useState(false),[a,n]=Te.useState(null),o=!!(_c&&Uc&&e.apiKey),i=Te.useCallback(async d=>{if(!o)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(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 m=p instanceof Error?p:new Error("Failed to generate plan");throw n(m),m}finally{r(false);}},[o]),c=Te.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(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 m=p instanceof Error?p:new Error("Failed to suggest assignee");throw n(m),m}finally{r(false);}},[o]),l=Te.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(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 m=p instanceof Error?p:new Error("Failed to predict risks");throw n(m),m}finally{r(false);}},[o]),s=Te.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(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 m=p instanceof Error?p:new Error("Failed to generate subtasks");throw n(m),m}finally{r(false);}},[o]),u=Te.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let m=p instanceof Error?p:new Error("Failed to estimate effort");throw n(m),m}finally{r(false);}},[o]);return {onGeneratePlan:i,onSuggestAssignee:c,onPredictRisks:l,onGenerateSubtasks:s,onEstimateEffort:u,isAvailable:o,isLoading:t,error:a}}function ws(){let[e,t]=Te.useState(()=>core.selectionStore.getState());Te.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=Te.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function Gc(e){let{cards:t}=e,[r,a]=ws(),n=Te.useCallback(d=>r.selectedCardIds.includes(d),[r.selectedCardIds]),o=Te.useCallback((d,p)=>{if(!p){a({selectedCardIds:[d],lastSelectedCardId:d});return}let m=p.ctrlKey||p.metaKey,x=p.shiftKey;if(m)r.selectedCardIds.includes(d)?a({selectedCardIds:r.selectedCardIds.filter(b=>b!==d),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,d],lastSelectedCardId:d});else if(x&&r.lastSelectedCardId){let b=t.find(g=>g.id===d),v=t.find(g=>g.id===r.lastSelectedCardId);if(b&&v&&b.columnId===v.columnId){let g=t.filter(C=>C.columnId===b.columnId).sort((C,D)=>C.position-D.position),h=g.findIndex(C=>C.id===r.lastSelectedCardId),f=g.findIndex(C=>C.id===d),[w,k]=h<f?[h,f]:[f,h],y=g.slice(w,k+1).map(C=>C.id),T=Array.from(new Set([...r.selectedCardIds,...y]));a({selectedCardIds:T,lastSelectedCardId:d});}else a({selectedCardIds:[d],lastSelectedCardId:d});}else a({selectedCardIds:[d],lastSelectedCardId:d});},[t,r,a]),i=Te.useCallback(d=>{a({selectedCardIds:r.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),c=Te.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),l=Te.useCallback(()=>{a({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),s=Te.useCallback(d=>{r.selectedCardIds.includes(d)?i(d):a({selectedCardIds:[...r.selectedCardIds,d],lastSelectedCardId:d});},[r,i,a]),u=Te.useCallback(()=>t.filter(d=>r.selectedCardIds.includes(d.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:o,deselectCard:i,clearSelection:c,selectAll:l,toggleCard:s,getSelectedCards:u}}var Hc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Vc(e){let{cards:t,config:r,aiService:a}=e,n=Te.useMemo(()=>({...Hc,...r}),[r]),[o,i]=Te.useState([]),c=Te.useCallback((b,v,g,h,f)=>{if(v.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:v,columnId:g,strategy:h,color:f,isExpanded:true,position:o.filter(k=>k.columnId===g).length,createdAt:new Date};i(k=>[...k,w]);},[n.minCardsPerStack,o]),l=Te.useCallback(b=>{i(v=>v.filter(g=>g.id!==b));},[]),s=Te.useCallback(b=>{i(v=>v.map(g=>g.id===b?{...g,isExpanded:!g.isExpanded}:g));},[]),u=Te.useCallback((b,v)=>{i(g=>g.map(h=>h.id===b&&!h.cardIds.includes(v)?{...h,cardIds:[...h.cardIds,v]}:h));},[]),d=Te.useCallback((b,v)=>{i(g=>g.map(h=>{if(h.id===b){let f=h.cardIds.filter(w=>w!==v);return f.length<n.minCardsPerStack?null:{...h,cardIds:f}}return h}).filter(h=>h!==null));},[n.minCardsPerStack]),p=Te.useCallback(b=>o.filter(v=>v.columnId===b).sort((v,g)=>v.position-g.position),[o]),m=Te.useCallback(async b=>{let v=t.filter(k=>k.columnId===b);if(v.length<n.minCardsPerStack*2)return [];let g=[],h=new Map;v.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(y=>{h.has(y)||h.set(y,[]),h.get(y).push(k);});}),h.forEach((k,y)=>{k.length>=n.minCardsPerStack&&g.push({stack:{title:`\u{1F4CC} ${y}`,cardIds:k.map(T=>T.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${y}"`,confidence:.85});});let f=new Map;v.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(y=>{f.has(y)||f.set(y,[]),f.get(y).push(k);});}),f.forEach((k,y)=>{k.length>=n.minCardsPerStack&&g.push({stack:{title:`\u{1F464} Assigned to user-${y.slice(-4)}`,cardIds:k.map(T=>T.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(v.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,y)=>{if(k.length>=n.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[y.toLowerCase()]||"\u26AA";g.push({stack:{title:`${T} ${y} Priority`,cardIds:k.map(C=>C.id),columnId:b,strategy:"priority",color:y==="high"||y==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${y} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let k of v){let T=(await a.findSimilar(k,v)).filter(C=>C.similarity>=n.autoStackConfidenceThreshold);if(T.length>=n.minCardsPerStack-1){let C=[k.id,...T.map(R=>R.card.id)],D=T.reduce((R,$)=>R+$.similarity,0)/T.length;g.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:C,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:D});}}return g.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,y)=>y.confidence-k.confidence).slice(0,5)},[t,n,a]),x=Te.useCallback(b=>{c(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[c]);return Te.useEffect(()=>{n.enableAutoStacking&&o.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let g=await m(v),h=g[0];g.length>0&&h&&h.confidence>=.9&&x(h);});},[]),{stacks:o,createStack:c,deleteStack:l,toggleStack:s,addToStack:u,removeFromStack:d,getStacksForColumn:p,getSuggestions:m,applySuggestion:x,config:n}}var Kc=Te.createContext(null);function jc({children:e,initialData:t,onStateChange:r}){let a=Te.useRef();if(!a.current){let o=new Map,i=new Map;t?.columns?.forEach(l=>{let{Column:s}=Ya("@libxai/core");o.set(l.id,new s(l));}),t?.cards?.forEach(l=>{let{Card:s}=Ya("@libxai/core");i.set(l.id,new s(l));});let c=null;if(t?.board){let{Board:l}=Ya("@libxai/core");c=new l(t.board);}a.current=new core.BoardStore({board:c,columns:o,cards:i});}let n=a.current;return Te.useEffect(()=>{if(r)return n.subscribeAll(o=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(Kc.Provider,{value:{store:n},children:e})}function Vn(){let e=Te.useContext(Kc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ka(){let e=Vn(),[t,r]=Te.useState(e.getBoard()),[a,n]=Te.useState(e.getAllColumns()),[o,i]=Te.useState(e.getAllCards());Te.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),i(e.getAllCards());}),[e]);let c=Te.useCallback(h=>{e.updateBoard(h);},[e]),l=Te.useCallback(h=>{e.addColumn(h);},[e]),s=Te.useCallback((h,f)=>{e.updateColumn(h,f);},[e]),u=Te.useCallback(h=>{e.deleteColumn(h);},[e]),d=Te.useCallback(h=>e.getColumn(h),[e]),p=Te.useCallback(h=>{e.addCard(h);},[e]),m=Te.useCallback((h,f)=>{e.updateCard(h,f);},[e]),x=Te.useCallback(h=>{e.deleteCard(h);},[e]),b=Te.useCallback((h,f,w)=>{e.moveCard(h,f,w);},[e]),v=Te.useCallback(h=>e.getCard(h),[e]),g=Te.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:a,cards:o,updateBoard:c,addColumn:l,updateColumn:s,deleteColumn:u,getColumn:d,addCard:p,updateCard:m,deleteCard:x,moveCard:b,getCard:v,getCardsByColumn:g}}function qc(e){let{cards:t}=Ka();return Te.useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),o=r.description?.toLowerCase().includes(a);if(!n&&!o)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function Xc(e="position",t="asc"){let{cards:r}=Ka();return Te.useMemo(()=>[...r].sort((n,o)=>{let i=0;switch(e){case "title":i=n.title.localeCompare(o.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},l=n.priority?c[n.priority]:0,s=o.priority?c[o.priority]:0;i=l-s;break}case "createdAt":i=n.createdAt.getTime()-o.createdAt.getTime();break;case "updatedAt":i=n.updatedAt.getTime()-o.updatedAt.getTime();break;case "position":i=n.position-o.position;break}return t==="asc"?i:-i}),[r,e,t])}var Kn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Xs.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 r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} 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(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(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,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let i=o[t];if(typeof i=="function")try{let c=await Promise.resolve(i.apply(o,r));c!==void 0&&(n=c,r[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,c,{plugin:o.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let o=n[t];typeof o=="function"&&a.push(Promise.resolve(o.apply(n,r)).catch(i=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,i,{plugin:n.id,hook:t});}));}await Promise.all(a);}},Ug=new Kn;function Zc({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:o=5,horizontal:i=false,gap:c=0,getItemKey:l}){let s=Te.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>s.current,estimateSize:()=>r,overscan:o,horizontal:i,gap:c}),d=u.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=i?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:s,style:p,className:n,children:jsxRuntime.jsx("div",{style:m,children:d.map(x=>{let b=e[x.index];if(!b)return null;let v=l?l(b,x.index):x.index,g={position:"absolute",top:i?0:x.start,left:i?x.start:0,width:i?x.size:"100%",height:i?"100%":x.size};return jsxRuntime.jsx("div",{style:g,"data-index":x.index,children:a(b,x.index)},v)})})})}function Qc(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 td({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:o="",overscan:i=3,gap:c=16,getItemKey:l,horizontal:s=true}){let u=Te.useRef(null),d=reactVirtual.useVirtualizer({horizontal:s,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>a,overscan:i,gap:c}),p=d.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},x={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:m,className:o,children:jsxRuntime.jsx("div",{style:x,children:p.map(b=>{let v=e[b.index];if(!v)return null;let g=l?l(v,b.index):b.index,h={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":b.index,children:n(v,b.index)},g)})})})}function rd(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 ad(e,t=10){return e>t}var Ds={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ns={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Es={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Rs={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ps={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Is={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ms={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},As={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)"},Ls={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)"},Fs={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Bs={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}},Os={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}},jn={spacing:Ds,borderRadius:Ns,fontSize:Es,fontWeight:Rs,lineHeight:Ps,zIndex:Is,duration:Ms,easing:As,shadows:Ls,opacity:Fs,kanban:Bs,gantt:Os};function nd(e,t,r){return e[t]??r}function zs(e,t="",r={}){for(let[a,n]of Object.entries(e)){let o=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?zs(n,o,r):(typeof n=="string"||typeof n=="number")&&(r[o]=n);}return r}function Hg(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function $s(e="asakaa"){let t=zs(jn),r=[];for(let[a,n]of Object.entries(t)){let o=`--${e}-${a}`,i=Hg(n);r.push(` ${o}: ${i};`);}return `:root {
279
324
  ${r.join(`
280
325
  `)}
281
- }`}function Ka(e,t="asakaa"){let r=[],a=As(e);for(let[n,o]of Object.entries(a)){let s=`--${t}-color-${n}`;r.push(` ${s}: ${o};`);}return `:root {
326
+ }`}function ja(e,t="asakaa"){let r=[],a=zs(e);for(let[n,o]of Object.entries(a)){let i=`--${t}-color-${n}`;r.push(` ${i}: ${o};`);}return `:root {
282
327
  ${r.join(`
283
328
  `)}
284
- }`}var Kn={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:"#8b5cf6",dependency:"#6b7280",weekend:"#2a2a2a"}},Fs={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:"#8b5cf6",dependency:"#6b7280",weekend:"#f9fafb"}},Bs={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:"#8b5cf6",dependency:"#71717a",weekend:"#27272a"}};function Os(e=Kn,t="asakaa"){let r=Ls(t),a=Ka(e,t);return `${r}
329
+ }`}var Yn={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:"#8b5cf6",dependency:"#6b7280",weekend:"#2a2a2a"}},_s={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:"#8b5cf6",dependency:"#6b7280",weekend:"#f9fafb"}},Us={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:"#8b5cf6",dependency:"#71717a",weekend:"#27272a"}};function Ws(e=Yn,t="asakaa"){let r=$s(t),a=ja(e,t);return `${r}
285
330
 
286
- ${a}`}function qc(){return `/**
331
+ ${a}`}function od(){return `/**
287
332
  * ASAKAA Design Tokens
288
333
  * Auto-generated from design-tokens.ts
289
334
  * Do not edit this file directly
290
335
  */
291
336
 
292
- ${Os(Kn)}
337
+ ${Ws(Yn)}
293
338
 
294
339
  /* Light theme */
295
340
  [data-theme="light"] {
296
- ${Ka(Fs,"asakaa").split(`
341
+ ${ja(_s,"asakaa").split(`
297
342
  `).slice(1,-1).join(`
298
343
  `)}
299
344
  }
300
345
 
301
346
  /* Neutral theme */
302
347
  [data-theme="neutral"] {
303
- ${Ka(Bs,"asakaa").split(`
348
+ ${ja(Us,"asakaa").split(`
304
349
  `).slice(1,-1).join(`
305
350
  `)}
306
351
  }
307
- `}var Fg=({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 Xc({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:o}=sa();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${r}`,children:Object.entries(o).map(([s,l])=>{let c=s,i=c===a;return jsxRuntime.jsxs("button",{onClick:()=>n(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(Fg,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
308
- 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=xc;exports.AI_FEATURES=mg;exports.AI_MODELS=fs;exports.AttachmentUploader=Aa;exports.BoardProvider=Oc;exports.BulkOperationsToolbar=kn;exports.BurnDownChart=Ro;exports.Card=gr;exports.CardDetailModal=To;exports.CardDetailModalV2=Do;exports.CardHistoryReplay=uc;exports.CardHistoryTimeline=cc;exports.CardRelationshipsGraph=fc;exports.CardStack=ng;exports.CardTemplateSelector=Bo;exports.CircuitBreaker=Xn;exports.Column=ea;exports.ColumnManager=Dn;exports.CommandPalette=wo;exports.ConfigMenu=Wo;exports.ContextMenu=la;exports.DEFAULT_SHORTCUTS=La;exports.DEFAULT_TEMPLATES=Fo;exports.DateRangePicker=Na;exports.DependenciesSelector=Ra;exports.DependencyLine=In;exports.DistributionCharts=Po;exports.EditableColumnTitle=vo;exports.ErrorBoundary=ra;exports.ExportImportModal=zo;exports.FilterBar=Uo;exports.GanttBoard=ac;exports.GanttMilestone=An;exports.GanttToolbar=Sn;exports.GenerateGanttTasksDialog=Cc;exports.GeneratePlanModal=vc;exports.GroupBySelector=Ao;exports.KanbanBoard=Tr;exports.KanbanViewAdapter=Ia;exports.KeyboardShortcutsHelp=Lo;exports.MenuIcons=Pt;exports.PluginManager=_n;exports.PrioritySelector=Da;exports.RATE_LIMITS=pg;exports.SwimlaneBoardView=Io;exports.TaskBar=Rn;exports.TaskFormModal=On;exports.TaskGrid=En;exports.ThemeModal=_o;exports.ThemeProvider=yl;exports.ThemeSwitcher=Xc;exports.Timeline=Bn;exports.UserAssignmentSelector=Wr;exports.VelocityChart=Eo;exports.VirtualGrid=Vc;exports.VirtualList=Gc;exports.aiUsageTracker=jr;exports.borderRadius=ws;exports.calculatePosition=qa;exports.cardToGanttTask=Un;exports.cardsToGanttTasks=oc;exports.cn=ae;exports.createKanbanView=tl;exports.createRetryWrapper=md;exports.darkTheme=$o;exports.darkTokenTheme=Kn;exports.defaultTheme=Cn;exports.designTokens=Vn;exports.duration=Ns;exports.easing=Es;exports.exportTokensToCSS=qc;exports.fontSize=Cs;exports.fontWeight=Ts;exports.formatCost=Ga;exports.ganttTaskToCardUpdate=nc;exports.ganttThemes=xe;exports.ganttTokens=Ms;exports.ganttUtils=V;exports.generateCSSVariables=Ls;exports.generateCompleteCSS=Os;exports.generateInitialPositions=cd;exports.generateThemeVariables=Ka;exports.getToken=Yc;exports.kanbanTokens=Is;exports.lightTheme=Go;exports.lightTokenTheme=Fs;exports.lineHeight=Ss;exports.neutralTheme=Ho;exports.neutralTokenTheme=Bs;exports.opacity=Ps;exports.pluginManager=Ig;exports.retrySyncOperation=pd;exports.retryWithBackoff=Xa;exports.shadows=Rs;exports.shouldVirtualizeGrid=jc;exports.spacing=ks;exports.themes=Hr;exports.useAI=Mc;exports.useBoard=Sc;exports.useBoardCore=Va;exports.useBoardStore=Hn;exports.useCardStacking=Fc;exports.useDragState=yo;exports.useFilteredCards=Uc;exports.useFilters=Ec;exports.useKanbanState=Gn;exports.useKeyboardShortcuts=hl;exports.useMultiSelect=Ac;exports.useSelectionState=vs;exports.useSortedCards=Wc;exports.useTheme=sa;exports.useVirtualGrid=Kc;exports.useVirtualList=Hc;exports.withErrorBoundary=xo;exports.zIndex=Ds;//# sourceMappingURL=index.cjs.map
352
+ `}var Vg=({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 sd({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:o}=ia();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${r}`,children:Object.entries(o).map(([i,c])=>{let l=i,s=l===a;return jsxRuntime.jsxs("button",{onClick:()=>n(l),className:`theme-switcher__button ${s?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":s,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Vg,{theme:l})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},l)})})}
353
+ 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=Pc;exports.AI_FEATURES=Cg;exports.AI_MODELS=ys;exports.AttachmentUploader=La;exports.BoardProvider=jc;exports.BulkOperationsToolbar=wn;exports.BurnDownChart=Io;exports.Card=gr;exports.CardDetailModal=Do;exports.CardDetailModalV2=Eo;exports.CardHistoryReplay=kc;exports.CardHistoryTimeline=yc;exports.CardRelationshipsGraph=Tc;exports.CardStack=fg;exports.CardTemplateSelector=zo;exports.CircuitBreaker=Zn;exports.Column=ta;exports.ColumnManager=Nn;exports.CommandPalette=To;exports.ConfigMenu=Wo;exports.ContextMenu=ca;exports.DEFAULT_SHORTCUTS=Fa;exports.DEFAULT_TEMPLATES=Oo;exports.DateRangePicker=Ea;exports.DependenciesSelector=Pa;exports.DependencyLine=Mn;exports.DistributionCharts=Mo;exports.EditableColumnTitle=yo;exports.ErrorBoundary=aa;exports.ExportImportModal=_o;exports.FilterBar=Uo;exports.GANTT_AI_SYSTEM_PROMPT=lc;exports.GanttAIAssistant=$n;exports.GanttBoard=ic;exports.GanttMilestone=Ln;exports.GanttToolbar=Dn;exports.GenerateGanttTasksDialog=Ac;exports.GeneratePlanModal=Nc;exports.GroupBySelector=Fo;exports.KanbanBoard=Sr;exports.KanbanViewAdapter=Ma;exports.KeyboardShortcutsHelp=Bo;exports.MenuIcons=Pt;exports.PluginManager=Kn;exports.PrioritySelector=Na;exports.RATE_LIMITS=wg;exports.SwimlaneBoardView=Ao;exports.TaskBar=Pn;exports.TaskFormModal=zn;exports.TaskGrid=Rn;exports.ThemeModal=Ko;exports.ThemeProvider=Tl;exports.ThemeSwitcher=sd;exports.Timeline=On;exports.UserAssignmentSelector=Ur;exports.VelocityChart=Po;exports.VirtualGrid=td;exports.VirtualList=Zc;exports.aiUsageTracker=Yr;exports.borderRadius=Ns;exports.calculatePosition=Xa;exports.cardToGanttTask=Un;exports.cardsToGanttTasks=gc;exports.cn=ae;exports.createKanbanView=sl;exports.createRetryWrapper=Cd;exports.darkTheme=Go;exports.darkTokenTheme=Yn;exports.defaultTheme=Tn;exports.designTokens=jn;exports.duration=Ms;exports.easing=As;exports.exportTokensToCSS=od;exports.findTaskByName=yr;exports.fontSize=Es;exports.fontWeight=Rs;exports.formatCost=Ga;exports.ganttTaskToCardUpdate=fc;exports.ganttThemes=xe;exports.ganttTokens=Os;exports.ganttUtils=V;exports.generateCSSVariables=$s;exports.generateCompleteCSS=Ws;exports.generateInitialPositions=yd;exports.generateTasksContext=cc;exports.generateThemeVariables=ja;exports.getToken=nd;exports.kanbanTokens=Bs;exports.lightTheme=Ho;exports.lightTokenTheme=_s;exports.lineHeight=Ps;exports.neutralTheme=Vo;exports.neutralTokenTheme=Us;exports.opacity=Fs;exports.parseLocalCommand=pc;exports.parseNaturalDate=fs;exports.parseNaturalDuration=gs;exports.parseProgress=hs;exports.parseStatus=uc;exports.pluginManager=Ug;exports.retrySyncOperation=wd;exports.retryWithBackoff=Ja;exports.shadows=Ls;exports.shouldVirtualizeGrid=ad;exports.spacing=Ds;exports.themes=Hr;exports.useAI=Wc;exports.useBoard=Fc;exports.useBoardCore=Ka;exports.useBoardStore=Vn;exports.useCardStacking=Vc;exports.useDragState=ko;exports.useFilteredCards=qc;exports.useFilters=zc;exports.useKanbanState=Hn;exports.useKeyboardShortcuts=kl;exports.useMultiSelect=Gc;exports.useSelectionState=ws;exports.useSortedCards=Xc;exports.useTheme=ia;exports.useVirtualGrid=rd;exports.useVirtualList=Qc;exports.validateAIResponse=mc;exports.withErrorBoundary=wo;exports.zIndex=Is;//# sourceMappingURL=index.cjs.map
309
354
  //# sourceMappingURL=index.cjs.map