@libxai/board 0.14.5 → 0.14.7
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 +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),we=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'),sc=require('html2canvas'),jsxRuntime=require('react/jsx-runtime'),Li=require('react-dom'),cmdk=require('cmdk'),Ap=require('react-markdown'),Lp=require('remark-gfm'),Fp=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 we__namespace=/*#__PURE__*/_interopNamespace(we);var sc__default=/*#__PURE__*/_interopDefault(sc);var Li__namespace=/*#__PURE__*/_interopNamespace(Li);var Ap__default=/*#__PURE__*/_interopDefault(Ap);var Lp__default=/*#__PURE__*/_interopDefault(Lp);var Fp__default=/*#__PURE__*/_interopDefault(Fp);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 re(...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 Cd(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 Td=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 Sd(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:s=Td,onRetry:c}=t,d,i=0;for(let u=1;u<=r;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(d=l,u===r||!s(d,u))return {error:d,attempts:i,success:false};let m=Sd(u,a,n,o);if(c)try{c(d,u,m);}catch(b){console.error("Error in retry callback:",b);}await new Promise(b=>setTimeout(b,m));}}return {error:d||new Error("Unknown error"),attempts:i,success:false}}function Dd(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 Nd(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,...s}=t,c=`[${r}] [${a}] [${o}]`,d=Object.keys(s).length>0;switch(a){case "DEBUG":console.debug(c,n,d?s:"");break;case "INFO":console.info(c,n,d?s:"");break;case "WARN":console.warn(c,n,d?s:"");break;case "ERROR":console.error(c,n,d?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",...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 Rd(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 Pd(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(c=>c.id===o.columnId);return [o.id,eo(o.title),eo(o.description||""),eo(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
2
|
`)}async function Id(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 sc__default.default(a,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:a.scrollWidth,windowHeight:a.scrollHeight}),c=s.toDataURL("image/png"),d=297,i=210,u=s.width/s.height,l=d-20,p=l/u;p>i-20&&(p=i-20,l=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,d,15,"F"),m.text(e.title||"Kanban Board",10,10);let b=(d-l)/2;return m.addImage(c,"PNG",b,20,l,p),m}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 c=e.cards.filter(d=>d.columnId===s.id);o>250&&(n.addPage(),o=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(s.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(d=>{if(o>260&&(n.addPage(),o=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(d.title,25,o),o+=6,d.description){n.setFontSize(9),n.setFont("helvetica","normal");let u=n.splitTextToSize(d.description,160);n.text(u,25,o),o+=u.length*5;}let i=[];if(d.priority&&i.push(`Priority: ${d.priority}`),d.labels&&d.labels.length>0&&i.push(`Labels: ${d.labels.join(", ")}`),d.assignedUserIds&&d.assignedUserIds.length>0&&i.push(`Assigned: ${d.assignedUserIds.length} user(s)`),d.startDate||d.endDate){let u=[];d.startDate&&u.push(`Start: ${d.startDate}`),d.endDate&&u.push(`End: ${d.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 eo(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
3
|
`)?`"${e.replace(/"/g,'""')}"`:e}async function Zs(e,t,r,a){switch(t){case "json":return Rd(e,a);case "csv":return Pd(e);case "pdf":return await Id(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]}`,s={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:s[t]}),d=URL.createObjectURL(c),i=document.createElement("a");i.href=d,i.download=o,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(d);}function Md(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 Ad(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 s=1;s<t.length;s++)try{let c=ei(t[s]||"");if(c.length>r.length){o.push(`Line ${s+1}: Too many columns`);continue}if(r.length-c.length>3){o.push(`Line ${s+1}: Column count mismatch (expected ${r.length}, got ${c.length})`);continue}for(;c.length<r.length;)c.push("");let i={};r.forEach((m,b)=>{i[m]=c[b]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let l=n.get(u),p={id:i["Card ID"]||`card-${s}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};a.push(p),l.cardIds.push(p.id);}catch(c){o.push(`Line ${s+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],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 ti(e,t){switch(t){case "json":return Md(e);case "csv":return Ad(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 wr(e){return ro(e)?(e.nodeName||"").toLowerCase():"#document"}function wt(e){var t;return (e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Kt(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 wt(e).Node:false}function ft(e){return Qa()?e instanceof Element||e instanceof wt(e).Element:false}function _t(e){return Qa()?e instanceof HTMLElement||e instanceof wt(e).HTMLElement:false}function to(e){return !Qa()||typeof ShadowRoot>"u"?false:e instanceof ShadowRoot||e instanceof wt(e).ShadowRoot}var Ld=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)&&!Ld.has(n)}var Fd=new Set(["table","td","th"]);function ai(e){return Fd.has(wr(e))}var Bd=[":popover-open",":modal"];function va(e){return Bd.some(t=>{try{return e.matches(t)}catch{return false}})}var Od=["transform","translate","scale","rotate","perspective"],zd=["transform","translate","scale","rotate","perspective","filter"],$d=["paint","layout","strict","content"];function en(e){let t=ba(),r=ft(e)?Dt(e):e;return Od.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)||zd.some(a=>(r.willChange||"").includes(a))||$d.some(a=>(r.contain||"").includes(a))}function ni(e){let t=nr(e);for(;_t(t)&&!Cr(t);){if(en(t))return t;if(va(t))return null;t=nr(t);}return null}function ba(){return typeof CSS>"u"||!CSS.supports?false:CSS.supports("-webkit-backdrop-filter","none")}var _d=new Set(["html","body","#document"]);function Cr(e){return _d.has(wr(e))}function Dt(e){return wt(e).getComputedStyle(e)}function ya(e){return ft(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nr(e){if(wr(e)==="html")return e;let t=e.assignedSlot||e.parentNode||to(e)&&e.host||Kt(e);return to(t)?t.host:t}function oi(e){let t=nr(e);return Cr(t)?e.ownerDocument?e.ownerDocument.body:e.body:_t(t)&&Zr(t)?t:oi(t)}function mr(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),s=wt(n);if(o){let c=tn(s);return t.concat(s,s.visualViewport||[],Zr(n)?n:[],c&&r?mr(c):[])}return t.concat(n,mr(n,[],r))}function tn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var or=Math.min,Ct=Math.max,ka=Math.round,wa=Math.floor,jt=e=>({x:e,y:e}),Ud={left:"right",right:"left",bottom:"top",top:"bottom"},Wd={start:"end",end:"start"};function an(e,t,r){return Ct(e,or(t,r))}function Or(e,t){return typeof e=="function"?e(t):e}function fr(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 Gd=new Set(["top","bottom"]);function sr(e){return Gd.has(fr(e))?"y":"x"}function on(e){return ao(sr(e))}function li(e,t,r){r===void 0&&(r=false);let a=zr(e),n=on(e),o=nn(n),s=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=xa(s)),[s,xa(s)]}function ci(e){let t=xa(e);return [rn(e),t,rn(t)]}function rn(e){return e.replace(/start|end/g,t=>Wd[t])}var si=["left","right"],ii=["right","left"],Hd=["top","bottom"],Vd=["bottom","top"];function Kd(e,t,r){switch(e){case "top":case "bottom":return r?t?ii:si:t?si:ii;case "left":case "right":return t?Hd:Vd;default:return []}}function di(e,t,r,a){let n=zr(e),o=Kd(fr(e),r==="start",a);return n&&(o=o.map(s=>s+"-"+n),t&&(o=o.concat(o.map(rn)))),o}function xa(e){return e.replace(/left|right|bottom|top/g,t=>Ud[t])}function jd(e){return {top:0,right:0,bottom:0,left:0,...e}}function no(e){return typeof e!="number"?jd(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 qd=typeof document<"u",Xd=function(){},Ta=qd?we.useLayoutEffect:Xd,Jd={...we__namespace};var Zd=Jd.useInsertionEffect,Qd=Zd||(e=>e());function ui(e){let t=we__namespace.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Qd(()=>{t.current=e;}),we__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=sr(t),s=on(t),c=nn(s),d=fr(t),i=o==="y",u=a.x+a.width/2-n.width/2,l=a.y+a.height/2-n.height/2,p=a[c]/2-n[c]/2,m;switch(d){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:l};break;case "left":m={x:a.x-n.width,y:l};break;default:m={x:a.x,y:a.y};}switch(zr(t)){case "start":m[s]-=p*(r&&i?-1:1);break;case "end":m[s]+=p*(r&&i?-1:1);break}return m}var mi=async(e,t,r)=>{let{placement:a="bottom",strategy:n="absolute",middleware:o=[],platform:s}=r,c=o.filter(Boolean),d=await(s.isRTL==null?void 0:s.isRTL(t)),i=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:l}=pi(i,a,d),p=a,m={},b=0;for(let y=0;y<c.length;y++){let{name:h,fn:g}=c[y],{x:v,y:f,data:w,reset:k}=await g({x:u,y:l,initialPlacement:a,placement:p,strategy:n,middlewareData:m,rects:i,platform:s,elements:{reference:e,floating:t}});u=v??u,l=f??l,m={...m,[h]:{...m[h],...w}},k&&b<=50&&(b++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(i=k.rects===true?await s.getElementRects({reference:e,floating:t,strategy:n}):k.rects),{x:u,y:l}=pi(i,p,d)),y=-1);}return {x:u,y:l,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:s,elements:c,strategy:d}=e,{boundary:i="clippingAncestors",rootBoundary:u="viewport",elementContext:l="floating",altBoundary:p=false,padding:m=0}=Or(t,e),b=no(m),h=c[p?l==="floating"?"reference":"floating":l],g=$r(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(h)))==null||r?h:h.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:i,rootBoundary:u,strategy:d})),v=l==="floating"?{x:a,y:n,width:s.floating.width,height:s.floating.height}:s.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:v,offsetParent:f,strategy:d}):v);return {top:(g.top-k.top+b.top)/w.y,bottom:(k.bottom-g.bottom+b.bottom)/w.y,left:(g.left-k.left+b.left)/w.x,right:(k.right-g.right+b.right)/w.x}}var fi=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:a,placement:n,rects:o,platform:s,elements:c,middlewareData:d}=t,{element:i,padding:u=0}=Or(e,t)||{};if(i==null)return {};let l=no(u),p={x:r,y:a},m=on(n),b=nn(m),y=await s.getDimensions(i),h=m==="y",g=h?"top":"left",v=h?"bottom":"right",f=h?"clientHeight":"clientWidth",w=o.reference[b]+o.reference[m]-p[m]-o.floating[b],k=p[m]-o.reference[m],x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i)),C=x?x[f]:0;(!C||!await(s.isElement==null?void 0:s.isElement(x)))&&(C=c.floating[f]||o.floating[b]);let T=w/2-k/2,D=C/2-y[b]/2-1,R=or(l[g],D),_=or(l[v],D),G=R,M=C-y[b]-_,O=C/2-y[b]/2+T,E=an(G,O,M),B=!d.arrow&&zr(n)!=null&&O!==E&&o.reference[b]/2-(O<G?R:_)-y[b]/2<0,z=B?O<G?O-G:O-M:0;return {[m]:p[m]+z,data:{[m]:E,centerOffset:O-E-z,...B&&{alignmentOffset:z}},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:s,initialPlacement:c,platform:d,elements:i}=t,{mainAxis:u=true,crossAxis:l=true,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:y=true,...h}=Or(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return {};let g=fr(n),v=sr(c),f=fr(c)===c,w=await(d.isRTL==null?void 0:d.isRTL(i.floating)),k=p||(f||!y?[xa(c)]:ci(c)),x=b!=="none";!p&&x&&k.push(...di(c,y,b,w));let C=[c,...k],T=await sn(t,h),D=[],R=((a=o.flip)==null?void 0:a.overflows)||[];if(u&&D.push(T[g]),l){let O=li(n,s,w);D.push(T[O[0]],T[O[1]]);}if(R=[...R,{placement:n,overflows:D}],!D.every(O=>O<=0)){var _,G;let O=(((_=o.flip)==null?void 0:_.index)||0)+1,E=C[O];if(E&&(!(l==="alignment"?v!==sr(E):false)||R.every($=>sr($.placement)===v?$.overflows[0]>0:true)))return {data:{index:O,overflows:R},reset:{placement:E}};let B=(G=R.filter(z=>z.overflows[0]<=0).sort((z,$)=>z.overflows[1]-$.overflows[1])[0])==null?void 0:G.placement;if(!B)switch(m){case "bestFit":{var M;let z=(M=R.filter($=>{if(x){let A=sr($.placement);return A===v||A==="y"}return true}).map($=>[$.placement,$.overflows.filter(A=>A>0).reduce((A,te)=>A+te,0)]).sort(($,A)=>$[1]-A[1])[0])==null?void 0:M[0];z&&(B=z);break}case "initialPlacement":B=c;break}if(n!==B)return {reset:{placement:B}}}return {}}}};var eu=new Set(["left","top"]);async function tu(e,t){let{placement:r,platform:a,elements:n}=e,o=await(a.isRTL==null?void 0:a.isRTL(n.floating)),s=fr(r),c=zr(r),d=sr(r)==="y",i=eu.has(s)?-1:1,u=o&&d?-1:1,l=Or(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:b}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return c&&typeof b=="number"&&(m=c==="end"?b*-1:b),d?{x:m*u,y:p*i}:{x:p*i,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:s,middlewareData:c}=t,d=await tu(t,e);return s===((r=c.offset)==null?void 0:r.placement)&&(a=c.arrow)!=null&&a.alignmentOffset?{}:{x:n+d.x,y:o+d.y,data:{...d,placement:s}}}}},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:s=false,limiter:c={fn:h=>{let{x:g,y:v}=h;return {x:g,y:v}}},...d}=Or(e,t),i={x:r,y:a},u=await sn(t,d),l=sr(fr(n)),p=ao(l),m=i[p],b=i[l];if(o){let h=p==="y"?"top":"left",g=p==="y"?"bottom":"right",v=m+u[h],f=m-u[g];m=an(v,m,f);}if(s){let h=l==="y"?"top":"left",g=l==="y"?"bottom":"right",v=b+u[h],f=b-u[g];b=an(v,b,f);}let y=c.fn({...t,[p]:m,[l]:b});return {...y,data:{x:y.x-r,y:y.y-a,enabled:{[p]:o,[l]:s}}}}}};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:s,elements:c}=t,{apply:d=()=>{},...i}=Or(e,t),u=await sn(t,i),l=fr(n),p=zr(n),m=sr(n)==="y",{width:b,height:y}=o.floating,h,g;l==="top"||l==="bottom"?(h=l,g=p===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(g=l,h=p==="end"?"top":"bottom");let v=y-u.top-u.bottom,f=b-u.left-u.right,w=or(y-u[h],v),k=or(b-u[g],f),x=!t.middlewareData.shift,C=w,T=k;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(T=f),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(C=v),x&&!p){let R=Ct(u.left,0),_=Ct(u.right,0),G=Ct(u.top,0),M=Ct(u.bottom,0);m?T=b-2*(R!==0||_!==0?R+_:Ct(u.left,u.right)):C=y-2*(G!==0||M!==0?G+M:Ct(u.top,u.bottom));}await d({...t,availableWidth:T,availableHeight:C});let D=await s.getDimensions(c.floating);return b!==D.width||y!==D.height?{reset:{rects:true}}:{}}}};function wi(e){let t=Dt(e),r=parseFloat(t.width)||0,a=parseFloat(t.height)||0,n=_t(e),o=n?e.offsetWidth:r,s=n?e.offsetHeight:a,c=ka(r)!==o||ka(a)!==s;return c&&(r=o,a=s),{width:r,height:a,$:c}}function so(e){return ft(e)?e:e.contextElement}function Qr(e){let t=so(e);if(!_t(t))return jt(1);let r=t.getBoundingClientRect(),{width:a,height:n,$:o}=wi(t),s=(o?ka(r.width):r.width)/a,c=(o?ka(r.height):r.height)/n;return (!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}var ru=jt(0);function Ci(e){let t=wt(e);return !ba()||!t.visualViewport?ru:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function au(e,t,r){return t===void 0&&(t=false),!r||t&&r!==wt(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),s=jt(1);t&&(a?ft(a)&&(s=Qr(a)):s=Qr(e));let c=au(o,r,a)?Ci(o):jt(0),d=(n.left+c.x)/s.x,i=(n.top+c.y)/s.y,u=n.width/s.x,l=n.height/s.y;if(o){let p=wt(o),m=a&&ft(a)?wt(a):a,b=p,y=tn(b);for(;y&&a&&m!==b;){let h=Qr(y),g=y.getBoundingClientRect(),v=Dt(y),f=g.left+(y.clientLeft+parseFloat(v.paddingLeft))*h.x,w=g.top+(y.clientTop+parseFloat(v.paddingTop))*h.y;d*=h.x,i*=h.y,u*=h.x,l*=h.y,d+=f,i+=w,b=wt(y),y=tn(b);}}return $r({width:u,height:l,x:d,y:i})}function ln(e,t){let r=ya(e).scrollLeft;return t?t.left+r:_r(Kt(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 nu(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e,o=n==="fixed",s=Kt(a),c=t?va(t.floating):false;if(a===s||c&&o)return r;let d={scrollLeft:0,scrollTop:0},i=jt(1),u=jt(0),l=_t(a);if((l||!l&&!o)&&((wr(a)!=="body"||Zr(s))&&(d=ya(a)),_t(a))){let m=_r(a);i=Qr(a),u.x=m.x+a.clientLeft,u.y=m.y+a.clientTop;}let p=s&&!l&&!o?Ti(s,d):jt(0);return {width:r.width*i.x,height:r.height*i.y,x:r.x*i.x-d.scrollLeft*i.x+u.x+p.x,y:r.y*i.y-d.scrollTop*i.y+u.y+p.y}}function ou(e){return Array.from(e.getClientRects())}function su(e){let t=Kt(e),r=ya(e),a=e.ownerDocument.body,n=Ct(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),o=Ct(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),s=-r.scrollLeft+ln(e),c=-r.scrollTop;return Dt(a).direction==="rtl"&&(s+=Ct(t.clientWidth,a.clientWidth)-n),{width:n,height:o,x:s,y:c}}var yi=25;function iu(e,t){let r=wt(e),a=Kt(e),n=r.visualViewport,o=a.clientWidth,s=a.clientHeight,c=0,d=0;if(n){o=n.width,s=n.height;let u=ba();(!u||u&&t==="fixed")&&(c=n.offsetLeft,d=n.offsetTop);}let i=ln(a);if(i<=0){let u=a.ownerDocument,l=u.body,p=getComputedStyle(l),m=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,b=Math.abs(a.clientWidth-l.clientWidth-m);b<=yi&&(o-=b);}else i<=yi&&(o+=i);return {width:o,height:s,x:c,y:d}}var lu=new Set(["absolute","fixed"]);function cu(e,t){let r=_r(e,true,t==="fixed"),a=r.top+e.clientTop,n=r.left+e.clientLeft,o=_t(e)?Qr(e):jt(1),s=e.clientWidth*o.x,c=e.clientHeight*o.y,d=n*o.x,i=a*o.y;return {width:s,height:c,x:d,y:i}}function xi(e,t,r){let a;if(t==="viewport")a=iu(e,r);else if(t==="document")a=su(Kt(e));else if(ft(t))a=cu(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=nr(e);return r===t||!ft(r)||Cr(r)?false:Dt(r).position==="fixed"||Si(r,t)}function du(e,t){let r=t.get(e);if(r)return r;let a=mr(e,[],false).filter(c=>ft(c)&&wr(c)!=="body"),n=null,o=Dt(e).position==="fixed",s=o?nr(e):e;for(;ft(s)&&!Cr(s);){let c=Dt(s),d=en(s);!d&&c.position==="fixed"&&(n=null),(o?!d&&!n:!d&&c.position==="static"&&!!n&&lu.has(n.position)||Zr(s)&&!d&&Si(e,s))?a=a.filter(u=>u!==s):n=c,s=nr(s);}return t.set(e,a),a}function uu(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e,s=[...r==="clippingAncestors"?va(t)?[]:du(t,this._c):[].concat(r),a],c=s[0],d=s.reduce((i,u)=>{let l=xi(t,u,n);return i.top=Ct(l.top,i.top),i.right=or(l.right,i.right),i.bottom=or(l.bottom,i.bottom),i.left=Ct(l.left,i.left),i},xi(t,c,n));return {width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function pu(e){let{width:t,height:r}=wi(e);return {width:t,height:r}}function mu(e,t,r){let a=_t(t),n=Kt(t),o=r==="fixed",s=_r(e,true,o,t),c={scrollLeft:0,scrollTop:0},d=jt(0);function i(){d.x=ln(n);}if(a||!a&&!o)if((wr(t)!=="body"||Zr(n))&&(c=ya(t)),a){let m=_r(t,true,o,t);d.x=m.x+t.clientLeft,d.y=m.y+t.clientTop;}else n&&i();o&&!a&&n&&i();let u=n&&!a&&!o?Ti(n,c):jt(0),l=s.left+c.scrollLeft-d.x-u.x,p=s.top+c.scrollTop-d.y-u.y;return {x:l,y:p,width:s.width,height:s.height}}function oo(e){return Dt(e).position==="static"}function ki(e,t){if(!_t(e)||Dt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Kt(e)===r&&(r=r.ownerDocument.body),r}function Di(e,t){let r=wt(e);if(va(e))return r;if(!_t(e)){let n=nr(e);for(;n&&!Cr(n);){if(ft(n)&&!oo(n))return n;n=nr(n);}return r}let a=ki(e,t);for(;a&&ai(a)&&oo(a);)a=ki(a,t);return a&&Cr(a)&&oo(a)&&!en(a)?r:a||ni(e)||r}var fu=async function(e){let t=this.getOffsetParent||Di,r=this.getDimensions,a=await r(e.floating);return {reference:mu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function gu(e){return Dt(e).direction==="rtl"}var io={convertOffsetParentRelativeRectToViewportRelativeRect:nu,getDocumentElement:Kt,getClippingRect:uu,getOffsetParent:Di,getElementRects:fu,getClientRects:ou,getDimensions:pu,getScale:Qr,isElement:ft,isRTL:gu};function Ni(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hu(e,t){let r=null,a,n=Kt(e);function o(){var c;clearTimeout(a),(c=r)==null||c.disconnect(),r=null;}function s(c,d){c===void 0&&(c=false),d===void 0&&(d=1),o();let i=e.getBoundingClientRect(),{left:u,top:l,width:p,height:m}=i;if(c||t(),!p||!m)return;let b=wa(l),y=wa(n.clientWidth-(u+p)),h=wa(n.clientHeight-(l+m)),g=wa(u),f={rootMargin:-b+"px "+-y+"px "+-h+"px "+-g+"px",threshold:Ct(0,or(1,d))||1},w=true;function k(x){let C=x[0].intersectionRatio;if(C!==d){if(!w)return s();C?s(false,C):a=setTimeout(()=>{s(false,1e-7);},1e3);}C===1&&!Ni(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 cn(e,t,r,a){a===void 0&&(a={});let{ancestorScroll:n=true,ancestorResize:o=true,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=false}=a,i=so(e),u=n||o?[...i?mr(i):[],...mr(t)]:[];u.forEach(g=>{n&&g.addEventListener("scroll",r,{passive:true}),o&&g.addEventListener("resize",r);});let l=i&&c?hu(i,r):null,p=-1,m=null;s&&(m=new ResizeObserver(g=>{let[v]=g;v&&v.target===i&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var f;(f=m)==null||f.observe(t);})),r();}),i&&!d&&m.observe(i),m.observe(t));let b,y=d?_r(e):null;d&&h();function h(){let g=_r(e);y&&!Ni(y,g)&&r(),y=g,b=requestAnimationFrame(h);}return r(),()=>{var g;u.forEach(v=>{n&&v.removeEventListener("scroll",r),o&&v.removeEventListener("resize",r);}),l?.(),(g=m)==null||g.disconnect(),m=null,d&&cancelAnimationFrame(b);}}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 bu=typeof document<"u",yu=function(){},un=bu?we.useLayoutEffect:yu;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=we__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:s}={},transform:c=true,whileElementsMounted:d,open:i}=e,[u,l]=we__namespace.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:false}),[p,m]=we__namespace.useState(a);pn(p,a)||m(a);let[b,y]=we__namespace.useState(null),[h,g]=we__namespace.useState(null),v=we__namespace.useCallback($=>{$!==x.current&&(x.current=$,y($));},[]),f=we__namespace.useCallback($=>{$!==C.current&&(C.current=$,g($));},[]),w=o||b,k=s||h,x=we__namespace.useRef(null),C=we__namespace.useRef(null),T=we__namespace.useRef(u),D=d!=null,R=co(d),_=co(n),G=co(i),M=we__namespace.useCallback(()=>{if(!x.current||!C.current)return;let $={placement:t,strategy:r,middleware:p};_.current&&($.platform=_.current),dn(x.current,C.current,$).then(A=>{let te={...A,isPositioned:G.current!==false};O.current&&!pn(T.current,te)&&(T.current=te,Li__namespace.flushSync(()=>{l(te);}));});},[p,t,r,_,G]);un(()=>{i===false&&T.current.isPositioned&&(T.current.isPositioned=false,l($=>({...$,isPositioned:false})));},[i]);let O=we__namespace.useRef(false);un(()=>(O.current=true,()=>{O.current=false;}),[]),un(()=>{if(w&&(x.current=w),k&&(C.current=k),w&&k){if(R.current)return R.current(w,k,M);M();}},[w,k,M,R,D]);let E=we__namespace.useMemo(()=>({reference:x,floating:C,setReference:v,setFloating:f}),[v,f]),B=we__namespace.useMemo(()=>({reference:w,floating:k}),[w,k]),z=we__namespace.useMemo(()=>{let $={position:r,left:0,top:0};if(!B.floating)return $;let A=Mi(B.floating,u.x),te=Mi(B.floating,u.y);return c?{...$,transform:"translate("+A+"px, "+te+"px)",...Fi(B.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:A,top:te}},[r,c,B.floating,u.x,u.y]);return we__namespace.useMemo(()=>({...u,update:M,refs:E,elements:B,floatingStyles:z}),[u,M,E,B,z])}var xu=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)=>({...xu(e),options:[e,t]});function _i(e){let t=we__namespace.useRef(void 0),r=we__namespace.useCallback(a=>{let n=e.map(o=>{if(o!=null){if(typeof o=="function"){let s=o,c=s(a);return typeof c=="function"?c:()=>{s(null);}}return o.current=a,()=>{o.current=null;}}});return ()=>{n.forEach(o=>o?.());}},e);return we__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 Eu={...we__namespace},Oi=false,Ru=0,zi=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ru++;function Pu(){let[e,t]=we__namespace.useState(()=>Oi?zi():void 0);return Ta(()=>{e==null&&t(zi());},[]),we__namespace.useEffect(()=>{Oi=true;},[]),e}var Iu=Eu.useId,Ui=Iu||Pu,Sa;process.env.NODE_ENV!=="production"&&(Sa=new Set);function Mu(){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 Au(){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=we__namespace.forwardRef(function(t,r){let{context:{placement:a,elements:{floating:n},middlewareData:{arrow:o,shift:s}},width:c=14,height:d=7,tipRadius:i=0,strokeWidth:u=0,staticOffset:l,stroke:p,d:m,style:{transform:b,...y}={},...h}=t;process.env.NODE_ENV!=="production"&&(r||Mu("The `ref` prop is required for `FloatingArrow`."));let g=Ui(),[v,f]=we__namespace.useState(false);if(Ta(()=>{if(!n)return;Dt(n).direction==="rtl"&&f(true);},[n]),!n)return null;let[w,k]=a.split("-"),x=w==="top"||w==="bottom",C=l;(x&&s!=null&&s.x||!x&&s!=null&&s.y)&&(C=null);let T=u*2,D=T/2,R=c/2*(i/-8+1),_=d/2*i/4,G=!!m,M=C&&k==="end"?"bottom":"top",O=C&&k==="end"?"right":"left";C&&v&&(O=k==="end"?"left":"right");let E=o?.x!=null?C||o.x:"",B=o?.y!=null?C||o.y:"",z=m||"M0,0"+(" H"+c)+(" L"+(c-R)+","+(d-_))+(" Q"+c/2+","+d+" "+R+","+(d-_))+" Z",$={top:G?"rotate(180deg)":"",left:G?"rotate(90deg)":"rotate(-90deg)",bottom:G?"":"rotate(180deg)",right:G?"rotate(-90deg)":"rotate(90deg)"}[w];return jsxRuntime.jsxs("svg",{...h,"aria-hidden":true,ref:r,width:G?c:c+T,height:c,viewBox:"0 0 "+c+" "+(d>c?d:c),style:{position:"absolute",pointerEvents:"none",[O]:E,[M]:B,[w]:x||G?"100%":"calc(100% - "+T/2+"px)",transform:[$,b].filter(A=>!!A).join(" "),...y},children:[T>0&&jsxRuntime.jsx("path",{clipPath:"url(#"+g+")",fill:"none",stroke:p,strokeWidth:T+(m?0:1),d:z}),jsxRuntime.jsx("path",{stroke:T&&!m?h.fill:"none",d:z}),jsxRuntime.jsx("clipPath",{id:g,children:jsxRuntime.jsx("rect",{x:-D,y:D*(G?-1:1),width:c+T,height:c})})]})});function Lu(){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 Fu=we__namespace.createContext(null),Bu=we__namespace.createContext(null),Ou=()=>{var e;return ((e=we__namespace.useContext(Fu))==null?void 0:e.id)||null},zu=()=>we__namespace.useContext(Bu);function $u(e){let{open:t=false,onOpenChange:r,elements:a}=e,n=Ui(),o=we__namespace.useRef({}),[s]=we__namespace.useState(()=>Lu()),c=Ou()!=null;if(process.env.NODE_ENV!=="production"){let m=a.reference;m&&!ft(m)&&Au("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.");}let[d,i]=we__namespace.useState(a.reference),u=ui((m,b,y)=>{o.current.openEvent=m?b:void 0,s.emit("openchange",{open:m,event:b,reason:y,nested:c}),r?.(m,b,y);}),l=we__namespace.useMemo(()=>({setPositionReference:i}),[]),p=we__namespace.useMemo(()=>({reference:d||a.reference||null,floating:a.floating||null,domReference:a.reference}),[d,a.reference,a.floating]);return we__namespace.useMemo(()=>({dataRef:o,open:t,onOpenChange:u,elements:p,events:s,floatingId:n,refs:l}),[t,u,p,s,n,l])}function Gi(e){e===void 0&&(e={});let{nodeId:t}=e,r=$u({...e,elements:{reference:null,floating:null,...e.elements}}),a=e.rootContext||r,n=a.elements,[o,s]=we__namespace.useState(null),[c,d]=we__namespace.useState(null),u=n?.domReference||o,l=we__namespace.useRef(null),p=zu();Ta(()=>{u&&(l.current=u);},[u]);let m=Bi({...e,elements:{...n,...c&&{reference:c}}}),b=we__namespace.useCallback(f=>{let w=ft(f)?{getBoundingClientRect:()=>f.getBoundingClientRect(),getClientRects:()=>f.getClientRects(),contextElement:f}:f;d(w),m.refs.setReference(w);},[m.refs]),y=we__namespace.useCallback(f=>{(ft(f)||f===null)&&(l.current=f,s(f)),(ft(m.refs.reference.current)||m.refs.reference.current===null||f!==null&&!ft(f))&&m.refs.setReference(f);},[m.refs]),h=we__namespace.useMemo(()=>({...m.refs,setReference:y,setPositionReference:b,domReference:l}),[m.refs,y,b]),g=we__namespace.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),v=we__namespace.useMemo(()=>({...m,...a,refs:h,elements:g,nodeId:t}),[m,h,g,t,a]);return Ta(()=>{a.dataRef.current.floatingContext=v;let f=p?.nodesRef.current.find(w=>w.id===t);f&&(f.context=v);}),we__namespace.useMemo(()=>({...m,context:v,refs:h,elements:g}),[m,h,g,v])}var go=we.createContext(null);function Hi(){return we.useContext(go)}function Ke({children:e,container:t}){let[r,a]=we.useState(false),n=Hi();if(we.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:c}=n,d={"--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 Li.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:d,children:e}),o)}return Li.createPortal(e,o)}function Ki(e,t,r=true){we.useEffect(()=>{if(!r)return;let a=o=>{(Array.isArray(e)?e:[e]).some(d=>{let i=d.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 Yi({itemCount:e,onSelect:t,onEscape:r,enabled:a=true,loop:n=true,containerRef:o}){let[s,c]=we.useState(-1);we.useEffect(()=>{if(!a||s===-1||!o?.current)return;let l=o.current.querySelector(`[data-index="${s}"]`);l&&l.scrollIntoView({block:"nearest",behavior:"smooth"});},[s,a,o]);let d=we.useCallback(u=>{if(a)switch(u.key){case "ArrowDown":u.preventDefault(),c(l=>l===-1?0:l===e-1?n?0:l:l+1);break;case "ArrowUp":u.preventDefault(),c(l=>l===-1?e-1:l===0?n?e-1:l:l-1);break;case "Enter":case " ":u.preventDefault(),s!==-1&&t&&t(s);break;case "Escape":u.preventDefault(),r&&r();break;case "Home":u.preventDefault(),c(0);break;case "End":u.preventDefault(),c(e-1);break;}},[a,s,e,n,t,r]),i=we.useCallback(u=>({"data-active":u===s,"data-index":u,role:"option",tabIndex:-1}),[s]);return {activeIndex:s,setActiveIndex:c,handleKeyDown:d,getItemProps:i}}function gr({trigger:e,children:t,isOpen:r,onOpenChange:a,placement:n="bottom-start",offsetDistance:o=8,maxHeight:s=320,minWidth:c="trigger",maxWidth:d,showArrow:i=false,className:u="",triggerClassName:l="",disableClickOutside:p=false,disableKeyboardNav:m=false,itemCount:b=0,onSelectItem:y,onOpen:h,onClose:g,animationDuration:v=200,zIndex:f=1e3}){let[w,k]=we.useState(false),x=r!==void 0?r:w,C=we.useCallback(fe=>{let P=x;r===void 0&&k(fe),a?.(fe),fe&&!P?h?.():!fe&&P&&g?.();},[r,a,h,g,x]),T=we.useCallback(()=>{C(!x);},[x,C]),D=we.useCallback(()=>{C(false);},[C]),R=we.useRef(null),_=we.useRef(null),G=we.useRef(null),{refs:M,floatingStyles:O,context:E}=Gi({open:x,onOpenChange:C,placement:n,middleware:[mn(o),po({padding:8}),uo({padding:8}),mo({apply({rects:fe,elements:P}){Object.assign(P.floating.style,{minWidth:c==="trigger"?`${fe.reference.width}px`:c?`${c}px`:void 0,maxWidth:d?`${d}px`:void 0,maxHeight:`${s}px`});},padding:8}),i?fo({element:G}):null].filter(Boolean),whileElementsMounted:cn}),B=_i([R,M.setReference]);Ki([R,_],D,x&&!p);let{activeIndex:z,setActiveIndex:$,handleKeyDown:A}=Yi({itemCount:b,onSelect:y,onEscape:D,enabled:x&&!m,loop:true,containerRef:_}),te=()=>typeof e=="function"?e({isOpen:x,toggle:T}):e,X=()=>typeof t=="function"?t({activeIndex:z,setActiveIndex:$,close:D}):t;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:B,className:`dropdown-trigger ${l}`,onClick:T,children:te()}),x&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:M.setFloating,style:{...O,zIndex:f},className:`dropdown-content ${u}`,role:"menu","aria-orientation":"vertical",onKeyDown:A,children:[jsxRuntime.jsx("div",{ref:_,className:"dropdown-inner",children:X()}),i&&jsxRuntime.jsx(Wi,{ref:G,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"}},Xu="#BDC3C7",Ju="#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"})]}),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:Xu,s=d=>{t(d);},c=Object.entries(Xi);return jsxRuntime.jsx(gr,{trigger:({isOpen:d})=>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:d?"scale(1.1)":"scale(1)"},title:a?.label||"Set priority","aria-label":"Select priority","aria-expanded":d,"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:d=>{let i=c[d];s(i?i[0]:void 0);},children:({activeIndex:d,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:[c.map(([u,l],p)=>{let m=n?l.darkColor:l.color,b=d===p,y=e===u;return jsxRuntime.jsxs("button",{onClick:()=>{s(u),i();},className:"dropdown-item","data-active":b,"data-index":p,role:"option","aria-selected":y,style:{color:b?m:"inherit",fontWeight:y?600:400},children:[jsxRuntime.jsx(Zu,{color:m}),jsxRuntime.jsx("span",{children:l.label}),y&&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:()=>{s(void 0),i();},className:"dropdown-item","data-active":d===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]=we.useState(e||""),[s,c]=we.useState(t||""),d=(b,y)=>{let h=new Date,g=new Date(h);g.setDate(g.getDate()+b);let v=h.toISOString().split("T")[0]||"",f=g.toISOString().split("T")[0]||"";o(v),c(f),r(v,f),y();},i=b=>{r(n||void 0,s||void 0),b();},u=()=>{if(!e||!t)return "Set date";let b=v=>{if(v instanceof Date)return v;if(typeof v!="string"||!v.match(/^\d{4}-\d{2}-\d{2}$/))return null;let f=v.split("-").map(Number);if(f.length!==3||f.some(C=>isNaN(C)))return null;let w=f[0],k=f[1],x=f[2];return w===void 0||k===void 0||x===void 0?null:new Date(w,k-1,x)},y=b(e),h=b(t);if(!y||!h||isNaN(y.getTime())||isNaN(h.getTime()))return "Set date";let g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${g[y.getMonth()]} ${y.getDate()} \u2013 ${g[h.getMonth()]} ${h.getDate()}`},l=e&&t,m=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,y=new Date;return y.setHours(0,0,0,0),b<y})();return jsxRuntime.jsx(gr,{trigger:({isOpen:b})=>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:b?"scale(1.05)":"scale(1)"},title:l?`${u()}`:"Set date range","aria-label":"Select date range","aria-expanded":b,"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:b,close:y})=>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((h,g)=>jsxRuntime.jsx("button",{onClick:()=>d(h.days,y),className:"dropdown-quick-button","data-active":b===g,"data-index":g,role:"option",children:h.label},h.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:h=>o(h.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:h=>c(h.target.value),className:"dropdown-input"})]}),jsxRuntime.jsx("button",{onClick:()=>i(y),className:"dropdown-primary-button",children:"Apply"}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{o(""),c(""),r(void 0,void 0),y();},className:"dropdown-danger-button",children:"Clear Dates"})]})]})]})})}function Ur({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[o,s]=we.useState(""),c=l=>{let p=e.some(m=>m.id===l.id);r(p?e.filter(m=>m.id!==l.id):[...e,l]);},d=t.filter(l=>l.name.toLowerCase().includes(o.toLowerCase())),i=e.slice(0,n),u=e.length-n;return jsxRuntime.jsx(gr,{trigger:({isOpen:l})=>jsxRuntime.jsx("button",{className:`dropdown-avatar-trigger ${a||""}`,style:{transform:l?"scale(1.05)":"scale(1)"},title:e.length>0?`${e.length} assigned`:"Assign users","aria-label":"Assign users","aria-expanded":l,"aria-haspopup":"menu",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[i.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:d.length,onSelectItem:l=>{let p=d[l];p&&c(p);},onClose:()=>s(""),children:({activeIndex:l,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=>s(m.target.value),placeholder:"Search users...",className:"dropdown-search-input",autoFocus:true})}),jsxRuntime.jsx("div",{className:"dropdown-list",children:d.length===0?jsxRuntime.jsx("div",{className:"dropdown-empty",children:"No users found"}):d.map((m,b)=>{let y=e.some(h=>h.id===m.id);return jsxRuntime.jsxs("button",{onClick:()=>{c(m);},className:"dropdown-item","data-active":l===b,"data-index":b,role:"option","aria-selected":y,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}),y&&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,s]=we.useState(""),[c,d]=we.useState(t.length>0),i=m=>{if(t.includes(m)){let y=t.filter(h=>h!==m);a(y),y.length===0&&d(false);}else a([...t,m]),d(true);},u=()=>{let m=!c;d(m),m||a([]);},l=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(gr,{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?l.length:0,onSelectItem:m=>{let b=l[m];b&&i(b.id);},onClose:()=>s(""),onOpen:()=>d(t.length>0),children:({activeIndex:m,close:b})=>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:y=>s(y.target.value),placeholder:"Search by name or ID...",className:"dropdown-search-input",autoFocus:true})}),jsxRuntime.jsx("div",{className:"dropdown-list",children:l.length===0?jsxRuntime.jsx("div",{className:"dropdown-empty",children:"No tasks found"}):l.map((y,h)=>{let g=t.includes(y.id);return jsxRuntime.jsxs("button",{onClick:()=>i(y.id),className:"dropdown-item","data-active":m===h,"data-index":h,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:y.title}),jsxRuntime.jsx("div",{style:{fontSize:"11px",marginTop:"2px",color:"var(--asakaa-color-text-secondary)"},children:y.id})]})]},y.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(false),b();},className:"dropdown-danger-button",children:"Clear All Dependencies"})})]})})}var hr=we.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:o,onUpdate:s,availableUsers:c=[],allCards:d=[]})=>{let{attributes:i,listeners:u,setNodeRef:l,transform:p,transition:m,isDragging:b}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),y={transform:qa.Transform.toString(p),transition:m};if(t)return jsxRuntime.jsx("div",{ref:l,style:y,...i,...u,onClick:()=>r?.(e),children:t(e)});let h=c.filter(g=>e.assignedUserIds?.includes(g.id));return jsxRuntime.jsxs("div",{ref:l,style:y,className:re("asakaa-card",b&&"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(Na,{priority:e.priority,onChange:g=>s?.(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,v)=>s?.(e.id,{startDate:g,endDate:v})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ur,{assignedUsers:h,availableUsers:c,onChange:g=>s?.(e.id,{assignedUserIds:g.map(v=>v.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:d,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));hr.displayName="Card";function rl({columnTitle:e,onRename:t,className:r}){let[a,n]=we.useState(false),[o,s]=we.useState(false),[c,d]=we.useState(e),[i,u]=we.useState({top:0,left:0}),l=we.useRef(null),p=we.useRef(null),m=we.useRef(null);we.useEffect(()=>{if(a&&p.current){let g=p.current.getBoundingClientRect();u({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[a]),we.useEffect(()=>{let g=v=>{l.current&&!l.current.contains(v.target)&&!p.current?.contains(v.target)&&(n(false),s(false));};if(a)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[a]),we.useEffect(()=>{let g=v=>{v.key==="Escape"&&(n(false),s(false),d(e));};if(a)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[a,e]),we.useEffect(()=>{o&&m.current&&(m.current.focus(),m.current.select());},[o]);let b=()=>{s(true),d(e);},y=()=>{let g=c.trim();g&&g!==e&&t(g),s(false),n(false),d(e);},h=g=>{g.key==="Enter"?y():g.key==="Escape"&&(s(false),d(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:l,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:m,type:"text",value:c,onChange:g=>d(g.target.value),onKeyDown:h,onBlur:y,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:b,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=we.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:o,onCardClick:s,onCardUpdate:c,availableUsers:d,allCards:i,enableVirtualization:u,cardHeight:l=120,isCollapsed:p,onToggleCollapse:m,onColumnRename:b,className:y})=>{let{setNodeRef:h,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),v=we.useRef(null),f=u??Ys(t.length),w=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>v.current,estimateSize:()=>l,enabled:f});if(r)return jsxRuntime.jsx("div",{ref:h,className:y,children:r(e,t)});let x=(()=>{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}})(),C=x.state==="exceeded",T=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:re("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",C&&"ring-2 ring-asakaa-accent-red",y),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:re(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&x.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${x.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[x.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"})]}),x.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"})]}),x.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"})}),x.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"})]})]}),b&&jsxRuntime.jsx(rl,{columnTitle:e.title,onRename:D=>b(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:v,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(hr,{card:R,render:a,onClick:s,onUpdate:c,availableUsers:d,allCards:i})},R.id):null})}):t.map(D=>jsxRuntime.jsx(hr,{card:D,render:a,onClick:s,onUpdate:c,availableUsers:d,allCards:i},D.id))})})]})});ta.displayName="Column";function yo({title:e,onSave:t,className:r}){let[a,n]=we.useState(false),[o,s]=we.useState(e),c=we.useRef(null);we.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.select());},[a]);let d=()=>{let u=o.trim();u&&u!==e?t(u):s(e),n(false);},i=u=>{u.key==="Enter"?d():u.key==="Escape"&&(s(e),n(false));};return a?jsxRuntime.jsx("input",{ref:c,type:"text",value:o,onChange:u=>s(u.target.value),onBlur:d,onKeyDown:i,className:re("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",r),maxLength:50}):jsxRuntime.jsx("h2",{className:re("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function ko(){let[e,t]=we.useState(()=>core.dragStore.getState());we.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let r=we.useCallback(a=>{core.dragStore.setState(a);},[]);return [e,r]}function Dr({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:o=[],className:s,style:c,isLoading:d,error:i,children:u}){let[l,p]=ko(),m=we.useCallback((k,x)=>{t.onCardUpdate?.(k,x);},[t]),b=we.useCallback((k,x)=>{t.onColumnUpdate?.(k,{title:x});},[t]),y=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),h=we.useMemo(()=>{let k=new Map;return e.columns.forEach(x=>{let C=x.cardIds.map(T=>e.cards.find(D=>D.id===T)).filter(T=>T!==void 0).sort((T,D)=>T.position-D.position);k.set(x.id,C);}),k},[e.cards,e.columns]),g=we.useCallback(k=>{let{active:x}=k,C=e.cards.find(T=>T.id===x.id);C&&p({isDragging:true,draggedCardId:C.id,sourceColumnId:C.columnId,targetColumnId:C.columnId});},[e.cards,p]),v=we.useCallback(k=>{let{active:x,over:C}=k;if(!C||!e.cards.find(R=>R.id===x.id))return;let D=null;C.data.current?.type==="column"?D=C.id:C.data.current?.type==="card"&&(D=e.cards.find(_=>_.id===C.id)?.columnId||null),D&&D!==l.targetColumnId&&p({...l,targetColumnId:D});},[e.cards,l,p]),f=we.useCallback(async k=>{let{active:x,over:C}=k;if(p({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!C)return;let T=e.cards.find(G=>G.id===x.id);if(!T)return;let D,R;if(C.data.current?.type==="column"){D=C.id;let G=h.get(D)||[];R=Jn(G,0);}else {let G=e.cards.find(E=>E.id===C.id);if(!G)return;D=G.columnId;let M=h.get(D)||[],O=M.findIndex(E=>E.id===C.id);R=Jn(M,O);}let _=e.columns.find(G=>G.id===D);if(_&&_.wipLimit&&_.wipLimitType==="hard"){let G=h.get(D)||[];if(T.columnId!==D&&G.length>=_.wipLimit){t.onWipLimitExceeded?.(_,T);return}}(T.columnId!==D||T.position!==R)&&await t.onCardMove?.(T.id,D,R);},[e.cards,e.columns,h,t,p]),w=we.useCallback(k=>{r?.(k);},[r]);return d?jsxRuntime.jsx("div",{className:re("asakaa-board",s),style:c,children:jsxRuntime.jsx(wp,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:re("asakaa-board",s),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 i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(core$1.DndContext,{sensors:y,collisionDetection:core$1.closestCorners,onDragStart:g,onDragOver:v,onDragEnd:f,children:[jsxRuntime.jsxs("div",{className:re("asakaa-board",s),style:c,children:[e.columns.sort((k,x)=>k.position-x.position).map(k=>{let x=h.get(k.id)||[];return jsxRuntime.jsx(ta,{column:k,cards:x,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,onCardClick:w,onCardUpdate:m,onColumnRename:b,availableUsers:o,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight},k.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(hr,{card:e.cards.find(k=>k.id===l.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})}function wp({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(Dr,{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 sl(e={}){return new Ma(e)}var aa=class extends we.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 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:s,onPredictRisks:c,onOpenAIUsage:d,shortcut:i="k",className:u=""}){let[l,p]=we.useState(false),[m,b]=we.useState(""),[y,h]=we.useState("home"),[g,v]=we.useState(""),[f,w]=we.useState("");we.useEffect(()=>{let T=D=>{(D.metaKey||D.ctrlKey)&&D.key===i&&(D.preventDefault(),p(R=>!R)),D.key==="Escape"&&(p(false),h("home"),b(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),we.useEffect(()=>{l||(h("home"),b(""),v(""),w(""));},[l]);let k=we.useCallback(()=>{p(false);},[]),x=we.useCallback(T=>{let[D,R]=T.split(":");switch(D){case "create-card":h("create-card");break;case "create-card-in":v(R||"");break;case "navigate":R?(r?.(R),k()):h("navigate");break;case "search":a?.(m),k();break;case "priority":h("priority");break;case "set-priority":f&&R&&(n?.(f,R),k());break;case "assign":h("assign");break;case "assign-user":f&&R&&(o?.(f,R),k());break;case "ai":h("ai");break;case "ai-generate-plan":s?.(),k();break;case "ai-predict-risks":c?.(),k();break;case "ai-usage":d?.(),k();break;case "back":h("home");break;}},[m,f,t,r,a,n,o,s,c,d,k]),C=we.useCallback(()=>{g&&m.trim()&&(t?.(g,m.trim()),k());},[g,m,t,k]);return l?jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:m,onValueChange:b,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:y==="create-card"&&g?"Type card title and press Enter...":y==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&y==="create-card"&&g&&C();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),y==="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:x,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:x,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:x,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:x,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:x,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:D},D))})]},T.id))})]}),y==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:x,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:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),y==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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(T=>{let D=e.columns.find(R=>R.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:x,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:D?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},T.id)})})]}),y==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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:x,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:x,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:x,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 Rp(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 Pp(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 Ip(e){return e.startsWith("image/")}function La({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:o=10}){let[s,c]=we.useState(false),[d,i]=we.useState(false),[u,l]=we.useState(null),p=we.useRef(null),m=we.useCallback(x=>{let C=[],T=[];return e.length+x.length>o?(T.push(`Maximum ${o} files allowed`),{valid:C,errors:T}):(x.forEach(D=>{if(D.size/1048576>a){T.push(`${D.name} is too large (max ${a}MB)`);return}if(n&&!n.some(_=>D.type.match(_))){T.push(`${D.name} has invalid file type`);return}C.push(D);}),{valid:C,errors:T})},[e.length,o,a,n]),b=we.useCallback(async x=>{let{valid:C,errors:T}=m(x);if(T.length>0){l(T.join(", ")),setTimeout(()=>l(null),5e3);return}if(C.length!==0){i(true),l(null);try{await t?.(C);}catch(D){l(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[m,t]),y=we.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(true);},[]),h=we.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(false);},[]),g=we.useCallback(x=>{x.preventDefault(),x.stopPropagation();},[]),v=we.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(false);let C=Array.from(x.dataTransfer.files);b(C);},[b]),f=we.useCallback(x=>{let C=x.target.files?Array.from(x.target.files):[];b(C),p.current&&(p.current.value="");},[b]),w=we.useCallback(()=>{p.current?.click();},[]),k=we.useCallback(x=>{confirm("Are you sure you want to delete this attachment?")&&r?.(x);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${s?"dragging":""} ${d?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:g,onDrop:v,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:d?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(x=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ip(x.type)&&x.url?jsxRuntime.jsx("img",{src:x.thumbnailUrl||x.url,alt:x.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Pp(x.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:x.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:x.name,children:x.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Rp(x.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(x.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(x.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"})})})]},x.id))})]})}function Do({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:c=[],aiInsights:d=[],attachments:i=[],onAddComment:u,onDeleteComment:l,onUploadAttachments:p,onDeleteAttachment:m,onSuggestAssignee:b,onGenerateSubtasks:y,onEstimateEffort:h,currentUserId:g="user-1"}){let[v,f]=we.useState("details"),[w,k]=we.useState(false),[x,C]=we.useState({}),[T,D]=we.useState(""),[R,_]=we.useState(false),[G,M]=we.useState({});if(!t||!e)return null;let O=we.useCallback(()=>{k(false),C({}),f("details"),D(""),M({}),r();},[r]),E=we.useCallback(()=>{a&&Object.keys(x).length>0&&(a(e.id,x),C({}),k(false));},[e.id,x,a]),B=we.useCallback(()=>{n&&window.confirm("Are you sure you want to delete this card?")&&(n(e.id),O());},[e.id,n,O]),z=we.useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),D(""));},[e.id,T,u]),$=we.useCallback(async()=>{if(b){_(true);try{let P=await b(e);M(ge=>({...ge,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{_(false);}}},[e,b]),A=we.useCallback(async()=>{if(y){_(true);try{let P=await y(e);M(ge=>({...ge,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{_(false);}}},[e,y]),te=we.useCallback(async()=>{if(h){_(true);try{let P=await h(e);M(ge=>({...ge,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{_(false);}}},[e,h]),X={...e,...x},fe=o.filter(P=>X.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:X.priority==="URGENT"?"#EF4444":X.priority==="HIGH"?"#F59E0B":X.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsxRuntime.jsx("input",{type:"text",value:x.title??X.title,onChange:P=>C({...x,title:P.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:X.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[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),C({});},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 ${v==="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 ${v==="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 ${v==="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 ${v==="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 ${v==="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:[v==="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:x.description??X.description??"",onChange:P=>C({...x,description:P.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:X.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsxRuntime.jsx("select",{multiple:true,value:x.assignedUserIds??X.assignedUserIds??[],onChange:P=>{let ge=Array.from(P.target.selectedOptions,ae=>ae.value);C({...x,assignedUserIds:ge});},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:fe.length>0?fe.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:x.priority??X.priority??"",onChange:P=>C({...x,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:X.priority==="URGENT"?"#EF4444":X.priority==="HIGH"?"#F59E0B":X.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:X.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:X.labels&&X.labels.length>0?X.labels.map(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:x.startDate?new Date(x.startDate).toISOString().split("T")[0]:X.startDate?new Date(X.startDate).toISOString().split("T")[0]:"",onChange:P=>C({...x,startDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:X.startDate?new Date(X.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsxRuntime.jsx("input",{type:"date",value:x.endDate?new Date(x.endDate).toISOString().split("T")[0]:X.endDate?new Date(X.endDate).toISOString().split("T")[0]:"",onChange:P=>C({...x,endDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:X.endDate?new Date(X.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:x.estimatedTime??X.estimatedTime??"",onChange:P=>C({...x,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:X.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:X.dependencies&&X.dependencies.length>0?X.dependencies.map(P=>{let ge=typeof P=="string"?P:P.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ge.slice(-4)]},ge)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:X.createdAt?new Date(X.createdAt).toLocaleString():"Unknown"})]})]}),v==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:P=>D(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:z,disabled:!T.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 ge=o.find(ae=>ae.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:[ge&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ge.color},children:ge.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ge?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(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"})]})})]}),v==="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 ge=o.find(ae=>ae.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:ge?.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"})]})}),v==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(La,{cardId:e.id,attachments:i,onUpload:p?P=>p(e.id,P):void 0,onDelete:m,currentUserId:g,maxSizeMB:10,maxFiles:20})}),v==="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:$,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("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:A,disabled:R||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:te,disabled:R||!h,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"]})]}),G.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),G.assignees.map((P,ge)=>{let ae=o.find(pt=>pt.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ae&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ae.color},children:ae.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ae?.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),"%"]})]})]},ge)})]}),G.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),G.subtasks.map((P,ge)=>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"]})]},ge))]}),G.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:[G.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(G.effort.confidence*100).toFixed(0),"%"]})]})]}),d.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),d.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))]}),!G.assignees&&!G.subtasks&&!G.effort&&d.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 Bp=["LOW","MEDIUM","HIGH","URGENT"],Op=["todo","in-progress","review","done"];function Eo({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:c=[],onAddComment:d,onDeleteComment:i,currentUser:u,onAIGenerateDescription:l,onAICreateSubtasks:p,onAIFindSimilar:m,availableColumns:b=[],availableLabels:y=[]}){let[h,g]=we.useState(e),[v,f]=we.useState(false),[w,k]=we.useState([]),[x,C]=we.useState(false),[T,D]=we.useState(""),[R,_]=we.useState(""),[G,M]=we.useState("all"),[O,E]=we.useState(false),[B,z]=we.useState(false),[$,A]=we.useState(false),[te,X]=we.useState(false),[fe,P]=we.useState(false),[ge,ae]=we.useState(false),pt=we.useRef(null),ct=we.useRef(null),Bt=we.useRef(null),ie=we.useRef(null),mt=we.useRef(null),vt=we.useRef(null),Ot=we.useRef(null),ar=we.useRef(null);we.useEffect(()=>{e&&!h?g({...e}):e&&h&&e.id!==h.id&&g({...e});},[e,h]),we.useEffect(()=>{let S=H=>{let pe=H.target;ie.current&&!ie.current.contains(pe)&&E(false),mt.current&&!mt.current.contains(pe)&&z(false),vt.current&&!vt.current.contains(pe)&&A(false),Ot.current&&!Ot.current.contains(pe)&&X(false);};if(O||B||$||te)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[O,B,$,te]),we.useEffect(()=>{if(!t)return;let S=H=>{let pe=H.target,Ee=pe.tagName==="INPUT"||pe.tagName==="TEXTAREA"||pe.isContentEditable;if(H.key==="Escape"){H.preventDefault(),O||B||$||te||fe||ge?(E(false),z(false),A(false),X(false),P(false),ae(false)):Ee||r();return}if(Ee&&H.key!=="Escape")return;let Fe=H.metaKey||H.ctrlKey;switch(H.key.toLowerCase()){case "s":H.preventDefault(),E(true);break;case "a":H.preventDefault(),A(true);break;case "p":H.preventDefault(),z(true);break;case "l":H.preventDefault(),X(true);break;case "d":Fe||(H.preventDefault(),P(true),setTimeout(()=>ar.current?.focus(),0));break;case "e":Fe||(H.preventDefault(),ae(true));break;case "i":H.preventDefault(),f(true),setTimeout(()=>ct.current?.focus(),0);break;case "t":H.preventDefault(),C(true);break;case "c":H.preventDefault(),Bt.current?.focus();break}};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[t,r,O,B,$,te,fe,ge]);let ne=we.useCallback(S=>{let H=S.currentTarget.textContent?.trim()||"";if(h&&H!==h.title){let pe={...h,title:H};g(pe),a?.(h.id,{title:H});}},[h,a]),se=we.useCallback(S=>{S.key==="Enter"&&(S.preventDefault(),S.currentTarget.blur()),S.key==="Escape"&&(S.preventDefault(),S.currentTarget.textContent=h?.title||"",S.currentTarget.blur());},[h]),Qe=we.useCallback(()=>{h&&e&&h.description!==e.description&&a?.(h.id,{description:h.description}),f(false);},[h,e,a]),Ht=we.useCallback(S=>{if(h){let H={...h,columnId:S};g(H),a?.(h.id,{columnId:S}),E(false);}},[h,a]),Vt=we.useCallback(S=>{if(h){let H={...h,priority:S};g(H),a?.(h.id,{priority:S}),z(false);}},[h,a]),ur=we.useCallback(S=>{if(h){let H=h.assignedUserIds||[],pe=H.includes(S)?H.filter(Fe=>Fe!==S):[...H,S],Ee={...h,assignedUserIds:pe};g(Ee),a?.(h.id,{assignedUserIds:pe});}},[h,a]),zt=we.useCallback(S=>{if(h){let H=h.labels||[],pe=H.includes(S)?H.filter(Fe=>Fe!==S):[...H,S],Ee={...h,labels:pe};g(Ee),a?.(h.id,{labels:pe});}},[h,a]),V=we.useCallback(S=>{if(h){let H=S.target.value,pe={...h,endDate:H};g(pe),a?.(h.id,{endDate:H}),P(false);}},[h,a]),U=we.useCallback(S=>{if(h){let H={...h,estimatedTime:parseFloat(S)||0};g(H),a?.(h.id,{estimatedTime:parseFloat(S)||0});}},[h,a]),Se=we.useCallback(()=>{if(T.trim()){let S={id:`subtask-${Date.now()}`,title:T.trim(),completed:false};k([...w,S]),D(""),C(false);}},[T,w]),ze=we.useCallback(S=>{k(w.map(H=>H.id===S?{...H,completed:!H.completed}:H));},[w]),Ne=we.useCallback(S=>{k(w.filter(H=>H.id!==S));},[w]),de=we.useCallback(()=>{R.trim()&&h&&d&&(d(h.id,R.trim()),_(""));},[R,h,d]),ue=we.useCallback(S=>{(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),de());},[de]),Ve=S=>jsxRuntime.jsx(Ap__default.default,{remarkPlugins:[Lp__default.default],rehypePlugins:[Fp__default.default],components:{a:({node:H,...pe})=>jsxRuntime.jsx("a",{...pe,target:"_blank",rel:"noopener noreferrer"})},children:S}),le=c.filter(S=>G==="comments"?S.type.includes("COMMENT"):G==="history"?!S.type.includes("COMMENT"):true);if(!t||!e)return null;let be=h||e,j=o.filter(S=>be.assignedUserIds?.includes(S.id)),ye=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:pt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ne,onKeyDown:se,children:be.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"})]})})]}),be.coverImage&&jsxRuntime.jsx("div",{className:"modal-v2-cover",children:jsxRuntime.jsx("img",{src:be.coverImage,alt:`Cover for ${be.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:ie,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:be.columnId||"No status"})]}),O&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(b.length>0?b:Op.map(S=>({id:S,title:S}))).map(S=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${be.columnId===S.id?"active":""}`,onClick:()=>Ht(S.id),children:S.title},S.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:vt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>A(!$),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"})})]}),$&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:o.map(S=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${be.assignedUserIds?.includes(S.id)?"active":""}`,onClick:()=>ur(S.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:S.color},children:S.initials}),S.name,be.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:mt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>z(!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:be.priority||"None"})]}),B&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[Bp.map(S=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${S.toLowerCase()} ${be.priority===S?"active":""}`,onClick:()=>Vt(S),children:S},S)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Vt(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ot,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>X(!te),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:be.labels&&be.labels.length>0?jsxRuntime.jsx("span",{children:be.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),te&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(y.length>0?y:["Bug","Feature","Enhancement","Documentation"]).map(S=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${be.labels?.includes(S)?"active":""}`,onClick:()=>zt(S),children:[S,be.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(!fe),setTimeout(()=>ar.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:be.endDate?new Date(be.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ar,type:"date",value:typeof be.endDate=="string"?be.endDate.split("T")[0]:be.endDate?(()=>{let S=new Date(be.endDate),H=S.getUTCFullYear(),pe=String(S.getUTCMonth()+1).padStart(2,"0"),Ee=String(S.getUTCDate()).padStart(2,"0");return `${H}-${pe}-${Ee}`})():"",onChange:V,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ae(!ge),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:be.estimatedTime?`${be.estimatedTime}h`:"Not set"})]}),ge&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:be.estimatedTime||"",onChange:S=>U(S.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ae(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"]})]}),v?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:be.description||"",onChange:S=>{if(h){let H={...h,description:S.target.value};g(H);}},onBlur:Qe,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>f(true),children:be.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Ve(be.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:[ye,"/",w.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>C(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:()=>ze(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:()=>Ne(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)),x&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:T,onChange:S=>D(S.target.value),onKeyDown:S=>{S.key==="Enter"&&Se(),S.key==="Escape"&&(C(false),D(""));},onBlur:Se,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 ${G==="all"?"active":""}`,onClick:()=>M("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${G==="comments"?"active":""}`,onClick:()=>M("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${G==="history"?"active":""}`,onClick:()=>M("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:Bt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:R,onChange:S=>_(S.target.value),onKeyDown:ue,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:de,disabled:!R.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[le.map(S=>{let H=o.find(Ee=>Ee.id===S.userId);if(S.type.includes("COMMENT")){let Ee=s.find(Fe=>Fe.id===S.metadata?.commentId);return Ee?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:Ee.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)}),le.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 Kp({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(s=>({...s,average:s.average??e.reduce((c,d)=>c+d.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(Kp,{})}),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,c)=>s+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((s,c)=>s+c.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,c)=>s+(c.planned||0),0)})]})]})]})}function tm({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),s=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,d=o>0?(o-s)/o*100:0,i=s<=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(tm,{})}),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:d>=50?"#10B981":"#F59E0B"},children:[d.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 dm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},gl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function um({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:o}){let s=a+(n-a)*.5,c=e+s*Math.cos(-r*(Math.PI/180)),d=t+s*Math.sin(-r*(Math.PI/180));return o<.05?null:jsxRuntime.jsx("text",{x:c,y:d,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((d,i)=>d+i.value,0),s=e.map(d=>({...d,totalValue:o,color:d.color||dm[d.name]||gl[e.indexOf(d)%gl.length]})),c=s.map(d=>d.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?um:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:s.map((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(hl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(d,i)=>{let u=i.payload,l=o>0?(u.value/o*100).toFixed(0):"0";return `${d} (${u.value} - ${l}%)`}})]}):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(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:s.map((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[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((d,i)=>i.value>d.value?i:d).name})]})]})]})}var wn=we.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:o=[]})=>{let[s,c]=we.useState(false),[d,i]=we.useState(false),[u,l]=we.useState(false),[p,m]=we.useState(false);if(e.length===0)return null;let b=e.map(w=>w.id),y=w=>{a.onBulkUpdate?.(b,{priority:w}),c(false);},h=w=>{a.onBulkMove?.(b,w),i(false),r();},g=w=>{a.onBulkUpdate?.(b,{assignedUserIds:w}),l(false);},v=w=>{let k=new Set;e.forEach(C=>{C.labels?.forEach(T=>k.add(T));});let x=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(b,{labels:x}),m(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(b),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(!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:()=>y(w),children:[jsxRuntime.jsx("span",{className:re("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(!d),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(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:()=>l(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(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:()=>v([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 hm(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let o,s,c,d,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let b=r?.find(y=>y.id===m);s=`assignee-${m}`,c=b?.name||`User ${m}`,d=b?.color,i=b?.avatar,a.has(s)||a.set(s,{id:s,title:c,groupValue:m,cardIds:[],color:d,icon:i}),a.get(s).cardIds.push(n.id);}):(s="assignee-unassigned",c="Unassigned",d="#6b7280",i="\u{1F464}",a.has(s)||a.set(s,{id:s,title:c,groupValue:null,cardIds:[],color:d,icon:i}),a.get(s).cardIds.push(n.id));break;case "priority":o=n.priority||"NONE",s=`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,d=p.color,a.has(s)||a.set(s,{id:s,title:c,groupValue:o,cardIds:[],color:d}),a.get(s).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{s=`label-${m}`,c=m,d="#6b7280",a.has(s)||a.set(s,{id:s,title:c,groupValue:m,cardIds:[],color:d}),a.get(s).cardIds.push(n.id);}):(s="label-none",c="No Labels",d="#6b7280",a.has(s)||a.set(s,{id:s,title:c,groupValue:null,cardIds:[],color:d}),a.get(s).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,s]=we.useState(new Set),c=we.useMemo(()=>hm(e.cards,t.groupBy,r),[e.cards,t.groupBy,r]),d=we.useCallback(i=>{s(u=>{let l=new Set(u);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Dr,{board:e,callbacks:a,availableUsers:r,className:n}):jsxRuntime.jsxs("div",{className:re("asakaa-swimlane-view",n),children:[c.map(i=>{let u=o.has(i.id),l=e.cards.filter(m=>i.cardIds.includes(m.id)),p={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&d(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(Dr,{board:p,callbacks:a,availableUsers:r})})]},i.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]=we.useState(false),o=we.useRef(null),s=we.useRef(null),c=Lo.find(i=>i.value===e)||Lo[0];we.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 d=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{className:re("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:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:re("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(i=>jsxRuntime.jsxs("button",{onClick:()=>d(i.value),className:re("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 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 ym(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,c=n.alt?e.altKey:!e.altKey,d=n.meta?e.metaKey:true;return o&&s&&c&&d}function kl(e={}){let{shortcuts:t=Fa,enabled:r=true,preventDefault:a=true}=e,n=we.useRef(t),o=we.useRef(r);we.useEffect(()=>{n.current=t,o.current=r;},[t,r]);let s=we.useCallback(d=>{n.current=[...n.current,d];},[]),c=we.useCallback(d=>{n.current=n.current.filter(i=>i.action!==d);},[]);return we.useEffect(()=>{function d(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 l of n.current)if(ym(i,l)){a&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[a]),{registerShortcut:s,unregisterShortcut:c,isEnabled:r}}function km(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function wm(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=wm(e),a=t?km(t):"";return r?`${r} + ${a}`:a}function Tm(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]=we.useState(false);if(we.useEffect(()=>{o(true);},[]),we.useEffect(()=>{function c(d){d.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r]),!n||!t)return null;let s=Tm(e);return jsxRuntime.jsxs("div",{className:re("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(([c,d])=>d.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:d.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))})]},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:**
|
|
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 s=1;s<t.length;s++)try{let c=ei(t[s]||"");if(c.length>r.length){o.push(`Line ${s+1}: Too many columns`);continue}if(r.length-c.length>3){o.push(`Line ${s+1}: Column count mismatch (expected ${r.length}, got ${c.length})`);continue}for(;c.length<r.length;)c.push("");let i={};r.forEach((m,b)=>{i[m]=c[b]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let l=n.get(u),p={id:i["Card ID"]||`card-${s}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};a.push(p),l.cardIds.push(p.id);}catch(c){o.push(`Line ${s+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],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 ti(e,t){switch(t){case "json":return Md(e);case "csv":return Ad(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 wr(e){return ro(e)?(e.nodeName||"").toLowerCase():"#document"}function wt(e){var t;return (e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Kt(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 wt(e).Node:false}function ft(e){return Qa()?e instanceof Element||e instanceof wt(e).Element:false}function _t(e){return Qa()?e instanceof HTMLElement||e instanceof wt(e).HTMLElement:false}function to(e){return !Qa()||typeof ShadowRoot>"u"?false:e instanceof ShadowRoot||e instanceof wt(e).ShadowRoot}var Ld=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)&&!Ld.has(n)}var Fd=new Set(["table","td","th"]);function ai(e){return Fd.has(wr(e))}var Bd=[":popover-open",":modal"];function va(e){return Bd.some(t=>{try{return e.matches(t)}catch{return false}})}var Od=["transform","translate","scale","rotate","perspective"],zd=["transform","translate","scale","rotate","perspective","filter"],$d=["paint","layout","strict","content"];function en(e){let t=ba(),r=ft(e)?Dt(e):e;return Od.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)||zd.some(a=>(r.willChange||"").includes(a))||$d.some(a=>(r.contain||"").includes(a))}function ni(e){let t=nr(e);for(;_t(t)&&!Cr(t);){if(en(t))return t;if(va(t))return null;t=nr(t);}return null}function ba(){return typeof CSS>"u"||!CSS.supports?false:CSS.supports("-webkit-backdrop-filter","none")}var _d=new Set(["html","body","#document"]);function Cr(e){return _d.has(wr(e))}function Dt(e){return wt(e).getComputedStyle(e)}function ya(e){return ft(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nr(e){if(wr(e)==="html")return e;let t=e.assignedSlot||e.parentNode||to(e)&&e.host||Kt(e);return to(t)?t.host:t}function oi(e){let t=nr(e);return Cr(t)?e.ownerDocument?e.ownerDocument.body:e.body:_t(t)&&Zr(t)?t:oi(t)}function mr(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),s=wt(n);if(o){let c=tn(s);return t.concat(s,s.visualViewport||[],Zr(n)?n:[],c&&r?mr(c):[])}return t.concat(n,mr(n,[],r))}function tn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var or=Math.min,Ct=Math.max,ka=Math.round,wa=Math.floor,jt=e=>({x:e,y:e}),Ud={left:"right",right:"left",bottom:"top",top:"bottom"},Wd={start:"end",end:"start"};function an(e,t,r){return Ct(e,or(t,r))}function Or(e,t){return typeof e=="function"?e(t):e}function fr(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 Gd=new Set(["top","bottom"]);function sr(e){return Gd.has(fr(e))?"y":"x"}function on(e){return ao(sr(e))}function li(e,t,r){r===void 0&&(r=false);let a=zr(e),n=on(e),o=nn(n),s=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=xa(s)),[s,xa(s)]}function ci(e){let t=xa(e);return [rn(e),t,rn(t)]}function rn(e){return e.replace(/start|end/g,t=>Wd[t])}var si=["left","right"],ii=["right","left"],Hd=["top","bottom"],Vd=["bottom","top"];function Kd(e,t,r){switch(e){case "top":case "bottom":return r?t?ii:si:t?si:ii;case "left":case "right":return t?Hd:Vd;default:return []}}function di(e,t,r,a){let n=zr(e),o=Kd(fr(e),r==="start",a);return n&&(o=o.map(s=>s+"-"+n),t&&(o=o.concat(o.map(rn)))),o}function xa(e){return e.replace(/left|right|bottom|top/g,t=>Ud[t])}function jd(e){return {top:0,right:0,bottom:0,left:0,...e}}function no(e){return typeof e!="number"?jd(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 qd=typeof document<"u",Xd=function(){},Ta=qd?we.useLayoutEffect:Xd,Jd={...we__namespace};var Zd=Jd.useInsertionEffect,Qd=Zd||(e=>e());function ui(e){let t=we__namespace.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Qd(()=>{t.current=e;}),we__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=sr(t),s=on(t),c=nn(s),d=fr(t),i=o==="y",u=a.x+a.width/2-n.width/2,l=a.y+a.height/2-n.height/2,p=a[c]/2-n[c]/2,m;switch(d){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:l};break;case "left":m={x:a.x-n.width,y:l};break;default:m={x:a.x,y:a.y};}switch(zr(t)){case "start":m[s]-=p*(r&&i?-1:1);break;case "end":m[s]+=p*(r&&i?-1:1);break}return m}var mi=async(e,t,r)=>{let{placement:a="bottom",strategy:n="absolute",middleware:o=[],platform:s}=r,c=o.filter(Boolean),d=await(s.isRTL==null?void 0:s.isRTL(t)),i=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:l}=pi(i,a,d),p=a,m={},b=0;for(let y=0;y<c.length;y++){let{name:h,fn:g}=c[y],{x:v,y:f,data:w,reset:k}=await g({x:u,y:l,initialPlacement:a,placement:p,strategy:n,middlewareData:m,rects:i,platform:s,elements:{reference:e,floating:t}});u=v??u,l=f??l,m={...m,[h]:{...m[h],...w}},k&&b<=50&&(b++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(i=k.rects===true?await s.getElementRects({reference:e,floating:t,strategy:n}):k.rects),{x:u,y:l}=pi(i,p,d)),y=-1);}return {x:u,y:l,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:s,elements:c,strategy:d}=e,{boundary:i="clippingAncestors",rootBoundary:u="viewport",elementContext:l="floating",altBoundary:p=false,padding:m=0}=Or(t,e),b=no(m),h=c[p?l==="floating"?"reference":"floating":l],g=$r(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(h)))==null||r?h:h.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:i,rootBoundary:u,strategy:d})),v=l==="floating"?{x:a,y:n,width:s.floating.width,height:s.floating.height}:s.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:v,offsetParent:f,strategy:d}):v);return {top:(g.top-k.top+b.top)/w.y,bottom:(k.bottom-g.bottom+b.bottom)/w.y,left:(g.left-k.left+b.left)/w.x,right:(k.right-g.right+b.right)/w.x}}var fi=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:a,placement:n,rects:o,platform:s,elements:c,middlewareData:d}=t,{element:i,padding:u=0}=Or(e,t)||{};if(i==null)return {};let l=no(u),p={x:r,y:a},m=on(n),b=nn(m),y=await s.getDimensions(i),h=m==="y",g=h?"top":"left",v=h?"bottom":"right",f=h?"clientHeight":"clientWidth",w=o.reference[b]+o.reference[m]-p[m]-o.floating[b],k=p[m]-o.reference[m],x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i)),C=x?x[f]:0;(!C||!await(s.isElement==null?void 0:s.isElement(x)))&&(C=c.floating[f]||o.floating[b]);let T=w/2-k/2,D=C/2-y[b]/2-1,R=or(l[g],D),_=or(l[v],D),G=R,M=C-y[b]-_,O=C/2-y[b]/2+T,E=an(G,O,M),B=!d.arrow&&zr(n)!=null&&O!==E&&o.reference[b]/2-(O<G?R:_)-y[b]/2<0,z=B?O<G?O-G:O-M:0;return {[m]:p[m]+z,data:{[m]:E,centerOffset:O-E-z,...B&&{alignmentOffset:z}},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:s,initialPlacement:c,platform:d,elements:i}=t,{mainAxis:u=true,crossAxis:l=true,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:y=true,...h}=Or(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return {};let g=fr(n),v=sr(c),f=fr(c)===c,w=await(d.isRTL==null?void 0:d.isRTL(i.floating)),k=p||(f||!y?[xa(c)]:ci(c)),x=b!=="none";!p&&x&&k.push(...di(c,y,b,w));let C=[c,...k],T=await sn(t,h),D=[],R=((a=o.flip)==null?void 0:a.overflows)||[];if(u&&D.push(T[g]),l){let O=li(n,s,w);D.push(T[O[0]],T[O[1]]);}if(R=[...R,{placement:n,overflows:D}],!D.every(O=>O<=0)){var _,G;let O=(((_=o.flip)==null?void 0:_.index)||0)+1,E=C[O];if(E&&(!(l==="alignment"?v!==sr(E):false)||R.every($=>sr($.placement)===v?$.overflows[0]>0:true)))return {data:{index:O,overflows:R},reset:{placement:E}};let B=(G=R.filter(z=>z.overflows[0]<=0).sort((z,$)=>z.overflows[1]-$.overflows[1])[0])==null?void 0:G.placement;if(!B)switch(m){case "bestFit":{var M;let z=(M=R.filter($=>{if(x){let A=sr($.placement);return A===v||A==="y"}return true}).map($=>[$.placement,$.overflows.filter(A=>A>0).reduce((A,ee)=>A+ee,0)]).sort(($,A)=>$[1]-A[1])[0])==null?void 0:M[0];z&&(B=z);break}case "initialPlacement":B=c;break}if(n!==B)return {reset:{placement:B}}}return {}}}};var eu=new Set(["left","top"]);async function tu(e,t){let{placement:r,platform:a,elements:n}=e,o=await(a.isRTL==null?void 0:a.isRTL(n.floating)),s=fr(r),c=zr(r),d=sr(r)==="y",i=eu.has(s)?-1:1,u=o&&d?-1:1,l=Or(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:b}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return c&&typeof b=="number"&&(m=c==="end"?b*-1:b),d?{x:m*u,y:p*i}:{x:p*i,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:s,middlewareData:c}=t,d=await tu(t,e);return s===((r=c.offset)==null?void 0:r.placement)&&(a=c.arrow)!=null&&a.alignmentOffset?{}:{x:n+d.x,y:o+d.y,data:{...d,placement:s}}}}},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:s=false,limiter:c={fn:h=>{let{x:g,y:v}=h;return {x:g,y:v}}},...d}=Or(e,t),i={x:r,y:a},u=await sn(t,d),l=sr(fr(n)),p=ao(l),m=i[p],b=i[l];if(o){let h=p==="y"?"top":"left",g=p==="y"?"bottom":"right",v=m+u[h],f=m-u[g];m=an(v,m,f);}if(s){let h=l==="y"?"top":"left",g=l==="y"?"bottom":"right",v=b+u[h],f=b-u[g];b=an(v,b,f);}let y=c.fn({...t,[p]:m,[l]:b});return {...y,data:{x:y.x-r,y:y.y-a,enabled:{[p]:o,[l]:s}}}}}};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:s,elements:c}=t,{apply:d=()=>{},...i}=Or(e,t),u=await sn(t,i),l=fr(n),p=zr(n),m=sr(n)==="y",{width:b,height:y}=o.floating,h,g;l==="top"||l==="bottom"?(h=l,g=p===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(g=l,h=p==="end"?"top":"bottom");let v=y-u.top-u.bottom,f=b-u.left-u.right,w=or(y-u[h],v),k=or(b-u[g],f),x=!t.middlewareData.shift,C=w,T=k;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(T=f),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(C=v),x&&!p){let R=Ct(u.left,0),_=Ct(u.right,0),G=Ct(u.top,0),M=Ct(u.bottom,0);m?T=b-2*(R!==0||_!==0?R+_:Ct(u.left,u.right)):C=y-2*(G!==0||M!==0?G+M:Ct(u.top,u.bottom));}await d({...t,availableWidth:T,availableHeight:C});let D=await s.getDimensions(c.floating);return b!==D.width||y!==D.height?{reset:{rects:true}}:{}}}};function wi(e){let t=Dt(e),r=parseFloat(t.width)||0,a=parseFloat(t.height)||0,n=_t(e),o=n?e.offsetWidth:r,s=n?e.offsetHeight:a,c=ka(r)!==o||ka(a)!==s;return c&&(r=o,a=s),{width:r,height:a,$:c}}function so(e){return ft(e)?e:e.contextElement}function Qr(e){let t=so(e);if(!_t(t))return jt(1);let r=t.getBoundingClientRect(),{width:a,height:n,$:o}=wi(t),s=(o?ka(r.width):r.width)/a,c=(o?ka(r.height):r.height)/n;return (!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}var ru=jt(0);function Ci(e){let t=wt(e);return !ba()||!t.visualViewport?ru:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function au(e,t,r){return t===void 0&&(t=false),!r||t&&r!==wt(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),s=jt(1);t&&(a?ft(a)&&(s=Qr(a)):s=Qr(e));let c=au(o,r,a)?Ci(o):jt(0),d=(n.left+c.x)/s.x,i=(n.top+c.y)/s.y,u=n.width/s.x,l=n.height/s.y;if(o){let p=wt(o),m=a&&ft(a)?wt(a):a,b=p,y=tn(b);for(;y&&a&&m!==b;){let h=Qr(y),g=y.getBoundingClientRect(),v=Dt(y),f=g.left+(y.clientLeft+parseFloat(v.paddingLeft))*h.x,w=g.top+(y.clientTop+parseFloat(v.paddingTop))*h.y;d*=h.x,i*=h.y,u*=h.x,l*=h.y,d+=f,i+=w,b=wt(y),y=tn(b);}}return $r({width:u,height:l,x:d,y:i})}function ln(e,t){let r=ya(e).scrollLeft;return t?t.left+r:_r(Kt(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 nu(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e,o=n==="fixed",s=Kt(a),c=t?va(t.floating):false;if(a===s||c&&o)return r;let d={scrollLeft:0,scrollTop:0},i=jt(1),u=jt(0),l=_t(a);if((l||!l&&!o)&&((wr(a)!=="body"||Zr(s))&&(d=ya(a)),_t(a))){let m=_r(a);i=Qr(a),u.x=m.x+a.clientLeft,u.y=m.y+a.clientTop;}let p=s&&!l&&!o?Ti(s,d):jt(0);return {width:r.width*i.x,height:r.height*i.y,x:r.x*i.x-d.scrollLeft*i.x+u.x+p.x,y:r.y*i.y-d.scrollTop*i.y+u.y+p.y}}function ou(e){return Array.from(e.getClientRects())}function su(e){let t=Kt(e),r=ya(e),a=e.ownerDocument.body,n=Ct(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),o=Ct(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),s=-r.scrollLeft+ln(e),c=-r.scrollTop;return Dt(a).direction==="rtl"&&(s+=Ct(t.clientWidth,a.clientWidth)-n),{width:n,height:o,x:s,y:c}}var yi=25;function iu(e,t){let r=wt(e),a=Kt(e),n=r.visualViewport,o=a.clientWidth,s=a.clientHeight,c=0,d=0;if(n){o=n.width,s=n.height;let u=ba();(!u||u&&t==="fixed")&&(c=n.offsetLeft,d=n.offsetTop);}let i=ln(a);if(i<=0){let u=a.ownerDocument,l=u.body,p=getComputedStyle(l),m=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,b=Math.abs(a.clientWidth-l.clientWidth-m);b<=yi&&(o-=b);}else i<=yi&&(o+=i);return {width:o,height:s,x:c,y:d}}var lu=new Set(["absolute","fixed"]);function cu(e,t){let r=_r(e,true,t==="fixed"),a=r.top+e.clientTop,n=r.left+e.clientLeft,o=_t(e)?Qr(e):jt(1),s=e.clientWidth*o.x,c=e.clientHeight*o.y,d=n*o.x,i=a*o.y;return {width:s,height:c,x:d,y:i}}function xi(e,t,r){let a;if(t==="viewport")a=iu(e,r);else if(t==="document")a=su(Kt(e));else if(ft(t))a=cu(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=nr(e);return r===t||!ft(r)||Cr(r)?false:Dt(r).position==="fixed"||Si(r,t)}function du(e,t){let r=t.get(e);if(r)return r;let a=mr(e,[],false).filter(c=>ft(c)&&wr(c)!=="body"),n=null,o=Dt(e).position==="fixed",s=o?nr(e):e;for(;ft(s)&&!Cr(s);){let c=Dt(s),d=en(s);!d&&c.position==="fixed"&&(n=null),(o?!d&&!n:!d&&c.position==="static"&&!!n&&lu.has(n.position)||Zr(s)&&!d&&Si(e,s))?a=a.filter(u=>u!==s):n=c,s=nr(s);}return t.set(e,a),a}function uu(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e,s=[...r==="clippingAncestors"?va(t)?[]:du(t,this._c):[].concat(r),a],c=s[0],d=s.reduce((i,u)=>{let l=xi(t,u,n);return i.top=Ct(l.top,i.top),i.right=or(l.right,i.right),i.bottom=or(l.bottom,i.bottom),i.left=Ct(l.left,i.left),i},xi(t,c,n));return {width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function pu(e){let{width:t,height:r}=wi(e);return {width:t,height:r}}function mu(e,t,r){let a=_t(t),n=Kt(t),o=r==="fixed",s=_r(e,true,o,t),c={scrollLeft:0,scrollTop:0},d=jt(0);function i(){d.x=ln(n);}if(a||!a&&!o)if((wr(t)!=="body"||Zr(n))&&(c=ya(t)),a){let m=_r(t,true,o,t);d.x=m.x+t.clientLeft,d.y=m.y+t.clientTop;}else n&&i();o&&!a&&n&&i();let u=n&&!a&&!o?Ti(n,c):jt(0),l=s.left+c.scrollLeft-d.x-u.x,p=s.top+c.scrollTop-d.y-u.y;return {x:l,y:p,width:s.width,height:s.height}}function oo(e){return Dt(e).position==="static"}function ki(e,t){if(!_t(e)||Dt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Kt(e)===r&&(r=r.ownerDocument.body),r}function Di(e,t){let r=wt(e);if(va(e))return r;if(!_t(e)){let n=nr(e);for(;n&&!Cr(n);){if(ft(n)&&!oo(n))return n;n=nr(n);}return r}let a=ki(e,t);for(;a&&ai(a)&&oo(a);)a=ki(a,t);return a&&Cr(a)&&oo(a)&&!en(a)?r:a||ni(e)||r}var fu=async function(e){let t=this.getOffsetParent||Di,r=this.getDimensions,a=await r(e.floating);return {reference:mu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function gu(e){return Dt(e).direction==="rtl"}var io={convertOffsetParentRelativeRectToViewportRelativeRect:nu,getDocumentElement:Kt,getClippingRect:uu,getOffsetParent:Di,getElementRects:fu,getClientRects:ou,getDimensions:pu,getScale:Qr,isElement:ft,isRTL:gu};function Ni(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hu(e,t){let r=null,a,n=Kt(e);function o(){var c;clearTimeout(a),(c=r)==null||c.disconnect(),r=null;}function s(c,d){c===void 0&&(c=false),d===void 0&&(d=1),o();let i=e.getBoundingClientRect(),{left:u,top:l,width:p,height:m}=i;if(c||t(),!p||!m)return;let b=wa(l),y=wa(n.clientWidth-(u+p)),h=wa(n.clientHeight-(l+m)),g=wa(u),f={rootMargin:-b+"px "+-y+"px "+-h+"px "+-g+"px",threshold:Ct(0,or(1,d))||1},w=true;function k(x){let C=x[0].intersectionRatio;if(C!==d){if(!w)return s();C?s(false,C):a=setTimeout(()=>{s(false,1e-7);},1e3);}C===1&&!Ni(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 cn(e,t,r,a){a===void 0&&(a={});let{ancestorScroll:n=true,ancestorResize:o=true,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=false}=a,i=so(e),u=n||o?[...i?mr(i):[],...mr(t)]:[];u.forEach(g=>{n&&g.addEventListener("scroll",r,{passive:true}),o&&g.addEventListener("resize",r);});let l=i&&c?hu(i,r):null,p=-1,m=null;s&&(m=new ResizeObserver(g=>{let[v]=g;v&&v.target===i&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var f;(f=m)==null||f.observe(t);})),r();}),i&&!d&&m.observe(i),m.observe(t));let b,y=d?_r(e):null;d&&h();function h(){let g=_r(e);y&&!Ni(y,g)&&r(),y=g,b=requestAnimationFrame(h);}return r(),()=>{var g;u.forEach(v=>{n&&v.removeEventListener("scroll",r),o&&v.removeEventListener("resize",r);}),l?.(),(g=m)==null||g.disconnect(),m=null,d&&cancelAnimationFrame(b);}}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 bu=typeof document<"u",yu=function(){},un=bu?we.useLayoutEffect:yu;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=we__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:s}={},transform:c=true,whileElementsMounted:d,open:i}=e,[u,l]=we__namespace.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:false}),[p,m]=we__namespace.useState(a);pn(p,a)||m(a);let[b,y]=we__namespace.useState(null),[h,g]=we__namespace.useState(null),v=we__namespace.useCallback($=>{$!==x.current&&(x.current=$,y($));},[]),f=we__namespace.useCallback($=>{$!==C.current&&(C.current=$,g($));},[]),w=o||b,k=s||h,x=we__namespace.useRef(null),C=we__namespace.useRef(null),T=we__namespace.useRef(u),D=d!=null,R=co(d),_=co(n),G=co(i),M=we__namespace.useCallback(()=>{if(!x.current||!C.current)return;let $={placement:t,strategy:r,middleware:p};_.current&&($.platform=_.current),dn(x.current,C.current,$).then(A=>{let ee={...A,isPositioned:G.current!==false};O.current&&!pn(T.current,ee)&&(T.current=ee,Li__namespace.flushSync(()=>{l(ee);}));});},[p,t,r,_,G]);un(()=>{i===false&&T.current.isPositioned&&(T.current.isPositioned=false,l($=>({...$,isPositioned:false})));},[i]);let O=we__namespace.useRef(false);un(()=>(O.current=true,()=>{O.current=false;}),[]),un(()=>{if(w&&(x.current=w),k&&(C.current=k),w&&k){if(R.current)return R.current(w,k,M);M();}},[w,k,M,R,D]);let E=we__namespace.useMemo(()=>({reference:x,floating:C,setReference:v,setFloating:f}),[v,f]),B=we__namespace.useMemo(()=>({reference:w,floating:k}),[w,k]),z=we__namespace.useMemo(()=>{let $={position:r,left:0,top:0};if(!B.floating)return $;let A=Mi(B.floating,u.x),ee=Mi(B.floating,u.y);return c?{...$,transform:"translate("+A+"px, "+ee+"px)",...Fi(B.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:A,top:ee}},[r,c,B.floating,u.x,u.y]);return we__namespace.useMemo(()=>({...u,update:M,refs:E,elements:B,floatingStyles:z}),[u,M,E,B,z])}var xu=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)=>({...xu(e),options:[e,t]});function _i(e){let t=we__namespace.useRef(void 0),r=we__namespace.useCallback(a=>{let n=e.map(o=>{if(o!=null){if(typeof o=="function"){let s=o,c=s(a);return typeof c=="function"?c:()=>{s(null);}}return o.current=a,()=>{o.current=null;}}});return ()=>{n.forEach(o=>o?.());}},e);return we__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 Eu={...we__namespace},Oi=false,Ru=0,zi=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ru++;function Pu(){let[e,t]=we__namespace.useState(()=>Oi?zi():void 0);return Ta(()=>{e==null&&t(zi());},[]),we__namespace.useEffect(()=>{Oi=true;},[]),e}var Iu=Eu.useId,Ui=Iu||Pu,Sa;process.env.NODE_ENV!=="production"&&(Sa=new Set);function Mu(){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 Au(){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=we__namespace.forwardRef(function(t,r){let{context:{placement:a,elements:{floating:n},middlewareData:{arrow:o,shift:s}},width:c=14,height:d=7,tipRadius:i=0,strokeWidth:u=0,staticOffset:l,stroke:p,d:m,style:{transform:b,...y}={},...h}=t;process.env.NODE_ENV!=="production"&&(r||Mu("The `ref` prop is required for `FloatingArrow`."));let g=Ui(),[v,f]=we__namespace.useState(false);if(Ta(()=>{if(!n)return;Dt(n).direction==="rtl"&&f(true);},[n]),!n)return null;let[w,k]=a.split("-"),x=w==="top"||w==="bottom",C=l;(x&&s!=null&&s.x||!x&&s!=null&&s.y)&&(C=null);let T=u*2,D=T/2,R=c/2*(i/-8+1),_=d/2*i/4,G=!!m,M=C&&k==="end"?"bottom":"top",O=C&&k==="end"?"right":"left";C&&v&&(O=k==="end"?"left":"right");let E=o?.x!=null?C||o.x:"",B=o?.y!=null?C||o.y:"",z=m||"M0,0"+(" H"+c)+(" L"+(c-R)+","+(d-_))+(" Q"+c/2+","+d+" "+R+","+(d-_))+" Z",$={top:G?"rotate(180deg)":"",left:G?"rotate(90deg)":"rotate(-90deg)",bottom:G?"":"rotate(180deg)",right:G?"rotate(-90deg)":"rotate(90deg)"}[w];return jsxRuntime.jsxs("svg",{...h,"aria-hidden":true,ref:r,width:G?c:c+T,height:c,viewBox:"0 0 "+c+" "+(d>c?d:c),style:{position:"absolute",pointerEvents:"none",[O]:E,[M]:B,[w]:x||G?"100%":"calc(100% - "+T/2+"px)",transform:[$,b].filter(A=>!!A).join(" "),...y},children:[T>0&&jsxRuntime.jsx("path",{clipPath:"url(#"+g+")",fill:"none",stroke:p,strokeWidth:T+(m?0:1),d:z}),jsxRuntime.jsx("path",{stroke:T&&!m?h.fill:"none",d:z}),jsxRuntime.jsx("clipPath",{id:g,children:jsxRuntime.jsx("rect",{x:-D,y:D*(G?-1:1),width:c+T,height:c})})]})});function Lu(){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 Fu=we__namespace.createContext(null),Bu=we__namespace.createContext(null),Ou=()=>{var e;return ((e=we__namespace.useContext(Fu))==null?void 0:e.id)||null},zu=()=>we__namespace.useContext(Bu);function $u(e){let{open:t=false,onOpenChange:r,elements:a}=e,n=Ui(),o=we__namespace.useRef({}),[s]=we__namespace.useState(()=>Lu()),c=Ou()!=null;if(process.env.NODE_ENV!=="production"){let m=a.reference;m&&!ft(m)&&Au("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.");}let[d,i]=we__namespace.useState(a.reference),u=ui((m,b,y)=>{o.current.openEvent=m?b:void 0,s.emit("openchange",{open:m,event:b,reason:y,nested:c}),r?.(m,b,y);}),l=we__namespace.useMemo(()=>({setPositionReference:i}),[]),p=we__namespace.useMemo(()=>({reference:d||a.reference||null,floating:a.floating||null,domReference:a.reference}),[d,a.reference,a.floating]);return we__namespace.useMemo(()=>({dataRef:o,open:t,onOpenChange:u,elements:p,events:s,floatingId:n,refs:l}),[t,u,p,s,n,l])}function Gi(e){e===void 0&&(e={});let{nodeId:t}=e,r=$u({...e,elements:{reference:null,floating:null,...e.elements}}),a=e.rootContext||r,n=a.elements,[o,s]=we__namespace.useState(null),[c,d]=we__namespace.useState(null),u=n?.domReference||o,l=we__namespace.useRef(null),p=zu();Ta(()=>{u&&(l.current=u);},[u]);let m=Bi({...e,elements:{...n,...c&&{reference:c}}}),b=we__namespace.useCallback(f=>{let w=ft(f)?{getBoundingClientRect:()=>f.getBoundingClientRect(),getClientRects:()=>f.getClientRects(),contextElement:f}:f;d(w),m.refs.setReference(w);},[m.refs]),y=we__namespace.useCallback(f=>{(ft(f)||f===null)&&(l.current=f,s(f)),(ft(m.refs.reference.current)||m.refs.reference.current===null||f!==null&&!ft(f))&&m.refs.setReference(f);},[m.refs]),h=we__namespace.useMemo(()=>({...m.refs,setReference:y,setPositionReference:b,domReference:l}),[m.refs,y,b]),g=we__namespace.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),v=we__namespace.useMemo(()=>({...m,...a,refs:h,elements:g,nodeId:t}),[m,h,g,t,a]);return Ta(()=>{a.dataRef.current.floatingContext=v;let f=p?.nodesRef.current.find(w=>w.id===t);f&&(f.context=v);}),we__namespace.useMemo(()=>({...m,context:v,refs:h,elements:g}),[m,h,g,v])}var go=we.createContext(null);function Hi(){return we.useContext(go)}function Ke({children:e,container:t}){let[r,a]=we.useState(false),n=Hi();if(we.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:c}=n,d={"--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 Li.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:d,children:e}),o)}return Li.createPortal(e,o)}function Ki(e,t,r=true){we.useEffect(()=>{if(!r)return;let a=o=>{(Array.isArray(e)?e:[e]).some(d=>{let i=d.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 Yi({itemCount:e,onSelect:t,onEscape:r,enabled:a=true,loop:n=true,containerRef:o}){let[s,c]=we.useState(-1);we.useEffect(()=>{if(!a||s===-1||!o?.current)return;let l=o.current.querySelector(`[data-index="${s}"]`);l&&l.scrollIntoView({block:"nearest",behavior:"smooth"});},[s,a,o]);let d=we.useCallback(u=>{if(a)switch(u.key){case "ArrowDown":u.preventDefault(),c(l=>l===-1?0:l===e-1?n?0:l:l+1);break;case "ArrowUp":u.preventDefault(),c(l=>l===-1?e-1:l===0?n?e-1:l:l-1);break;case "Enter":case " ":u.preventDefault(),s!==-1&&t&&t(s);break;case "Escape":u.preventDefault(),r&&r();break;case "Home":u.preventDefault(),c(0);break;case "End":u.preventDefault(),c(e-1);break;}},[a,s,e,n,t,r]),i=we.useCallback(u=>({"data-active":u===s,"data-index":u,role:"option",tabIndex:-1}),[s]);return {activeIndex:s,setActiveIndex:c,handleKeyDown:d,getItemProps:i}}function gr({trigger:e,children:t,isOpen:r,onOpenChange:a,placement:n="bottom-start",offsetDistance:o=8,maxHeight:s=320,minWidth:c="trigger",maxWidth:d,showArrow:i=false,className:u="",triggerClassName:l="",disableClickOutside:p=false,disableKeyboardNav:m=false,itemCount:b=0,onSelectItem:y,onOpen:h,onClose:g,animationDuration:v=200,zIndex:f=1e3}){let[w,k]=we.useState(false),x=r!==void 0?r:w,C=we.useCallback(fe=>{let P=x;r===void 0&&k(fe),a?.(fe),fe&&!P?h?.():!fe&&P&&g?.();},[r,a,h,g,x]),T=we.useCallback(()=>{C(!x);},[x,C]),D=we.useCallback(()=>{C(false);},[C]),R=we.useRef(null),_=we.useRef(null),G=we.useRef(null),{refs:M,floatingStyles:O,context:E}=Gi({open:x,onOpenChange:C,placement:n,middleware:[mn(o),po({padding:8}),uo({padding:8}),mo({apply({rects:fe,elements:P}){Object.assign(P.floating.style,{minWidth:c==="trigger"?`${fe.reference.width}px`:c?`${c}px`:void 0,maxWidth:d?`${d}px`:void 0,maxHeight:`${s}px`});},padding:8}),i?fo({element:G}):null].filter(Boolean),whileElementsMounted:cn}),B=_i([R,M.setReference]);Ki([R,_],D,x&&!p);let{activeIndex:z,setActiveIndex:$,handleKeyDown:A}=Yi({itemCount:b,onSelect:y,onEscape:D,enabled:x&&!m,loop:true,containerRef:_}),ee=()=>typeof e=="function"?e({isOpen:x,toggle:T}):e,X=()=>typeof t=="function"?t({activeIndex:z,setActiveIndex:$,close:D}):t;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:B,className:`dropdown-trigger ${l}`,onClick:T,children:ee()}),x&&jsxRuntime.jsx(Ke,{children:jsxRuntime.jsxs("div",{ref:M.setFloating,style:{...O,zIndex:f},className:`dropdown-content ${u}`,role:"menu","aria-orientation":"vertical",onKeyDown:A,children:[jsxRuntime.jsx("div",{ref:_,className:"dropdown-inner",children:X()}),i&&jsxRuntime.jsx(Wi,{ref:G,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"}},Xu="#BDC3C7",Ju="#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"})]}),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:Xu,s=d=>{t(d);},c=Object.entries(Xi);return jsxRuntime.jsx(gr,{trigger:({isOpen:d})=>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:d?"scale(1.1)":"scale(1)"},title:a?.label||"Set priority","aria-label":"Select priority","aria-expanded":d,"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:d=>{let i=c[d];s(i?i[0]:void 0);},children:({activeIndex:d,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:[c.map(([u,l],p)=>{let m=n?l.darkColor:l.color,b=d===p,y=e===u;return jsxRuntime.jsxs("button",{onClick:()=>{s(u),i();},className:"dropdown-item","data-active":b,"data-index":p,role:"option","aria-selected":y,style:{color:b?m:"inherit",fontWeight:y?600:400},children:[jsxRuntime.jsx(Zu,{color:m}),jsxRuntime.jsx("span",{children:l.label}),y&&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:()=>{s(void 0),i();},className:"dropdown-item","data-active":d===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]=we.useState(e||""),[s,c]=we.useState(t||""),d=(b,y)=>{let h=new Date,g=new Date(h);g.setDate(g.getDate()+b);let v=h.toISOString().split("T")[0]||"",f=g.toISOString().split("T")[0]||"";o(v),c(f),r(v,f),y();},i=b=>{r(n||void 0,s||void 0),b();},u=()=>{if(!e||!t)return "Set date";let b=v=>{if(v instanceof Date)return v;if(typeof v!="string"||!v.match(/^\d{4}-\d{2}-\d{2}$/))return null;let f=v.split("-").map(Number);if(f.length!==3||f.some(C=>isNaN(C)))return null;let w=f[0],k=f[1],x=f[2];return w===void 0||k===void 0||x===void 0?null:new Date(w,k-1,x)},y=b(e),h=b(t);if(!y||!h||isNaN(y.getTime())||isNaN(h.getTime()))return "Set date";let g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${g[y.getMonth()]} ${y.getDate()} \u2013 ${g[h.getMonth()]} ${h.getDate()}`},l=e&&t,m=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,y=new Date;return y.setHours(0,0,0,0),b<y})();return jsxRuntime.jsx(gr,{trigger:({isOpen:b})=>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:b?"scale(1.05)":"scale(1)"},title:l?`${u()}`:"Set date range","aria-label":"Select date range","aria-expanded":b,"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:b,close:y})=>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((h,g)=>jsxRuntime.jsx("button",{onClick:()=>d(h.days,y),className:"dropdown-quick-button","data-active":b===g,"data-index":g,role:"option",children:h.label},h.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:h=>o(h.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:h=>c(h.target.value),className:"dropdown-input"})]}),jsxRuntime.jsx("button",{onClick:()=>i(y),className:"dropdown-primary-button",children:"Apply"}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{o(""),c(""),r(void 0,void 0),y();},className:"dropdown-danger-button",children:"Clear Dates"})]})]})]})})}function Ur({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[o,s]=we.useState(""),c=l=>{let p=e.some(m=>m.id===l.id);r(p?e.filter(m=>m.id!==l.id):[...e,l]);},d=t.filter(l=>l.name.toLowerCase().includes(o.toLowerCase())),i=e.slice(0,n),u=e.length-n;return jsxRuntime.jsx(gr,{trigger:({isOpen:l})=>jsxRuntime.jsx("button",{className:`dropdown-avatar-trigger ${a||""}`,style:{transform:l?"scale(1.05)":"scale(1)"},title:e.length>0?`${e.length} assigned`:"Assign users","aria-label":"Assign users","aria-expanded":l,"aria-haspopup":"menu",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[i.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:d.length,onSelectItem:l=>{let p=d[l];p&&c(p);},onClose:()=>s(""),children:({activeIndex:l,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=>s(m.target.value),placeholder:"Search users...",className:"dropdown-search-input",autoFocus:true})}),jsxRuntime.jsx("div",{className:"dropdown-list",children:d.length===0?jsxRuntime.jsx("div",{className:"dropdown-empty",children:"No users found"}):d.map((m,b)=>{let y=e.some(h=>h.id===m.id);return jsxRuntime.jsxs("button",{onClick:()=>{c(m);},className:"dropdown-item","data-active":l===b,"data-index":b,role:"option","aria-selected":y,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}),y&&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,s]=we.useState(""),[c,d]=we.useState(t.length>0),i=m=>{if(t.includes(m)){let y=t.filter(h=>h!==m);a(y),y.length===0&&d(false);}else a([...t,m]),d(true);},u=()=>{let m=!c;d(m),m||a([]);},l=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(gr,{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?l.length:0,onSelectItem:m=>{let b=l[m];b&&i(b.id);},onClose:()=>s(""),onOpen:()=>d(t.length>0),children:({activeIndex:m,close:b})=>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:y=>s(y.target.value),placeholder:"Search by name or ID...",className:"dropdown-search-input",autoFocus:true})}),jsxRuntime.jsx("div",{className:"dropdown-list",children:l.length===0?jsxRuntime.jsx("div",{className:"dropdown-empty",children:"No tasks found"}):l.map((y,h)=>{let g=t.includes(y.id);return jsxRuntime.jsxs("button",{onClick:()=>i(y.id),className:"dropdown-item","data-active":m===h,"data-index":h,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:y.title}),jsxRuntime.jsx("div",{style:{fontSize:"11px",marginTop:"2px",color:"var(--asakaa-color-text-secondary)"},children:y.id})]})]},y.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(false),b();},className:"dropdown-danger-button",children:"Clear All Dependencies"})})]})})}var hr=we.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:o,onUpdate:s,availableUsers:c=[],allCards:d=[]})=>{let{attributes:i,listeners:u,setNodeRef:l,transform:p,transition:m,isDragging:b}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),y={transform:qa.Transform.toString(p),transition:m};if(t)return jsxRuntime.jsx("div",{ref:l,style:y,...i,...u,onClick:()=>r?.(e),children:t(e)});let h=c.filter(g=>e.assignedUserIds?.includes(g.id));return jsxRuntime.jsxs("div",{ref:l,style:y,className:re("asakaa-card",b&&"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(Na,{priority:e.priority,onChange:g=>s?.(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,v)=>s?.(e.id,{startDate:g,endDate:v})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ur,{assignedUsers:h,availableUsers:c,onChange:g=>s?.(e.id,{assignedUserIds:g.map(v=>v.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:d,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));hr.displayName="Card";function rl({columnTitle:e,onRename:t,className:r}){let[a,n]=we.useState(false),[o,s]=we.useState(false),[c,d]=we.useState(e),[i,u]=we.useState({top:0,left:0}),l=we.useRef(null),p=we.useRef(null),m=we.useRef(null);we.useEffect(()=>{if(a&&p.current){let g=p.current.getBoundingClientRect();u({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[a]),we.useEffect(()=>{let g=v=>{l.current&&!l.current.contains(v.target)&&!p.current?.contains(v.target)&&(n(false),s(false));};if(a)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[a]),we.useEffect(()=>{let g=v=>{v.key==="Escape"&&(n(false),s(false),d(e));};if(a)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[a,e]),we.useEffect(()=>{o&&m.current&&(m.current.focus(),m.current.select());},[o]);let b=()=>{s(true),d(e);},y=()=>{let g=c.trim();g&&g!==e&&t(g),s(false),n(false),d(e);},h=g=>{g.key==="Enter"?y():g.key==="Escape"&&(s(false),d(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:l,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:m,type:"text",value:c,onChange:g=>d(g.target.value),onKeyDown:h,onBlur:y,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:b,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=we.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:o,onCardClick:s,onCardUpdate:c,availableUsers:d,allCards:i,enableVirtualization:u,cardHeight:l=120,isCollapsed:p,onToggleCollapse:m,onColumnRename:b,className:y})=>{let{setNodeRef:h,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),v=we.useRef(null),f=u??Ys(t.length),w=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>v.current,estimateSize:()=>l,enabled:f});if(r)return jsxRuntime.jsx("div",{ref:h,className:y,children:r(e,t)});let x=(()=>{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}})(),C=x.state==="exceeded",T=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:re("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",C&&"ring-2 ring-asakaa-accent-red",y),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:re(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&x.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${x.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[x.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"})]}),x.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"})]}),x.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"})}),x.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"})]})]}),b&&jsxRuntime.jsx(rl,{columnTitle:e.title,onRename:D=>b(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:v,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(hr,{card:R,render:a,onClick:s,onUpdate:c,availableUsers:d,allCards:i})},R.id):null})}):t.map(D=>jsxRuntime.jsx(hr,{card:D,render:a,onClick:s,onUpdate:c,availableUsers:d,allCards:i},D.id))})})]})});ta.displayName="Column";function yo({title:e,onSave:t,className:r}){let[a,n]=we.useState(false),[o,s]=we.useState(e),c=we.useRef(null);we.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.select());},[a]);let d=()=>{let u=o.trim();u&&u!==e?t(u):s(e),n(false);},i=u=>{u.key==="Enter"?d():u.key==="Escape"&&(s(e),n(false));};return a?jsxRuntime.jsx("input",{ref:c,type:"text",value:o,onChange:u=>s(u.target.value),onBlur:d,onKeyDown:i,className:re("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",r),maxLength:50}):jsxRuntime.jsx("h2",{className:re("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function ko(){let[e,t]=we.useState(()=>core.dragStore.getState());we.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let r=we.useCallback(a=>{core.dragStore.setState(a);},[]);return [e,r]}function Dr({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:o=[],className:s,style:c,isLoading:d,error:i,children:u}){let[l,p]=ko(),m=we.useCallback((k,x)=>{t.onCardUpdate?.(k,x);},[t]),b=we.useCallback((k,x)=>{t.onColumnUpdate?.(k,{title:x});},[t]),y=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),h=we.useMemo(()=>{let k=new Map;return e.columns.forEach(x=>{let C=x.cardIds.map(T=>e.cards.find(D=>D.id===T)).filter(T=>T!==void 0).sort((T,D)=>T.position-D.position);k.set(x.id,C);}),k},[e.cards,e.columns]),g=we.useCallback(k=>{let{active:x}=k,C=e.cards.find(T=>T.id===x.id);C&&p({isDragging:true,draggedCardId:C.id,sourceColumnId:C.columnId,targetColumnId:C.columnId});},[e.cards,p]),v=we.useCallback(k=>{let{active:x,over:C}=k;if(!C||!e.cards.find(R=>R.id===x.id))return;let D=null;C.data.current?.type==="column"?D=C.id:C.data.current?.type==="card"&&(D=e.cards.find(_=>_.id===C.id)?.columnId||null),D&&D!==l.targetColumnId&&p({...l,targetColumnId:D});},[e.cards,l,p]),f=we.useCallback(async k=>{let{active:x,over:C}=k;if(p({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!C)return;let T=e.cards.find(G=>G.id===x.id);if(!T)return;let D,R;if(C.data.current?.type==="column"){D=C.id;let G=h.get(D)||[];R=Jn(G,0);}else {let G=e.cards.find(E=>E.id===C.id);if(!G)return;D=G.columnId;let M=h.get(D)||[],O=M.findIndex(E=>E.id===C.id);R=Jn(M,O);}let _=e.columns.find(G=>G.id===D);if(_&&_.wipLimit&&_.wipLimitType==="hard"){let G=h.get(D)||[];if(T.columnId!==D&&G.length>=_.wipLimit){t.onWipLimitExceeded?.(_,T);return}}(T.columnId!==D||T.position!==R)&&await t.onCardMove?.(T.id,D,R);},[e.cards,e.columns,h,t,p]),w=we.useCallback(k=>{r?.(k);},[r]);return d?jsxRuntime.jsx("div",{className:re("asakaa-board",s),style:c,children:jsxRuntime.jsx(wp,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:re("asakaa-board",s),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 i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(core$1.DndContext,{sensors:y,collisionDetection:core$1.closestCorners,onDragStart:g,onDragOver:v,onDragEnd:f,children:[jsxRuntime.jsxs("div",{className:re("asakaa-board",s),style:c,children:[e.columns.sort((k,x)=>k.position-x.position).map(k=>{let x=h.get(k.id)||[];return jsxRuntime.jsx(ta,{column:k,cards:x,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,onCardClick:w,onCardUpdate:m,onColumnRename:b,availableUsers:o,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight},k.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(hr,{card:e.cards.find(k=>k.id===l.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})}function wp({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(Dr,{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 sl(e={}){return new Ma(e)}var aa=class extends we.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 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:s,onPredictRisks:c,onOpenAIUsage:d,shortcut:i="k",className:u=""}){let[l,p]=we.useState(false),[m,b]=we.useState(""),[y,h]=we.useState("home"),[g,v]=we.useState(""),[f,w]=we.useState("");we.useEffect(()=>{let T=D=>{(D.metaKey||D.ctrlKey)&&D.key===i&&(D.preventDefault(),p(R=>!R)),D.key==="Escape"&&(p(false),h("home"),b(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),we.useEffect(()=>{l||(h("home"),b(""),v(""),w(""));},[l]);let k=we.useCallback(()=>{p(false);},[]),x=we.useCallback(T=>{let[D,R]=T.split(":");switch(D){case "create-card":h("create-card");break;case "create-card-in":v(R||"");break;case "navigate":R?(r?.(R),k()):h("navigate");break;case "search":a?.(m),k();break;case "priority":h("priority");break;case "set-priority":f&&R&&(n?.(f,R),k());break;case "assign":h("assign");break;case "assign-user":f&&R&&(o?.(f,R),k());break;case "ai":h("ai");break;case "ai-generate-plan":s?.(),k();break;case "ai-predict-risks":c?.(),k();break;case "ai-usage":d?.(),k();break;case "back":h("home");break;}},[m,f,t,r,a,n,o,s,c,d,k]),C=we.useCallback(()=>{g&&m.trim()&&(t?.(g,m.trim()),k());},[g,m,t,k]);return l?jsxRuntime.jsx(Ke,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:m,onValueChange:b,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:y==="create-card"&&g?"Type card title and press Enter...":y==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&y==="create-card"&&g&&C();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),y==="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:x,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:x,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:x,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:x,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:x,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:D},D))})]},T.id))})]}),y==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:x,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:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),y==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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(T=>{let D=e.columns.find(R=>R.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:x,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:D?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},T.id)})})]}),y==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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:x,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:x,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:x,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 Rp(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 Pp(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 Ip(e){return e.startsWith("image/")}function La({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:o=10}){let[s,c]=we.useState(false),[d,i]=we.useState(false),[u,l]=we.useState(null),p=we.useRef(null),m=we.useCallback(x=>{let C=[],T=[];return e.length+x.length>o?(T.push(`Maximum ${o} files allowed`),{valid:C,errors:T}):(x.forEach(D=>{if(D.size/1048576>a){T.push(`${D.name} is too large (max ${a}MB)`);return}if(n&&!n.some(_=>D.type.match(_))){T.push(`${D.name} has invalid file type`);return}C.push(D);}),{valid:C,errors:T})},[e.length,o,a,n]),b=we.useCallback(async x=>{let{valid:C,errors:T}=m(x);if(T.length>0){l(T.join(", ")),setTimeout(()=>l(null),5e3);return}if(C.length!==0){i(true),l(null);try{await t?.(C);}catch(D){l(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[m,t]),y=we.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(true);},[]),h=we.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(false);},[]),g=we.useCallback(x=>{x.preventDefault(),x.stopPropagation();},[]),v=we.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(false);let C=Array.from(x.dataTransfer.files);b(C);},[b]),f=we.useCallback(x=>{let C=x.target.files?Array.from(x.target.files):[];b(C),p.current&&(p.current.value="");},[b]),w=we.useCallback(()=>{p.current?.click();},[]),k=we.useCallback(x=>{confirm("Are you sure you want to delete this attachment?")&&r?.(x);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${s?"dragging":""} ${d?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:g,onDrop:v,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:d?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(x=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ip(x.type)&&x.url?jsxRuntime.jsx("img",{src:x.thumbnailUrl||x.url,alt:x.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Pp(x.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:x.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:x.name,children:x.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Rp(x.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(x.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(x.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"})})})]},x.id))})]})}function Do({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:c=[],aiInsights:d=[],attachments:i=[],onAddComment:u,onDeleteComment:l,onUploadAttachments:p,onDeleteAttachment:m,onSuggestAssignee:b,onGenerateSubtasks:y,onEstimateEffort:h,currentUserId:g="user-1"}){let[v,f]=we.useState("details"),[w,k]=we.useState(false),[x,C]=we.useState({}),[T,D]=we.useState(""),[R,_]=we.useState(false),[G,M]=we.useState({});if(!t||!e)return null;let O=we.useCallback(()=>{k(false),C({}),f("details"),D(""),M({}),r();},[r]),E=we.useCallback(()=>{a&&Object.keys(x).length>0&&(a(e.id,x),C({}),k(false));},[e.id,x,a]),B=we.useCallback(()=>{n&&window.confirm("Are you sure you want to delete this card?")&&(n(e.id),O());},[e.id,n,O]),z=we.useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),D(""));},[e.id,T,u]),$=we.useCallback(async()=>{if(b){_(true);try{let P=await b(e);M(ge=>({...ge,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{_(false);}}},[e,b]),A=we.useCallback(async()=>{if(y){_(true);try{let P=await y(e);M(ge=>({...ge,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{_(false);}}},[e,y]),ee=we.useCallback(async()=>{if(h){_(true);try{let P=await h(e);M(ge=>({...ge,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{_(false);}}},[e,h]),X={...e,...x},fe=o.filter(P=>X.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:X.priority==="URGENT"?"#EF4444":X.priority==="HIGH"?"#F59E0B":X.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsxRuntime.jsx("input",{type:"text",value:x.title??X.title,onChange:P=>C({...x,title:P.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:X.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[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),C({});},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 ${v==="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 ${v==="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 ${v==="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 ${v==="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 ${v==="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:[v==="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:x.description??X.description??"",onChange:P=>C({...x,description:P.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:X.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsxRuntime.jsx("select",{multiple:true,value:x.assignedUserIds??X.assignedUserIds??[],onChange:P=>{let ge=Array.from(P.target.selectedOptions,ae=>ae.value);C({...x,assignedUserIds:ge});},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:fe.length>0?fe.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:x.priority??X.priority??"",onChange:P=>C({...x,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:X.priority==="URGENT"?"#EF4444":X.priority==="HIGH"?"#F59E0B":X.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:X.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:X.labels&&X.labels.length>0?X.labels.map(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:x.startDate?new Date(x.startDate).toISOString().split("T")[0]:X.startDate?new Date(X.startDate).toISOString().split("T")[0]:"",onChange:P=>C({...x,startDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:X.startDate?new Date(X.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsxRuntime.jsx("input",{type:"date",value:x.endDate?new Date(x.endDate).toISOString().split("T")[0]:X.endDate?new Date(X.endDate).toISOString().split("T")[0]:"",onChange:P=>C({...x,endDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:X.endDate?new Date(X.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:x.estimatedTime??X.estimatedTime??"",onChange:P=>C({...x,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:X.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:X.dependencies&&X.dependencies.length>0?X.dependencies.map(P=>{let ge=typeof P=="string"?P:P.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ge.slice(-4)]},ge)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:X.createdAt?new Date(X.createdAt).toLocaleString():"Unknown"})]})]}),v==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:P=>D(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:z,disabled:!T.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 ge=o.find(ae=>ae.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:[ge&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ge.color},children:ge.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ge?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(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"})]})})]}),v==="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 ge=o.find(ae=>ae.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:ge?.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"})]})}),v==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(La,{cardId:e.id,attachments:i,onUpload:p?P=>p(e.id,P):void 0,onDelete:m,currentUserId:g,maxSizeMB:10,maxFiles:20})}),v==="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:$,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("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:A,disabled:R||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:ee,disabled:R||!h,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"]})]}),G.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),G.assignees.map((P,ge)=>{let ae=o.find(pt=>pt.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ae&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ae.color},children:ae.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ae?.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),"%"]})]})]},ge)})]}),G.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),G.subtasks.map((P,ge)=>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"]})]},ge))]}),G.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:[G.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(G.effort.confidence*100).toFixed(0),"%"]})]})]}),d.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),d.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))]}),!G.assignees&&!G.subtasks&&!G.effort&&d.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 Bp=["LOW","MEDIUM","HIGH","URGENT"],Op=["todo","in-progress","review","done"];function Eo({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:c=[],onAddComment:d,onDeleteComment:i,currentUser:u,onAIGenerateDescription:l,onAICreateSubtasks:p,onAIFindSimilar:m,availableColumns:b=[],availableLabels:y=[]}){let[h,g]=we.useState(e),[v,f]=we.useState(false),[w,k]=we.useState([]),[x,C]=we.useState(false),[T,D]=we.useState(""),[R,_]=we.useState(""),[G,M]=we.useState("all"),[O,E]=we.useState(false),[B,z]=we.useState(false),[$,A]=we.useState(false),[ee,X]=we.useState(false),[fe,P]=we.useState(false),[ge,ae]=we.useState(false),pt=we.useRef(null),ct=we.useRef(null),Bt=we.useRef(null),ie=we.useRef(null),mt=we.useRef(null),vt=we.useRef(null),Ot=we.useRef(null),ar=we.useRef(null);we.useEffect(()=>{e&&!h?g({...e}):e&&h&&e.id!==h.id&&g({...e});},[e,h]),we.useEffect(()=>{let S=H=>{let pe=H.target;ie.current&&!ie.current.contains(pe)&&E(false),mt.current&&!mt.current.contains(pe)&&z(false),vt.current&&!vt.current.contains(pe)&&A(false),Ot.current&&!Ot.current.contains(pe)&&X(false);};if(O||B||$||ee)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[O,B,$,ee]),we.useEffect(()=>{if(!t)return;let S=H=>{let pe=H.target,Ee=pe.tagName==="INPUT"||pe.tagName==="TEXTAREA"||pe.isContentEditable;if(H.key==="Escape"){H.preventDefault(),O||B||$||ee||fe||ge?(E(false),z(false),A(false),X(false),P(false),ae(false)):Ee||r();return}if(Ee&&H.key!=="Escape")return;let Fe=H.metaKey||H.ctrlKey;switch(H.key.toLowerCase()){case "s":H.preventDefault(),E(true);break;case "a":H.preventDefault(),A(true);break;case "p":H.preventDefault(),z(true);break;case "l":H.preventDefault(),X(true);break;case "d":Fe||(H.preventDefault(),P(true),setTimeout(()=>ar.current?.focus(),0));break;case "e":Fe||(H.preventDefault(),ae(true));break;case "i":H.preventDefault(),f(true),setTimeout(()=>ct.current?.focus(),0);break;case "t":H.preventDefault(),C(true);break;case "c":H.preventDefault(),Bt.current?.focus();break}};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[t,r,O,B,$,ee,fe,ge]);let ne=we.useCallback(S=>{let H=S.currentTarget.textContent?.trim()||"";if(h&&H!==h.title){let pe={...h,title:H};g(pe),a?.(h.id,{title:H});}},[h,a]),se=we.useCallback(S=>{S.key==="Enter"&&(S.preventDefault(),S.currentTarget.blur()),S.key==="Escape"&&(S.preventDefault(),S.currentTarget.textContent=h?.title||"",S.currentTarget.blur());},[h]),Qe=we.useCallback(()=>{h&&e&&h.description!==e.description&&a?.(h.id,{description:h.description}),f(false);},[h,e,a]),Ht=we.useCallback(S=>{if(h){let H={...h,columnId:S};g(H),a?.(h.id,{columnId:S}),E(false);}},[h,a]),Vt=we.useCallback(S=>{if(h){let H={...h,priority:S};g(H),a?.(h.id,{priority:S}),z(false);}},[h,a]),ur=we.useCallback(S=>{if(h){let H=h.assignedUserIds||[],pe=H.includes(S)?H.filter(Fe=>Fe!==S):[...H,S],Ee={...h,assignedUserIds:pe};g(Ee),a?.(h.id,{assignedUserIds:pe});}},[h,a]),zt=we.useCallback(S=>{if(h){let H=h.labels||[],pe=H.includes(S)?H.filter(Fe=>Fe!==S):[...H,S],Ee={...h,labels:pe};g(Ee),a?.(h.id,{labels:pe});}},[h,a]),V=we.useCallback(S=>{if(h){let H=S.target.value,pe={...h,endDate:H};g(pe),a?.(h.id,{endDate:H}),P(false);}},[h,a]),U=we.useCallback(S=>{if(h){let H={...h,estimatedTime:parseFloat(S)||0};g(H),a?.(h.id,{estimatedTime:parseFloat(S)||0});}},[h,a]),Se=we.useCallback(()=>{if(T.trim()){let S={id:`subtask-${Date.now()}`,title:T.trim(),completed:false};k([...w,S]),D(""),C(false);}},[T,w]),ze=we.useCallback(S=>{k(w.map(H=>H.id===S?{...H,completed:!H.completed}:H));},[w]),Ne=we.useCallback(S=>{k(w.filter(H=>H.id!==S));},[w]),de=we.useCallback(()=>{R.trim()&&h&&d&&(d(h.id,R.trim()),_(""));},[R,h,d]),ue=we.useCallback(S=>{(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),de());},[de]),Ve=S=>jsxRuntime.jsx(Ap__default.default,{remarkPlugins:[Lp__default.default],rehypePlugins:[Fp__default.default],components:{a:({node:H,...pe})=>jsxRuntime.jsx("a",{...pe,target:"_blank",rel:"noopener noreferrer"})},children:S}),le=c.filter(S=>G==="comments"?S.type.includes("COMMENT"):G==="history"?!S.type.includes("COMMENT"):true);if(!t||!e)return null;let be=h||e,j=o.filter(S=>be.assignedUserIds?.includes(S.id)),ye=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:pt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ne,onKeyDown:se,children:be.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"})]})})]}),be.coverImage&&jsxRuntime.jsx("div",{className:"modal-v2-cover",children:jsxRuntime.jsx("img",{src:be.coverImage,alt:`Cover for ${be.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:ie,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:be.columnId||"No status"})]}),O&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(b.length>0?b:Op.map(S=>({id:S,title:S}))).map(S=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${be.columnId===S.id?"active":""}`,onClick:()=>Ht(S.id),children:S.title},S.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:vt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>A(!$),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"})})]}),$&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:o.map(S=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${be.assignedUserIds?.includes(S.id)?"active":""}`,onClick:()=>ur(S.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:S.color},children:S.initials}),S.name,be.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:mt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>z(!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:be.priority||"None"})]}),B&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[Bp.map(S=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${S.toLowerCase()} ${be.priority===S?"active":""}`,onClick:()=>Vt(S),children:S},S)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Vt(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ot,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>X(!ee),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:be.labels&&be.labels.length>0?jsxRuntime.jsx("span",{children:be.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),ee&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(y.length>0?y:["Bug","Feature","Enhancement","Documentation"]).map(S=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${be.labels?.includes(S)?"active":""}`,onClick:()=>zt(S),children:[S,be.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(!fe),setTimeout(()=>ar.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:be.endDate?new Date(be.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ar,type:"date",value:typeof be.endDate=="string"?be.endDate.split("T")[0]:be.endDate?(()=>{let S=new Date(be.endDate),H=S.getUTCFullYear(),pe=String(S.getUTCMonth()+1).padStart(2,"0"),Ee=String(S.getUTCDate()).padStart(2,"0");return `${H}-${pe}-${Ee}`})():"",onChange:V,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ae(!ge),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:be.estimatedTime?`${be.estimatedTime}h`:"Not set"})]}),ge&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:be.estimatedTime||"",onChange:S=>U(S.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ae(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"]})]}),v?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:be.description||"",onChange:S=>{if(h){let H={...h,description:S.target.value};g(H);}},onBlur:Qe,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>f(true),children:be.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Ve(be.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:[ye,"/",w.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>C(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:()=>ze(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:()=>Ne(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)),x&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:T,onChange:S=>D(S.target.value),onKeyDown:S=>{S.key==="Enter"&&Se(),S.key==="Escape"&&(C(false),D(""));},onBlur:Se,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 ${G==="all"?"active":""}`,onClick:()=>M("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${G==="comments"?"active":""}`,onClick:()=>M("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${G==="history"?"active":""}`,onClick:()=>M("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:Bt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:R,onChange:S=>_(S.target.value),onKeyDown:ue,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:de,disabled:!R.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[le.map(S=>{let H=o.find(Ee=>Ee.id===S.userId);if(S.type.includes("COMMENT")){let Ee=s.find(Fe=>Fe.id===S.metadata?.commentId);return Ee?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:Ee.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)}),le.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 Kp({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(s=>({...s,average:s.average??e.reduce((c,d)=>c+d.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(Kp,{})}),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,c)=>s+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((s,c)=>s+c.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,c)=>s+(c.planned||0),0)})]})]})]})}function tm({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),s=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,d=o>0?(o-s)/o*100:0,i=s<=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(tm,{})}),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:d>=50?"#10B981":"#F59E0B"},children:[d.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 dm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},gl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function um({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:o}){let s=a+(n-a)*.5,c=e+s*Math.cos(-r*(Math.PI/180)),d=t+s*Math.sin(-r*(Math.PI/180));return o<.05?null:jsxRuntime.jsx("text",{x:c,y:d,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((d,i)=>d+i.value,0),s=e.map(d=>({...d,totalValue:o,color:d.color||dm[d.name]||gl[e.indexOf(d)%gl.length]})),c=s.map(d=>d.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?um:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:s.map((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(hl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(d,i)=>{let u=i.payload,l=o>0?(u.value/o*100).toFixed(0):"0";return `${d} (${u.value} - ${l}%)`}})]}):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(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:s.map((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[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((d,i)=>i.value>d.value?i:d).name})]})]})]})}var wn=we.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:o=[]})=>{let[s,c]=we.useState(false),[d,i]=we.useState(false),[u,l]=we.useState(false),[p,m]=we.useState(false);if(e.length===0)return null;let b=e.map(w=>w.id),y=w=>{a.onBulkUpdate?.(b,{priority:w}),c(false);},h=w=>{a.onBulkMove?.(b,w),i(false),r();},g=w=>{a.onBulkUpdate?.(b,{assignedUserIds:w}),l(false);},v=w=>{let k=new Set;e.forEach(C=>{C.labels?.forEach(T=>k.add(T));});let x=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(b,{labels:x}),m(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(b),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(!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:()=>y(w),children:[jsxRuntime.jsx("span",{className:re("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(!d),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(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:()=>l(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(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:()=>v([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 hm(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let o,s,c,d,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let b=r?.find(y=>y.id===m);s=`assignee-${m}`,c=b?.name||`User ${m}`,d=b?.color,i=b?.avatar,a.has(s)||a.set(s,{id:s,title:c,groupValue:m,cardIds:[],color:d,icon:i}),a.get(s).cardIds.push(n.id);}):(s="assignee-unassigned",c="Unassigned",d="#6b7280",i="\u{1F464}",a.has(s)||a.set(s,{id:s,title:c,groupValue:null,cardIds:[],color:d,icon:i}),a.get(s).cardIds.push(n.id));break;case "priority":o=n.priority||"NONE",s=`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,d=p.color,a.has(s)||a.set(s,{id:s,title:c,groupValue:o,cardIds:[],color:d}),a.get(s).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{s=`label-${m}`,c=m,d="#6b7280",a.has(s)||a.set(s,{id:s,title:c,groupValue:m,cardIds:[],color:d}),a.get(s).cardIds.push(n.id);}):(s="label-none",c="No Labels",d="#6b7280",a.has(s)||a.set(s,{id:s,title:c,groupValue:null,cardIds:[],color:d}),a.get(s).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,s]=we.useState(new Set),c=we.useMemo(()=>hm(e.cards,t.groupBy,r),[e.cards,t.groupBy,r]),d=we.useCallback(i=>{s(u=>{let l=new Set(u);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Dr,{board:e,callbacks:a,availableUsers:r,className:n}):jsxRuntime.jsxs("div",{className:re("asakaa-swimlane-view",n),children:[c.map(i=>{let u=o.has(i.id),l=e.cards.filter(m=>i.cardIds.includes(m.id)),p={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&d(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(Dr,{board:p,callbacks:a,availableUsers:r})})]},i.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]=we.useState(false),o=we.useRef(null),s=we.useRef(null),c=Lo.find(i=>i.value===e)||Lo[0];we.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 d=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{className:re("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:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:re("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(i=>jsxRuntime.jsxs("button",{onClick:()=>d(i.value),className:re("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 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 ym(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,c=n.alt?e.altKey:!e.altKey,d=n.meta?e.metaKey:true;return o&&s&&c&&d}function kl(e={}){let{shortcuts:t=Fa,enabled:r=true,preventDefault:a=true}=e,n=we.useRef(t),o=we.useRef(r);we.useEffect(()=>{n.current=t,o.current=r;},[t,r]);let s=we.useCallback(d=>{n.current=[...n.current,d];},[]),c=we.useCallback(d=>{n.current=n.current.filter(i=>i.action!==d);},[]);return we.useEffect(()=>{function d(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 l of n.current)if(ym(i,l)){a&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[a]),{registerShortcut:s,unregisterShortcut:c,isEnabled:r}}function km(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function wm(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=wm(e),a=t?km(t):"";return r?`${r} + ${a}`:a}function Tm(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]=we.useState(false);if(we.useEffect(()=>{o(true);},[]),we.useEffect(()=>{function c(d){d.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r]),!n||!t)return null;let s=Tm(e);return jsxRuntime.jsxs("div",{className:re("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(([c,d])=>d.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:d.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))})]},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,7 +42,7 @@
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function zo({templates:e,onSelectTemplate:t,className:r}){let[a,n]=we.useState(false),o=we.useRef(null),s=we.useRef(null);we.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);},d=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxRuntime.jsxs("div",{className:re("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:re("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(d).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function _o({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,c]=we.useState("export"),[d,i]=we.useState("json"),[u,l]=we.useState(null),p=we.useRef(null);if(!t)return null;let m=async()=>{let y=n?.current||void 0,h=await Zs(e,d,y);Qs(h,d);},b=async y=>{let h=y.target.files?.[0];if(h){try{let g=await ri(h),v=h.name.endsWith(".json")?"json":"csv",f=ti(g,v);l(f),f.success&&a&&a(f,g);}catch(g){l({success:false,errors:[`Failed to read file: ${g instanceof Error?g.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:re("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:re("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:()=>c("import"),className:re("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(y=>jsxRuntime.jsxs("button",{onClick:()=>i(y),className:re("p-4 rounded-lg border-2 transition-all text-center",d===y?"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:[y==="json"&&"\u{1F4C4}",y==="csv"&&"\u{1F4CA}",y==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:y})]},y))})]}),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"})]}),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:p,type:"file",accept:".json,.csv",onChange:b,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:re("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:re("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((y,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",y]},h))})]})]})]})]})]})}var Rm=["URGENT","HIGH","MEDIUM","LOW"],Pm=[{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"}],Im=[{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:c,availableUsers:d=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:p=false,groupBy:m="none",onGroupByChange:b}){let[y,h]=we.useState(true),g=we.useCallback(x=>{r({search:x.target.value});},[r]),v=we.useCallback(x=>{r({dateFilter:x.target.value});},[r]),f=we.useCallback(x=>{a({by:x.target.value});},[a]),w=we.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":""} ${y?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!y),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:y?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:x=>{x.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:y?"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)"]})]}),!y&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),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"}),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:v,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:x=>{let C=x.target.value;r({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Rm.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:x=>{let C=x.target.value;r({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),d.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.name},x.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:x=>{let C=x.target.value;r({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),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:Pm.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.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"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:m,onChange:x=>b(x.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Im.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.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:c,onExportGanttCSV:d}){let[i,u]=we.useState(false),l=we.useRef(null);we.useEffect(()=>{let m=b=>{l.current&&!l.current.contains(b.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let p=m=>{m(),u(false);};return jsxRuntime.jsxs("div",{className:re("relative",a),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":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:()=>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 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: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(()=>d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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=we.createContext(void 0),Um="asakaa-theme";function Tl({children:e,defaultTheme:t=Tn,storageKey:r=Um}){let[a,n]=we.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),o=we.useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);we.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,d=Hr[a];Object.entries(d.colors).forEach(([u,l])=>{l&&c.style.setProperty(`--theme-${Wm(u)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,l])=>{let p=d.colors[u];p&&c.style.setProperty(l,p);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:Hr};return jsxRuntime.jsx(Sn.Provider,{value:s,children:e})}function ia(){let e=we.useContext(Sn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Wm(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:re("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:re("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 ke={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 ke[e]||ke.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",ke[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ke[e].bgSecondary),bgGrid:a("--theme-bg-card",ke[e].bgGrid),bgWeekend:a("--theme-bg-hover",ke[e].bgWeekend),border:a("--theme-border-primary",ke[e].border),borderLight:a("--theme-border-subtle",ke[e].borderLight),textPrimary:a("--theme-text-primary",ke[e].textPrimary),textSecondary:a("--theme-text-secondary",ke[e].textSecondary),textTertiary:a("--theme-text-tertiary",ke[e].textTertiary),accent:a("--theme-accent-primary",ke[e].accent),accentHover:a("--theme-accent-hover",ke[e].accentHover),accentLight:a("--theme-accent-primary",ke[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ke[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ke[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ke[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ke[e].dependency),dependencyHover:a("--theme-border-secondary",ke[e].dependencyHover),criticalPath:a("--theme-error",ke[e].criticalPath),criticalPathLight:a("--theme-error",ke[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ke[e].today):e==="neutral"?a("--theme-text-primary",ke[e].today):a("--theme-error",ke[e].today),todayLight:e==="light"?a("--theme-accent-primary",ke[e].todayLight):e==="neutral"?a("--theme-text-primary",ke[e].todayLight):a("--theme-error",ke[e].todayLight),milestone:a("--theme-warning",ke[e].milestone),milestoneLight:a("--theme-warning",ke[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ke[e].statusTodo),statusInProgress:a("--theme-accent-primary",ke[e].statusInProgress),statusCompleted:a("--theme-success",ke[e].statusCompleted),hoverBg:a("--theme-bg-hover",ke[e].hoverBg),focusRing:a("--theme-accent-primary",ke[e].focusRing)}}function nf({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:o,onExportMSProject:s}){let[c,d]=we.useState(false),[i,u]=we.useState(null),l=we.useRef(null);if(we.useEffect(()=>{let y=h=>{l.current&&!l.current.contains(h.target)&&d(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||r||a||n||o||s))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:s}].filter(y=>y.handler),b=async(y,h)=>{if(h){u(y);try{await h();}catch(g){console.error(`Export ${y} failed:`,g);}finally{u(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!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((y,h)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(y.id,y.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:h<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===y.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"})}):y.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:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.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:s,rowDensity:c,onRowDensityChange:d,showThemeSelector:i=true,showCreateTaskButton:u=false,createTaskLabel:l="Crear tarea",onCreateTask:p,onExportPNG:m,onExportPDF:b,onExportExcel:y,onExportCSV:h,onExportJSON:g,onExportMSProject:v}){let f=m||b||y||h||g||v,w=[{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"})}],k=[{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"})}],x=[{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:w,value:t,onChange:C=>r(C),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:x,value:c,onChange:C=>d(C),theme:e})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(16, 185, 129, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(16, 185, 129, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l})]}),(f||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nf,{theme:e,onExportPNG:m,onExportPDF:b,onExportExcel:y,onExportCSV:h,onExportJSON:g,onExportMSProject:v}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(qo,{options:k,value:o,onChange:C=>s(C),theme:e})]})]})}function Nn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=we.useState(false),[o,s]=we.useState({x:0,y:0}),c=we.useRef(null),d=we.useRef(null);we.useEffect(()=>{if(!a)return;let u=l=>{c.current&&!c.current.contains(l.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:d,onClick:()=>{if(!a&&d.current){let u=d.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: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"}),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:l=>{l.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function ca({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=we.useRef(null);return we.useEffect(()=>{if(!e)return;let c=i=>{s.current&&!s.current.contains(i.target)&&n();},d=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[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(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:d=>{c.disabled||(d.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:d=>{d.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 Ll({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:c,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:p=true}){let m=we.useRef(false),b=we.useCallback(f=>{m.current=f;},[]),y=we.useCallback(f=>{let w=[],k=x=>{for(let C of x)w.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&k(C.subtasks);};return k(f),w},[]),h=we.useCallback(()=>{let f=y(e);for(let w of f)if(t.has(w.id))return w;return null},[e,t,y]),g=we.useCallback((f,w)=>{let k=y(e);if(k.length===0)return;let x=h();if(!x){r(k[0].id,false);return}let C=k.findIndex(R=>R.id===x.id);if(C===-1)return;let T=f==="up"?C-1:C+1;if(T<0||T>=k.length)return;let D=k[T];r(D.id,w);},[e,h,y,r]),v=we.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 C=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,T=Array.from(t),D=h();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")){T.length>0&&(f.preventDefault(),s(T,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){T.length>0&&(f.preventDefault(),c(T));return}if(f.key==="Tab"&&f.shiftKey){T.length>0&&(f.preventDefault(),d(T));return}if(f.key==="Enter"&&!f.shiftKey&&!C){D&&(f.preventDefault(),a(D.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!C){D&&(f.preventDefault(),a(D.id,"above"));return}if(f.key==="Enter"&&C){D&&(f.preventDefault(),l(D.id));return}if(f.key==="F2"){D&&(f.preventDefault(),i(D.id));return}if(f.key==="Delete"||f.key==="Backspace"&&C){T.length>0&&(f.preventDefault(),n(T));return}if(f.key==="d"&&C&&!f.shiftKey){T.length>0&&(f.preventDefault(),o(T));return}},[p,t,h,g,a,n,o,s,c,d,i,u,l]);return we.useEffect(()=>{if(p)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[p,v]),{setIsEditing:b}}function Bl(){let[e,t]=we.useState(new Set),[r,a]=we.useState(null),n=we.useCallback(l=>{t(new Set([l])),a(l);},[]),o=we.useCallback(l=>{t(p=>{let m=new Set(p);return m.has(l)?m.delete(l):m.add(l),m}),a(l);},[]),s=we.useCallback((l,p)=>{if(!r){n(l);return}let m=p.indexOf(r),b=p.indexOf(l);if(m===-1||b===-1){n(l);return}let y=Math.min(m,b),h=Math.max(m,b),g=p.slice(y,h+1);t(new Set(g)),a(l);},[r,n]),c=we.useCallback((l,p,m,b)=>{b?s(l,p):m?o(l):n(l);},[n,o,s]),d=we.useCallback((l,p)=>{p?t(m=>{let b=new Set(m);return b.add(l),b}):n(l);},[n]),i=we.useCallback(()=>{t(new Set),a(null);},[]),u=we.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:c,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:u}}function da(e){let t=[],r=(a,n,o=0)=>{for(let s=0;s<a.length;s++){let c={...a[s],parentId:n,level:o,position:s};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(l=>l.id===a);if(n<=0)return e;let o=r[n-1],s=(l,p)=>{let m=[];return {tasks:l.filter(y=>{if(p.has(y.id))return m.push(y),false;if(y.subtasks){let h=s(y.subtasks,p);y.subtasks=h.tasks,m.push(...h.removed);}return true}),removed:m}},c=(l,p,m)=>l.map(b=>b.id===p?{...b,subtasks:[...b.subtasks||[],...m],isExpanded:true}:b.subtasks?{...b,subtasks:c(b.subtasks,p,m)}:b),d=new Set(t),{tasks:i,removed:u}=s(e,d);return c(i,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),s=(i,u,l)=>{for(let p=0;p<i.length;p++){let m=i[p];if(m.id===u&&m.subtasks){let b=m.subtasks.findIndex(y=>y.id===l);if(b!==-1){let[y]=m.subtasks.splice(b,1);return y}}if(m.subtasks){let b=s(m.subtasks,u,l);if(b)return b}}return null},c=(i,u,l)=>{let p=i.findIndex(m=>m.id===u);if(p!==-1)return i.splice(p+1,0,l),i;for(let m of i)m.subtasks&&c(m.subtasks,u,l);return i},d=s(r,n.id,a);d&&(o&&o.subtasks?c(o.subtasks,n.id,d):c(r,n.id,d));}return r}function es(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,c,d)=>{let i=s.findIndex(l=>l.id===c);if(i===-1){for(let l of s)if(l.subtasks&&o(l.subtasks,c,d))return true;return false}let u=d==="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 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=s=>{let c=s.findIndex(u=>u.id===a);if(c===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let d=s[c],i={...d,id:`${d.id}-copy-${Date.now()}`,name:`${d.name} (Copy)`,subtasks:d.subtasks?o(d.subtasks):void 0};return s.splice(c+1,0,i),true},o=s=>s.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?o(c.subtasks):void 0}));n(r);}return r}function Ol(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"},c=d=>{let i=d.findIndex(l=>l.id===t);if(i===-1){for(let l of d)if(l.subtasks&&c(l.subtasks))return true;return false}let u=r==="above"?i:i+1;return d.splice(u,0,s),true};return c(a),{tasks:a,newTask:s}}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=d=>{for(let i of d){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"},c=d=>d.map(i=>{if(i.id===t){let u=i.subtasks||[];return {...i,subtasks:[...u,s],isExpanded:true}}return i.subtasks?{...i,subtasks:c(i.subtasks)}:i});return {tasks:c(e),newTask:s}}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"}},Ul=({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 Wl({status:e="todo",onChange:t,className:r}){let[a,n]=we.useState(false),[o,s]=we.useState({top:0,left:0}),c=we.useRef(null),d=we.useRef(null);we.useEffect(()=>{if(a&&d.current){let p=d.current.getBoundingClientRect();s({top:p.bottom+window.scrollY+8,left:p.left+window.scrollX});}},[a]),we.useEffect(()=>{let p=m=>{c.current&&!c.current.contains(m.target)&&!d.current?.contains(m.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),we.useEffect(()=>{let p=m=>{m.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let i=p=>{t(p),n(false);},u=_l[e],l=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:d,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:`${l}10`,boxShadow:`0 0 0 2px ${l}30 inset`},title:u.label,children:jsxRuntime.jsx(Ul,{icon:u.icon,color:l})}),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:()=>i(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:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ul,{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:s,onTaskContextMenu:c,onTaskToggle:d,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:p,onTaskUpdate:m,onTaskIndent:b,onTaskOutdent:y,onTaskMove:h,onMultiTaskDelete:g,onTaskDuplicate:v,onTaskCreate:f,onTaskRename:w,onCreateSubtask:k,onOpenTaskModal:x}){let[C,T]=we.useState(null),[D,R]=we.useState(false),[_,G]=we.useState(null),[M,O]=we.useState(""),E=we.useRef(null),B=we.useRef(null),[z,$]=we.useState(null),[A,te]=we.useState(0),[X,fe]=we.useState(0),[P,ge]=we.useState({isOpen:false,x:0,y:0,type:"header"});we.useEffect(()=>{function V(U){E.current&&!E.current.contains(U.target)&&R(false);}if(D)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[D]),we.useEffect(()=>{_&&B.current&&(B.current.focus(),B.current.select());},[_]),we.useEffect(()=>{if(!z)return;let V=Se=>{let ze=Se.clientX-A,Ne=X+ze;p?.(z,Ne);},U=()=>{$(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",U),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",U),document.body.style.cursor="",document.body.style.userSelect="";}},[z,A,X,p]);let{selectedTaskIds:ae,handleTaskClick:pt,isTaskSelected:ct}=Bl(),{setIsEditing:Bt}=Ll({tasks:e,selectedTaskIds:ae,onTaskSelect:(V,U)=>{let ze=da(e).map(Ne=>Ne.id);pt(V,ze,U||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:V=>{let U=da(e).find(Se=>Se.id===V);U&&ar(U);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:V=>{let U=da(e).find(Se=>Se.id===V);U&&x&&x(U);},enableKeyboard:true}),ie=(V,U=0)=>{let Se=[];for(let ze of V)Se.push({task:ze,level:U}),ze.subtasks&&ze.subtasks.length>0&&ze.isExpanded&&Se.push(...ie(ze.subtasks,U+1));return Se},mt=ie(e),vt=48,Ot=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,ar=V=>{G(V.id),O(V.name),Bt(true);},ne=V=>{M.trim()&&M!==e.find(U=>U.id===V)?.name&&w?.(V,M.trim()),G(null),O(""),Bt(false);},se=()=>{G(null),O(""),Bt(false);},Qe=(V,U)=>{U.stopPropagation(),k?.(V.id);},Ht=(V,U,Se)=>{switch(V.id){case "name":let ze=_===U.id,Ne=C===U.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Se*20}px`},children:[U.subtasks&&U.subtasks.length>0?jsxRuntime.jsx("button",{onClick:le=>{le.stopPropagation(),d?.(U.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:U.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:U.color||"#6366F1",opacity:U.parentId?.6:1,borderColor:U.isMilestone?t.accent:"transparent",borderWidth:U.isMilestone?"2px":"0px"},title:U.isMilestone?"Milestone":U.parentId?"Subtask":"Task"}),ze?jsxRuntime.jsx("input",{ref:B,type:"text",value:M,onChange:le=>O(le.target.value),onKeyDown:le=>{le.key==="Enter"?ne(U.id):le.key==="Escape"&&se();},onBlur:()=>ne(U.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:le=>le.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Se===0?"14px":Se===1?"13px":"12px",fontWeight:U.isMilestone?600:U.subtasks&&U.subtasks.length>0?500:400,opacity:Se===0?1:Se===1?.95:.88},title:U.name,children:U.name}),Ne&&!ze&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:le=>le.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:le=>Qe(U,le),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:le=>{le.stopPropagation(),ar(U);},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 de=U.startDate?typeof U.startDate=="string"?U.startDate:U.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:de||"",onChange:le=>{m?.(U.id,{startDate:le.target.value?new Date(le.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 ue=U.endDate?typeof U.endDate=="string"?U.endDate:U.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ue||"",onChange:le=>{m?.(U.id,{endDate:le.target.value?new Date(le.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:Ot(U)})});case "assignees":let Ve=a.filter(le=>U.assignees?.some(be=>be.name===le.name||be.initials===le.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx(Ur,{assignedUsers:Ve,availableUsers:a,onChange:le=>{let be=le.map(j=>({id:j.id,name:j.name,initials:j.initials,color:j.color}));m?.(U.id,{assignees:be.length>0?be:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx(Wl,{status:U.status||"todo",onChange:le=>{m?.(U.id,{status:le,progress:le==="completed"?100:U.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:`${U.progress}%`,backgroundColor:U.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:[U.progress,"%"]})]});default:return null}},Vt=V=>[{id:"hide",label:"Hide Column",icon:Pt.Hide,onClick:()=>l(V),disabled:V==="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:()=>{}}],ur=V=>[{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:V.status==="completed"?"Mark Incomplete":"Mark Complete",icon:Pt.Progress,onClick:()=>{let U=V.status==="completed"?"in-progress":"completed",Se=V.status==="completed"?V.progress:100;m?.(V.id,{status:U,progress:Se});}},{id:"setInProgress",label:"Set In Progress",icon:Pt.Progress,onClick:()=>{m?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"delete",label:"Delete Task",icon:Pt.Delete,onClick:()=>{window.confirm(`Delete task "${V.name}"?`)&&g?.([V.id]);}}],zt=u.filter(V=>V.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:`${vt}px`,marginLeft:"3px"},children:[zt.map(V=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative ${V.id==="name"?"justify-start":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.width}px`,maxWidth:`${V.width}px`,borderColor:t.borderLight,height:"100%",boxSizing:"border-box"},onContextMenu:U=>{U.preventDefault(),ge({isOpen:true,x:U.clientX,y:U.clientY,type:"header",columnId:V.id});},onMouseEnter:U=>{U.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:U=>{U.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:V.label}),V.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:z===V.id?t.accent:"transparent"},onMouseDown:U=>{U.preventDefault(),U.stopPropagation(),$(V.id),te(U.clientX),fe(V.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}})})]},V.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(Nn,{columns:u,onToggleColumn:l,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:V=>V.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:mt.map(({task:V,level:U},Se)=>{let ze=ct(V.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center border-b cursor-pointer group",style:{height:`${r}px`,borderTop:`1px solid ${ze?t.accent:t.borderLight}`,borderRight:`1px solid ${ze?t.accent:t.borderLight}`,borderBottom:`1px solid ${ze?t.accent:t.borderLight}`,borderLeft:ze?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ze?t.accentLight:Se%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>T(V.id),onMouseLeave:()=>T(null),onClick:Ne=>{let ue=da(e).map(be=>be.id),le=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ne.metaKey:Ne.ctrlKey;pt(V.id,ue,le,Ne.shiftKey),o?.(V);},onDoubleClick:Ne=>{Ne.stopPropagation(),s?.(V);},onContextMenu:Ne=>{Ne.preventDefault(),ge({isOpen:true,x:Ne.clientX,y:Ne.clientY,type:"task",task:V}),c?.(V,Ne);},whileHover:{backgroundColor:ze?t.accentLight:t.hoverBg},children:zt.map(Ne=>jsxRuntime.jsx("div",{className:`px-4 border-r flex items-center ${Ne.id==="name"?"justify-start":"justify-center"}`,style:{width:`${Ne.width}px`,minWidth:`${Ne.width}px`,maxWidth:`${Ne.width}px`,borderColor:C===V.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:Ht(Ne,V,Ne.id==="name"?U:0)},`${V.id}-${Ne.id}`))},V.id)})}),jsxRuntime.jsx(ca,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?Vt(P.columnId):P.type==="task"&&P.task?ur(P.task):[],onClose:()=>ge({...P,isOpen:false}),theme:t})]})}function Hl(e,t){let[r,a]=we.useState("none"),[n,o]=we.useState(0),[s,c]=we.useState(e),[d,i]=we.useState(t),[u,l]=we.useState(null),[p,m]=we.useState(null),[b,y]=we.useState(null),[h,g]=we.useState(null),[v,f]=we.useState(0),[w,k]=we.useState(0),[x,C]=we.useState(null),[T,D]=we.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:c,ghostWidth:d,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:p,setHoveredTaskId:m,activeZone:b,setActiveZone:y,draggedSegmentIndex:h,setDraggedSegmentIndex:g,draggedSegmentStartX:v,setDraggedSegmentStartX:f,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:x,setHoveredSegmentIndex:C,isHovered:T,setIsHovered:D,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(O,E)=>{a("none"),l(null),m(null),c(O),i(E),k(0),g(null),f(0);}}}function Pn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:c,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:p,allTaskPositions:m=[],onDragMove:b}){let y=Hl(t,a),h=we.useRef(null),{dragMode:g,setDragMode:v,dragOffset:f,setDragOffset:w,ghostX:k,setGhostX:x,ghostWidth:C,setGhostWidth:T,connectionLine:D,setConnectionLine:R,hoveredTaskId:_,setHoveredTaskId:G,activeZone:M,setActiveZone:O,draggedSegmentIndex:E,setDraggedSegmentIndex:B,draggedSegmentStartX:z,setDraggedSegmentStartX:$,segmentDragOffsetX:A,setSegmentDragOffsetX:te,hoveredSegmentIndex:X,setHoveredSegmentIndex:fe,isHovered:P,setIsHovered:ge,isDragging:ae,isResizing:pt,isConnecting:ct,resetDragState:Bt}=y,ie=32,mt=8,vt=e.endDate&&e.endDate<new Date&&e.progress<100,Ot=e.isCriticalPath,ar=n.name==="neutral"||n.today==="#1C1917",se=(j=>j>=80?20:j>=60?15:j>=50?12:10)(a),Qe=a<50,Ht=a<40,Vt=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ur=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},zt=j=>Math.round(j/o)*o,V=j=>{let ye=Math.round(j/o),S=new Date(s);return S.setDate(S.getDate()+ye),S},U=(j,ye)=>{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&&ye>=S.y-H&&ye<=S.y+S.height+H)return S.id}return null},Se=we.useCallback((j,ye,S)=>{j.preventDefault(),j.stopPropagation();let H=h.current?.ownerSVGElement;if(!H)return;let pe=H.createSVGPoint();pe.x=j.clientX,pe.y=j.clientY;let Ee=pe.matrixTransform(H.getScreenCTM()?.inverse()),Fe=S!==void 0?S:t,We=ye;if(!We){let Mt=Ee.x-Fe;j.shiftKey?(We="connect",R({x:t+a,y:r+ie/2})):j.ctrlKey||j.metaKey?We="move":j.altKey?We=Mt<a/2?"resize-start":"resize-end":Ht?Mt<a/2?We="move":We="resize-end":Qe?Mt<=se/2?We="resize-start":Mt>=a-se/2?We="resize-end":We="move":Mt<=se?We="resize-start":Mt>=a-se?We="resize-end":We="move";}v(We),ge(false),O(null),We==="move"?w(Ee.x-Fe):We==="connect"?R({x:t+a,y:r+ie/2}):w(0),x(Fe),T(a);},[t,a,r,ie]),ze=we.useCallback(j=>{if(g==="none")return;let ye=h.current?.ownerSVGElement;if(!ye)return;let S=ye.createSVGPoint();S.x=j.clientX,S.y=j.clientY;let H=S.matrixTransform(ye.getScreenCTM()?.inverse());if(g==="connect"){R({x:H.x,y:H.y});let pe=U(H.x,H.y);G(pe);}else if(g==="move"){let pe=H.x-f,Ee=zt(pe);x(Ee),T(a);let Fe=Math.round((Ee-t)/o);if(b?.(e.id,Fe,true),e.segments&&e.segments.length>0&&E!==null){let We=Ee-z;te(We);}}else if(g==="resize-start"){let pe=H.x,Ee=zt(pe),Fe=t+a-Ee;Fe>=o&&(x(Ee),T(Fe));}else if(g==="resize-end"){let pe=H.x,Fe=zt(pe)-t;Fe>=o&&T(Fe);}},[g,t,a,o,f,e,zt,E,z,U,G,R,x,T,te,b]),Ne=we.useCallback(()=>{if(g!=="none"){if(g==="connect")_&&p&&p(e,_),R(null),G(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),ye,S,H=true;if(g==="move"){if(ye=V(k),S=new Date(ye.getTime()+j),e.segments&&e.segments.length>0&&E!==null){let pe=Math.round(A/o),Ee=e.segments.map(($t,qn)=>{if(qn===E){let ga=new Date($t.startDate),ha=new Date($t.endDate);return ga.setDate(ga.getDate()+pe),ha.setDate(ha.getDate()+pe),{startDate:ga,endDate:ha}}return $t}),Fe=Ee.flatMap($t=>[$t.startDate,$t.endDate]),We=new Date(Math.min(...Fe.map($t=>$t.getTime()))),Mt=new Date(Math.max(...Fe.map($t=>$t.getTime())));l?.({...e,segments:Ee},We,Mt),Bt(t,a);return}}else g==="resize-start"?(ye=V(k),S=e.endDate,ye>=S&&(console.warn("Invalid date range: start date must be before end date"),H=false)):g==="resize-end"?(ye=e.startDate,S=V(k+C),S<=ye&&(console.warn("Invalid date range: end date must be after start date"),H=false)):H=false;H&&ye&&S&&(S.getTime()-ye.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,ye,S));}b?.(e.id,0,false),Bt(t,a);}},[g,k,C,e,l,_,p,t,a,o,V,A,E,Bt,b]);we.useEffect(()=>{if(g==="none")return;let j=S=>{ze(S);},ye=()=>{Ne();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",ye),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",ye);}},[g,ze,Ne]);let de=ae&&!ct?k:t,ue=ae&&!ct?C:a,Ve=c.taskTooltip(e),le=typeof Ve=="string"?Ve:"",be=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!ae&&ge(true),onMouseLeave:()=>{ae||(ge(false),O(null));},onClick:()=>!ae&&d?.(e),onDoubleClick:j=>{ae||(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},children:[le&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:le}}),P&&!ae&&!Qe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:se,height:ie,fill:M==="resize-start"?n.accent:"transparent",opacity:M==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-start"),onMouseDown:j=>Se(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+se,y:r,width:a-se*2,height:ie,fill:M==="move"?n.accent:"transparent",opacity:M==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:j=>Se(j,"move")}),jsxRuntime.jsx("rect",{x:t+a-se,y:r,width:se,height:ie,fill:M==="resize-end"?n.accent:"transparent",opacity:M==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:j=>Se(j,"resize-end")})]}),P&&!ae&&Ht&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:ie,fill:M==="move"?n.accent:"transparent",opacity:M==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:j=>Se(j,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:ie,fill:M==="resize-end"?n.accent:"transparent",opacity:M==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:j=>Se(j,"resize-end")}),P&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+ie-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ae&&!ct&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:r,width:C,height:ie,rx:mt,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:de,y:r,width:ue,height:ie,rx:mt,fill:e.isCriticalPath||vt?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":be,initial:{opacity:0,scale:.95},animate:{opacity:ae&&!ct?.15:e.parentId?.6:P?.9:.8,scale:P&&!ae?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>Se(j),style:{cursor:ae?ct?"crosshair":pt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:de,y:r,width:ue*(e.progress/100),height:ie,rx:mt,fill:e.isCriticalPath||vt?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((j,ye)=>{let S=(j.startDate.getTime()-s.getTime())/864e5*o,pe=(j.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-S+o,Ee=ae&&g==="move"&&E===ye,Fe=X===ye,We=Ee?S+A:S;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ae&&fe(ye),onMouseLeave:()=>!ae&&fe(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:We,y:r,width:pe,height:ie,rx:mt,fill:e.isCriticalPath||vt?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:Ee||e.parentId?.6:Fe?.9:.8,scale:Fe&&!ae?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Mt=>{Mt.stopPropagation(),B(ye),$(S),Se(Mt,void 0,S);},style:{cursor:ae?ct?"crosshair":pt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:We,y:r,width:pe*(e.progress/100),height:ie,rx:mt,fill:e.isCriticalPath||vt?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ye}`)}),ar&&(vt||Ot)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ot&&!vt&&jsxRuntime.jsx("rect",{x:de,y:r,width:ue,height:ie,rx:mt,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),vt&&jsxRuntime.jsx("rect",{x:de,y:r,width:ue,height:ie,rx:mt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ue>60&&!e.segments&&(()=>{let j=c.taskLabel(e),ye=typeof j=="string"?j:e.name,S=ye.length>Math.floor(ue/8)?`${ye.substring(0,Math.floor(ue/8))}...`:ye;return jsxRuntime.jsx("text",{x:de+12,y:r+ie/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S})})(),ue>100&&e.progress>0&&e.progress<100&&!ae&&!e.segments&&jsxRuntime.jsxs("text",{x:de+ue-12,y:r+ie/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&&ue>80&&!ae&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:de+ue-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:de+ue-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(P||pt)&&!ct&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Qe?de-15:de-10,y:r-5,width:Qe?25:20,height:ie+10,fill:"transparent",onMouseDown:j=>Se(j,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe?de-8:de-3,y:r+6,width:Qe?8:6,height:Qe?ie-12:ie-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:de+ue-10,y:r-5,width:Qe?25:20,height:ie+10,fill:"transparent",onMouseDown:j=>Se(j,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe?de+ue:de+ue-3,y:r+6,width:Qe?8:6,height:Qe?ie-12:ie-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&&!ae&&!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+ie/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(),Se(j,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+ie/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ct&&D&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+ie/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||ae)&&!ct&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:de-2,y:r-2,width:ue+4,height:ie+4,rx:mt+2,fill:"none",stroke:ae?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:ae?.6:.4,initial:{opacity:0},animate:{opacity:ae?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),pt&&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+C,y1:0,x2:k+C,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!ae&&!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:de+ue/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 ${de+ue/2-6} ${r-13} L ${de+ue/2} ${r-3} L ${de+ue/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:de+ue/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:de+ue/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:de+ue/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Vt(e.startDate)}),jsxRuntime.jsx("text",{x:de+ue/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:de+ue/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Vt(e.endDate)}),jsxRuntime.jsx("text",{x:de+ue/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:de+ue/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ur()}),jsxRuntime.jsx("text",{x:de+ue/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:de+ue/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:de+ue/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:de+ue/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:de+ue/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ht?"Left: move \u2022 Right: resize":Qe?"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[s,c]=we.useState(false),d=r-e,i=a-t,u=e+d/2,l=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,p=6,m=Math.atan2(i,d),b=r-p*Math.cos(m-Math.PI/6),y=a-p*Math.sin(m-Math.PI/6),h=r-p*Math.cos(m+Math.PI/6),g=a-p*Math.sin(m+Math.PI/6),v=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:v,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 ${b} ${y} M ${r} ${a} L ${h} ${g}`,fill:"none",stroke:v,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:v,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 Ln({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=we.useState(false),c=16,d=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: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:d(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 K={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,c=new Set,d=i=>{if(!s.has(i)){s.add(i),c.add(i);let u=a.get(i)||[];for(let l of u){if(!s.has(l)&&d(l))return true;if(c.has(l))return true}}return c.delete(i),false};return d(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=K.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=K.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=K.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=K.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(`
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function zo({templates:e,onSelectTemplate:t,className:r}){let[a,n]=we.useState(false),o=we.useRef(null),s=we.useRef(null);we.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);},d=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxRuntime.jsxs("div",{className:re("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:re("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(d).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function _o({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,c]=we.useState("export"),[d,i]=we.useState("json"),[u,l]=we.useState(null),p=we.useRef(null);if(!t)return null;let m=async()=>{let y=n?.current||void 0,h=await Zs(e,d,y);Qs(h,d);},b=async y=>{let h=y.target.files?.[0];if(h){try{let g=await ri(h),v=h.name.endsWith(".json")?"json":"csv",f=ti(g,v);l(f),f.success&&a&&a(f,g);}catch(g){l({success:false,errors:[`Failed to read file: ${g instanceof Error?g.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:re("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:re("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:()=>c("import"),className:re("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(y=>jsxRuntime.jsxs("button",{onClick:()=>i(y),className:re("p-4 rounded-lg border-2 transition-all text-center",d===y?"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:[y==="json"&&"\u{1F4C4}",y==="csv"&&"\u{1F4CA}",y==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:y})]},y))})]}),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"})]}),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:p,type:"file",accept:".json,.csv",onChange:b,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:re("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:re("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((y,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",y]},h))})]})]})]})]})]})}var Rm=["URGENT","HIGH","MEDIUM","LOW"],Pm=[{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"}],Im=[{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:c,availableUsers:d=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:p=false,groupBy:m="none",onGroupByChange:b}){let[y,h]=we.useState(true),g=we.useCallback(x=>{r({search:x.target.value});},[r]),v=we.useCallback(x=>{r({dateFilter:x.target.value});},[r]),f=we.useCallback(x=>{a({by:x.target.value});},[a]),w=we.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":""} ${y?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!y),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:y?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:x=>{x.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:y?"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)"]})]}),!y&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),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"}),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:v,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:x=>{let C=x.target.value;r({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Rm.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:x=>{let C=x.target.value;r({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),d.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.name},x.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:x=>{let C=x.target.value;r({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),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:Pm.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.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"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:m,onChange:x=>b(x.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Im.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.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:c,onExportGanttCSV:d}){let[i,u]=we.useState(false),l=we.useRef(null);we.useEffect(()=>{let m=b=>{l.current&&!l.current.contains(b.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let p=m=>{m(),u(false);};return jsxRuntime.jsxs("div",{className:re("relative",a),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":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:()=>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 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: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(()=>d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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=we.createContext(void 0),Um="asakaa-theme";function Tl({children:e,defaultTheme:t=Tn,storageKey:r=Um}){let[a,n]=we.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),o=we.useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);we.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,d=Hr[a];Object.entries(d.colors).forEach(([u,l])=>{l&&c.style.setProperty(`--theme-${Wm(u)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,l])=>{let p=d.colors[u];p&&c.style.setProperty(l,p);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:Hr};return jsxRuntime.jsx(Sn.Provider,{value:s,children:e})}function ia(){let e=we.useContext(Sn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Wm(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:re("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:re("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 ke={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1C1F24",bgWeekend:"rgba(59, 130, 246, 0.02)",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:"#FDFEFE",bgWeekend:"rgba(37, 99, 235, 0.02)",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:"#FBFBFA",bgWeekend:"rgba(41, 37, 36, 0.015)",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 ke[e]||ke.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",ke[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ke[e].bgSecondary),bgGrid:a("--theme-bg-card",ke[e].bgGrid),bgWeekend:a("--theme-bg-hover",ke[e].bgWeekend),border:a("--theme-border-primary",ke[e].border),borderLight:a("--theme-border-subtle",ke[e].borderLight),textPrimary:a("--theme-text-primary",ke[e].textPrimary),textSecondary:a("--theme-text-secondary",ke[e].textSecondary),textTertiary:a("--theme-text-tertiary",ke[e].textTertiary),accent:a("--theme-accent-primary",ke[e].accent),accentHover:a("--theme-accent-hover",ke[e].accentHover),accentLight:a("--theme-accent-primary",ke[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ke[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ke[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ke[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ke[e].dependency),dependencyHover:a("--theme-border-secondary",ke[e].dependencyHover),criticalPath:a("--theme-error",ke[e].criticalPath),criticalPathLight:a("--theme-error",ke[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ke[e].today):e==="neutral"?a("--theme-text-primary",ke[e].today):a("--theme-error",ke[e].today),todayLight:e==="light"?a("--theme-accent-primary",ke[e].todayLight):e==="neutral"?a("--theme-text-primary",ke[e].todayLight):a("--theme-error",ke[e].todayLight),milestone:a("--theme-warning",ke[e].milestone),milestoneLight:a("--theme-warning",ke[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ke[e].statusTodo),statusInProgress:a("--theme-accent-primary",ke[e].statusInProgress),statusCompleted:a("--theme-success",ke[e].statusCompleted),hoverBg:a("--theme-bg-hover",ke[e].hoverBg),focusRing:a("--theme-accent-primary",ke[e].focusRing)}}function nf({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:o,onExportMSProject:s}){let[c,d]=we.useState(false),[i,u]=we.useState(null),l=we.useRef(null);if(we.useEffect(()=>{let y=h=>{l.current&&!l.current.contains(h.target)&&d(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||r||a||n||o||s))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:s}].filter(y=>y.handler),b=async(y,h)=>{if(h){u(y);try{await h();}catch(g){console.error(`Export ${y} failed:`,g);}finally{u(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!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((y,h)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(y.id,y.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:h<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===y.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"})}):y.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:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.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:s,rowDensity:c,onRowDensityChange:d,showThemeSelector:i=true,showCreateTaskButton:u=false,createTaskLabel:l="Crear tarea",onCreateTask:p,onExportPNG:m,onExportPDF:b,onExportExcel:y,onExportCSV:h,onExportJSON:g,onExportMSProject:v}){let f=m||b||y||h||g||v,w=[{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"})}],k=[{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"})}],x=[{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:w,value:t,onChange:C=>r(C),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:x,value:c,onChange:C=>d(C),theme:e})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(16, 185, 129, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(16, 185, 129, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l})]}),(f||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nf,{theme:e,onExportPNG:m,onExportPDF:b,onExportExcel:y,onExportCSV:h,onExportJSON:g,onExportMSProject:v}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(qo,{options:k,value:o,onChange:C=>s(C),theme:e})]})]})}function Nn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=we.useState(false),[o,s]=we.useState({x:0,y:0}),c=we.useRef(null),d=we.useRef(null);we.useEffect(()=>{if(!a)return;let u=l=>{c.current&&!c.current.contains(l.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:d,onClick:()=>{if(!a&&d.current){let u=d.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: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"}),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:l=>{l.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function ca({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=we.useRef(null);return we.useEffect(()=>{if(!e)return;let c=i=>{s.current&&!s.current.contains(i.target)&&n();},d=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[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(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:d=>{c.disabled||(d.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:d=>{d.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 Ll({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:c,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:p=true}){let m=we.useRef(false),b=we.useCallback(f=>{m.current=f;},[]),y=we.useCallback(f=>{let w=[],k=x=>{for(let C of x)w.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&k(C.subtasks);};return k(f),w},[]),h=we.useCallback(()=>{let f=y(e);for(let w of f)if(t.has(w.id))return w;return null},[e,t,y]),g=we.useCallback((f,w)=>{let k=y(e);if(k.length===0)return;let x=h();if(!x){r(k[0].id,false);return}let C=k.findIndex(R=>R.id===x.id);if(C===-1)return;let T=f==="up"?C-1:C+1;if(T<0||T>=k.length)return;let D=k[T];r(D.id,w);},[e,h,y,r]),v=we.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 C=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,T=Array.from(t),D=h();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")){T.length>0&&(f.preventDefault(),s(T,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){T.length>0&&(f.preventDefault(),c(T));return}if(f.key==="Tab"&&f.shiftKey){T.length>0&&(f.preventDefault(),d(T));return}if(f.key==="Enter"&&!f.shiftKey&&!C){D&&(f.preventDefault(),a(D.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!C){D&&(f.preventDefault(),a(D.id,"above"));return}if(f.key==="Enter"&&C){D&&(f.preventDefault(),l(D.id));return}if(f.key==="F2"){D&&(f.preventDefault(),i(D.id));return}if(f.key==="Delete"||f.key==="Backspace"&&C){T.length>0&&(f.preventDefault(),n(T));return}if(f.key==="d"&&C&&!f.shiftKey){T.length>0&&(f.preventDefault(),o(T));return}},[p,t,h,g,a,n,o,s,c,d,i,u,l]);return we.useEffect(()=>{if(p)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[p,v]),{setIsEditing:b}}function Bl(){let[e,t]=we.useState(new Set),[r,a]=we.useState(null),n=we.useCallback(l=>{t(new Set([l])),a(l);},[]),o=we.useCallback(l=>{t(p=>{let m=new Set(p);return m.has(l)?m.delete(l):m.add(l),m}),a(l);},[]),s=we.useCallback((l,p)=>{if(!r){n(l);return}let m=p.indexOf(r),b=p.indexOf(l);if(m===-1||b===-1){n(l);return}let y=Math.min(m,b),h=Math.max(m,b),g=p.slice(y,h+1);t(new Set(g)),a(l);},[r,n]),c=we.useCallback((l,p,m,b)=>{b?s(l,p):m?o(l):n(l);},[n,o,s]),d=we.useCallback((l,p)=>{p?t(m=>{let b=new Set(m);return b.add(l),b}):n(l);},[n]),i=we.useCallback(()=>{t(new Set),a(null);},[]),u=we.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:c,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:u}}function da(e){let t=[],r=(a,n,o=0)=>{for(let s=0;s<a.length;s++){let c={...a[s],parentId:n,level:o,position:s};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(l=>l.id===a);if(n<=0)return e;let o=r[n-1],s=(l,p)=>{let m=[];return {tasks:l.filter(y=>{if(p.has(y.id))return m.push(y),false;if(y.subtasks){let h=s(y.subtasks,p);y.subtasks=h.tasks,m.push(...h.removed);}return true}),removed:m}},c=(l,p,m)=>l.map(b=>b.id===p?{...b,subtasks:[...b.subtasks||[],...m],isExpanded:true}:b.subtasks?{...b,subtasks:c(b.subtasks,p,m)}:b),d=new Set(t),{tasks:i,removed:u}=s(e,d);return c(i,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),s=(i,u,l)=>{for(let p=0;p<i.length;p++){let m=i[p];if(m.id===u&&m.subtasks){let b=m.subtasks.findIndex(y=>y.id===l);if(b!==-1){let[y]=m.subtasks.splice(b,1);return y}}if(m.subtasks){let b=s(m.subtasks,u,l);if(b)return b}}return null},c=(i,u,l)=>{let p=i.findIndex(m=>m.id===u);if(p!==-1)return i.splice(p+1,0,l),i;for(let m of i)m.subtasks&&c(m.subtasks,u,l);return i},d=s(r,n.id,a);d&&(o&&o.subtasks?c(o.subtasks,n.id,d):c(r,n.id,d));}return r}function es(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,c,d)=>{let i=s.findIndex(l=>l.id===c);if(i===-1){for(let l of s)if(l.subtasks&&o(l.subtasks,c,d))return true;return false}let u=d==="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 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=s=>{let c=s.findIndex(u=>u.id===a);if(c===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let d=s[c],i={...d,id:`${d.id}-copy-${Date.now()}`,name:`${d.name} (Copy)`,subtasks:d.subtasks?o(d.subtasks):void 0};return s.splice(c+1,0,i),true},o=s=>s.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?o(c.subtasks):void 0}));n(r);}return r}function Ol(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"},c=d=>{let i=d.findIndex(l=>l.id===t);if(i===-1){for(let l of d)if(l.subtasks&&c(l.subtasks))return true;return false}let u=r==="above"?i:i+1;return d.splice(u,0,s),true};return c(a),{tasks:a,newTask:s}}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=d=>{for(let i of d){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"},c=d=>d.map(i=>{if(i.id===t){let u=i.subtasks||[];return {...i,subtasks:[...u,s],isExpanded:true}}return i.subtasks?{...i,subtasks:c(i.subtasks)}:i});return {tasks:c(e),newTask:s}}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"}},Ul=({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 Wl({status:e="todo",onChange:t,className:r}){let[a,n]=we.useState(false),[o,s]=we.useState({top:0,left:0}),c=we.useRef(null),d=we.useRef(null);we.useEffect(()=>{if(a&&d.current){let p=d.current.getBoundingClientRect();s({top:p.bottom+window.scrollY+8,left:p.left+window.scrollX});}},[a]),we.useEffect(()=>{let p=m=>{c.current&&!c.current.contains(m.target)&&!d.current?.contains(m.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),we.useEffect(()=>{let p=m=>{m.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let i=p=>{t(p),n(false);},u=_l[e],l=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:d,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:`${l}10`,boxShadow:`0 0 0 2px ${l}30 inset`},title:u.label,children:jsxRuntime.jsx(Ul,{icon:u.icon,color:l})}),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:()=>i(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:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ul,{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:s,onTaskContextMenu:c,onTaskToggle:d,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:p,onTaskUpdate:m,onTaskIndent:b,onTaskOutdent:y,onTaskMove:h,onMultiTaskDelete:g,onTaskDuplicate:v,onTaskCreate:f,onTaskRename:w,onCreateSubtask:k,onOpenTaskModal:x}){let[C,T]=we.useState(null),[D,R]=we.useState(false),[_,G]=we.useState(null),[M,O]=we.useState(""),E=we.useRef(null),B=we.useRef(null),[z,$]=we.useState(null),[A,ee]=we.useState(0),[X,fe]=we.useState(0),[P,ge]=we.useState({isOpen:false,x:0,y:0,type:"header"});we.useEffect(()=>{function V(U){E.current&&!E.current.contains(U.target)&&R(false);}if(D)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[D]),we.useEffect(()=>{_&&B.current&&(B.current.focus(),B.current.select());},[_]),we.useEffect(()=>{if(!z)return;let V=Se=>{let ze=Se.clientX-A,Ne=X+ze;p?.(z,Ne);},U=()=>{$(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",U),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",U),document.body.style.cursor="",document.body.style.userSelect="";}},[z,A,X,p]);let{selectedTaskIds:ae,handleTaskClick:pt,isTaskSelected:ct}=Bl(),{setIsEditing:Bt}=Ll({tasks:e,selectedTaskIds:ae,onTaskSelect:(V,U)=>{let ze=da(e).map(Ne=>Ne.id);pt(V,ze,U||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:V=>{let U=da(e).find(Se=>Se.id===V);U&&ar(U);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:V=>{let U=da(e).find(Se=>Se.id===V);U&&x&&x(U);},enableKeyboard:true}),ie=(V,U=0)=>{let Se=[];for(let ze of V)Se.push({task:ze,level:U}),ze.subtasks&&ze.subtasks.length>0&&ze.isExpanded&&Se.push(...ie(ze.subtasks,U+1));return Se},mt=ie(e),vt=48,Ot=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,ar=V=>{G(V.id),O(V.name),Bt(true);},ne=V=>{M.trim()&&M!==e.find(U=>U.id===V)?.name&&w?.(V,M.trim()),G(null),O(""),Bt(false);},se=()=>{G(null),O(""),Bt(false);},Qe=(V,U)=>{U.stopPropagation(),k?.(V.id);},Ht=(V,U,Se)=>{switch(V.id){case "name":let ze=_===U.id,Ne=C===U.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Se*20}px`},children:[U.subtasks&&U.subtasks.length>0?jsxRuntime.jsx("button",{onClick:le=>{le.stopPropagation(),d?.(U.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:U.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:U.color||"#3B82F6",opacity:U.parentId?.6:1,borderColor:U.isMilestone?t.accent:"transparent",borderWidth:U.isMilestone?"2px":"0px"},title:U.isMilestone?"Milestone":U.parentId?"Subtask":"Task"}),ze?jsxRuntime.jsx("input",{ref:B,type:"text",value:M,onChange:le=>O(le.target.value),onKeyDown:le=>{le.key==="Enter"?ne(U.id):le.key==="Escape"&&se();},onBlur:()=>ne(U.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:le=>le.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Se===0?"14px":Se===1?"13px":"12px",fontWeight:U.isMilestone?600:U.subtasks&&U.subtasks.length>0?500:400,opacity:Se===0?1:Se===1?.95:.88},title:U.name,children:U.name}),Ne&&!ze&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:le=>le.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:le=>Qe(U,le),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:le=>{le.stopPropagation(),ar(U);},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 de=U.startDate?typeof U.startDate=="string"?U.startDate:U.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:de||"",onChange:le=>{m?.(U.id,{startDate:le.target.value?new Date(le.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 ue=U.endDate?typeof U.endDate=="string"?U.endDate:U.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ue||"",onChange:le=>{m?.(U.id,{endDate:le.target.value?new Date(le.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:Ot(U)})});case "assignees":let Ve=a.filter(le=>U.assignees?.some(be=>be.name===le.name||be.initials===le.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx(Ur,{assignedUsers:Ve,availableUsers:a,onChange:le=>{let be=le.map(j=>({id:j.id,name:j.name,initials:j.initials,color:j.color}));m?.(U.id,{assignees:be.length>0?be:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsxRuntime.jsx(Wl,{status:U.status||"todo",onChange:le=>{m?.(U.id,{status:le,progress:le==="completed"?100:U.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:`${U.progress}%`,backgroundColor:U.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:[U.progress,"%"]})]});default:return null}},Vt=V=>[{id:"hide",label:"Hide Column",icon:Pt.Hide,onClick:()=>l(V),disabled:V==="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:()=>{}}],ur=V=>[{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:V.status==="completed"?"Mark Incomplete":"Mark Complete",icon:Pt.Progress,onClick:()=>{let U=V.status==="completed"?"in-progress":"completed",Se=V.status==="completed"?V.progress:100;m?.(V.id,{status:U,progress:Se});}},{id:"setInProgress",label:"Set In Progress",icon:Pt.Progress,onClick:()=>{m?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"delete",label:"Delete Task",icon:Pt.Delete,onClick:()=>{window.confirm(`Delete task "${V.name}"?`)&&g?.([V.id]);}}],zt=u.filter(V=>V.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:`${vt}px`,marginLeft:"3px"},children:[zt.map(V=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative ${V.id==="name"?"justify-start":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.width}px`,maxWidth:`${V.width}px`,borderColor:t.borderLight,height:"100%",boxSizing:"border-box"},onContextMenu:U=>{U.preventDefault(),ge({isOpen:true,x:U.clientX,y:U.clientY,type:"header",columnId:V.id});},onMouseEnter:U=>{U.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:U=>{U.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:V.label}),V.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:z===V.id?t.accent:"transparent"},onMouseDown:U=>{U.preventDefault(),U.stopPropagation(),$(V.id),ee(U.clientX),fe(V.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}})})]},V.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(Nn,{columns:u,onToggleColumn:l,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:V=>V.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:mt.map(({task:V,level:U},Se)=>{let ze=ct(V.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center border-b cursor-pointer group",style:{height:`${r}px`,borderTop:`1px solid ${ze?t.accent:t.borderLight}`,borderRight:`1px solid ${ze?t.accent:t.borderLight}`,borderBottom:`1px solid ${ze?t.accent:t.borderLight}`,borderLeft:ze?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ze?t.accentLight:Se%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>T(V.id),onMouseLeave:()=>T(null),onClick:Ne=>{let ue=da(e).map(be=>be.id),le=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ne.metaKey:Ne.ctrlKey;pt(V.id,ue,le,Ne.shiftKey),o?.(V);},onDoubleClick:Ne=>{Ne.stopPropagation(),s?.(V);},onContextMenu:Ne=>{Ne.preventDefault(),ge({isOpen:true,x:Ne.clientX,y:Ne.clientY,type:"task",task:V}),c?.(V,Ne);},whileHover:{backgroundColor:ze?t.accentLight:t.hoverBg},children:zt.map(Ne=>jsxRuntime.jsx("div",{className:`px-4 border-r flex items-center ${Ne.id==="name"?"justify-start":"justify-center"}`,style:{width:`${Ne.width}px`,minWidth:`${Ne.width}px`,maxWidth:`${Ne.width}px`,borderColor:C===V.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:Ht(Ne,V,Ne.id==="name"?U:0)},`${V.id}-${Ne.id}`))},V.id)})}),jsxRuntime.jsx(ca,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?Vt(P.columnId):P.type==="task"&&P.task?ur(P.task):[],onClose:()=>ge({...P,isOpen:false}),theme:t})]})}function Hl(e,t){let[r,a]=we.useState("none"),[n,o]=we.useState(0),[s,c]=we.useState(e),[d,i]=we.useState(t),[u,l]=we.useState(null),[p,m]=we.useState(null),[b,y]=we.useState(null),[h,g]=we.useState(null),[v,f]=we.useState(0),[w,k]=we.useState(0),[x,C]=we.useState(null),[T,D]=we.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:c,ghostWidth:d,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:p,setHoveredTaskId:m,activeZone:b,setActiveZone:y,draggedSegmentIndex:h,setDraggedSegmentIndex:g,draggedSegmentStartX:v,setDraggedSegmentStartX:f,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:x,setHoveredSegmentIndex:C,isHovered:T,setIsHovered:D,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(O,E)=>{a("none"),l(null),m(null),c(O),i(E),k(0),g(null),f(0);}}}function Pn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:c,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:p,allTaskPositions:m=[],onDragMove:b}){let y=Hl(t,a),h=we.useRef(null),{dragMode:g,setDragMode:v,dragOffset:f,setDragOffset:w,ghostX:k,setGhostX:x,ghostWidth:C,setGhostWidth:T,connectionLine:D,setConnectionLine:R,hoveredTaskId:_,setHoveredTaskId:G,activeZone:M,setActiveZone:O,draggedSegmentIndex:E,setDraggedSegmentIndex:B,draggedSegmentStartX:z,setDraggedSegmentStartX:$,segmentDragOffsetX:A,setSegmentDragOffsetX:ee,hoveredSegmentIndex:X,setHoveredSegmentIndex:fe,isHovered:P,setIsHovered:ge,isDragging:ae,isResizing:pt,isConnecting:ct,resetDragState:Bt}=y,ie=32,mt=8,vt=e.endDate&&e.endDate<new Date&&e.progress<100,Ot=e.isCriticalPath,ar=n.name==="neutral"||n.today==="#1C1917",se=(j=>j>=80?20:j>=60?15:j>=50?12:10)(a),Qe=a<50,Ht=a<40,Vt=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ur=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},zt=j=>Math.round(j/o)*o,V=j=>{let ye=Math.round(j/o),S=new Date(s);return S.setDate(S.getDate()+ye),S},U=(j,ye)=>{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&&ye>=S.y-H&&ye<=S.y+S.height+H)return S.id}return null},Se=we.useCallback((j,ye,S)=>{j.preventDefault(),j.stopPropagation();let H=h.current?.ownerSVGElement;if(!H)return;let pe=H.createSVGPoint();pe.x=j.clientX,pe.y=j.clientY;let Ee=pe.matrixTransform(H.getScreenCTM()?.inverse()),Fe=S!==void 0?S:t,We=ye;if(!We){let Mt=Ee.x-Fe;j.shiftKey?(We="connect",R({x:t+a,y:r+ie/2})):j.ctrlKey||j.metaKey?We="move":j.altKey?We=Mt<a/2?"resize-start":"resize-end":Ht?Mt<a/2?We="move":We="resize-end":Qe?Mt<=se/2?We="resize-start":Mt>=a-se/2?We="resize-end":We="move":Mt<=se?We="resize-start":Mt>=a-se?We="resize-end":We="move";}v(We),ge(false),O(null),We==="move"?w(Ee.x-Fe):We==="connect"?R({x:t+a,y:r+ie/2}):w(0),x(Fe),T(a);},[t,a,r,ie]),ze=we.useCallback(j=>{if(g==="none")return;let ye=h.current?.ownerSVGElement;if(!ye)return;let S=ye.createSVGPoint();S.x=j.clientX,S.y=j.clientY;let H=S.matrixTransform(ye.getScreenCTM()?.inverse());if(g==="connect"){R({x:H.x,y:H.y});let pe=U(H.x,H.y);G(pe);}else if(g==="move"){let pe=H.x-f,Ee=zt(pe);x(Ee),T(a);let Fe=Math.round((Ee-t)/o);if(b?.(e.id,Fe,true),e.segments&&e.segments.length>0&&E!==null){let We=Ee-z;ee(We);}}else if(g==="resize-start"){let pe=H.x,Ee=zt(pe),Fe=t+a-Ee;Fe>=o&&(x(Ee),T(Fe));}else if(g==="resize-end"){let pe=H.x,Fe=zt(pe)-t;Fe>=o&&T(Fe);}},[g,t,a,o,f,e,zt,E,z,U,G,R,x,T,ee,b]),Ne=we.useCallback(()=>{if(g!=="none"){if(g==="connect")_&&p&&p(e,_),R(null),G(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),ye,S,H=true;if(g==="move"){if(ye=V(k),S=new Date(ye.getTime()+j),e.segments&&e.segments.length>0&&E!==null){let pe=Math.round(A/o),Ee=e.segments.map(($t,qn)=>{if(qn===E){let ga=new Date($t.startDate),ha=new Date($t.endDate);return ga.setDate(ga.getDate()+pe),ha.setDate(ha.getDate()+pe),{startDate:ga,endDate:ha}}return $t}),Fe=Ee.flatMap($t=>[$t.startDate,$t.endDate]),We=new Date(Math.min(...Fe.map($t=>$t.getTime()))),Mt=new Date(Math.max(...Fe.map($t=>$t.getTime())));l?.({...e,segments:Ee},We,Mt),Bt(t,a);return}}else g==="resize-start"?(ye=V(k),S=e.endDate,ye>=S&&(console.warn("Invalid date range: start date must be before end date"),H=false)):g==="resize-end"?(ye=e.startDate,S=V(k+C),S<=ye&&(console.warn("Invalid date range: end date must be after start date"),H=false)):H=false;H&&ye&&S&&(S.getTime()-ye.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,ye,S));}b?.(e.id,0,false),Bt(t,a);}},[g,k,C,e,l,_,p,t,a,o,V,A,E,Bt,b]);we.useEffect(()=>{if(g==="none")return;let j=S=>{ze(S);},ye=()=>{Ne();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",ye),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",ye);}},[g,ze,Ne]);let de=ae&&!ct?k:t,ue=ae&&!ct?C:a,Ve=c.taskTooltip(e),le=typeof Ve=="string"?Ve:"",be=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!ae&&ge(true),onMouseLeave:()=>{ae||(ge(false),O(null));},onClick:()=>!ae&&d?.(e),onDoubleClick:j=>{ae||(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},children:[le&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:le}}),P&&!ae&&!Qe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:se,height:ie,fill:M==="resize-start"?n.accent:"transparent",opacity:M==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-start"),onMouseDown:j=>Se(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+se,y:r,width:a-se*2,height:ie,fill:M==="move"?n.accent:"transparent",opacity:M==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:j=>Se(j,"move")}),jsxRuntime.jsx("rect",{x:t+a-se,y:r,width:se,height:ie,fill:M==="resize-end"?n.accent:"transparent",opacity:M==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:j=>Se(j,"resize-end")})]}),P&&!ae&&Ht&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:ie,fill:M==="move"?n.accent:"transparent",opacity:M==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>O("move"),onMouseDown:j=>Se(j,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:ie,fill:M==="resize-end"?n.accent:"transparent",opacity:M==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>O("resize-end"),onMouseDown:j=>Se(j,"resize-end")}),P&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+ie-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ae&&!ct&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:r,width:C,height:ie,rx:mt,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:de,y:r,width:ue,height:ie,rx:mt,fill:e.isCriticalPath||vt?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":be,initial:{opacity:0,scale:.95},animate:{opacity:ae&&!ct?.15:e.parentId?.6:P?.9:.8,scale:P&&!ae?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>Se(j),style:{cursor:ae?ct?"crosshair":pt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:de,y:r,width:ue*(e.progress/100),height:ie,rx:mt,fill:e.isCriticalPath||vt?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((j,ye)=>{let S=(j.startDate.getTime()-s.getTime())/864e5*o,pe=(j.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-S+o,Ee=ae&&g==="move"&&E===ye,Fe=X===ye,We=Ee?S+A:S;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ae&&fe(ye),onMouseLeave:()=>!ae&&fe(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:We,y:r,width:pe,height:ie,rx:mt,fill:e.isCriticalPath||vt?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:Ee||e.parentId?.6:Fe?.9:.8,scale:Fe&&!ae?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Mt=>{Mt.stopPropagation(),B(ye),$(S),Se(Mt,void 0,S);},style:{cursor:ae?ct?"crosshair":pt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:We,y:r,width:pe*(e.progress/100),height:ie,rx:mt,fill:e.isCriticalPath||vt?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ye}`)}),ar&&(vt||Ot)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ot&&!vt&&jsxRuntime.jsx("rect",{x:de,y:r,width:ue,height:ie,rx:mt,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),vt&&jsxRuntime.jsx("rect",{x:de,y:r,width:ue,height:ie,rx:mt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ue>60&&!e.segments&&(()=>{let j=c.taskLabel(e),ye=typeof j=="string"?j:e.name,S=ye.length>Math.floor(ue/8)?`${ye.substring(0,Math.floor(ue/8))}...`:ye;return jsxRuntime.jsx("text",{x:de+12,y:r+ie/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S})})(),ue>100&&e.progress>0&&e.progress<100&&!ae&&!e.segments&&jsxRuntime.jsxs("text",{x:de+ue-12,y:r+ie/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&&ue>80&&!ae&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:de+ue-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:de+ue-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(P||pt)&&!ct&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Qe?de-15:de-10,y:r-5,width:Qe?25:20,height:ie+10,fill:"transparent",onMouseDown:j=>Se(j,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe?de-8:de-3,y:r+6,width:Qe?8:6,height:Qe?ie-12:ie-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:de+ue-10,y:r-5,width:Qe?25:20,height:ie+10,fill:"transparent",onMouseDown:j=>Se(j,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe?de+ue:de+ue-3,y:r+6,width:Qe?8:6,height:Qe?ie-12:ie-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&&!ae&&!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+ie/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(),Se(j,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+ie/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ct&&D&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+ie/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||ae)&&!ct&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:de-2,y:r-2,width:ue+4,height:ie+4,rx:mt+2,fill:"none",stroke:ae?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:ae?.6:.4,initial:{opacity:0},animate:{opacity:ae?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),pt&&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+C,y1:0,x2:k+C,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!ae&&!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:de+ue/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 ${de+ue/2-6} ${r-13} L ${de+ue/2} ${r-3} L ${de+ue/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:de+ue/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:de+ue/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:de+ue/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Vt(e.startDate)}),jsxRuntime.jsx("text",{x:de+ue/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:de+ue/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Vt(e.endDate)}),jsxRuntime.jsx("text",{x:de+ue/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:de+ue/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ur()}),jsxRuntime.jsx("text",{x:de+ue/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:de+ue/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:de+ue/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:de+ue/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:de+ue/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ht?"Left: move \u2022 Right: resize":Qe?"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[s,c]=we.useState(false),d=r-e,i=a-t,u=e+d/2,l=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,p=6,m=Math.atan2(i,d),b=r-p*Math.cos(m-Math.PI/6),y=a-p*Math.sin(m-Math.PI/6),h=r-p*Math.cos(m+Math.PI/6),g=a-p*Math.sin(m+Math.PI/6),v=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:v,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 ${b} ${y} M ${r} ${a} L ${h} ${g}`,fill:"none",stroke:v,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:v,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 Ln({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=we.useState(false),c=16,d=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: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:d(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 K={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,c=new Set,d=i=>{if(!s.has(i)){s.add(i),c.add(i);let u=a.get(i)||[];for(let l of u){if(!s.has(l)&&d(l))return true;if(c.has(l))return true}}return c.delete(i),false};return d(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=K.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=K.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=K.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=K.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
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=K.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=K.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)=>K.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=K.findTaskById(e,t);return !r||!r.dependencies?[]:K.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>K.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>K.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=K.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=>K.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=K.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"]],c=o.map(d=>{let i=d.startDate&&d.endDate?K.calculateDuration(d.startDate,d.endDate):0;return [d.name,d.startDate?K.formatDate(d.startDate):"N/A",d.endDate?K.formatDate(d.endDate):"N/A",i>0?`${i} days`:"N/A",`${d.progress}%`,d.status||"N/A"]});a(n,{head:s,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=K.flattenTasks(e).map(d=>{let i=d.startDate&&d.endDate?K.calculateDuration(d.startDate,d.endDate):0;return {"Task ID":d.id,"Task Name":d.name,"Start Date":d.startDate?K.formatDate(d.startDate):"","End Date":d.endDate?K.formatDate(d.endDate):"","Duration (days)":i>0?i:"","Progress (%)":d.progress,Status:d.status||"",Assignees:d.assignees?.map(u=>u.name).join(", ")||"",Dependencies:d.dependencies?.join(", ")||"","Is Milestone":d.isMilestone?"Yes":"No","Parent ID":d.parentId||"",Level:d.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 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=K.flattenTasks(e),n=new Map;a.forEach((p,m)=>{n.set(p.id,m+1);});let o=p=>p.toISOString().replace("Z",""),s=K.getEarliestStartDate(e)||new Date,c=K.getLatestEndDate(e)||new Date,d=a.map((p,m)=>{let b=n.get(p.id),y=p.startDate&&p.endDate?K.calculateDuration(p.startDate,p.endDate):0,h=(p.dependencies||[]).filter(g=>n.has(g)).map(g=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
48
|
<PredecessorUID>${n.get(g)}</PredecessorUID>
|
|
@@ -273,9 +273,9 @@
|
|
|
273
273
|
</Calendars>
|
|
274
274
|
<Tasks>${d}
|
|
275
275
|
</Tasks>
|
|
276
|
-
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(u),l.download=r,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=K.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?K.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let b=t.find(y=>y.id===m);if(b){n(b);let y=a.get(m)?.ef||0;l=Math.max(l,y);}}let p=l+u;a.set(i.id,{es:l,ef:p});};r.forEach(n);let o=Math.max(...Array.from(a.values()).map(i=>i.ef)),s=new Map,c=i=>{if(s.has(i.id))return;let u=i.startDate&&i.endDate?K.calculateDuration(i.startDate,i.endDate):0,l=t.filter(b=>b.dependencies&&b.dependencies.includes(i.id)),p=o;if(l.length>0)for(let b of l){c(b);let y=s.get(b.id)?.ls||0;p=Math.min(p,y);}let m=p-u;s.set(i.id,{ls:m,lf:p});};r.forEach(c);let d=[];for(let i of r){let u=a.get(i.id),l=s.get(i.id);if(u&&l){let p=l.ls-u.es;Math.abs(p)<.01&&d.push(i.id);}}return d},calculateSlack:(e,t)=>{let r=K.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(K.calculateCriticalPath(e).includes(t))return 0;let n=K.getDependentTasks(e,t);if(n.length===0){let c=K.getLatestEndDate(e);if(!c)return null;let d=K.calculateDuration(r.endDate,c);return Math.max(0,d)}let o=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,d)=>c-d)[0];if(!o)return null;let s=K.calculateDuration(r.endDate,new Date(o));return Math.max(0,s)},isOnCriticalPath:(e,t)=>K.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r)=>{let a=K.findTaskById(e,t);if(!a||!a.endDate)return e;let n=K.getDependentTasks(e,t);if(n.length===0)return e;let o=[...e];for(let s of n){if(!s.startDate||!s.endDate)continue;let c=K.calculateDuration(s.startDate,s.endDate),d;r!==void 0?(d=new Date(s.startDate),d.setDate(d.getDate()+r)):(d=new Date(a.endDate),d.setDate(d.getDate()+1));let i=K.calculateEndDate(d,c),u=l=>l.map(p=>p.id===s.id?{...p,startDate:d,endDate:i}:p.subtasks?{...p,subtasks:u(p.subtasks)}:p);o=u(o),o=K.autoScheduleDependents(o,s.id,r);}return o},calculateCascadePreview:(e,t,r,a,n,o,s,c)=>{if(r===0)return [];let d=[],i=n.getTime(),u=1e3*60*60*24,l=K.findTaskById(e,t);if(!l||!l.endDate)return [];let p=(m,b,y=new Set)=>{if(y.has(m))return;y.add(m);let h=K.getDependentTasks(e,m);for(let g of h){if(!g.startDate||!g.endDate)continue;let v=a.findIndex(_=>_.id===g.id);if(v===-1)continue;let f=g.startDate.getTime(),k=(g.endDate.getTime()-f)/u,C=(f-i)/u*o,T=C+b*o,D=Math.max(k*o,o),R=c+v*s+12;d.push({taskId:g.id,taskName:g.name,originalX:C,previewX:T,width:D,y:R,rowIndex:v,daysDelta:b,color:g.color}),p(g.id,b,y);}};return p(t,r),d},splitTask:(e,t,r,a=3)=>{let n=K.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 c=new Date(n.endDate);c.setDate(c.getDate()+a);let d=[{startDate:new Date(n.startDate),endDate:o},{startDate:s,endDate:c}],i=u=>u.map(l=>l.id===n.id?{...l,endDate:c,segments:d}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function On({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:s,templates:c,onTaskClick:d,onTaskDblClick:i,onTaskContextMenu:u,onTaskDateChange:l,onDependencyCreate:p,onDependencyDelete:m}){let[y,h]=we.useState([]),g=Math.ceil((o.getTime()-n.getTime())/(1e3*60*60*24)),v=a==="day"?60:a==="week"?20:8,f=g*v*s,w=E=>{let B=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),z=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-z);let $=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-$.getTime())/864e5+1)/7)},k=E=>{let B=E.getDay();return B===0||B===6},x=we.useCallback(E=>{let B=Math.round(E/(v*s)),z=new Date(n);return z.setDate(z.getDate()+B),z},[n,v,s]),C=we.useCallback((E,B)=>{if(B.startDate&&B.endDate)return;let z=E.currentTarget.ownerSVGElement;if(!z)return;let $=z.createSVGPoint();$.x=E.clientX,$.y=E.clientY;let A=$.matrixTransform(z.getScreenCTM()?.inverse()),te=x(A.x),X=new Date(te);X.setDate(X.getDate()+1),l?.(B,te,X);},[x,l]),T=we.useMemo(()=>{let E=A=>A.map(te=>{if(te.subtasks&&te.subtasks.length>0){let X=E(te.subtasks),fe=X.filter(P=>P.startDate&&P.endDate);if(fe.length>0){let P=fe.map(ct=>ct.startDate.getTime()),ge=fe.map(ct=>ct.endDate.getTime()),ae=new Date(Math.min(...P)),pt=new Date(Math.max(...ge));return {...te,subtasks:X,startDate:ae,endDate:pt}}return {...te,subtasks:X}}return te}),B=(A,te=[])=>{for(let X of A)te.push(X),X.subtasks&&X.subtasks.length>0&&(X.isExpanded===void 0||X.isExpanded)&&B(X.subtasks,te);return te},z=E(e);return B(z)},[e]),D=we.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let B=E.startDate.getTime(),z=E.endDate.getTime(),$=n.getTime(),A=(B-$)/(1e3*60*60*24),te=(z-B)/(1e3*60*60*24),X=A*v*s,fe=Math.max(v*s,40),P=Math.max(te*v*s,fe);return {x:X,width:P}},[n,v,s]),R=we.useMemo(()=>T.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:B,width:z}=D(E),A=T.findIndex(te=>te.id===E.id)*r+12;return {id:E.id,x:B,y:A,width:z,height:32}}),[T,D]),_=we.useCallback((E,B,z)=>{if(!z||B===0){h([]);return}let $=K.calculateCascadePreview(e,E,B,T,n,v*s,r,48);h($);},[e,T,n,v,s,r,48]),G=we.useMemo(()=>{let E=[],B=new Date(n);for(;B<=o;){let A=(B.getTime()-n.getTime())/864e5*v*s;if(a==="day")E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:A}),B.setDate(B.getDate()+1);else if(a==="week"){let te=w(B);E.push({date:new Date(B),label:`Week ${te}`,x:A}),B.setDate(B.getDate()+7);}else E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:A}),B.setMonth(B.getMonth()+1);}return E},[n,o,a,v,s]),M=we.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*v*s,[n,v,s]),O=Math.max(T.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}),G.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}`)),M>=0&&M<=f&&jsxRuntime.jsx("circle",{cx:M,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}),G.map((E,B)=>{let z=G[B+1]?.x||f,$=k(E.date);return jsxRuntime.jsxs("g",{children:[$&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:z-E.x,height:T.length*r,fill:t.bgWeekend,opacity:1}),jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:T.length*r,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),M>=0&&M<=f&&jsxRuntime.jsx("line",{x1:M,y1:0,x2:M,y2:T.length*r,stroke:t.today,strokeWidth:2,opacity:1}),T.map((E,B)=>{let z=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}`),!z&&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:$=>C($,E),onMouseEnter:$=>{$.currentTarget.setAttribute("fill",t.accentLight),$.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:$=>{$.currentTarget.setAttribute("fill","transparent"),$.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:M>0?M: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}`)}),T.map((E,B)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(z=>{let $=T.find(fe=>fe.id===z);if(!$||!$.startDate||!$.endDate)return null;let A=T.findIndex(fe=>fe.id===z),te=D($),X=D(E);return jsxRuntime.jsx(Mn,{x1:te.x+te.width,y1:A*r+r/2,x2:X.x,y2:B*r+r/2,theme:t,onDelete:()=>m?.(E.id,z)},`dep-${z}-${E.id}`)})),T.map((E,B)=>{if(!E.startDate||!E.endDate)return null;let{x:z,width:$}=D(E),A=B*r+12,te=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Ln,{task:E,x:z+$/2,y:A+16,theme:t,onClick:d},E.id):te?jsxRuntime.jsxs("g",{onClick:()=>d?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:z,y:A,width:$,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:z,y1:A,x2:z+$,y2:A,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z,y1:A,x2:z,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z+$,y1:A,x2:z+$,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z,y1:A+32,x2:z+$,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),$>60&&jsxRuntime.jsx("text",{x:z+12,y:A+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:z,y:A,width:$,theme:t,dayWidth:v*s,startDate:n,templates:c,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:p,allTaskPositions:R,onDragMove:_},E.id)}),y.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 Yl=[{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 ql({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:Yl.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:Yl.find(a=>a.value===e)?.name||"Personalizado"})]})}function zn({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:s=false,mode:c=r?"edit":"create",theme:d="dark"}){let i=ke[d]||ke.dark,u={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},l={color:i.textSecondary},[p,m]=we.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[b,y]=we.useState({});we.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 h=()=>{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"),y(f),Object.keys(f).length===0},g=async f=>{if(f.preventDefault(),!!h())try{await o(p),t();}catch(w){console.error("Error submitting task:",w);}},v=(f,w)=>{m(k=>{let x={...k,[f]:w};if(f==="progress"){let C=typeof w=="number"?w:parseInt(w,10);C===100&&k.status!=="completed"?x.status="completed":C>0&&C<100&&k.status==="todo"?x.status="in-progress":C===0&&k.status==="in-progress"&&(x.status="todo");}return x}),b[f]&&y(k=>{let x={...k};return delete x[f],x});};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:c==="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:l,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:p.name,onChange:f=>v("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}),b.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"}),b.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:l,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=>v("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||p.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,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=>v("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||p.isMilestone}),b.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"}),b.endDate]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:p.status,onChange:f=>v("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:l,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(ql,{value:p.color,onChange:f=>v("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:l,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=>v("progress",parseInt(f.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:p.progress<30?"#EF4444":p.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:`${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: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:()=>v("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:p.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.bgSecondary,color:p.progress===f?"#FFFFFF":i.textSecondary,border:`1px solid ${p.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:p.isMilestone,onChange:f=>v("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:l,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: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(x=>x[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(p.assignees||[]).filter(x=>x.name!==f.name);v("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:l,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:p.dependencies?.includes(f.id),onChange:w=>{let k=w.target.checked?[...p.dependencies||[],f.id]:(p.dependencies||[]).filter(x=>x!==f.id);v("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"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var tg=['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"'],rc=()=>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"})]}),rg=()=>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"})}),ag=()=>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"})}),ng=()=>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"})}),og=()=>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:s,onDependencyCreate:c,onDependencyDelete:d}){let[i,u]=we.useState(false),[l,p]=we.useState(false),[m,b]=we.useState([]),[y,h]=we.useState(""),[g,v]=we.useState(false),[f,w]=we.useState(true),k=we.useRef(null),x=we.useRef(null),C=we.useRef(null),{enabled:T=true,placeholder:D='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:_,suggestions:G=tg,maxHistory:M=50}=r;we.useEffect(()=>{x.current&&x.current.scrollIntoView({behavior:"smooth"});},[m]),we.useEffect(()=>{i&&!l&&k.current&&setTimeout(()=>k.current?.focus(),100);},[i,l]);let O=we.useCallback(A=>{if(A.success)switch(A.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":A.taskId&&A.updates&&n?.(A.taskId,A.updates);break;case "create_task":A.newTask&&o?.(A.newTask);break;case "delete_task":A.taskId&&s?.(A.taskId);break;case "link_tasks":A.dependencyFrom&&A.dependencyTo&&c?.(A.dependencyFrom,A.dependencyTo);break;case "unlink_tasks":A.taskId&&A.dependencyFrom&&d?.(A.taskId,A.dependencyFrom);break}},[n,o,s,c,d]),E=we.useCallback(async A=>{if(!A.trim()||g)return;let te={id:`user-${Date.now()}`,role:"user",content:A,timestamp:new Date};b(fe=>[...fe.slice(-(M-1)),te]),h(""),w(false),v(true);let X={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(fe=>[...fe,X]);try{if(_){let fe=await _(A,e);b(P=>{let ge=P.filter(pt=>!pt.isLoading),ae={id:`assistant-${Date.now()}`,role:"assistant",content:fe.message,timestamp:new Date,command:fe};return [...ge,ae]}),O(fe);}else b(fe=>[...fe.filter(ge=>!ge.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(fe){b(P=>[...P.filter(ae=>!ae.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${fe instanceof Error?fe.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[g,M,_,e,O]),B=A=>{A.preventDefault(),E(y);},z=A=>{h(A),k.current?.focus();};if(we.useEffect(()=>{let A=te=>{(te.metaKey||te.ctrlKey)&&te.key==="k"&&(te.preventDefault(),u(X=>!X),i||p(false)),te.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[i]),!T)return null;let $={"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.05},whileTap:{scale:.95},className:`fixed ${$[R]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(rc,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:C,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${$[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, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(rc,{}),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(A=>!A),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(ng,{})}),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(ag,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[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:G.slice(0,4).map((A,te)=>jsxRuntime.jsx("button",{onClick:()=>z(A),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:A.length>30?A.slice(0,30)+"...":A},te))})]}),m.map(A=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${A.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${A.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:A.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:A.role==="user"?"white":t.textPrimary},children:[A.isLoading?jsxRuntime.jsx(og,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:A.content}),A.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:A.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:A.command.success?"#10B981":"#EF4444"},children:[A.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:A.command.type.replace(/_/g," ")})]})]})},A.id)),jsxRuntime.jsx("div",{ref:x})]}),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:y,onChange:A=>h(A.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:!y.trim()||g,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:y.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:y.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(rg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function ac(e,t=50){let[r,a]=we.useState({past:[],present:e,future:[]}),n=we.useRef(false),o=we.useCallback((i,u=true)=>{a(l=>{let p=typeof i=="function"?i(l.present):i;if(n.current)return {...l,present:p};if(!u)return {...l,present:p};let m=[...l.past,l.present];return m.length>t&&m.shift(),{past:m,present:p,future:[]}});},[t]),s=we.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:l,present:u,future:[i.present,...i.future]}});},[]),c=we.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],l=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:l}});},[]),d=we.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:o,undo:s,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:d}}function nc({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){we.useEffect(()=>{if(!n)return;let o=s=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=c?s.metaKey:s.ctrlKey;if(d&&s.key==="z"&&!s.shiftKey&&r){s.preventDefault(),e();return}if(a){if(!c&&d&&s.key==="y"){s.preventDefault(),t();return}if(c&&d&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var cg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${K.formatDate(e.startDate)} - ${K.formatDate(e.endDate)}`);let r=K.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=>K.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function oc(e){return {...cg,...e}}var fg=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},lc=we.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:o,timeScale:s="week",rowDensity:c="comfortable",showThemeSelector:d=true,showExportButton:i=true,availableUsers:u=[],templates:l,enableAutoCriticalPath:p=true,aiAssistant:m,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:h,onThemeChange:g,onTaskClick:v,onTaskDblClick:f,onTaskContextMenu:w,onTaskUpdate:k,onProgressChange:x,onDependencyCreate:C,onDependencyDelete:T,onBeforeTaskAdd:D,onAfterTaskAdd:R,onBeforeTaskUpdate:_,onAfterTaskUpdate:G}=r,O=we.useContext(Sn)?.theme,[E,B]=we.useState(O||o||"dark"),[z,$]=we.useState(s),[A,te]=we.useState(c),[X,fe]=we.useState(1),[P,ge]=we.useState(0),[ae,pt]=we.useState(false),[ct,Bt]=we.useState(null),[ie,mt]=we.useState({isOpen:false,x:0,y:0,task:null}),[vt,Ot]=we.useState(null);we.useEffect(()=>{O&&O!==E&&B(O);},[O]),we.useEffect(()=>{o&&o!==E&&B(o);},[o]);let ar=we.useCallback(N=>{B(N),g?.(N);},[g]),{state:ne,setState:se,undo:Qe,redo:Ht,canUndo:Vt,canRedo:ur,clearHistory:zt}=ac(t,50);we.useEffect(()=>{se(t);},[t,se]),we.useEffect(()=>{a&&a(ne);},[ne,a]);let[V,U]=we.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}]),Se=we.useMemo(()=>V.filter(N=>N.visible).reduce((N,I)=>N+I.width,0)+60,[V]),ze=ct||Se,Ne=we.useRef(null),de=we.useRef(null),ue=we.useRef(null),Ve=we.useMemo(()=>Sl(E),[E]),le=we.useMemo(()=>({theme:Ve,themeName:E}),[Ve,E]),be=we.useMemo(()=>oc(l),[l]),j=we.useMemo(()=>{if(!p)return ne;let N=K.calculateCriticalPath(ne),I=W=>W.map(J=>({...J,isCriticalPath:N.includes(J.id),subtasks:J.subtasks?I(J.subtasks):void 0}));return I(ne)},[ne,p]),ye=fg(A);nc({undo:Qe,redo:Ht,canUndo:Vt,canRedo:ur,enabled:true}),we.useImperativeHandle(n,()=>({getTask:N=>K.findTaskById(ne,N),addTask:(N,I)=>{se(W=>{if(!I)return [...W,{...N,level:0}];let J=ee=>ee.map(oe=>oe.id===I?{...oe,subtasks:[...oe.subtasks||[],{...N,parentId:I,level:(oe.level||0)+1}],isExpanded:true}:oe.subtasks?{...oe,subtasks:J(oe.subtasks)}:oe);return J(W)});},updateTask:(N,I)=>{se(W=>{let J=ee=>ee.map(oe=>oe.id===N?{...oe,...I}:oe.subtasks?{...oe,subtasks:J(oe.subtasks)}:oe);return J(W)});},deleteTask:N=>{se(I=>{let W=J=>J.filter(ee=>ee.id===N?false:(ee.subtasks&&(ee.subtasks=W(ee.subtasks)),true));return W(I)});},deleteTasks:N=>{se(I=>En(I,N));},duplicateTask:N=>{se(I=>ts(I,[N]));},splitTask:(N,I,W=3)=>{se(J=>K.splitTask(J,N,I,W));},calculateEndDate:K.calculateEndDate,calculateDuration:K.calculateDuration,validateDependency:(N,I)=>!K.validateDependencies(ne,N,I),getAllTasks:()=>K.flattenTasks(ne),getTasksByStatus:N=>K.flattenTasks(ne).filter(I=>I.status===N),getTasksByParent:N=>N?K.findTaskById(ne,N)?.subtasks||[]:ne.filter(W=>!W.parentId),getCriticalPath:()=>K.flattenTasks(ne).filter(N=>N.isCriticalPath),indentTask:N=>{se(I=>Zo(I,[N]));},outdentTask:N=>{se(I=>Qo(I,[N]));},moveTask:(N,I)=>{se(W=>es(W,[N],I));},createSubtask:async N=>{let{tasks:I,newTask:W}=ns(ne,N);if(D){let J=D({...W,parentId:N});if((J instanceof Promise?await J:J)===false)return}se(I),R&&R({...W,parentId:N});},scrollToTask:N=>{let W=K.flattenTasks(ne).findIndex(J=>J.id===N);if(W!==-1&&Ne.current){let J=W*ye;Ne.current.scrollTo({top:J,behavior:"smooth"}),de.current&&de.current.scrollTo({top:J,behavior:"smooth"});}},highlightTask:(N,I=2e3)=>{},expandTask:N=>{se(I=>{let W=J=>J.map(ee=>ee.id===N?{...ee,isExpanded:true}:ee.subtasks?{...ee,subtasks:W(ee.subtasks)}:ee);return W(I)});},collapseTask:N=>{se(I=>{let W=J=>J.map(ee=>ee.id===N?{...ee,isExpanded:false}:ee.subtasks?{...ee,subtasks:W(ee.subtasks)}:ee);return W(I)});},expandAll:()=>{se(N=>{let I=W=>W.map(J=>({...J,isExpanded:true,subtasks:J.subtasks?I(J.subtasks):void 0}));return I(N)});},collapseAll:()=>{se(N=>{let I=W=>W.map(J=>({...J,isExpanded:false,subtasks:J.subtasks?I(J.subtasks):void 0}));return I(N)});},undo:Qe,redo:Ht,canUndo:()=>Vt,canRedo:()=>ur,clearHistory:zt,exportToPNG:async()=>{if(!ue.current)throw new Error("Gantt container not found");let N=await sc__default.default(ue.current,{backgroundColor:Ve.bgPrimary,scale:2});return new Promise((I,W)=>{N.toBlob(J=>{J?I(J):W(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await K.exportToPDF(ne,N);},exportToExcel:async N=>{await K.exportToExcel(ne,N);},exportToJSON:()=>K.exportToJSON(ne),exportToCSV:()=>K.exportToCSV(ne),importFromJSON:N=>{let I=K.importFromJSON(N);se(I);},getTasks:()=>ne,refresh:()=>{se(N=>[...N]);},clearAll:()=>{se([]);}}),[ne,Qe,Ht,Vt,ur,zt,Ve,ye]);let S=we.useCallback(N=>{U(I=>I.map(W=>W.id===N?{...W,visible:!W.visible}:W));},[]),H=we.useCallback((N,I)=>{U(W=>W.map(J=>{if(J.id!==N)return J;let ee=J.minWidth??100,oe=J.maxWidth??800,et=Math.max(ee,Math.min(oe,I));return {...J,width:et}}));},[]),pe=we.useCallback(N=>{se(I=>as(I,N)),r.onTaskToggleExpand?.(N);},[r]),Ee=we.useCallback((N,I)=>{if(_&&_(N,I)===false)return;let J=K.findTaskById(ne,N)?.progress,ee=et=>et.map(nt=>nt.id===N?{...nt,...I}:nt.subtasks?{...nt,subtasks:ee(nt.subtasks)}:nt);se(ee(ne));let oe=K.findTaskById(ee(ne),N);oe&&(k?.(oe),G?.(oe),I.progress!==void 0&&J!==void 0&&I.progress!==J&&x?.(N,J,I.progress));},[ne,k,_,G,x]),Fe=we.useCallback(N=>{N.length!==0&&(se(I=>Zo(I,N)),r.onTaskIndent?.(N[0]));},[r]),We=we.useCallback(N=>{N.length!==0&&(se(I=>Qo(I,N)),r.onTaskOutdent?.(N[0]));},[r]),Mt=we.useCallback((N,I)=>{N.length!==0&&(se(W=>es(W,N,I)),r.onTaskMove?.(N[0],I));},[r]),$t=we.useCallback(N=>{r.onMultiTaskDelete?r.onMultiTaskDelete(N):(se(I=>En(I,N)),N.forEach(I=>r.onTaskDelete?.(I)));},[r]),qn=we.useCallback(N=>{se(I=>ts(I,N)),N.forEach(I=>r.onTaskDuplicate?.(I));},[r]),ga=we.useCallback((N,I)=>{se(W=>{let{tasks:J,newTask:ee}=Ol(W,N,I);return D&&D(ee)===false?W:(r.onTaskCreate?.(ee.parentId,ee.position||0),R?.(ee),J)});},[r,D,R]),ha=we.useCallback((N,I)=>{se(W=>rs(W,N,I)),r.onTaskRename?.(N,I);},[r]),ld=we.useCallback(N=>{se(I=>{let{tasks:W}=ns(I,N);return r.onTaskCreate?.(N,0),W});},[r]),cd=we.useCallback((N,I,W)=>{let J=N.startDate?Math.round((I.getTime()-N.startDate.getTime())/864e5):0,ee=nt=>nt.map(pr=>pr.id===N.id?{...pr,startDate:I,endDate:W,...N.segments&&{segments:N.segments}}:pr.subtasks?{...pr,subtasks:ee(pr.subtasks)}:pr),oe=ee(ne);oe=K.autoScheduleDependents(oe,N.id,J),se(oe);let et={...N,startDate:I,endDate:W};k?.(et);},[ne,k]),dd=we.useCallback((N,I)=>{w?.(N,I),mt({isOpen:true,x:I.clientX,y:I.clientY,task:N});},[w]),ud=we.useCallback((N,I)=>{let W=K.splitTask(ne,N.id,I);se(W),mt({isOpen:false,x:0,y:0,task:null});},[ne]),Hs=we.useCallback(N=>{f?.(N),Ot(N);},[f]),Vs=we.useCallback((N,I,W)=>{let J=new Map,ee=Lr=>{Lr.forEach(Fr=>{Fr.dependencies&&J.set(Fr.id,Fr.dependencies),Fr.subtasks&&ee(Fr.subtasks);});};ee(W);let oe=J.get(I)||[];J.set(I,[...oe,N]);let et=new Set,nt=new Set,pr=Lr=>{if(!et.has(Lr)){et.add(Lr),nt.add(Lr);let Fr=J.get(Lr)||[];for(let Xn of Fr){if(!et.has(Xn)&&pr(Xn))return true;if(nt.has(Xn))return true}}return nt.delete(Lr),false};return pr(I)},[]),Ks=we.useCallback((N,I)=>{if(Vs(N.id,I,ne)){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([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(u),l.download=r,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=K.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?K.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let b=t.find(y=>y.id===m);if(b){n(b);let y=a.get(m)?.ef||0;l=Math.max(l,y);}}let p=l+u;a.set(i.id,{es:l,ef:p});};r.forEach(n);let o=Math.max(...Array.from(a.values()).map(i=>i.ef)),s=new Map,c=i=>{if(s.has(i.id))return;let u=i.startDate&&i.endDate?K.calculateDuration(i.startDate,i.endDate):0,l=t.filter(b=>b.dependencies&&b.dependencies.includes(i.id)),p=o;if(l.length>0)for(let b of l){c(b);let y=s.get(b.id)?.ls||0;p=Math.min(p,y);}let m=p-u;s.set(i.id,{ls:m,lf:p});};r.forEach(c);let d=[];for(let i of r){let u=a.get(i.id),l=s.get(i.id);if(u&&l){let p=l.ls-u.es;Math.abs(p)<.01&&d.push(i.id);}}return d},calculateSlack:(e,t)=>{let r=K.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(K.calculateCriticalPath(e).includes(t))return 0;let n=K.getDependentTasks(e,t);if(n.length===0){let c=K.getLatestEndDate(e);if(!c)return null;let d=K.calculateDuration(r.endDate,c);return Math.max(0,d)}let o=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,d)=>c-d)[0];if(!o)return null;let s=K.calculateDuration(r.endDate,new Date(o));return Math.max(0,s)},isOnCriticalPath:(e,t)=>K.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r)=>{let a=K.findTaskById(e,t);if(!a||!a.endDate)return e;let n=K.getDependentTasks(e,t);if(n.length===0)return e;let o=[...e];for(let s of n){if(!s.startDate||!s.endDate)continue;let c=K.calculateDuration(s.startDate,s.endDate),d;r!==void 0?(d=new Date(s.startDate),d.setDate(d.getDate()+r)):(d=new Date(a.endDate),d.setDate(d.getDate()+1));let i=K.calculateEndDate(d,c),u=l=>l.map(p=>p.id===s.id?{...p,startDate:d,endDate:i}:p.subtasks?{...p,subtasks:u(p.subtasks)}:p);o=u(o),o=K.autoScheduleDependents(o,s.id,r);}return o},calculateCascadePreview:(e,t,r,a,n,o,s,c)=>{if(r===0)return [];let d=[],i=n.getTime(),u=1e3*60*60*24,l=K.findTaskById(e,t);if(!l||!l.endDate)return [];let p=(m,b,y=new Set)=>{if(y.has(m))return;y.add(m);let h=K.getDependentTasks(e,m);for(let g of h){if(!g.startDate||!g.endDate)continue;let v=a.findIndex(_=>_.id===g.id);if(v===-1)continue;let f=g.startDate.getTime(),k=(g.endDate.getTime()-f)/u,C=(f-i)/u*o,T=C+b*o,D=Math.max(k*o,o),R=c+v*s+12;d.push({taskId:g.id,taskName:g.name,originalX:C,previewX:T,width:D,y:R,rowIndex:v,daysDelta:b,color:g.color}),p(g.id,b,y);}};return p(t,r),d},splitTask:(e,t,r,a=3)=>{let n=K.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 c=new Date(n.endDate);c.setDate(c.getDate()+a);let d=[{startDate:new Date(n.startDate),endDate:o},{startDate:s,endDate:c}],i=u=>u.map(l=>l.id===n.id?{...l,endDate:c,segments:d}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function On({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:s,templates:c,onTaskClick:d,onTaskDblClick:i,onTaskContextMenu:u,onTaskDateChange:l,onDependencyCreate:p,onDependencyDelete:m}){let[y,h]=we.useState([]),g=Math.ceil((o.getTime()-n.getTime())/(1e3*60*60*24)),v=a==="day"?60:a==="week"?20:8,f=g*v*s,w=E=>{let B=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),z=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-z);let $=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-$.getTime())/864e5+1)/7)},k=E=>{let B=E.getDay();return B===0||B===6},x=we.useCallback(E=>{let B=Math.round(E/(v*s)),z=new Date(n);return z.setDate(z.getDate()+B),z},[n,v,s]),C=we.useCallback((E,B)=>{if(B.startDate&&B.endDate)return;let z=E.currentTarget.ownerSVGElement;if(!z)return;let $=z.createSVGPoint();$.x=E.clientX,$.y=E.clientY;let A=$.matrixTransform(z.getScreenCTM()?.inverse()),ee=x(A.x),X=new Date(ee);X.setDate(X.getDate()+1),l?.(B,ee,X);},[x,l]),T=we.useMemo(()=>{let E=A=>A.map(ee=>{if(ee.subtasks&&ee.subtasks.length>0){let X=E(ee.subtasks),fe=X.filter(P=>P.startDate&&P.endDate);if(fe.length>0){let P=fe.map(ct=>ct.startDate.getTime()),ge=fe.map(ct=>ct.endDate.getTime()),ae=new Date(Math.min(...P)),pt=new Date(Math.max(...ge));return {...ee,subtasks:X,startDate:ee.startDate||ae,endDate:ee.endDate||pt}}return {...ee,subtasks:X}}return ee}),B=(A,ee=[])=>{for(let X of A)ee.push(X),X.subtasks&&X.subtasks.length>0&&(X.isExpanded===void 0||X.isExpanded)&&B(X.subtasks,ee);return ee},z=E(e);return B(z)},[e]),D=we.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let B=E.startDate.getTime(),z=E.endDate.getTime(),$=n.getTime(),A=(B-$)/(1e3*60*60*24),ee=(z-B)/(1e3*60*60*24),X=A*v*s,fe=Math.max(v*s,40),P=Math.max(ee*v*s,fe);return {x:X,width:P}},[n,v,s]),R=we.useMemo(()=>T.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:B,width:z}=D(E),A=T.findIndex(ee=>ee.id===E.id)*r+12;return {id:E.id,x:B,y:A,width:z,height:32}}),[T,D]),_=we.useCallback((E,B,z)=>{if(!z||B===0){h([]);return}let $=K.calculateCascadePreview(e,E,B,T,n,v*s,r,48);h($);},[e,T,n,v,s,r,48]),G=we.useMemo(()=>{let E=[],B=new Date(n);for(;B<=o;){let A=(B.getTime()-n.getTime())/864e5*v*s;if(a==="day")E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:A}),B.setDate(B.getDate()+1);else if(a==="week"){let ee=w(B);E.push({date:new Date(B),label:`Week ${ee}`,x:A}),B.setDate(B.getDate()+7);}else E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:A}),B.setMonth(B.getMonth()+1);}return E},[n,o,a,v,s]),M=we.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*v*s,[n,v,s]),O=Math.max(T.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}),G.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}`)),M>=0&&M<=f&&jsxRuntime.jsx("circle",{cx:M,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}),G.map((E,B)=>{let z=G[B+1]?.x||f,$=k(E.date);return jsxRuntime.jsxs("g",{children:[$&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:z-E.x,height:T.length*r,fill:t.bgWeekend,opacity:1}),jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:T.length*r,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),M>=0&&M<=f&&jsxRuntime.jsx("line",{x1:M,y1:0,x2:M,y2:T.length*r,stroke:t.today,strokeWidth:2,opacity:1}),T.map((E,B)=>{let z=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}`),!z&&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:$=>C($,E),onMouseEnter:$=>{$.currentTarget.setAttribute("fill",t.accentLight),$.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:$=>{$.currentTarget.setAttribute("fill","transparent"),$.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:M>0?M: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}`)}),T.map((E,B)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(z=>{let $=T.find(fe=>fe.id===z);if(!$||!$.startDate||!$.endDate)return null;let A=T.findIndex(fe=>fe.id===z),ee=D($),X=D(E);return jsxRuntime.jsx(Mn,{x1:ee.x+ee.width,y1:A*r+r/2,x2:X.x,y2:B*r+r/2,theme:t,onDelete:()=>m?.(E.id,z)},`dep-${z}-${E.id}`)})),T.map((E,B)=>{if(!E.startDate||!E.endDate)return null;let{x:z,width:$}=D(E),A=B*r+12,ee=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Ln,{task:E,x:z+$/2,y:A+16,theme:t,onClick:d},E.id):ee?jsxRuntime.jsxs("g",{onClick:()=>d?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:z,y:A,width:$,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:z,y1:A,x2:z+$,y2:A,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z,y1:A,x2:z,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z+$,y1:A,x2:z+$,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z,y1:A+32,x2:z+$,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),$>60&&jsxRuntime.jsx("text",{x:z+12,y:A+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:z,y:A,width:$,theme:t,dayWidth:v*s,startDate:n,templates:c,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:p,allTaskPositions:R,onDragMove:_},E.id)}),y.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 Yl=[{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 ql({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:Yl.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:Yl.find(a=>a.value===e)?.name||"Personalizado"})]})}function zn({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:s=false,mode:c=r?"edit":"create",theme:d="dark"}){let i=ke[d]||ke.dark,u={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},l={color:i.textSecondary},[p,m]=we.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[b,y]=we.useState({});we.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 h=()=>{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"),y(f),Object.keys(f).length===0},g=async f=>{if(f.preventDefault(),!!h())try{await o(p),t();}catch(w){console.error("Error submitting task:",w);}},v=(f,w)=>{m(k=>{let x={...k,[f]:w};if(f==="progress"){let C=typeof w=="number"?w:parseInt(w,10);C===100&&k.status!=="completed"?x.status="completed":C>0&&C<100&&k.status==="todo"?x.status="in-progress":C===0&&k.status==="in-progress"&&(x.status="todo");}return x}),b[f]&&y(k=>{let x={...k};return delete x[f],x});};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:c==="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:l,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:p.name,onChange:f=>v("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}),b.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"}),b.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:l,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=>v("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||p.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,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=>v("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||p.isMilestone}),b.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"}),b.endDate]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:p.status,onChange:f=>v("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:l,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(ql,{value:p.color,onChange:f=>v("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:l,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=>v("progress",parseInt(f.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:p.progress<30?"#EF4444":p.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:`${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: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:()=>v("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:p.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.bgSecondary,color:p.progress===f?"#FFFFFF":i.textSecondary,border:`1px solid ${p.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:p.isMilestone,onChange:f=>v("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:l,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: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(x=>x[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(p.assignees||[]).filter(x=>x.name!==f.name);v("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:l,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:p.dependencies?.includes(f.id),onChange:w=>{let k=w.target.checked?[...p.dependencies||[],f.id]:(p.dependencies||[]).filter(x=>x!==f.id);v("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"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var tg=['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"'],rc=()=>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"})]}),rg=()=>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"})}),ag=()=>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"})}),ng=()=>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"})}),og=()=>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:s,onDependencyCreate:c,onDependencyDelete:d}){let[i,u]=we.useState(false),[l,p]=we.useState(false),[m,b]=we.useState([]),[y,h]=we.useState(""),[g,v]=we.useState(false),[f,w]=we.useState(true),k=we.useRef(null),x=we.useRef(null),C=we.useRef(null),{enabled:T=true,placeholder:D='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:_,suggestions:G=tg,maxHistory:M=50}=r;we.useEffect(()=>{x.current&&x.current.scrollIntoView({behavior:"smooth"});},[m]),we.useEffect(()=>{i&&!l&&k.current&&setTimeout(()=>k.current?.focus(),100);},[i,l]);let O=we.useCallback(A=>{if(A.success)switch(A.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":A.taskId&&A.updates&&n?.(A.taskId,A.updates);break;case "create_task":A.newTask&&o?.(A.newTask);break;case "delete_task":A.taskId&&s?.(A.taskId);break;case "link_tasks":A.dependencyFrom&&A.dependencyTo&&c?.(A.dependencyFrom,A.dependencyTo);break;case "unlink_tasks":A.taskId&&A.dependencyFrom&&d?.(A.taskId,A.dependencyFrom);break}},[n,o,s,c,d]),E=we.useCallback(async A=>{if(!A.trim()||g)return;let ee={id:`user-${Date.now()}`,role:"user",content:A,timestamp:new Date};b(fe=>[...fe.slice(-(M-1)),ee]),h(""),w(false),v(true);let X={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(fe=>[...fe,X]);try{if(_){let fe=await _(A,e);b(P=>{let ge=P.filter(pt=>!pt.isLoading),ae={id:`assistant-${Date.now()}`,role:"assistant",content:fe.message,timestamp:new Date,command:fe};return [...ge,ae]}),O(fe);}else b(fe=>[...fe.filter(ge=>!ge.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(fe){b(P=>[...P.filter(ae=>!ae.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${fe instanceof Error?fe.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[g,M,_,e,O]),B=A=>{A.preventDefault(),E(y);},z=A=>{h(A),k.current?.focus();};if(we.useEffect(()=>{let A=ee=>{(ee.metaKey||ee.ctrlKey)&&ee.key==="k"&&(ee.preventDefault(),u(X=>!X),i||p(false)),ee.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[i]),!T)return null;let $={"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.05},whileTap:{scale:.95},className:`fixed ${$[R]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(rc,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:C,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${$[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, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(rc,{}),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(A=>!A),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(ng,{})}),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(ag,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[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:G.slice(0,4).map((A,ee)=>jsxRuntime.jsx("button",{onClick:()=>z(A),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:A.length>30?A.slice(0,30)+"...":A},ee))})]}),m.map(A=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${A.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${A.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:A.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:A.role==="user"?"white":t.textPrimary},children:[A.isLoading?jsxRuntime.jsx(og,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:A.content}),A.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:A.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:A.command.success?"#10B981":"#EF4444"},children:[A.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:A.command.type.replace(/_/g," ")})]})]})},A.id)),jsxRuntime.jsx("div",{ref:x})]}),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:y,onChange:A=>h(A.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:!y.trim()||g,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:y.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:y.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(rg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function ac(e,t=50){let[r,a]=we.useState({past:[],present:e,future:[]}),n=we.useRef(false),o=we.useCallback((i,u=true)=>{a(l=>{let p=typeof i=="function"?i(l.present):i;if(n.current)return {...l,present:p};if(!u)return {...l,present:p};let m=[...l.past,l.present];return m.length>t&&m.shift(),{past:m,present:p,future:[]}});},[t]),s=we.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:l,present:u,future:[i.present,...i.future]}});},[]),c=we.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],l=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:l}});},[]),d=we.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:o,undo:s,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:d}}function nc({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){we.useEffect(()=>{if(!n)return;let o=s=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=c?s.metaKey:s.ctrlKey;if(d&&s.key==="z"&&!s.shiftKey&&r){s.preventDefault(),e();return}if(a){if(!c&&d&&s.key==="y"){s.preventDefault(),t();return}if(c&&d&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var cg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${K.formatDate(e.startDate)} - ${K.formatDate(e.endDate)}`);let r=K.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=>K.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function oc(e){return {...cg,...e}}var fg=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},lc=we.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:o,timeScale:s="week",rowDensity:c="comfortable",showThemeSelector:d=true,showExportButton:i=true,availableUsers:u=[],templates:l,enableAutoCriticalPath:p=true,aiAssistant:m,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:h,onThemeChange:g,onTaskClick:v,onTaskDblClick:f,onTaskContextMenu:w,onTaskUpdate:k,onProgressChange:x,onDependencyCreate:C,onDependencyDelete:T,onBeforeTaskAdd:D,onAfterTaskAdd:R,onBeforeTaskUpdate:_,onAfterTaskUpdate:G}=r,O=we.useContext(Sn)?.theme,[E,B]=we.useState(O||o||"dark"),[z,$]=we.useState(s),[A,ee]=we.useState(c),[X,fe]=we.useState(1),[P,ge]=we.useState(0),[ae,pt]=we.useState(false),[ct,Bt]=we.useState(null),[ie,mt]=we.useState({isOpen:false,x:0,y:0,task:null}),[vt,Ot]=we.useState(null);we.useEffect(()=>{O&&O!==E&&B(O);},[O]),we.useEffect(()=>{o&&o!==E&&B(o);},[o]);let ar=we.useCallback(N=>{B(N),g?.(N);},[g]),{state:ne,setState:se,undo:Qe,redo:Ht,canUndo:Vt,canRedo:ur,clearHistory:zt}=ac(t,50);we.useEffect(()=>{console.log("\u{1F504} GanttBoard: tasks prop changed, syncing to local state"),console.log("\u{1F4E5} Incoming tasks:",t.length,t.map(N=>({id:N.id,name:N.name,startDate:N.startDate?.toISOString?.()}))),se(t);},[t,se]),we.useEffect(()=>{a&&a(ne);},[ne,a]);let[V,U]=we.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}]),Se=we.useMemo(()=>V.filter(N=>N.visible).reduce((N,I)=>N+I.width,0)+60,[V]),ze=ct||Se,Ne=we.useRef(null),de=we.useRef(null),ue=we.useRef(null),Ve=we.useMemo(()=>Sl(E),[E]),le=we.useMemo(()=>({theme:Ve,themeName:E}),[Ve,E]),be=we.useMemo(()=>oc(l),[l]),j=we.useMemo(()=>{if(!p)return ne;let N=K.calculateCriticalPath(ne),I=W=>W.map(J=>({...J,isCriticalPath:N.includes(J.id),subtasks:J.subtasks?I(J.subtasks):void 0}));return I(ne)},[ne,p]),ye=fg(A);nc({undo:Qe,redo:Ht,canUndo:Vt,canRedo:ur,enabled:true}),we.useImperativeHandle(n,()=>({getTask:N=>K.findTaskById(ne,N),addTask:(N,I)=>{se(W=>{if(!I)return [...W,{...N,level:0}];let J=te=>te.map(oe=>oe.id===I?{...oe,subtasks:[...oe.subtasks||[],{...N,parentId:I,level:(oe.level||0)+1}],isExpanded:true}:oe.subtasks?{...oe,subtasks:J(oe.subtasks)}:oe);return J(W)});},updateTask:(N,I)=>{se(W=>{let J=te=>te.map(oe=>oe.id===N?{...oe,...I}:oe.subtasks?{...oe,subtasks:J(oe.subtasks)}:oe);return J(W)});},deleteTask:N=>{se(I=>{let W=J=>J.filter(te=>te.id===N?false:(te.subtasks&&(te.subtasks=W(te.subtasks)),true));return W(I)});},deleteTasks:N=>{se(I=>En(I,N));},duplicateTask:N=>{se(I=>ts(I,[N]));},splitTask:(N,I,W=3)=>{se(J=>K.splitTask(J,N,I,W));},calculateEndDate:K.calculateEndDate,calculateDuration:K.calculateDuration,validateDependency:(N,I)=>!K.validateDependencies(ne,N,I),getAllTasks:()=>K.flattenTasks(ne),getTasksByStatus:N=>K.flattenTasks(ne).filter(I=>I.status===N),getTasksByParent:N=>N?K.findTaskById(ne,N)?.subtasks||[]:ne.filter(W=>!W.parentId),getCriticalPath:()=>K.flattenTasks(ne).filter(N=>N.isCriticalPath),indentTask:N=>{se(I=>Zo(I,[N]));},outdentTask:N=>{se(I=>Qo(I,[N]));},moveTask:(N,I)=>{se(W=>es(W,[N],I));},createSubtask:async N=>{let{tasks:I,newTask:W}=ns(ne,N);if(D){let J=D({...W,parentId:N});if((J instanceof Promise?await J:J)===false)return}se(I),R&&R({...W,parentId:N});},scrollToTask:N=>{let W=K.flattenTasks(ne).findIndex(J=>J.id===N);if(W!==-1&&Ne.current){let J=W*ye;Ne.current.scrollTo({top:J,behavior:"smooth"}),de.current&&de.current.scrollTo({top:J,behavior:"smooth"});}},highlightTask:(N,I=2e3)=>{},expandTask:N=>{se(I=>{let W=J=>J.map(te=>te.id===N?{...te,isExpanded:true}:te.subtasks?{...te,subtasks:W(te.subtasks)}:te);return W(I)});},collapseTask:N=>{se(I=>{let W=J=>J.map(te=>te.id===N?{...te,isExpanded:false}:te.subtasks?{...te,subtasks:W(te.subtasks)}:te);return W(I)});},expandAll:()=>{se(N=>{let I=W=>W.map(J=>({...J,isExpanded:true,subtasks:J.subtasks?I(J.subtasks):void 0}));return I(N)});},collapseAll:()=>{se(N=>{let I=W=>W.map(J=>({...J,isExpanded:false,subtasks:J.subtasks?I(J.subtasks):void 0}));return I(N)});},undo:Qe,redo:Ht,canUndo:()=>Vt,canRedo:()=>ur,clearHistory:zt,exportToPNG:async()=>{if(!ue.current)throw new Error("Gantt container not found");let N=await sc__default.default(ue.current,{backgroundColor:Ve.bgPrimary,scale:2});return new Promise((I,W)=>{N.toBlob(J=>{J?I(J):W(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await K.exportToPDF(ne,N);},exportToExcel:async N=>{await K.exportToExcel(ne,N);},exportToJSON:()=>K.exportToJSON(ne),exportToCSV:()=>K.exportToCSV(ne),importFromJSON:N=>{let I=K.importFromJSON(N);se(I);},getTasks:()=>ne,refresh:()=>{se(N=>[...N]);},clearAll:()=>{se([]);}}),[ne,Qe,Ht,Vt,ur,zt,Ve,ye]);let S=we.useCallback(N=>{U(I=>I.map(W=>W.id===N?{...W,visible:!W.visible}:W));},[]),H=we.useCallback((N,I)=>{U(W=>W.map(J=>{if(J.id!==N)return J;let te=J.minWidth??100,oe=J.maxWidth??800,et=Math.max(te,Math.min(oe,I));return {...J,width:et}}));},[]),pe=we.useCallback(N=>{se(I=>as(I,N)),r.onTaskToggleExpand?.(N);},[r]),Ee=we.useCallback((N,I)=>{if(_&&_(N,I)===false)return;let J=K.findTaskById(ne,N)?.progress,te=et=>et.map(nt=>nt.id===N?{...nt,...I}:nt.subtasks?{...nt,subtasks:te(nt.subtasks)}:nt);se(te(ne));let oe=K.findTaskById(te(ne),N);oe&&(k?.(oe),G?.(oe),I.progress!==void 0&&J!==void 0&&I.progress!==J&&x?.(N,J,I.progress));},[ne,k,_,G,x]),Fe=we.useCallback(N=>{N.length!==0&&(se(I=>Zo(I,N)),r.onTaskIndent?.(N[0]));},[r]),We=we.useCallback(N=>{N.length!==0&&(se(I=>Qo(I,N)),r.onTaskOutdent?.(N[0]));},[r]),Mt=we.useCallback((N,I)=>{N.length!==0&&(se(W=>es(W,N,I)),r.onTaskMove?.(N[0],I));},[r]),$t=we.useCallback(N=>{r.onMultiTaskDelete?r.onMultiTaskDelete(N):(se(I=>En(I,N)),N.forEach(I=>r.onTaskDelete?.(I)));},[r]),qn=we.useCallback(N=>{se(I=>ts(I,N)),N.forEach(I=>r.onTaskDuplicate?.(I));},[r]),ga=we.useCallback((N,I)=>{se(W=>{let{tasks:J,newTask:te}=Ol(W,N,I);return D&&D(te)===false?W:(r.onTaskCreate?.(te.parentId,te.position||0),R?.(te),J)});},[r,D,R]),ha=we.useCallback((N,I)=>{se(W=>rs(W,N,I)),r.onTaskRename?.(N,I);},[r]),ld=we.useCallback(N=>{se(I=>{let{tasks:W}=ns(I,N);return r.onTaskCreate?.(N,0),W});},[r]),cd=we.useCallback((N,I,W)=>{let J=N.startDate?Math.round((I.getTime()-N.startDate.getTime())/864e5):0,te=nt=>nt.map(pr=>pr.id===N.id?{...pr,startDate:I,endDate:W,...N.segments&&{segments:N.segments}}:pr.subtasks?{...pr,subtasks:te(pr.subtasks)}:pr),oe=te(ne);oe=K.autoScheduleDependents(oe,N.id,J),se(oe);let et={...N,startDate:I,endDate:W};k?.(et);},[ne,k]),dd=we.useCallback((N,I)=>{w?.(N,I),mt({isOpen:true,x:I.clientX,y:I.clientY,task:N});},[w]),ud=we.useCallback((N,I)=>{let W=K.splitTask(ne,N.id,I);se(W),mt({isOpen:false,x:0,y:0,task:null});},[ne]),Hs=we.useCallback(N=>{f?.(N),Ot(N);},[f]),Vs=we.useCallback((N,I,W)=>{let J=new Map,te=Lr=>{Lr.forEach(Fr=>{Fr.dependencies&&J.set(Fr.id,Fr.dependencies),Fr.subtasks&&te(Fr.subtasks);});};te(W);let oe=J.get(I)||[];J.set(I,[...oe,N]);let et=new Set,nt=new Set,pr=Lr=>{if(!et.has(Lr)){et.add(Lr),nt.add(Lr);let Fr=J.get(Lr)||[];for(let Xn of Fr){if(!et.has(Xn)&&pr(Xn))return true;if(nt.has(Xn))return true}}return nt.delete(Lr),false};return pr(I)},[]),Ks=we.useCallback((N,I)=>{if(Vs(N.id,I,ne)){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 W=J=>J.map(
|
|
278
|
+
Task dependencies must flow in one direction only.`);return}let W=J=>J.map(te=>{if(te.id===I){let oe=te.dependencies||[];if(!oe.includes(N.id))return {...te,dependencies:[...oe,N.id]}}return te.subtasks?{...te,subtasks:W(te.subtasks)}:te});se(W(ne)),C?.(N.id,I);},[ne,C,Vs]),js=we.useCallback((N,I)=>{let W=J=>J.map(te=>{if(te.id===N&&te.dependencies){let oe=te.dependencies.filter(et=>et!==I);return {...te,dependencies:oe}}return te.subtasks?{...te,subtasks:W(te.subtasks)}:te});se(W(ne)),T?.(N,I);},[ne,T]),{startDate:pd,endDate:md}=we.useMemo(()=>{let N=ne.filter(oe=>oe.startDate&&oe.endDate);if(N.length===0){let oe=new Date,et=new Date(oe);et.setDate(et.getDate()-30);let nt=new Date(oe);return nt.setDate(nt.getDate()+60),{startDate:et,endDate:nt}}let I=N.flatMap(oe=>[oe.startDate,oe.endDate]).filter(oe=>oe!==void 0),W=new Date(Math.min(...I.map(oe=>oe.getTime()))),J=new Date(Math.max(...I.map(oe=>oe.getTime()))),te=z==="day"?7:z==="week"?14:30;return W.setDate(W.getDate()-te),J.setDate(J.getDate()+te),{startDate:W,endDate:J}},[ne,z]),fd=we.useCallback(async()=>{if(!ue.current)return;let N=await sc__default.default(ue.current,{backgroundColor:Ve.bgPrimary,scale:2}),I=document.createElement("a");I.download="gantt-chart.png",I.href=N.toDataURL("image/png"),I.click();},[Ve]),gd=we.useCallback(async()=>{await K.exportToPDF(ne);},[ne]),hd=we.useCallback(async()=>{await K.exportToExcel(ne);},[ne]),vd=we.useCallback(()=>{let N=K.exportToCSV(ne),I=new Blob([N],{type:"text/csv;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(I),W.download="gantt-chart.csv",W.click(),URL.revokeObjectURL(W.href);},[ne]),bd=we.useCallback(()=>{let N=K.exportToJSON(ne),I=new Blob([N],{type:"application/json;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(I),W.download="gantt-chart.json",W.click(),URL.revokeObjectURL(W.href);},[ne]),yd=we.useCallback(()=>{K.exportToMSProject(ne,"Gantt Project","project.xml");},[ne]),xd=N=>{N.preventDefault(),pt(true);};return we.useEffect(()=>{let N=de.current,I=Ne.current;if(!N||!I)return;let W=I.querySelector(".gantt-taskgrid-content"),J=()=>{let et=N.scrollTop;ge(et),W&&(W.style.transform=`translateY(-${et}px)`);},te=et=>{if(ae){let nt=et.clientX;nt>300&&nt<window.innerWidth-400&&Bt(nt);}},oe=()=>{pt(false);};return N.addEventListener("scroll",J),document.addEventListener("mousemove",te),document.addEventListener("mouseup",oe),()=>{N.removeEventListener("scroll",J),document.removeEventListener("mousemove",te),document.removeEventListener("mouseup",oe);}},[ae]),jsxRuntime.jsx(go.Provider,{value:le,children:jsxRuntime.jsxs("div",{ref:ue,className:"flex flex-col h-full w-full",style:{backgroundColor:Ve.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Dn,{theme:Ve,timeScale:z,onTimeScaleChange:$,zoom:X,onZoomChange:fe,currentTheme:E,onThemeChange:ar,rowDensity:A,onRowDensityChange:ee,showThemeSelector:d,showCreateTaskButton:b,createTaskLabel:y,onCreateTask:h,onExportPNG:i?fd:void 0,onExportPDF:i?gd:void 0,onExportExcel:i?hd:void 0,onExportCSV:i?vd:void 0,onExportJSON:i?bd:void 0,onExportMSProject:i?yd:void 0}),jsxRuntime.jsxs("div",{ref:Ne,className:"flex-1 flex min-h-0",style:{overflow:"hidden"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:ze,overflow:"hidden"},children:jsxRuntime.jsx(Rn,{tasks:j,theme:Ve,rowHeight:ye,availableUsers:u,templates:be,onTaskClick:v,onTaskDblClick:Hs,onTaskContextMenu:w,onTaskToggle:pe,scrollTop:P,columns:V,onToggleColumn:S,onColumnResize:H,onTaskUpdate:Ee,onTaskIndent:Fe,onTaskOutdent:We,onTaskMove:Mt,onMultiTaskDelete:$t,onTaskDuplicate:qn,onTaskCreate:ga,onTaskRename:ha,onCreateSubtask:ld,onOpenTaskModal:v?N=>v(N):void 0})}),jsxRuntime.jsx("div",{className:"relative flex-shrink-0 cursor-col-resize group",style:{width:8,backgroundColor:ae?Ve.accent:Ve.border,transition:"background-color 0.2s"},onMouseDown:xd,children:jsxRuntime.jsx(framerMotion.motion.div,{className:"absolute inset-y-0 left-1/2 -translate-x-1/2",style:{width:2,backgroundColor:Ve.accent},initial:{opacity:0},animate:{opacity:ae?1:0},whileHover:{opacity:1}})}),jsxRuntime.jsx("div",{ref:de,className:"gantt-timeline-scroll flex-1 overflow-auto",style:{minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(On,{tasks:j,theme:Ve,rowHeight:ye,timeScale:z,startDate:pd,endDate:md,zoom:X,templates:be,onTaskClick:v,onTaskDblClick:Hs,onTaskContextMenu:dd,onTaskDateChange:cd,onDependencyCreate:Ks,onDependencyDelete:js})})]}),ie.task&&jsxRuntime.jsx(ca,{isOpen:ie.isOpen,x:ie.x,y:ie.y,theme:Ve,onClose:()=>mt({isOpen:false,x:0,y:0,task:null}),items:[{id:"split",label:"Split Task",icon:Pt.Split,onClick:()=>{if(!ie.task?.startDate||!ie.task?.endDate){console.warn("Cannot split task without dates");return}let N=ie.task.startDate.getTime(),I=ie.task.endDate.getTime(),W=N+(I-N)/2,J=new Date(W);ud(ie.task,J);},disabled:!ie.task?.startDate||!ie.task?.endDate}]}),vt&&jsxRuntime.jsx(zn,{isOpen:true,onClose:()=>Ot(null),task:vt,onSubmit:N=>{Ee(vt.id,N),Ot(null);},mode:"edit",theme:E}),m?.enabled&&jsxRuntime.jsx($n,{tasks:ne,theme:Ve,config:m,onTasksUpdate:se,onTaskUpdate:Ee,onTaskCreate:N=>{se(I=>[...I,N]);},onTaskDelete:N=>{se(I=>En(I,[N]));},onDependencyCreate:(N,I)=>{let W=K.findTaskById(ne,N);W&&Ks(W,I);},onDependencyDelete:js})]})})});var cc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
279
279
|
|
|
280
280
|
AVAILABLE COMMANDS:
|
|
281
281
|
1. move_task - Move a task to a different date
|
|
@@ -326,7 +326,7 @@ ${r.join(`
|
|
|
326
326
|
}`}function ja(e,t="asakaa"){let r=[],a=zs(e);for(let[n,o]of Object.entries(a)){let s=`--${t}-color-${n}`;r.push(` ${s}: ${o};`);}return `:root {
|
|
327
327
|
${r.join(`
|
|
328
328
|
`)}
|
|
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:"#
|
|
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:"#3b82f6",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:"#3b82f6",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:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function Ws(e=Yn,t="asakaa"){let r=$s(t),a=ja(e,t);return `${r}
|
|
330
330
|
|
|
331
331
|
${a}`}function sd(){return `/**
|
|
332
332
|
* ASAKAA Design Tokens
|