@libxai/board 0.17.6 → 0.17.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +60 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +60 -60
- package/dist/index.js.map +1 -1
- package/dist/styles.css +75 -10
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let r=Ai(t[0]),a=[],n=new Map,o=[];for(let s=1;s<t.length;s++)try{let c=Ai(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,v)=>{i[m]=c[v]||"";});let p=i.Column||"Unnamed";n.has(p)||n.set(p,{id:`col-${n.size+1}`,title:p,position:n.size+1,cardIds:[]});let l=n.get(p),d={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(d),l.cardIds.push(d.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 Ai(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 Li(e,t){switch(t){case "json":return Au(e);case "csv":return Lu(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Fi(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 dn(){return typeof window<"u"}function Sr(e){return ko(e)?(e.nodeName||"").toLowerCase():"#document"}function Nt(e){var t;return (e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xt(e){var t;return (t=(ko(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ko(e){return dn()?e instanceof Node||e instanceof Nt(e).Node:false}function ft(e){return dn()?e instanceof Element||e instanceof Nt(e).Element:false}function Gt(e){return dn()?e instanceof HTMLElement||e instanceof Nt(e).HTMLElement:false}function xo(e){return !dn()||typeof ShadowRoot>"u"?false:e instanceof ShadowRoot||e instanceof Nt(e).ShadowRoot}var Fu=new Set(["inline","contents"]);function na(e){let{overflow:t,overflowX:r,overflowY:a,display:n}=It(e);return /auto|scroll|overlay|hidden|clip/.test(t+a+r)&&!Fu.has(n)}var Bu=new Set(["table","td","th"]);function Bi(e){return Bu.has(Sr(e))}var Ou=[":popover-open",":modal"];function Da(e){return Ou.some(t=>{try{return e.matches(t)}catch{return false}})}var zu=["transform","translate","scale","rotate","perspective"],$u=["transform","translate","scale","rotate","perspective","filter"],Wu=["paint","layout","strict","content"];function un(e){let t=Sa(),r=ft(e)?It(e):e;return zu.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)||$u.some(a=>(r.willChange||"").includes(a))||Wu.some(a=>(r.contain||"").includes(a))}function Oi(e){let t=cr(e);for(;Gt(t)&&!Nr(t);){if(un(t))return t;if(Da(t))return null;t=cr(t);}return null}function Sa(){return typeof CSS>"u"||!CSS.supports?false:CSS.supports("-webkit-backdrop-filter","none")}var Uu=new Set(["html","body","#document"]);function Nr(e){return Uu.has(Sr(e))}function It(e){return Nt(e).getComputedStyle(e)}function Na(e){return ft(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function cr(e){if(Sr(e)==="html")return e;let t=e.assignedSlot||e.parentNode||xo(e)&&e.host||Xt(e);return xo(t)?t.host:t}function zi(e){let t=cr(e);return Nr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gt(t)&&na(t)?t:zi(t)}function vr(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=true);let n=zi(e),o=n===((a=e.ownerDocument)==null?void 0:a.body),s=Nt(n);if(o){let c=mn(s);return t.concat(s,s.visualViewport||[],na(n)?n:[],c&&r?vr(c):[])}return t.concat(n,vr(n,[],r))}function mn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var dr=Math.min,Et=Math.max,Pa=Math.round,Ra=Math.floor,Jt=e=>({x:e,y:e}),Gu={left:"right",right:"left",bottom:"top",top:"bottom"},_u={start:"end",end:"start"};function fn(e,t,r){return Et(e,dr(t,r))}function Ur(e,t){return typeof e=="function"?e(t):e}function yr(e){return e.split("-")[0]}function Gr(e){return e.split("-")[1]}function wo(e){return e==="x"?"y":"x"}function gn(e){return e==="y"?"height":"width"}var Hu=new Set(["top","bottom"]);function ur(e){return Hu.has(yr(e))?"y":"x"}function hn(e){return wo(ur(e))}function Ui(e,t,r){r===void 0&&(r=false);let a=Gr(e),n=hn(e),o=gn(n),s=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Ea(s)),[s,Ea(s)]}function Gi(e){let t=Ea(e);return [pn(e),t,pn(t)]}function pn(e){return e.replace(/start|end/g,t=>_u[t])}var $i=["left","right"],Wi=["right","left"],Vu=["top","bottom"],ju=["bottom","top"];function Ku(e,t,r){switch(e){case "top":case "bottom":return r?t?Wi:$i:t?$i:Wi;case "left":case "right":return t?Vu:ju;default:return []}}function _i(e,t,r,a){let n=Gr(e),o=Ku(yr(e),r==="start",a);return n&&(o=o.map(s=>s+"-"+n),t&&(o=o.concat(o.map(pn)))),o}function Ea(e){return e.replace(/left|right|bottom|top/g,t=>Gu[t])}function Yu(e){return {top:0,right:0,bottom:0,left:0,...e}}function Co(e){return typeof e!="number"?Yu(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 Xu=typeof document<"u",Ju=function(){},Ia=Xu?Se.useLayoutEffect:Ju,Zu={...Se__namespace};var Qu=Zu.useInsertionEffect,em=Qu||(e=>e());function Hi(e){let t=Se__namespace.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return em(()=>{t.current=e;}),Se__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 Vi(e,t,r){let{reference:a,floating:n}=e,o=ur(t),s=hn(t),c=gn(s),u=yr(t),i=o==="y",p=a.x+a.width/2-n.width/2,l=a.y+a.height/2-n.height/2,d=a[c]/2-n[c]/2,m;switch(u){case "top":m={x:p,y:a.y-n.height};break;case "bottom":m={x:p,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(Gr(t)){case "start":m[s]-=d*(r&&i?-1:1);break;case "end":m[s]+=d*(r&&i?-1:1);break}return m}var ji=async(e,t,r)=>{let{placement:a="bottom",strategy:n="absolute",middleware:o=[],platform:s}=r,c=o.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(t)),i=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:p,y:l}=Vi(i,a,u),d=a,m={},v=0;for(let y=0;y<c.length;y++){let{name:h,fn:g}=c[y],{x:b,y:f,data:k,reset:w}=await g({x:p,y:l,initialPlacement:a,placement:d,strategy:n,middlewareData:m,rects:i,platform:s,elements:{reference:e,floating:t}});p=b??p,l=f??l,m={...m,[h]:{...m[h],...k}},w&&v<=50&&(v++,typeof w=="object"&&(w.placement&&(d=w.placement),w.rects&&(i=w.rects===true?await s.getElementRects({reference:e,floating:t,strategy:n}):w.rects),{x:p,y:l}=Vi(i,d,u)),y=-1);}return {x:p,y:l,placement:d,strategy:n,middlewareData:m}};async function bn(e,t){var r;t===void 0&&(t={});let{x:a,y:n,platform:o,rects:s,elements:c,strategy:u}=e,{boundary:i="clippingAncestors",rootBoundary:p="viewport",elementContext:l="floating",altBoundary:d=false,padding:m=0}=Ur(t,e),v=Co(m),h=c[d?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:p,strategy:u})),b=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)),k=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},w=_r(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:f,strategy:u}):b);return {top:(g.top-w.top+v.top)/k.y,bottom:(w.bottom-g.bottom+v.bottom)/k.y,left:(g.left-w.left+v.left)/k.x,right:(w.right-g.right+v.right)/k.x}}var Ki=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:a,placement:n,rects:o,platform:s,elements:c,middlewareData:u}=t,{element:i,padding:p=0}=Ur(e,t)||{};if(i==null)return {};let l=Co(p),d={x:r,y:a},m=hn(n),v=gn(m),y=await s.getDimensions(i),h=m==="y",g=h?"top":"left",b=h?"bottom":"right",f=h?"clientHeight":"clientWidth",k=o.reference[v]+o.reference[m]-d[m]-o.floating[v],w=d[m]-o.reference[m],x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i)),D=x?x[f]:0;(!D||!await(s.isElement==null?void 0:s.isElement(x)))&&(D=c.floating[f]||o.floating[v]);let C=k/2-w/2,N=D/2-y[v]/2-1,T=dr(l[g],N),$=dr(l[b],N),z=T,R=D-y[v]-$,W=D/2-y[v]/2+C,E=fn(z,W,R),O=!u.arrow&&Gr(n)!=null&&W!==E&&o.reference[v]/2-(W<z?T:$)-y[v]/2<0,G=O?W<z?W-z:W-R:0;return {[m]:d[m]+G,data:{[m]:E,centerOffset:W-E-G,...O&&{alignmentOffset:G}},reset:O}}});var Yi=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:u,elements:i}=t,{mainAxis:p=true,crossAxis:l=true,fallbackPlacements:d,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:y=true,...h}=Ur(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return {};let g=yr(n),b=ur(c),f=yr(c)===c,k=await(u.isRTL==null?void 0:u.isRTL(i.floating)),w=d||(f||!y?[Ea(c)]:Gi(c)),x=v!=="none";!d&&x&&w.push(..._i(c,y,v,k));let D=[c,...w],C=await bn(t,h),N=[],T=((a=o.flip)==null?void 0:a.overflows)||[];if(p&&N.push(C[g]),l){let W=Ui(n,s,k);N.push(C[W[0]],C[W[1]]);}if(T=[...T,{placement:n,overflows:N}],!N.every(W=>W<=0)){var $,z;let W=((($=o.flip)==null?void 0:$.index)||0)+1,E=D[W];if(E&&(!(l==="alignment"?b!==ur(E):false)||T.every(U=>ur(U.placement)===b?U.overflows[0]>0:true)))return {data:{index:W,overflows:T},reset:{placement:E}};let O=(z=T.filter(G=>G.overflows[0]<=0).sort((G,U)=>G.overflows[1]-U.overflows[1])[0])==null?void 0:z.placement;if(!O)switch(m){case "bestFit":{var R;let G=(R=T.filter(U=>{if(x){let A=ur(U.placement);return A===b||A==="y"}return true}).map(U=>[U.placement,U.overflows.filter(A=>A>0).reduce((A,K)=>A+K,0)]).sort((U,A)=>U[1]-A[1])[0])==null?void 0:R[0];G&&(O=G);break}case "initialPlacement":O=c;break}if(n!==O)return {reset:{placement:O}}}return {}}}};var tm=new Set(["left","top"]);async function rm(e,t){let{placement:r,platform:a,elements:n}=e,o=await(a.isRTL==null?void 0:a.isRTL(n.floating)),s=yr(r),c=Gr(r),u=ur(r)==="y",i=tm.has(s)?-1:1,p=o&&u?-1:1,l=Ur(t,e),{mainAxis:d,crossAxis:m,alignmentAxis:v}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return c&&typeof v=="number"&&(m=c==="end"?v*-1:v),u?{x:m*p,y:d*i}:{x:d*i,y:m*p}}var qi=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,u=await rm(t,e);return s===((r=c.offset)==null?void 0:r.placement)&&(a=c.arrow)!=null&&a.alignmentOffset?{}:{x:n+u.x,y:o+u.y,data:{...u,placement:s}}}}},Xi=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:b}=h;return {x:g,y:b}}},...u}=Ur(e,t),i={x:r,y:a},p=await bn(t,u),l=ur(yr(n)),d=wo(l),m=i[d],v=i[l];if(o){let h=d==="y"?"top":"left",g=d==="y"?"bottom":"right",b=m+p[h],f=m-p[g];m=fn(b,m,f);}if(s){let h=l==="y"?"top":"left",g=l==="y"?"bottom":"right",b=v+p[h],f=v-p[g];v=fn(b,v,f);}let y=c.fn({...t,[d]:m,[l]:v});return {...y,data:{x:y.x-r,y:y.y-a,enabled:{[d]:o,[l]:s}}}}}};var Ji=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:u=()=>{},...i}=Ur(e,t),p=await bn(t,i),l=yr(n),d=Gr(n),m=ur(n)==="y",{width:v,height:y}=o.floating,h,g;l==="top"||l==="bottom"?(h=l,g=d===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(g=l,h=d==="end"?"top":"bottom");let b=y-p.top-p.bottom,f=v-p.left-p.right,k=dr(y-p[h],b),w=dr(v-p[g],f),x=!t.middlewareData.shift,D=k,C=w;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(C=f),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(D=b),x&&!d){let T=Et(p.left,0),$=Et(p.right,0),z=Et(p.top,0),R=Et(p.bottom,0);m?C=v-2*(T!==0||$!==0?T+$:Et(p.left,p.right)):D=y-2*(z!==0||R!==0?z+R:Et(p.top,p.bottom));}await u({...t,availableWidth:C,availableHeight:D});let N=await s.getDimensions(c.floating);return v!==N.width||y!==N.height?{reset:{rects:true}}:{}}}};function tl(e){let t=It(e),r=parseFloat(t.width)||0,a=parseFloat(t.height)||0,n=Gt(e),o=n?e.offsetWidth:r,s=n?e.offsetHeight:a,c=Pa(r)!==o||Pa(a)!==s;return c&&(r=o,a=s),{width:r,height:a,$:c}}function Do(e){return ft(e)?e:e.contextElement}function oa(e){let t=Do(e);if(!Gt(t))return Jt(1);let r=t.getBoundingClientRect(),{width:a,height:n,$:o}=tl(t),s=(o?Pa(r.width):r.width)/a,c=(o?Pa(r.height):r.height)/n;return (!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}var am=Jt(0);function rl(e){let t=Nt(e);return !Sa()||!t.visualViewport?am:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nm(e,t,r){return t===void 0&&(t=false),!r||t&&r!==Nt(e)?false:t}function Hr(e,t,r,a){t===void 0&&(t=false),r===void 0&&(r=false);let n=e.getBoundingClientRect(),o=Do(e),s=Jt(1);t&&(a?ft(a)&&(s=oa(a)):s=oa(e));let c=nm(o,r,a)?rl(o):Jt(0),u=(n.left+c.x)/s.x,i=(n.top+c.y)/s.y,p=n.width/s.x,l=n.height/s.y;if(o){let d=Nt(o),m=a&&ft(a)?Nt(a):a,v=d,y=mn(v);for(;y&&a&&m!==v;){let h=oa(y),g=y.getBoundingClientRect(),b=It(y),f=g.left+(y.clientLeft+parseFloat(b.paddingLeft))*h.x,k=g.top+(y.clientTop+parseFloat(b.paddingTop))*h.y;u*=h.x,i*=h.y,p*=h.x,l*=h.y,u+=f,i+=k,v=Nt(y),y=mn(v);}}return _r({width:p,height:l,x:u,y:i})}function vn(e,t){let r=Na(e).scrollLeft;return t?t.left+r:Hr(Xt(e)).left+r}function al(e,t){let r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-vn(e,r),n=r.top+t.scrollTop;return {x:a,y:n}}function om(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e,o=n==="fixed",s=Xt(a),c=t?Da(t.floating):false;if(a===s||c&&o)return r;let u={scrollLeft:0,scrollTop:0},i=Jt(1),p=Jt(0),l=Gt(a);if((l||!l&&!o)&&((Sr(a)!=="body"||na(s))&&(u=Na(a)),Gt(a))){let m=Hr(a);i=oa(a),p.x=m.x+a.clientLeft,p.y=m.y+a.clientTop;}let d=s&&!l&&!o?al(s,u):Jt(0);return {width:r.width*i.x,height:r.height*i.y,x:r.x*i.x-u.scrollLeft*i.x+p.x+d.x,y:r.y*i.y-u.scrollTop*i.y+p.y+d.y}}function sm(e){return Array.from(e.getClientRects())}function im(e){let t=Xt(e),r=Na(e),a=e.ownerDocument.body,n=Et(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),o=Et(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),s=-r.scrollLeft+vn(e),c=-r.scrollTop;return It(a).direction==="rtl"&&(s+=Et(t.clientWidth,a.clientWidth)-n),{width:n,height:o,x:s,y:c}}var Zi=25;function lm(e,t){let r=Nt(e),a=Xt(e),n=r.visualViewport,o=a.clientWidth,s=a.clientHeight,c=0,u=0;if(n){o=n.width,s=n.height;let p=Sa();(!p||p&&t==="fixed")&&(c=n.offsetLeft,u=n.offsetTop);}let i=vn(a);if(i<=0){let p=a.ownerDocument,l=p.body,d=getComputedStyle(l),m=p.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,v=Math.abs(a.clientWidth-l.clientWidth-m);v<=Zi&&(o-=v);}else i<=Zi&&(o+=i);return {width:o,height:s,x:c,y:u}}var cm=new Set(["absolute","fixed"]);function dm(e,t){let r=Hr(e,true,t==="fixed"),a=r.top+e.clientTop,n=r.left+e.clientLeft,o=Gt(e)?oa(e):Jt(1),s=e.clientWidth*o.x,c=e.clientHeight*o.y,u=n*o.x,i=a*o.y;return {width:s,height:c,x:u,y:i}}function Qi(e,t,r){let a;if(t==="viewport")a=lm(e,r);else if(t==="document")a=im(Xt(e));else if(ft(t))a=dm(t,r);else {let n=rl(e);a={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height};}return _r(a)}function nl(e,t){let r=cr(e);return r===t||!ft(r)||Nr(r)?false:It(r).position==="fixed"||nl(r,t)}function um(e,t){let r=t.get(e);if(r)return r;let a=vr(e,[],false).filter(c=>ft(c)&&Sr(c)!=="body"),n=null,o=It(e).position==="fixed",s=o?cr(e):e;for(;ft(s)&&!Nr(s);){let c=It(s),u=un(s);!u&&c.position==="fixed"&&(n=null),(o?!u&&!n:!u&&c.position==="static"&&!!n&&cm.has(n.position)||na(s)&&!u&&nl(e,s))?a=a.filter(p=>p!==s):n=c,s=cr(s);}return t.set(e,a),a}function mm(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e,s=[...r==="clippingAncestors"?Da(t)?[]:um(t,this._c):[].concat(r),a],c=s[0],u=s.reduce((i,p)=>{let l=Qi(t,p,n);return i.top=Et(l.top,i.top),i.right=dr(l.right,i.right),i.bottom=dr(l.bottom,i.bottom),i.left=Et(l.left,i.left),i},Qi(t,c,n));return {width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function pm(e){let{width:t,height:r}=tl(e);return {width:t,height:r}}function fm(e,t,r){let a=Gt(t),n=Xt(t),o=r==="fixed",s=Hr(e,true,o,t),c={scrollLeft:0,scrollTop:0},u=Jt(0);function i(){u.x=vn(n);}if(a||!a&&!o)if((Sr(t)!=="body"||na(n))&&(c=Na(t)),a){let m=Hr(t,true,o,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop;}else n&&i();o&&!a&&n&&i();let p=n&&!a&&!o?al(n,c):Jt(0),l=s.left+c.scrollLeft-u.x-p.x,d=s.top+c.scrollTop-u.y-p.y;return {x:l,y:d,width:s.width,height:s.height}}function To(e){return It(e).position==="static"}function el(e,t){if(!Gt(e)||It(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Xt(e)===r&&(r=r.ownerDocument.body),r}function ol(e,t){let r=Nt(e);if(Da(e))return r;if(!Gt(e)){let n=cr(e);for(;n&&!Nr(n);){if(ft(n)&&!To(n))return n;n=cr(n);}return r}let a=el(e,t);for(;a&&Bi(a)&&To(a);)a=el(a,t);return a&&Nr(a)&&To(a)&&!un(a)?r:a||Oi(e)||r}var gm=async function(e){let t=this.getOffsetParent||ol,r=this.getDimensions,a=await r(e.floating);return {reference:fm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function hm(e){return It(e).direction==="rtl"}var So={convertOffsetParentRelativeRectToViewportRelativeRect:om,getDocumentElement:Xt,getClippingRect:mm,getOffsetParent:ol,getElementRects:gm,getClientRects:sm,getDimensions:pm,getScale:oa,isElement:ft,isRTL:hm};function sl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bm(e,t){let r=null,a,n=Xt(e);function o(){var c;clearTimeout(a),(c=r)==null||c.disconnect(),r=null;}function s(c,u){c===void 0&&(c=false),u===void 0&&(u=1),o();let i=e.getBoundingClientRect(),{left:p,top:l,width:d,height:m}=i;if(c||t(),!d||!m)return;let v=Ra(l),y=Ra(n.clientWidth-(p+d)),h=Ra(n.clientHeight-(l+m)),g=Ra(p),f={rootMargin:-v+"px "+-y+"px "+-h+"px "+-g+"px",threshold:Et(0,dr(1,u))||1},k=true;function w(x){let D=x[0].intersectionRatio;if(D!==u){if(!k)return s();D?s(false,D):a=setTimeout(()=>{s(false,1e-7);},1e3);}D===1&&!sl(i,e.getBoundingClientRect())&&s(),k=false;}try{r=new IntersectionObserver(w,{...f,root:n.ownerDocument});}catch{r=new IntersectionObserver(w,f);}r.observe(e);}return s(true),o}function yn(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:u=false}=a,i=Do(e),p=n||o?[...i?vr(i):[],...vr(t)]:[];p.forEach(g=>{n&&g.addEventListener("scroll",r,{passive:true}),o&&g.addEventListener("resize",r);});let l=i&&c?bm(i,r):null,d=-1,m=null;s&&(m=new ResizeObserver(g=>{let[b]=g;b&&b.target===i&&m&&(m.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var f;(f=m)==null||f.observe(t);})),r();}),i&&!u&&m.observe(i),m.observe(t));let v,y=u?Hr(e):null;u&&h();function h(){let g=Hr(e);y&&!sl(y,g)&&r(),y=g,v=requestAnimationFrame(h);}return r(),()=>{var g;p.forEach(b=>{n&&b.removeEventListener("scroll",r),o&&b.removeEventListener("resize",r);}),l?.(),(g=m)==null||g.disconnect(),m=null,u&&cancelAnimationFrame(v);}}var il=qi;var ll=Xi,cl=Yi,dl=Ji;var No=Ki;var xn=(e,t,r)=>{let a=new Map,n={platform:So,...r},o={...n.platform,_c:a};return ji(e,t,{...n,platform:o})};var ym=typeof document<"u",xm=function(){},kn=ym?Se.useLayoutEffect:xm;function wn(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(!wn(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)&&!wn(e[o],t[o]))return false}return true}return e!==e&&t!==t}function fl(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ul(e,t){let r=fl(e);return Math.round(t*r)/r}function Eo(e){let t=Se__namespace.useRef(e);return kn(()=>{t.current=e;}),t}function gl(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:u,open:i}=e,[p,l]=Se__namespace.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:false}),[d,m]=Se__namespace.useState(a);wn(d,a)||m(a);let[v,y]=Se__namespace.useState(null),[h,g]=Se__namespace.useState(null),b=Se__namespace.useCallback(U=>{U!==x.current&&(x.current=U,y(U));},[]),f=Se__namespace.useCallback(U=>{U!==D.current&&(D.current=U,g(U));},[]),k=o||v,w=s||h,x=Se__namespace.useRef(null),D=Se__namespace.useRef(null),C=Se__namespace.useRef(p),N=u!=null,T=Eo(u),$=Eo(n),z=Eo(i),R=Se__namespace.useCallback(()=>{if(!x.current||!D.current)return;let U={placement:t,strategy:r,middleware:d};$.current&&(U.platform=$.current),xn(x.current,D.current,U).then(A=>{let K={...A,isPositioned:z.current!==false};W.current&&!wn(C.current,K)&&(C.current=K,pl__namespace.flushSync(()=>{l(K);}));});},[d,t,r,$,z]);kn(()=>{i===false&&C.current.isPositioned&&(C.current.isPositioned=false,l(U=>({...U,isPositioned:false})));},[i]);let W=Se__namespace.useRef(false);kn(()=>(W.current=true,()=>{W.current=false;}),[]),kn(()=>{if(k&&(x.current=k),w&&(D.current=w),k&&w){if(T.current)return T.current(k,w,R);R();}},[k,w,R,T,N]);let E=Se__namespace.useMemo(()=>({reference:x,floating:D,setReference:b,setFloating:f}),[b,f]),O=Se__namespace.useMemo(()=>({reference:k,floating:w}),[k,w]),G=Se__namespace.useMemo(()=>{let U={position:r,left:0,top:0};if(!O.floating)return U;let A=ul(O.floating,p.x),K=ul(O.floating,p.y);return c?{...U,transform:"translate("+A+"px, "+K+"px)",...fl(O.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:A,top:K}},[r,c,O.floating,p.x,p.y]);return Se__namespace.useMemo(()=>({...p,update:R,refs:E,elements:O,floatingStyles:G}),[p,R,E,O,G])}var km=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?No({element:a.current,padding:n}).fn(r):{}:a?No({element:a,padding:n}).fn(r):{}}}},Cn=(e,t)=>({...il(e),options:[e,t]}),Po=(e,t)=>({...ll(e),options:[e,t]});var Ro=(e,t)=>({...cl(e),options:[e,t]}),Mo=(e,t)=>({...dl(e),options:[e,t]});var Io=(e,t)=>({...km(e),options:[e,t]});function yl(e){let t=Se__namespace.useRef(void 0),r=Se__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 Se__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 Pm={...Se__namespace},hl=false,Rm=0,bl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Rm++;function Mm(){let[e,t]=Se__namespace.useState(()=>hl?bl():void 0);return Ia(()=>{e==null&&t(bl());},[]),Se__namespace.useEffect(()=>{hl=true;},[]),e}var Im=Pm.useId,xl=Im||Mm,Aa;process.env.NODE_ENV!=="production"&&(Aa=new Set);function Am(){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=Aa)!=null&&e.has(n))){var o;(o=Aa)==null||o.add(n),console.warn(n);}}function Lm(){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=Aa)!=null&&e.has(n))){var o;(o=Aa)==null||o.add(n),console.error(n);}}var kl=Se__namespace.forwardRef(function(t,r){let{context:{placement:a,elements:{floating:n},middlewareData:{arrow:o,shift:s}},width:c=14,height:u=7,tipRadius:i=0,strokeWidth:p=0,staticOffset:l,stroke:d,d:m,style:{transform:v,...y}={},...h}=t;process.env.NODE_ENV!=="production"&&(r||Am("The `ref` prop is required for `FloatingArrow`."));let g=xl(),[b,f]=Se__namespace.useState(false);if(Ia(()=>{if(!n)return;It(n).direction==="rtl"&&f(true);},[n]),!n)return null;let[k,w]=a.split("-"),x=k==="top"||k==="bottom",D=l;(x&&s!=null&&s.x||!x&&s!=null&&s.y)&&(D=null);let C=p*2,N=C/2,T=c/2*(i/-8+1),$=u/2*i/4,z=!!m,R=D&&w==="end"?"bottom":"top",W=D&&w==="end"?"right":"left";D&&b&&(W=w==="end"?"left":"right");let E=o?.x!=null?D||o.x:"",O=o?.y!=null?D||o.y:"",G=m||"M0,0"+(" H"+c)+(" L"+(c-T)+","+(u-$))+(" Q"+c/2+","+u+" "+T+","+(u-$))+" Z",U={top:z?"rotate(180deg)":"",left:z?"rotate(90deg)":"rotate(-90deg)",bottom:z?"":"rotate(180deg)",right:z?"rotate(-90deg)":"rotate(90deg)"}[k];return jsxRuntime.jsxs("svg",{...h,"aria-hidden":true,ref:r,width:z?c:c+C,height:c,viewBox:"0 0 "+c+" "+(u>c?u:c),style:{position:"absolute",pointerEvents:"none",[W]:E,[R]:O,[k]:x||z?"100%":"calc(100% - "+C/2+"px)",transform:[U,v].filter(A=>!!A).join(" "),...y},children:[C>0&&jsxRuntime.jsx("path",{clipPath:"url(#"+g+")",fill:"none",stroke:d,strokeWidth:C+(m?0:1),d:G}),jsxRuntime.jsx("path",{stroke:C&&!m?h.fill:"none",d:G}),jsxRuntime.jsx("clipPath",{id:g,children:jsxRuntime.jsx("rect",{x:-N,y:N*(z?-1:1),width:c+C,height:c})})]})});function Fm(){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 Bm=Se__namespace.createContext(null),Om=Se__namespace.createContext(null),zm=()=>{var e;return ((e=Se__namespace.useContext(Bm))==null?void 0:e.id)||null},$m=()=>Se__namespace.useContext(Om);function Wm(e){let{open:t=false,onOpenChange:r,elements:a}=e,n=xl(),o=Se__namespace.useRef({}),[s]=Se__namespace.useState(()=>Fm()),c=zm()!=null;if(process.env.NODE_ENV!=="production"){let m=a.reference;m&&!ft(m)&&Lm("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.");}let[u,i]=Se__namespace.useState(a.reference),p=Hi((m,v,y)=>{o.current.openEvent=m?v:void 0,s.emit("openchange",{open:m,event:v,reason:y,nested:c}),r?.(m,v,y);}),l=Se__namespace.useMemo(()=>({setPositionReference:i}),[]),d=Se__namespace.useMemo(()=>({reference:u||a.reference||null,floating:a.floating||null,domReference:a.reference}),[u,a.reference,a.floating]);return Se__namespace.useMemo(()=>({dataRef:o,open:t,onOpenChange:p,elements:d,events:s,floatingId:n,refs:l}),[t,p,d,s,n,l])}function wl(e){e===void 0&&(e={});let{nodeId:t}=e,r=Wm({...e,elements:{reference:null,floating:null,...e.elements}}),a=e.rootContext||r,n=a.elements,[o,s]=Se__namespace.useState(null),[c,u]=Se__namespace.useState(null),p=n?.domReference||o,l=Se__namespace.useRef(null),d=$m();Ia(()=>{p&&(l.current=p);},[p]);let m=gl({...e,elements:{...n,...c&&{reference:c}}}),v=Se__namespace.useCallback(f=>{let k=ft(f)?{getBoundingClientRect:()=>f.getBoundingClientRect(),getClientRects:()=>f.getClientRects(),contextElement:f}:f;u(k),m.refs.setReference(k);},[m.refs]),y=Se__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=Se__namespace.useMemo(()=>({...m.refs,setReference:y,setPositionReference:v,domReference:l}),[m.refs,y,v]),g=Se__namespace.useMemo(()=>({...m.elements,domReference:p}),[m.elements,p]),b=Se__namespace.useMemo(()=>({...m,...a,refs:h,elements:g,nodeId:t}),[m,h,g,t,a]);return Ia(()=>{a.dataRef.current.floatingContext=b;let f=d?.nodesRef.current.find(k=>k.id===t);f&&(f.context=b);}),Se__namespace.useMemo(()=>({...m,context:b,refs:h,elements:g}),[m,h,g,b])}var Ao=Se.createContext(null);function Cl(){return Se.useContext(Ao)}function Ye({children:e,container:t}){let[r,a]=Se.useState(false),n=Cl();if(Se.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,u={"--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 pl.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:u,children:e}),o)}return pl.createPortal(e,o)}function Dl(e,t,r=true){Se.useEffect(()=>{if(!r)return;let a=o=>{(Array.isArray(e)?e:[e]).some(u=>{let i=u.current;if(!i)return false;let p=o.target;return i===p||i.contains(p)})||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 Nl({itemCount:e,onSelect:t,onEscape:r,enabled:a=true,loop:n=true,containerRef:o}){let[s,c]=Se.useState(-1);Se.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 u=Se.useCallback(p=>{if(a)switch(p.key){case "ArrowDown":p.preventDefault(),c(l=>l===-1?0:l===e-1?n?0:l:l+1);break;case "ArrowUp":p.preventDefault(),c(l=>l===-1?e-1:l===0?n?e-1:l:l-1);break;case "Enter":case " ":p.preventDefault(),s!==-1&&t&&t(s);break;case "Escape":p.preventDefault(),r&&r();break;case "Home":p.preventDefault(),c(0);break;case "End":p.preventDefault(),c(e-1);break;}},[a,s,e,n,t,r]),i=Se.useCallback(p=>({"data-active":p===s,"data-index":p,role:"option",tabIndex:-1}),[s]);return {activeIndex:s,setActiveIndex:c,handleKeyDown:u,getItemProps:i}}function xr({trigger:e,children:t,isOpen:r,onOpenChange:a,placement:n="bottom-start",offsetDistance:o=8,maxHeight:s=320,minWidth:c="trigger",maxWidth:u,showArrow:i=false,className:p="",triggerClassName:l="",disableClickOutside:d=false,disableKeyboardNav:m=false,itemCount:v=0,onSelectItem:y,onOpen:h,onClose:g,animationDuration:b=200,zIndex:f=1e3}){let[k,w]=Se.useState(false),x=r!==void 0?r:k,D=Se.useCallback(ae=>{let M=x;r===void 0&&w(ae),a?.(ae),ae&&!M?h?.():!ae&&M&&g?.();},[r,a,h,g,x]),C=Se.useCallback(()=>{D(!x);},[x,D]),N=Se.useCallback(()=>{D(false);},[D]),T=Se.useRef(null),$=Se.useRef(null),z=Se.useRef(null),{refs:R,floatingStyles:W,context:E}=wl({open:x,onOpenChange:D,placement:n,middleware:[Cn(o),Ro({padding:8}),Po({padding:8}),Mo({apply({rects:ae,elements:M}){Object.assign(M.floating.style,{minWidth:c==="trigger"?`${ae.reference.width}px`:c?`${c}px`:void 0,maxWidth:u?`${u}px`:void 0,maxHeight:`${s}px`});},padding:8}),i?Io({element:z}):null].filter(Boolean),whileElementsMounted:yn}),O=yl([T,R.setReference]);Dl([T,$],N,x&&!d);let{activeIndex:G,setActiveIndex:U,handleKeyDown:A}=Nl({itemCount:v,onSelect:y,onEscape:N,enabled:x&&!m,loop:true,containerRef:$}),K=()=>typeof e=="function"?e({isOpen:x,toggle:C}):e,_=()=>typeof t=="function"?t({activeIndex:G,setActiveIndex:U,close:N}):t;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:O,className:`dropdown-trigger ${l}`,onClick:C,children:K()}),x&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsxs("div",{ref:R.setFloating,style:{...W,zIndex:f},className:`dropdown-content ${p}`,role:"menu","aria-orientation":"vertical",onKeyDown:A,children:[jsxRuntime.jsx("div",{ref:$,className:"dropdown-inner",children:_()}),i&&jsxRuntime.jsx(kl,{ref:z,context:E,className:"dropdown-arrow"})]})})]})}var Pl={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"}},Jm="#BDC3C7",Zm="#868e96",Qm=({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"})]}),Rl=()=>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 Fa({priority:e,onChange:t,className:r}){let a=e?Pl[e]:null,n=document.documentElement.getAttribute("data-theme")==="dark",o=a?n?a.darkColor:a.color:n?Zm:Jm,s=u=>{t(u);},c=Object.entries(Pl);return jsxRuntime.jsx(xr,{trigger:({isOpen:u})=>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:u?"scale(1.1)":"scale(1)"},title:a?.label||"Set priority","aria-label":"Select priority","aria-expanded":u,"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:u=>{let i=c[u];s(i?i[0]:void 0);},children:({activeIndex:u,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(([p,l],d)=>{let m=n?l.darkColor:l.color,v=u===d,y=e===p;return jsxRuntime.jsxs("button",{onClick:()=>{s(p),i();},className:"dropdown-item","data-active":v,"data-index":d,role:"option","aria-selected":y,style:{color:v?m:"inherit",fontWeight:y?600:400},children:[jsxRuntime.jsx(Qm,{color:m}),jsxRuntime.jsx("span",{children:l.label}),y&&jsxRuntime.jsx(Rl,{})]},p)}),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":u===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(Rl,{})]})})]})]})})}var Il=[{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 Ba({startDate:e,endDate:t,onChange:r,className:a}){let[n,o]=Se.useState(e||""),[s,c]=Se.useState(t||""),u=(v,y)=>{let h=new Date,g=new Date(h);g.setDate(g.getDate()+v);let b=h.toISOString().split("T")[0]||"",f=g.toISOString().split("T")[0]||"";o(b),c(f),r(b,f),y();},i=v=>{r(n||void 0,s||void 0),v();},p=()=>{if(!e||!t)return "Set date";let v=b=>{if(b instanceof Date)return b;if(typeof b!="string"||!b.match(/^\d{4}-\d{2}-\d{2}$/))return null;let f=b.split("-").map(Number);if(f.length!==3||f.some(D=>isNaN(D)))return null;let k=f[0],w=f[1],x=f[2];return k===void 0||w===void 0||x===void 0?null:new Date(k,w-1,x)},y=v(e),h=v(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 v=typeof t=="string"?new Date(t):t,y=new Date;return y.setHours(0,0,0,0),v<y})();return jsxRuntime.jsx(xr,{trigger:({isOpen:v})=>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:v?"scale(1.05)":"scale(1)"},title:l?`${p()}`:"Set date range","aria-label":"Select date range","aria-expanded":v,"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:p()})]}),placement:"bottom-start",minWidth:320,maxHeight:480,itemCount:Il.length,onOpen:()=>{o(e||""),c(t||"");},children:({activeIndex:v,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:Il.map((h,g)=>jsxRuntime.jsx("button",{onClick:()=>u(h.days,y),className:"dropdown-quick-button","data-active":v===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 Vr({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[o,s]=Se.useState(""),c=l=>{let d=e.some(m=>m.id===l.id);r(d?e.filter(m=>m.id!==l.id):[...e,l]);},u=t.filter(l=>l.name.toLowerCase().includes(o.toLowerCase())),i=e.slice(0,n),p=e.length-n;return jsxRuntime.jsx(xr,{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(d=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:d.name,style:{backgroundColor:d.color,color:"#fff"},children:d.avatar?jsxRuntime.jsx("img",{src:d.avatar,alt:d.name,className:"asakaa-avatar-img"}):d.initials},d.id)),p>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar dropdown-avatar-overflow",children:["+",p]})]}):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:u.length,onSelectItem:l=>{let d=u[l];d&&c(d);},onClose:()=>s(""),children:({activeIndex:l,close:d})=>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:u.length===0?jsxRuntime.jsx("div",{className:"dropdown-empty",children:"No users found"}):u.map((m,v)=>{let y=e.some(h=>h.id===m.id);return jsxRuntime.jsxs("button",{onClick:()=>{c(m);},className:"dropdown-item","data-active":l===v,"data-index":v,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([]),d();},className:"dropdown-danger-button",children:"Clear All"})})]})})}function za({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n}){let[o,s]=Se.useState(""),[c,u]=Se.useState(t.length>0),i=m=>{if(t.includes(m)){let y=t.filter(h=>h!==m);a(y),y.length===0&&u(false);}else a([...t,m]),u(true);},p=()=>{let m=!c;u(m),m||a([]);},l=r.filter(m=>m.id!==e).filter(m=>m.title.toLowerCase().includes(o.toLowerCase())||m.id.toLowerCase().includes(o.toLowerCase())),d=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsx(xr,{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:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:d},children:t.length})]}),placement:"bottom-start",minWidth:300,maxHeight:350,itemCount:c?l.length:0,onSelectItem:m=>{let v=l[m];v&&i(v.id);},onClose:()=>s(""),onOpen:()=>u(t.length>0),children:({activeIndex:m,close:v})=>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:p,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([]),u(false),v();},className:"dropdown-danger-button",children:"Clear All Dependencies"})})]})})}var kr=Se.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:o,onUpdate:s,availableUsers:c=[],allCards:u=[]})=>{let{attributes:i,listeners:p,setNodeRef:l,transform:d,transition:m,isDragging:v}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),y={transform:on.Transform.toString(d),transition:m};if(t)return jsxRuntime.jsx("div",{ref:l,style:y,...i,...p,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:L("asakaa-card",v&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",o),...i,...p,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(Fa,{priority:e.priority,onChange:g=>s?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ba,{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,b)=>s?.(e.id,{startDate:g,endDate:b})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Vr,{assignedUsers:h,availableUsers:c,onChange:g=>s?.(e.id,{assignedUserIds:g.map(b=>b.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(za,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:u,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));kr.displayName="Card";function Fl({columnTitle:e,onRename:t,className:r}){let[a,n]=Se.useState(false),[o,s]=Se.useState(false),[c,u]=Se.useState(e),[i,p]=Se.useState({top:0,left:0}),l=Se.useRef(null),d=Se.useRef(null),m=Se.useRef(null);Se.useEffect(()=>{if(a&&d.current){let g=d.current.getBoundingClientRect();p({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[a]),Se.useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&!d.current?.contains(b.target)&&(n(false),s(false));};if(a)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[a]),Se.useEffect(()=>{let g=b=>{b.key==="Escape"&&(n(false),s(false),u(e));};if(a)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[a,e]),Se.useEffect(()=>{o&&m.current&&(m.current.focus(),m.current.select());},[o]);let v=()=>{s(true),u(e);},y=()=>{let g=c.trim();g&&g!==e&&t(g),s(false),n(false),u(e);},h=g=>{g.key==="Enter"?y():g.key==="Escape"&&(s(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:d,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(Ye,{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=>u(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:v,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 ia=Se.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:o,onCardClick:s,onCardUpdate:c,availableUsers:u,allCards:i,enableVirtualization:p,cardHeight:l=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:v,className:y})=>{let{setNodeRef:h,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),b=Se.useRef(null),f=p??Ni(t.length),k=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>b.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 N=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:N}:N>=80?{state:"warning",percentage:N}:N>=60?{state:"approaching",percentage:N}:{state:"ok",percentage:N}})(),D=x.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:L("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",D&&"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:L(C()),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"})]})]}),v&&jsxRuntime.jsx(Fl,{columnTitle:e.title,onRename:N=>v(e.id,N)}),m&&jsxRuntime.jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),!d&&jsxRuntime.jsx("div",{ref:b,className:"asakaa-column-cards",style:{maxHeight:f?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(N=>N.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:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(N=>{let T=t[N.index];return T?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(kr,{card:T,render:a,onClick:s,onUpdate:c,availableUsers:u,allCards:i})},T.id):null})}):t.map(N=>jsxRuntime.jsx(kr,{card:N,render:a,onClick:s,onUpdate:c,availableUsers:u,allCards:i},N.id))})})]})});ia.displayName="Column";function Oo({title:e,onSave:t,className:r}){let[a,n]=Se.useState(false),[o,s]=Se.useState(e),c=Se.useRef(null);Se.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.select());},[a]);let u=()=>{let p=o.trim();p&&p!==e?t(p):s(e),n(false);},i=p=>{p.key==="Enter"?u():p.key==="Escape"&&(s(e),n(false));};return a?jsxRuntime.jsx("input",{ref:c,type:"text",value:o,onChange:p=>s(p.target.value),onBlur:u,onKeyDown:i,className:L("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",r),maxLength:50}):jsxRuntime.jsx("h2",{className:L("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function $o(){let[e,t]=Se.useState(()=>core.dragStore.getState());Se.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let r=Se.useCallback(a=>{core.dragStore.setState(a);},[]);return [e,r]}function Rr({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:o=[],className:s,style:c,isLoading:u,error:i,children:p}){let[l,d]=$o(),m=n?.theme||"dark",y=m==="dark"||m==="neutral"?"dark":"",h=Se.useCallback((C,N)=>{t.onCardUpdate?.(C,N);},[t]),g=Se.useCallback((C,N)=>{t.onColumnUpdate?.(C,{title:N});},[t]),b=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),f=Se.useMemo(()=>{let C=new Map;return e.columns.forEach(N=>{let T=N.cardIds.map($=>e.cards.find(z=>z.id===$)).filter($=>$!==void 0).sort(($,z)=>$.position-z.position);C.set(N.id,T);}),C},[e.cards,e.columns]),k=Se.useCallback(C=>{let{active:N}=C,T=e.cards.find($=>$.id===N.id);T&&d({isDragging:true,draggedCardId:T.id,sourceColumnId:T.columnId,targetColumnId:T.columnId});},[e.cards,d]),w=Se.useCallback(C=>{let{active:N,over:T}=C;if(!T||!e.cards.find(R=>R.id===N.id))return;let z=null;T.data.current?.type==="column"?z=T.id:T.data.current?.type==="card"&&(z=e.cards.find(W=>W.id===T.id)?.columnId||null),z&&z!==l.targetColumnId&&d({...l,targetColumnId:z});},[e.cards,l,d]),x=Se.useCallback(async C=>{let{active:N,over:T}=C;if(d({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!T)return;let $=e.cards.find(E=>E.id===N.id);if(!$)return;let z,R;if(T.data.current?.type==="column"){z=T.id;let E=f.get(z)||[];R=ho(E,0);}else {let E=e.cards.find(U=>U.id===T.id);if(!E)return;z=E.columnId;let O=f.get(z)||[],G=O.findIndex(U=>U.id===T.id);R=ho(O,G);}let W=e.columns.find(E=>E.id===z);if(W&&W.wipLimit&&W.wipLimitType==="hard"){let E=f.get(z)||[];if($.columnId!==z&&E.length>=W.wipLimit){t.onWipLimitExceeded?.(W,$);return}}($.columnId!==z||$.position!==R)&&await t.onCardMove?.($.id,z,R);},[e.cards,e.columns,f,t,d]),D=Se.useCallback(C=>{r?.(C);},[r]);return u?jsxRuntime.jsx("div",{className:L("asakaa-board",y,s),style:c,children:jsxRuntime.jsx(Cp,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:L("asakaa-board",y,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:b,collisionDetection:core$1.closestCorners,onDragStart:k,onDragOver:w,onDragEnd:x,children:[jsxRuntime.jsxs("div",{className:L("asakaa-board",y,s),style:c,children:[e.columns.sort((C,N)=>C.position-N.position).map(C=>{let N=f.get(C.id)||[];return jsxRuntime.jsx(ia,{column:C,cards:N,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,onCardClick:D,onCardUpdate:h,onColumnRename:g,availableUsers:o,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight},C.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(kr,{card:e.cards.find(C=>C.id===l.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})}function Cp({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 Wa=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(Rr,{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 $l(e={}){return new Wa(e)}var ca=class extends Se.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(ca,{...t,children:jsxRuntime.jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Go({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:o,onGeneratePlan:s,onPredictRisks:c,onOpenAIUsage:u,shortcut:i="k",className:p=""}){let[l,d]=Se.useState(false),[m,v]=Se.useState(""),[y,h]=Se.useState("home"),[g,b]=Se.useState(""),[f,k]=Se.useState("");Se.useEffect(()=>{let C=N=>{(N.metaKey||N.ctrlKey)&&N.key===i&&(N.preventDefault(),d(T=>!T)),N.key==="Escape"&&(d(false),h("home"),v(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),Se.useEffect(()=>{l||(h("home"),v(""),b(""),k(""));},[l]);let w=Se.useCallback(()=>{d(false);},[]),x=Se.useCallback(C=>{let[N,T]=C.split(":");switch(N){case "create-card":h("create-card");break;case "create-card-in":b(T||"");break;case "navigate":T?(r?.(T),w()):h("navigate");break;case "search":a?.(m),w();break;case "priority":h("priority");break;case "set-priority":f&&T&&(n?.(f,T),w());break;case "assign":h("assign");break;case "assign-user":f&&T&&(o?.(f,T),w());break;case "ai":h("ai");break;case "ai-generate-plan":s?.(),w();break;case "ai-predict-risks":c?.(),w();break;case "ai-usage":u?.(),w();break;case "back":h("home");break;}},[m,f,t,r,a,n,o,s,c,u,w]),D=Se.useCallback(()=>{g&&m.trim()&&(t?.(g,m.trim()),w());},[g,m,t,w]);return l?jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:w,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:m,onValueChange:v,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder: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:C=>{C.key==="Enter"&&y==="create-card"&&g&&D();}}),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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:x,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:N},N))})]},C.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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.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:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.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(C=>{let N=e.columns.find(T=>T.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:x,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:N?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:T},T))})]},C.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 Mp(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 Ga({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:o=10}){let[s,c]=Se.useState(false),[u,i]=Se.useState(false),[p,l]=Se.useState(null),d=Se.useRef(null),m=Se.useCallback(x=>{let D=[],C=[];return e.length+x.length>o?(C.push(`Maximum ${o} files allowed`),{valid:D,errors:C}):(x.forEach(N=>{if(N.size/1048576>a){C.push(`${N.name} is too large (max ${a}MB)`);return}if(n&&!n.some($=>N.type.match($))){C.push(`${N.name} has invalid file type`);return}D.push(N);}),{valid:D,errors:C})},[e.length,o,a,n]),v=Se.useCallback(async x=>{let{valid:D,errors:C}=m(x);if(C.length>0){l(C.join(", ")),setTimeout(()=>l(null),5e3);return}if(D.length!==0){i(true),l(null);try{await t?.(D);}catch(N){l(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[m,t]),y=Se.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(true);},[]),h=Se.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(false);},[]),g=Se.useCallback(x=>{x.preventDefault(),x.stopPropagation();},[]),b=Se.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(false);let D=Array.from(x.dataTransfer.files);v(D);},[v]),f=Se.useCallback(x=>{let D=x.target.files?Array.from(x.target.files):[];v(D),d.current&&(d.current.value="");},[v]),k=Se.useCallback(()=>{d.current?.click();},[]),w=Se.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":""} ${u?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:g,onDrop:b,onClick:k,children:[jsxRuntime.jsx("input",{ref:d,type:"file",multiple:true,onChange:f,style:{display:"none"},accept:n?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:u?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"]})]})})]}),p&&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:p})]}),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:Mp(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:()=>w(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 Ho({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:c=[],aiInsights:u=[],attachments:i=[],onAddComment:p,onDeleteComment:l,onUploadAttachments:d,onDeleteAttachment:m,onSuggestAssignee:v,onGenerateSubtasks:y,onEstimateEffort:h,currentUserId:g="user-1"}){let[b,f]=Se.useState("details"),[k,w]=Se.useState(false),[x,D]=Se.useState({}),[C,N]=Se.useState(""),[T,$]=Se.useState(false),[z,R]=Se.useState({});if(!t||!e)return null;let W=Se.useCallback(()=>{w(false),D({}),f("details"),N(""),R({}),r();},[r]),E=Se.useCallback(()=>{a&&Object.keys(x).length>0&&(a(e.id,x),D({}),w(false));},[e.id,x,a]),O=Se.useCallback(()=>{n&&window.confirm("Are you sure you want to delete this card?")&&(n(e.id),W());},[e.id,n,W]),G=Se.useCallback(()=>{p&&C.trim()&&(p(e.id,C.trim()),N(""));},[e.id,C,p]),U=Se.useCallback(async()=>{if(v){$(true);try{let M=await v(e);R(de=>({...de,assignees:M}));}catch(M){console.error("Failed to suggest assignee:",M);}finally{$(false);}}},[e,v]),A=Se.useCallback(async()=>{if(y){$(true);try{let M=await y(e);R(de=>({...de,subtasks:M}));}catch(M){console.error("Failed to generate subtasks:",M);}finally{$(false);}}},[e,y]),K=Se.useCallback(async()=>{if(h){$(true);try{let M=await h(e);R(de=>({...de,effort:M}));}catch(M){console.error("Failed to estimate effort:",M);}finally{$(false);}}},[e,h]),_={...e,...x},ae=o.filter(M=>_.assignedUserIds?.includes(M.id));return jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:W,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:M=>M.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:_.priority==="URGENT"?"#EF4444":_.priority==="HIGH"?"#F59E0B":_.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:x.title??_.title,onChange:M=>D({...x,title:M.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:_.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:E,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{w(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>w(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:O,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:W,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 ${b==="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 ${b==="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 ${b==="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 ${b==="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 ${b==="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:[b==="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"}),k?jsxRuntime.jsx("textarea",{value:x.description??_.description??"",onChange:M=>D({...x,description:M.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:_.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:x.assignedUserIds??_.assignedUserIds??[],onChange:M=>{let de=Array.from(M.target.selectedOptions,ie=>ie.value);D({...x,assignedUserIds:de});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:o.map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:ae.length>0?ae.map(M=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:M.color},children:M.initials}),jsxRuntime.jsx("span",{children:M.name})]},M.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"}),k?jsxRuntime.jsxs("select",{value:x.priority??_.priority??"",onChange:M=>D({...x,priority:M.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:_.priority==="URGENT"?"#EF4444":_.priority==="HIGH"?"#F59E0B":_.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:_.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:_.labels&&_.labels.length>0?_.labels.map(M=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:M},M)):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"}),k?jsxRuntime.jsx("input",{type:"date",value:x.startDate?new Date(x.startDate).toISOString().split("T")[0]:_.startDate?new Date(_.startDate).toISOString().split("T")[0]:"",onChange:M=>D({...x,startDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:_.startDate?new Date(_.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:x.endDate?new Date(x.endDate).toISOString().split("T")[0]:_.endDate?new Date(_.endDate).toISOString().split("T")[0]:"",onChange:M=>D({...x,endDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:_.endDate?new Date(_.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:x.estimatedTime??_.estimatedTime??"",onChange:M=>D({...x,estimatedTime:M.target.value?parseFloat(M.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:_.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:_.dependencies&&_.dependencies.length>0?_.dependencies.map(M=>{let de=typeof M=="string"?M:M.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",de.slice(-4)]},de)}):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:_.createdAt?new Date(_.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:M=>N(M.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:G,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:s.length>0?s.map(M=>{let de=o.find(ie=>ie.id===M.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:[de&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:de.color},children:de.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:de?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(M.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(M.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:M.content})]},M.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"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(M=>{let de=o.find(ie=>ie.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[M.type.includes("CREATED")&&"\u2795",M.type.includes("UPDATED")&&"\u270F\uFE0F",M.type.includes("MOVED")&&"\u27A1\uFE0F",M.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",M.type.includes("COMMENT")&&"\u{1F4AC}",M.type.includes("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",M.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:de?.name||"Unknown"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:M.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.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"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Ga,{cardId:e.id,attachments:i,onUpload:d?M=>d(e.id,M):void 0,onDelete:m,currentUserId:g,maxSizeMB:10,maxFiles:20})}),b==="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:U,disabled:T||!v,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:A,disabled:T||!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:K,disabled:T||!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"]})]}),z.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),z.assignees.map((M,de)=>{let ie=o.find(kt=>kt.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ie&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ie.color},children:ie.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ie?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:M.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(M.confidence*100).toFixed(0),"%"]})]})]},de)})]}),z.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),z.subtasks.map((M,de)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:M.title}),M.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:M.description}),M.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",M.estimatedTime,"h"]})]},de))]}),z.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:[z.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(z.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),u.map(M=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${M.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:M.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:M.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:M.description}),M.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",M.suggestedAction]})]},M.id))]}),!z.assignees&&!z.subtasks&&!z.effort&&u.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 Op=["LOW","MEDIUM","HIGH","URGENT"],zp=["todo","in-progress","review","done"];function jo({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:c=[],onAddComment:u,onDeleteComment:i,currentUser:p,onAIGenerateDescription:l,onAICreateSubtasks:d,onAIFindSimilar:m,availableColumns:v=[],availableLabels:y=[]}){let[h,g]=Se.useState(e),[b,f]=Se.useState(false),[k,w]=Se.useState([]),[x,D]=Se.useState(false),[C,N]=Se.useState(""),[T,$]=Se.useState(""),[z,R]=Se.useState("all"),[W,E]=Se.useState(false),[O,G]=Se.useState(false),[U,A]=Se.useState(false),[K,_]=Se.useState(false),[ae,M]=Se.useState(false),[de,ie]=Se.useState(false),kt=Se.useRef(null),rt=Se.useRef(null),ir=Se.useRef(null),De=Se.useRef(null),bt=Se.useRef(null),wt=Se.useRef(null),jt=Se.useRef(null),hr=Se.useRef(null);Se.useEffect(()=>{e&&!h?g({...e}):e&&h&&e.id!==h.id&&g({...e});},[e,h]),Se.useEffect(()=>{let S=H=>{let me=H.target;De.current&&!De.current.contains(me)&&E(false),bt.current&&!bt.current.contains(me)&&G(false),wt.current&&!wt.current.contains(me)&&A(false),jt.current&&!jt.current.contains(me)&&_(false);};if(W||O||U||K)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[W,O,U,K]),Se.useEffect(()=>{if(!t)return;let S=H=>{let me=H.target,ye=me.tagName==="INPUT"||me.tagName==="TEXTAREA"||me.isContentEditable;if(H.key==="Escape"){H.preventDefault(),W||O||U||K||ae||de?(E(false),G(false),A(false),_(false),M(false),ie(false)):ye||r();return}if(ye&&H.key!=="Escape")return;let Be=H.metaKey||H.ctrlKey;switch(H.key.toLowerCase()){case "s":H.preventDefault(),E(true);break;case "a":H.preventDefault(),A(true);break;case "p":H.preventDefault(),G(true);break;case "l":H.preventDefault(),_(true);break;case "d":Be||(H.preventDefault(),M(true),setTimeout(()=>hr.current?.focus(),0));break;case "e":Be||(H.preventDefault(),ie(true));break;case "i":H.preventDefault(),f(true),setTimeout(()=>rt.current?.focus(),0);break;case "t":H.preventDefault(),D(true);break;case "c":H.preventDefault(),ir.current?.focus();break}};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[t,r,W,O,U,K,ae,de]);let zr=Se.useCallback(S=>{let H=S.currentTarget.textContent?.trim()||"";if(h&&H!==h.title){let me={...h,title:H};g(me),a?.(h.id,{title:H});}},[h,a]),he=Se.useCallback(S=>{S.key==="Enter"&&(S.preventDefault(),S.currentTarget.blur()),S.key==="Escape"&&(S.preventDefault(),S.currentTarget.textContent=h?.title||"",S.currentTarget.blur());},[h]),at=Se.useCallback(()=>{h&&e&&h.description!==e.description&&a?.(h.id,{description:h.description}),f(false);},[h,e,a]),Kt=Se.useCallback(S=>{if(h){let H={...h,columnId:S};g(H),a?.(h.id,{columnId:S}),E(false);}},[h,a]),Wt=Se.useCallback(S=>{if(h){let H={...h,priority:S};g(H),a?.(h.id,{priority:S}),G(false);}},[h,a]),$r=Se.useCallback(S=>{if(h){let H=h.assignedUserIds||[],me=H.includes(S)?H.filter(Be=>Be!==S):[...H,S],ye={...h,assignedUserIds:me};g(ye),a?.(h.id,{assignedUserIds:me});}},[h,a]),se=Se.useCallback(S=>{if(h){let H=h.labels||[],me=H.includes(S)?H.filter(Be=>Be!==S):[...H,S],ye={...h,labels:me};g(ye),a?.(h.id,{labels:me});}},[h,a]),ue=Se.useCallback(S=>{if(h){let H=S.target.value,me={...h,endDate:H};g(me),a?.(h.id,{endDate:H}),M(false);}},[h,a]),X=Se.useCallback(S=>{if(h){let H={...h,estimatedTime:parseFloat(S)||0};g(H),a?.(h.id,{estimatedTime:parseFloat(S)||0});}},[h,a]),j=Se.useCallback(()=>{if(C.trim()){let S={id:`subtask-${Date.now()}`,title:C.trim(),completed:false};w([...k,S]),N(""),D(false);}},[C,k]),Te=Se.useCallback(S=>{w(k.map(H=>H.id===S?{...H,completed:!H.completed}:H));},[k]),We=Se.useCallback(S=>{w(k.filter(H=>H.id!==S));},[k]),re=Se.useCallback(()=>{T.trim()&&h&&u&&(u(h.id,T.trim()),$(""));},[T,h,u]),le=Se.useCallback(S=>{(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),re());},[re]),lr=S=>jsxRuntime.jsx(Lp__default.default,{remarkPlugins:[Fp__default.default],rehypePlugins:[Bp__default.default],components:{a:({node:H,...me})=>jsxRuntime.jsx("a",{...me,target:"_blank",rel:"noopener noreferrer"})},children:S}),Ut=c.filter(S=>z==="comments"?S.type.includes("COMMENT"):z==="history"?!S.type.includes("COMMENT"):true);if(!t||!e)return null;let J=h||e,Y=o.filter(S=>J.assignedUserIds?.includes(S.id)),ve=k.filter(S=>S.completed).length;return jsxRuntime.jsx(Ye,{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:kt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:zr,onKeyDown:he,children:J.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"})]})})]}),J.coverImage&&jsxRuntime.jsx("div",{className:"modal-v2-cover",children:jsxRuntime.jsx("img",{src:J.coverImage,alt:`Cover for ${J.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:De,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>E(!W),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:J.columnId||"No status"})]}),W&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(v.length>0?v:zp.map(S=>({id:S,title:S}))).map(S=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${J.columnId===S.id?"active":""}`,onClick:()=>Kt(S.id),children:S.title},S.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:wt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>A(!U),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:Y.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Y.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"})})]}),U&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:o.map(S=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${J.assignedUserIds?.includes(S.id)?"active":""}`,onClick:()=>$r(S.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:S.color},children:S.initials}),S.name,J.assignedUserIds?.includes(S.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},S.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:bt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>G(!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("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:J.priority||"None"})]}),O&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[Op.map(S=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${S.toLowerCase()} ${J.priority===S?"active":""}`,onClick:()=>Wt(S),children:S},S)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Wt(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:jt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>_(!K),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:J.labels&&J.labels.length>0?jsxRuntime.jsx("span",{children:J.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),K&&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 ${J.labels?.includes(S)?"active":""}`,onClick:()=>se(S),children:[S,J.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:()=>{M(!ae),setTimeout(()=>hr.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:J.endDate?new Date(J.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:hr,type:"date",value:typeof J.endDate=="string"?J.endDate.split("T")[0]:J.endDate?(()=>{let S=new Date(J.endDate),H=S.getUTCFullYear(),me=String(S.getUTCMonth()+1).padStart(2,"0"),ye=String(S.getUTCDate()).padStart(2,"0");return `${H}-${me}-${ye}`})():"",onChange:ue,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ie(!de),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:J.estimatedTime?`${J.estimatedTime}h`:"Not set"})]}),de&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:J.estimatedTime||"",onChange:S=>X(S.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ie(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"]})]}),b?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:J.description||"",onChange:S=>{if(h){let H={...h,description:S.target.value};g(H);}},onBlur:at,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>f(true),children:J.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:lr(J.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"}),k.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ve,"/",k.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>D(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:[k.map(S=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${S.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Te(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:()=>We(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:C,onChange:S=>N(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j(),S.key==="Escape"&&(D(false),N(""));},onBlur:j,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 ${z==="all"?"active":""}`,onClick:()=>R("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>R("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>R("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ir,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:T,onChange:S=>$(S.target.value),onKeyDown:le,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:re,disabled:!T.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Ut.map(S=>{let H=o.find(ye=>ye.id===S.userId);if(S.type.includes("COMMENT")){let ye=s.find(Be=>Be.id===S.metadata?.commentId);return ye?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:ye.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)}),Ut.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 Yo({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,u)=>c+u.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 rf({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 qo({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,u=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(rf,{})}),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:u>=50?"#10B981":"#F59E0B"},children:[u.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 mf={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Yl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function pf({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)),u=t+s*Math.sin(-r*(Math.PI/180));return o<.05?null:jsxRuntime.jsx("text",{x:c,y:u,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(o*100).toFixed(0)}%`})}function ql({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 Xo({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let o=e.reduce((u,i)=>u+i.value,0),s=e.map(u=>({...u,totalValue:o,color:u.color||mf[u.name]||Yl[e.indexOf(u)%Yl.length]})),c=s.map(u=>u.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?pf:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:s.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ql,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let p=i.payload,l=o>0?(p.value/o*100).toFixed(0):"0";return `${u} (${p.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(ql,{})}),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((u,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((u,i)=>i.value>u.value?i:u).name})]})]})]})}var In=Se.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:o=[]})=>{let[s,c]=Se.useState(false),[u,i]=Se.useState(false),[p,l]=Se.useState(false),[d,m]=Se.useState(false);if(e.length===0)return null;let v=e.map(k=>k.id),y=k=>{a.onBulkUpdate?.(v,{priority:k}),c(false);},h=k=>{a.onBulkMove?.(v,k),i(false),r();},g=k=>{a.onBulkUpdate?.(v,{assignedUserIds:k}),l(false);},b=k=>{let w=new Set;e.forEach(D=>{D.labels?.forEach(C=>w.add(C));});let x=Array.from(new Set([...w,...k]));a.onBulkUpdate?.(v,{labels:x}),m(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(v),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(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(k),children:[jsxRuntime.jsx("span",{className:L("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!u),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([k]),children:k},k))})]}),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"})})]})]})})});In.displayName="BulkOperationsToolbar";function vf(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let o,s,c,u,i;switch(t){case "assignee":let p=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);p.length>0?p.forEach(m=>{let v=r?.find(y=>y.id===m);s=`assignee-${m}`,c=v?.name||`User ${m}`,u=v?.color,i=v?.avatar,a.has(s)||a.set(s,{id:s,title:c,groupValue:m,cardIds:[],color:u,icon:i}),a.get(s).cardIds.push(n.id);}):(s="assignee-unassigned",c="Unassigned",u="#6b7280",i="\u{1F464}",a.has(s)||a.set(s,{id:s,title:c,groupValue:null,cardIds:[],color:u,icon:i}),a.get(s).cardIds.push(n.id));break;case "priority":o=n.priority||"NONE",s=`priority-${o}`;let d={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=d.title,u=d.color,a.has(s)||a.set(s,{id:s,title:c,groupValue:o,cardIds:[],color:u}),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,u="#6b7280",a.has(s)||a.set(s,{id:s,title:c,groupValue:m,cardIds:[],color:u}),a.get(s).cardIds.push(n.id);}):(s="label-none",c="No Labels",u="#6b7280",a.has(s)||a.set(s,{id:s,title:c,groupValue:null,cardIds:[],color:u}),a.get(s).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,o)=>n.title.localeCompare(o.title))}function Jo({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n}){let[o,s]=Se.useState(new Set),c=Se.useMemo(()=>vf(e.cards,t.groupBy,r),[e.cards,t.groupBy,r]),u=Se.useCallback(i=>{s(p=>{let l=new Set(p);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Rr,{board:e,callbacks:a,availableUsers:r,className:n}):jsxRuntime.jsxs("div",{className:L("asakaa-swimlane-view",n),children:[c.map(i=>{let p=o.has(i.id),l=e.cards.filter(m=>i.cardIds.includes(m.id)),d={...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&&u(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":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Rr,{board:d,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 Zo=[{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 Qo({value:e,onChange:t,className:r}){let[a,n]=Se.useState(false),o=Se.useRef(null),s=Se.useRef(null),c=Zo.find(i=>i.value===e)||Zo[0];Se.useEffect(()=>{function i(p){o.current&&!o.current.contains(p.target)&&s.current&&!s.current.contains(p.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let u=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{className:L("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:L("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:Zo.map(i=>jsxRuntime.jsxs("button",{onClick:()=>u(i.value),className:L("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 _a=[{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 kf(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,u=n.meta?e.metaKey:true;return o&&s&&c&&u}function ec(e={}){let{shortcuts:t=_a,enabled:r=true,preventDefault:a=true}=e,n=Se.useRef(t),o=Se.useRef(r);Se.useEffect(()=>{n.current=t,o.current=r;},[t,r]);let s=Se.useCallback(u=>{n.current=[...n.current,u];},[]),c=Se.useCallback(u=>{n.current=n.current.filter(i=>i.action!==u);},[]);return Se.useEffect(()=>{function u(i){if(!o.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of n.current)if(kf(i,l)){a&&i.preventDefault();let d=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[a]),{registerShortcut:s,unregisterShortcut:c,isEnabled:r}}function Cf(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Tf(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 Df(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=Tf(e),a=t?Cf(t):"";return r?`${r} + ${a}`:a}function Sf(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 es({shortcuts:e=_a,isOpen:t,onClose:r,className:a}){let[n,o]=Se.useState(false);if(Se.useEffect(()=>{o(true);},[]),Se.useEffect(()=>{function c(u){u.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r]),!n||!t)return null;let s=Sf(e);return jsxRuntime.jsxs("div",{className:L("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,u])=>u.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:u.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:Df(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 ts=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
1
|
+
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),Zi=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),cmdk=require('cmdk'),Mc=require('react-markdown'),Ic=require('remark-gfm'),Lc=require('rehype-sanitize'),recharts=require('recharts'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Zi__default=/*#__PURE__*/_interopDefault(Zi);var Mc__default=/*#__PURE__*/_interopDefault(Mc);var Ic__default=/*#__PURE__*/_interopDefault(Ic);var Lc__default=/*#__PURE__*/_interopDefault(Lc);var Nr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Sr=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return "scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return [Sr.Translate.toString(e),Sr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function A(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Er(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 Ld(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function wo(e,t){return e.length===0?1e3:t===0?Er(null,e[0].position):t>=e.length?Er(e[e.length-1].position,null):Er(e[t-1].position,e[t].position)}function Ts(e,t=100){return e>t}var Ad=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 Fd(e,t,a,r){let o=t*Math.pow(a,e-1),n=o*.2*Math.random();return Math.min(o+n,r)}async function Pr(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:n=1e4,shouldRetry:i=Ad,onRetry:m}=t,c,s=0;for(let p=1;p<=a;p++){s=p;try{return {data:await e(),attempts:s,success:!0}}catch(d){if(c=d,p===a||!i(c,p))return {error:c,attempts:s,success:false};let g=Fd(p,r,o,n);if(m)try{m(c,p,g);}catch(x){console.error("Error in retry callback:",x);}await new Promise(x=>setTimeout(x,g));}}return {error:c||new Error("Unknown error"),attempts:s,success:false}}function Bd(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Rd(e,t={}){return async(...a)=>Pr(()=>e(...a),t)}var Co=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var Ds=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.NONE=4]="NONE",n))(Ds||{}),wa=class wa{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:n,...i}=t,m=`[${a}] [${r}] [${n}]`,c=Object.keys(i).length>0;switch(r){case "DEBUG":console.debug(m,o,c?i:"");break;case "INFO":console.info(m,o,c?i:"");break;case "WARN":console.warn(m,o,c?i:"");break;case "ERROR":console.error(m,o,c?i:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...wa.globalOptions};}static configure(t){wa.globalOptions={...wa.globalOptions,...t};}child(t){return new wa({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Mr((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Mr(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Ds[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};wa.globalOptions={};var To=wa,Mr=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Ns=new To;function zd(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function Ud(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(n=>{let i=e.columns.find(m=>m.id===n.columnId);return [n.id,Do(n.title),Do(n.description||""),Do(i?.title||""),n.priority||"",(n.labels||[]).join(";"),(n.assignedUserIds||[]).join(";"),n.startDate||"",n.endDate||"",n.createdAt||"",n.updatedAt||""]});return [a.join(","),...r.map(n=>n.join(","))].join(`
|
|
2
|
+
`)}async function Gd(e,t,a){let r=t;if(!r){let i=document.querySelector(".asakaa-board");i&&(r=i.parentElement||i);}if(r)try{let i=await Zi__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=i.toDataURL("image/png"),c=297,s=210,p=i.width/i.height,d=c-20,l=d/p;l>s-20&&(l=s-20,d=l*p);let g=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let x=(c-d)/2;return g.addImage(m,"PNG",x,20,d,l),g}catch(i){console.error("Error capturing board:",i);}let o=new jspdf.jsPDF,n=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,n),n+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,n),n+=15,o.setTextColor(0,0,0),e.columns.forEach(i=>{let m=e.cards.filter(c=>c.columnId===i.id);n>250&&(o.addPage(),n=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(i.title,20,n),n+=8,m.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,n),o.setTextColor(0,0,0),n+=10):m.forEach(c=>{if(n>260&&(o.addPage(),n=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,n),n+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(c.description,160);o.text(p,25,n),n+=p.length*5;}let s=[];if(c.priority&&s.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&s.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&s.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),s.push(p.join(" \u2192 "));}s.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(s.join(" \u2022 "),25,n),o.setTextColor(0,0,0),n+=5),n+=5;}),n+=5;}),o}function Do(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Es(e,t,a,r){switch(t){case "json":return zd(e,r);case "csv":return Ud(e);case "pdf":return await Gd(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Ps(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let n=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,i={json:"application/json",csv:"text/csv",pdf:"application/pdf"},m=new Blob([e],{type:i[t]}),c=URL.createObjectURL(m),s=document.createElement("a");s.href=c,s.download=n,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(c);}function $d(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Wd(e){try{let t=e.trim().split(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Ms(t[0]),r=[],o=new Map,n=[];for(let i=1;i<t.length;i++)try{let m=Ms(t[i]||"");if(m.length>a.length){n.push(`Line ${i+1}: Too many columns`);continue}if(a.length-m.length>3){n.push(`Line ${i+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let s={};a.forEach((g,x)=>{s[g]=m[x]||"";});let p=s.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),l={id:s["Card ID"]||`card-${i}`,title:s.Title||"Untitled",description:s.Description?s.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:s.Priority||void 0,labels:s.Labels?s.Labels.split(";").filter(Boolean):void 0,assignedUserIds:s["Assigned Users"]?s["Assigned Users"].split(";").filter(Boolean):void 0,startDate:s["Start Date"]?s["Start Date"]:void 0,endDate:s["End Date"]?s["End Date"]:void 0,createdAt:s["Created At"]?s["Created At"]:void 0,updatedAt:s["Updated At"]?s["Updated At"]:void 0};r.push(l),d.cardIds.push(l.id);}catch(m){n.push(`Line ${i+1}: ${m instanceof Error?m.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...n]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:n.length>0?n:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Ms(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],i=e[o+1];n==='"'&&r&&i==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function Is(e,t){switch(t){case "json":return $d(e);case "csv":return Wd(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Ls(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var No=react.createContext(null);function As(){return react.useContext(No)}function Be({children:e,container:t}){let[a,r]=react.useState(false),o=As();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:i,themeName:m}=o,c={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:c,children:e}),n)}return reactDom.createPortal(e,n)}var Os={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Yd="#BDC3C7",Xd=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function or({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,i]=react.useState({top:0,left:0}),m=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(r&&c.current){let l=c.current.getBoundingClientRect();i({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[r]),react.useEffect(()=>{let l=g=>{m.current&&!m.current.contains(g.target)&&!c.current?.contains(g.target)&&o(false);};if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]),react.useEffect(()=>{let l=g=>{g.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r]);let s=l=>{t(l),o(false);},p=e?Os[e]:null,d=p?.color||Yd;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>o(!r),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:p?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:m,className:"priority-selector-menu",style:{position:"absolute",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"160px",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Os).map(([l,g])=>jsxRuntime.jsxs("button",{onClick:()=>s(l),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:g.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Xd,{color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:g.label}),e===l&&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"})})]},l)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>s(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:l=>{l.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:l=>{l.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var qd=[{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 nr({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[i,m]=react.useState({top:0,left:0}),c=react.useRef(null),s=react.useRef(null);react.useEffect(()=>{if(o&&s.current){let y=s.current.getBoundingClientRect();m({top:y.bottom+window.scrollY+8,left:y.left+window.scrollX});}},[o]),react.useEffect(()=>{let y=b=>{c.current&&!c.current.contains(b.target)&&!s.current?.contains(b.target)&&n(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=b=>{b.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let p=y=>{let b=new Date,f=w=>{let v=w.getFullYear(),P=String(w.getMonth()+1).padStart(2,"0"),C=String(w.getDate()).padStart(2,"0");return `${v}-${P}-${C}`},h=f(b),u=new Date(b);u.setDate(u.getDate()+y);let k=f(u);a(h,k),n(false);},d=()=>{if(!e||!t)return "Set date";let y=u=>{if(u instanceof Date)return u;if(typeof u!="string"||!u.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=u.split("-").map(Number);if(k.length!==3||k.some(C=>isNaN(C)))return null;let w=k[0],v=k[1],P=k[2];return w===void 0||v===void 0||P===void 0?null:new Date(w,v-1,P)},b=y(e),f=y(t);if(!b||!f||isNaN(b.getTime())||isNaN(f.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[b.getMonth()]} ${b.getDate()} \u2013 ${h[f.getMonth()]} ${f.getDate()}`},l=e&&t,x=(()=>{if(!t)return false;let y=typeof t=="string"?new Date(t):t,b=new Date;return b.setHours(0,0,0,0),y<b})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>n(!o),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${x?"asakaa-date-overdue":"asakaa-date"}`,title:l?`${d()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:d()})]}),o&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu absolute rounded-xl shadow-2xl border min-w-[320px]",style:{top:`${i.top}px`,left:`${i.left}px`,background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:qd.map(y=>jsxRuntime.jsx("button",{onClick:()=>p(y.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95 border",style:{color:"var(--modal-v2-text-primary, #60a5fa)",borderColor:"var(--modal-v2-border, rgba(96, 165, 250, 0.3))",background:"var(--modal-v2-bg-secondary, rgba(96, 165, 250, 0.08))"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(96, 165, 250, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(96, 165, 250, 0.08))";},children:y.label},y.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:y=>a(y.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:y=>a(e,y.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),n(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear Dates"})]})]})})]})}function Ta({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,i]=react.useState(false),[m,c]=react.useState(""),[s,p]=react.useState({top:0,left:0}),d=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{if(n&&l.current){let f=l.current.getBoundingClientRect();p({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[n]),react.useEffect(()=>{let f=h=>{d.current&&!d.current.contains(h.target)&&!l.current?.contains(h.target)&&(i(false),c(""));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),react.useEffect(()=>{let f=h=>{h.key==="Escape"&&(i(false),c(""));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n]);let g=f=>{let h=e.some(u=>u.id===f.id);a(h?e.filter(u=>u.id!==f.id):[...e,f]);},x=t.filter(f=>f.name.toLowerCase().includes(m.toLowerCase())),y=e.slice(0,o),b=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>i(!n),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[y.map(f=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:f.name,children:f.avatar?jsxRuntime.jsx("img",{src:f.avatar,alt:f.name,className:"asakaa-avatar-img"}):f.initials},f.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),n&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu absolute rounded-xl shadow-2xl border min-w-[300px]",style:{top:`${s.top}px`,left:`${s.left}px`,background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:f=>c(f.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(f=>{let h=e.some(u=>u.id===f.id);return jsxRuntime.jsxs("button",{onClick:()=>g(f),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:u=>{u.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:f.color,color:"#fff"},children:f.avatar?jsxRuntime.jsx("img",{src:f.avatar,alt:f.name,className:"w-full h-full rounded-full object-cover"}):f.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:f.name}),h&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},f.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),i(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function sr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o}){let[n,i]=react.useState(false),[m,c]=react.useState(""),[s,p]=react.useState(t.length>0),[d,l]=react.useState({top:0,left:0}),g=react.useRef(null),x=react.useRef(null);react.useEffect(()=>{if(n&&x.current){let u=x.current.getBoundingClientRect();l({top:u.bottom+window.scrollY+8,left:u.left+window.scrollX});}},[n]),react.useEffect(()=>{let u=k=>{g.current&&!g.current.contains(k.target)&&!x.current?.contains(k.target)&&(i(false),c(""));};if(n)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]),react.useEffect(()=>{let u=k=>{k.key==="Escape"&&(i(false),c(""));};if(n)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[n]);let y=u=>{if(t.includes(u)){let w=t.filter(v=>v!==u);r(w),w.length===0&&p(false);}else r([...t,u]),p(true);},b=()=>{let u=!s;p(u),u||r([]);},f=a.filter(u=>u.id!==e).filter(u=>u.title.toLowerCase().includes(m.toLowerCase())||u.id.toLowerCase().includes(m.toLowerCase())),h=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:x,onClick:()=>i(!n),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:h,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:h},children:t.length})]}),n&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:g,className:"dependencies-selector-menu absolute rounded-xl shadow-2xl border min-w-[300px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:b,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:s?"#3b82f6":"transparent",borderColor:s?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:s&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:u=>c(u.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:f.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):f.map(u=>{let k=t.includes(u.id);return jsxRuntime.jsxs("button",{onClick:()=>y(u.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:k?"#3b82f6":"transparent",borderColor:k?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:k&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:u.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:u.id})]})]},u.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(false),i(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var sa=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:i,availableUsers:m=[],allCards:c=[]})=>{let{attributes:s,listeners:p,setNodeRef:d,transform:l,transition:g,isDragging:x}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),y={transform:Sr.Transform.toString(l),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:y,...s,...p,onClick:()=>a?.(e),children:t(e)});let b=m.filter(f=>e.assignedUserIds?.includes(f.id));return jsxRuntime.jsxs("div",{ref:d,style:y,className:A("asakaa-card",x&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...s,...p,onClick:f=>{f.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:f=>{f.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:f=>f.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(or,{priority:e.priority,onChange:f=>i?.(e.id,{priority:f})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(nr,{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:(f,h)=>i?.(e.id,{startDate:f,endDate:h})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ta,{assignedUsers:b,availableUsers:m,onChange:f=>i?.(e.id,{assignedUserIds:f.map(h=>h.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(sr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:c,onChange:f=>i?.(e.id,{dependencies:f})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(f=>jsxRuntime.jsx("span",{className:"asakaa-label",children:f},f))})]})},(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));sa.displayName="Card";function Hs({columnTitle:e,onRename:t,className:a}){let[r,o]=react.useState(false),[n,i]=react.useState(false),[m,c]=react.useState(e),[s,p]=react.useState({top:0,left:0}),d=react.useRef(null),l=react.useRef(null),g=react.useRef(null);react.useEffect(()=>{if(r&&l.current){let f=l.current.getBoundingClientRect();p({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[r]),react.useEffect(()=>{let f=h=>{d.current&&!d.current.contains(h.target)&&!l.current?.contains(h.target)&&(o(false),i(false));};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=h=>{h.key==="Escape"&&(o(false),i(false),c(e));};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r,e]),react.useEffect(()=>{n&&g.current&&(g.current.focus(),g.current.select());},[n]);let x=()=>{i(true),c(e);},y=()=>{let f=m.trim();f&&f!==e&&t(f),i(false),o(false),c(e);},b=f=>{f.key==="Enter"?y():f.key==="Escape"&&(i(false),c(e));};return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>o(!r),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"})]})}),r&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsx("div",{ref:d,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${s.top}px`,left:`${s.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:n?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:g,type:"text",value:m,onChange:f=>c(f.target.value),onKeyDown:b,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:x,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]})})})})]})}var Ga=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:i,onCardUpdate:m,availableUsers:c,allCards:s,enableVirtualization:p,cardHeight:d=120,isCollapsed:l,onToggleCollapse:g,onColumnRename:x,className:y})=>{let{setNodeRef:b,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),h=react.useRef(null),u=p??Ts(t.length),k=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>h.current,estimateSize:()=>d,enabled:u});if(a)return jsxRuntime.jsx("div",{ref:b,className:y,children:a(e,t)});let v=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let E=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:E}:E>=80?{state:"warning",percentage:E}:E>=60?{state:"approaching",percentage:E}:{state:"ok",percentage:E}})(),P=v.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:A("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",P&&"ring-2 ring-asakaa-accent-red",y),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:A(C()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&v.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${v.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[v.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"})]}),v.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"})]}),v.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"})}),v.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),x&&jsxRuntime.jsx(Hs,{columnTitle:e.title,onRename:E=>x(e.id,E)}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":l?"Expand column":"Collapse column",children:l?"\u25B6":"\u25BC"})]})]}),!l&&jsxRuntime.jsx("div",{ref:h,className:"asakaa-column-cards",style:{maxHeight:u?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(E=>E.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?n?n(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):u?jsxRuntime.jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(E=>{let T=t[E.index];return T?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${E.start}px)`},children:jsxRuntime.jsx(sa,{card:T,render:r,onClick:i,onUpdate:m,availableUsers:c,allCards:s})},T.id):null})}):t.map(E=>jsxRuntime.jsx(sa,{card:E,render:r,onClick:i,onUpdate:m,availableUsers:c,allCards:s},E.id))})})]})});Ga.displayName="Column";function Ao({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,i]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let c=()=>{let p=n.trim();p&&p!==e?t(p):i(e),o(false);},s=p=>{p.key==="Enter"?c():p.key==="Escape"&&(i(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:n,onChange:p=>i(p.target.value),onBlur:c,onKeyDown:s,className:A("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:A("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Bo(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function pa({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:i,style:m,isLoading:c,error:s,children:p}){let[d,l]=Bo(),g=o?.theme||"dark",y=g==="dark"||g==="neutral"?"dark":"",b=react.useCallback((C,E)=>{t.onCardUpdate?.(C,E);},[t]),f=react.useCallback((C,E)=>{t.onColumnUpdate?.(C,{title:E});},[t]),h=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),u=react.useMemo(()=>{let C=new Map;return e.columns.forEach(E=>{let T=E.cardIds.map(z=>e.cards.find(U=>U.id===z)).filter(z=>z!==void 0).sort((z,U)=>z.position-U.position);C.set(E.id,T);}),C},[e.cards,e.columns]),k=react.useCallback(C=>{let{active:E}=C,T=e.cards.find(z=>z.id===E.id);T&&l({isDragging:true,draggedCardId:T.id,sourceColumnId:T.columnId,targetColumnId:T.columnId});},[e.cards,l]),w=react.useCallback(C=>{let{active:E,over:T}=C;if(!T||!e.cards.find(L=>L.id===E.id))return;let U=null;T.data.current?.type==="column"?U=T.id:T.data.current?.type==="card"&&(U=e.cards.find(H=>H.id===T.id)?.columnId||null),U&&U!==d.targetColumnId&&l({...d,targetColumnId:U});},[e.cards,d,l]),v=react.useCallback(async C=>{let{active:E,over:T}=C;if(l({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!T)return;let z=e.cards.find(S=>S.id===E.id);if(!z)return;let U,L;if(T.data.current?.type==="column"){U=T.id;let S=u.get(U)||[];L=wo(S,0);}else {let S=e.cards.find(Q=>Q.id===T.id);if(!S)return;U=S.columnId;let O=u.get(U)||[],Y=O.findIndex(Q=>Q.id===T.id);L=wo(O,Y);}let H=e.columns.find(S=>S.id===U);if(H&&H.wipLimit&&H.wipLimitType==="hard"){let S=u.get(U)||[];if(z.columnId!==U&&S.length>=H.wipLimit){t.onWipLimitExceeded?.(H,z);return}}(z.columnId!==U||z.position!==L)&&await t.onCardMove?.(z.id,U,L);},[e.cards,e.columns,u,t,l]),P=react.useCallback(C=>{a?.(C);},[a]);return c?jsxRuntime.jsx("div",{className:A("asakaa-board",y,i),style:m,children:jsxRuntime.jsx(yc,{columnCount:3})}):s?jsxRuntime.jsx("div",{className:A("asakaa-board",y,i),style:m,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof s=="string"?s:s.message})]})})}):jsxRuntime.jsxs(core$1.DndContext,{sensors:h,collisionDetection:core$1.closestCorners,onDragStart:k,onDragOver:w,onDragEnd:v,children:[jsxRuntime.jsxs("div",{className:A("asakaa-board",y,i),style:m,children:[e.columns.sort((C,E)=>C.position-E.position).map(C=>{let E=u.get(C.id)||[];return jsxRuntime.jsx(Ga,{column:C,cards:E,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:P,onCardUpdate:b,onColumnRename:f,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},C.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:d.draggedCardId?jsxRuntime.jsx(sa,{card:e.cards.find(C=>C.id===d.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})}function yc({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var lr=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(pa,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(n=>n.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
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 r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,n)=>{r.toBlob(i=>{i?o(i):n(new Error("Failed to create PNG blob"));},"image/png");})}};function Ks(e={}){return new lr(e)}var Wa=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:n}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${n||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(i){console.error("Error in error handler:",i);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:n,componentName:i}=this.props;return a&&r?n?n(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:i?`Error in ${i}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Ro(e,t){let a=r=>jsxRuntime.jsx(Wa,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function zo({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:i,onPredictRisks:m,onOpenAIUsage:c,shortcut:s="k",className:p=""}){let[d,l]=react.useState(false),[g,x]=react.useState(""),[y,b]=react.useState("home"),[f,h]=react.useState(""),[u,k]=react.useState("");react.useEffect(()=>{let C=E=>{(E.metaKey||E.ctrlKey)&&E.key===s&&(E.preventDefault(),l(T=>!T)),E.key==="Escape"&&(l(false),b("home"),x(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[s]),react.useEffect(()=>{d||(b("home"),x(""),h(""),k(""));},[d]);let w=react.useCallback(()=>{l(false);},[]),v=react.useCallback(C=>{let[E,T]=C.split(":");switch(E){case "create-card":b("create-card");break;case "create-card-in":h(T||"");break;case "navigate":T?(a?.(T),w()):b("navigate");break;case "search":r?.(g),w();break;case "priority":b("priority");break;case "set-priority":u&&T&&(o?.(u,T),w());break;case "assign":b("assign");break;case "assign-user":u&&T&&(n?.(u,T),w());break;case "ai":b("ai");break;case "ai-generate-plan":i?.(),w();break;case "ai-predict-risks":m?.(),w();break;case "ai-usage":c?.(),w();break;case "back":b("home");break;}},[g,u,t,a,r,o,n,i,m,c,w]),P=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),w());},[f,g,t,w]);return d?jsxRuntime.jsx(Be,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:w,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:x,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:y==="create-card"&&f?"Type card title and press Enter...":y==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&y==="create-card"&&f&&P();}}),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:v,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:v,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:v,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:v,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:v,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(E=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:E},E))})]},C.id))})]}),y==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:v,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.id}`,onSelect:v,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),y==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:v,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(C=>{let E=e.columns.find(T=>T.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:v,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:E?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:T},T))})]},C.id)})})]}),y==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:v,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:v,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:v,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:v,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 Nc(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function Sc(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 Ec(e){return e.startsWith("image/")}function cr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[i,m]=react.useState(false),[c,s]=react.useState(false),[p,d]=react.useState(null),l=react.useRef(null),g=react.useCallback(v=>{let P=[],C=[];return e.length+v.length>n?(C.push(`Maximum ${n} files allowed`),{valid:P,errors:C}):(v.forEach(E=>{if(E.size/1048576>r){C.push(`${E.name} is too large (max ${r}MB)`);return}if(o&&!o.some(z=>E.type.match(z))){C.push(`${E.name} has invalid file type`);return}P.push(E);}),{valid:P,errors:C})},[e.length,n,r,o]),x=react.useCallback(async v=>{let{valid:P,errors:C}=g(v);if(C.length>0){d(C.join(", ")),setTimeout(()=>d(null),5e3);return}if(P.length!==0){s(true),d(null);try{await t?.(P);}catch(E){d(E instanceof Error?E.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{s(false);}}},[g,t]),y=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(true);},[]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(false);},[]),f=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),h=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(false);let P=Array.from(v.dataTransfer.files);x(P);},[x]),u=react.useCallback(v=>{let P=v.target.files?Array.from(v.target.files):[];x(P),l.current&&(l.current.value="");},[x]),k=react.useCallback(()=>{l.current?.click();},[]),w=react.useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${i?"dragging":""} ${c?"uploading":""}`,onDragEnter:y,onDragLeave:b,onDragOver:f,onDrop:h,onClick:k,children:[jsxRuntime.jsx("input",{ref:l,type:"file",multiple:true,onChange:u,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:i?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",n," files"]})]})})]}),p&&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:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ec(v.type)&&v.url?jsxRuntime.jsx("img",{src:v.thumbnailUrl||v.url,alt:v.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Sc(v.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Nc(v.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>w(v.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"})})})]},v.id))})]})}function Go({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:i=[],activities:m=[],aiInsights:c=[],attachments:s=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:l,onDeleteAttachment:g,onSuggestAssignee:x,onGenerateSubtasks:y,onEstimateEffort:b,currentUserId:f="user-1"}){let[h,u]=react.useState("details"),[k,w]=react.useState(false),[v,P]=react.useState({}),[C,E]=react.useState(""),[T,z]=react.useState(false),[U,L]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{w(false),P({}),u("details"),E(""),L({}),a();},[a]),S=react.useCallback(()=>{r&&Object.keys(v).length>0&&(r(e.id,v),P({}),w(false));},[e.id,v,r]),O=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),Y=react.useCallback(()=>{p&&C.trim()&&(p(e.id,C.trim()),E(""));},[e.id,C,p]),Q=react.useCallback(async()=>{if(x){z(true);try{let M=await x(e);L(ce=>({...ce,assignees:M}));}catch(M){console.error("Failed to suggest assignee:",M);}finally{z(false);}}},[e,x]),R=react.useCallback(async()=>{if(y){z(true);try{let M=await y(e);L(ce=>({...ce,subtasks:M}));}catch(M){console.error("Failed to generate subtasks:",M);}finally{z(false);}}},[e,y]),ee=react.useCallback(async()=>{if(b){z(true);try{let M=await b(e);L(ce=>({...ce,effort:M}));}catch(M){console.error("Failed to estimate effort:",M);}finally{z(false);}}},[e,b]),G={...e,...v},ne=n.filter(M=>G.assignedUserIds?.includes(M.id));return jsxRuntime.jsx(Be,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:M=>M.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:G.priority==="URGENT"?"#EF4444":G.priority==="HIGH"?"#F59E0B":G.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:v.title??G.title,onChange:M=>P({...v,title:M.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:G.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:S,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{w(false),P({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>w(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:O,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:H,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:()=>u("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>u("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),k?jsxRuntime.jsx("textarea",{value:v.description??G.description??"",onChange:M=>P({...v,description:M.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:G.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:v.assignedUserIds??G.assignedUserIds??[],onChange:M=>{let ce=Array.from(M.target.selectedOptions,ie=>ie.value);P({...v,assignedUserIds:ce});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:ne.length>0?ne.map(M=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:M.color},children:M.initials}),jsxRuntime.jsx("span",{children:M.name})]},M.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"}),k?jsxRuntime.jsxs("select",{value:v.priority??G.priority??"",onChange:M=>P({...v,priority:M.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:G.priority==="URGENT"?"#EF4444":G.priority==="HIGH"?"#F59E0B":G.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:G.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:G.labels&&G.labels.length>0?G.labels.map(M=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:M},M)):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"}),k?jsxRuntime.jsx("input",{type:"date",value:v.startDate?new Date(v.startDate).toISOString().split("T")[0]:G.startDate?new Date(G.startDate).toISOString().split("T")[0]:"",onChange:M=>P({...v,startDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:G.startDate?new Date(G.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:v.endDate?new Date(v.endDate).toISOString().split("T")[0]:G.endDate?new Date(G.endDate).toISOString().split("T")[0]:"",onChange:M=>P({...v,endDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:G.endDate?new Date(G.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:v.estimatedTime??G.estimatedTime??"",onChange:M=>P({...v,estimatedTime:M.target.value?parseFloat(M.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:G.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:G.dependencies&&G.dependencies.length>0?G.dependencies.map(M=>{let ce=typeof M=="string"?M:M.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ce.slice(-4)]},ce)}):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:G.createdAt?new Date(G.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:M=>E(M.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Y,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:i.length>0?i.map(M=>{let ce=n.find(ie=>ie.id===M.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:[ce&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ce.color},children:ce.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ce?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(M.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(M.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:M.content})]},M.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(M=>{let ce=n.find(ie=>ie.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[M.type.includes("CREATED")&&"\u2795",M.type.includes("UPDATED")&&"\u270F\uFE0F",M.type.includes("MOVED")&&"\u27A1\uFE0F",M.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",M.type.includes("COMMENT")&&"\u{1F4AC}",M.type.includes("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",M.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:ce?.name||"Unknown"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:M.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(cr,{cardId:e.id,attachments:s,onUpload:l?M=>l(e.id,M):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Q,disabled:T||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:R,disabled:T||!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:T||!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("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),U.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),U.assignees.map((M,ce)=>{let ie=n.find(vt=>vt.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ie&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ie.color},children:ie.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ie?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:M.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(M.confidence*100).toFixed(0),"%"]})]})]},ce)})]}),U.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),U.subtasks.map((M,ce)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:M.title}),M.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:M.description}),M.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",M.estimatedTime,"h"]})]},ce))]}),U.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:[U.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(U.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(M=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${M.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:M.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:M.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:M.description}),M.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",M.suggestedAction]})]},M.id))]}),!U.assignees&&!U.subtasks&&!U.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}var Ac=["LOW","MEDIUM","HIGH","URGENT"],Fc=["todo","in-progress","review","done"];function Wo({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:i=[],activities:m=[],onAddComment:c,onDeleteComment:s,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:l,onAIFindSimilar:g,availableColumns:x=[],availableLabels:y=[]}){let[b,f]=react.useState(e),[h,u]=react.useState(false),[k,w]=react.useState([]),[v,P]=react.useState(false),[C,E]=react.useState(""),[T,z]=react.useState(""),[U,L]=react.useState("all"),[H,S]=react.useState(false),[O,Y]=react.useState(false),[Q,R]=react.useState(false),[ee,G]=react.useState(false),[ne,M]=react.useState(false),[ce,ie]=react.useState(false),vt=react.useRef(null),at=react.useRef(null),Zt=react.useRef(null),De=react.useRef(null),ft=react.useRef(null),yt=react.useRef(null),Ut=react.useRef(null),oa=react.useRef(null);react.useEffect(()=>{e&&!b?f({...e}):e&&b&&e.id!==b.id&&f({...e});},[e,b]),react.useEffect(()=>{let D=$=>{let pe=$.target;De.current&&!De.current.contains(pe)&&S(false),ft.current&&!ft.current.contains(pe)&&Y(false),yt.current&&!yt.current.contains(pe)&&R(false),Ut.current&&!Ut.current.contains(pe)&&G(false);};if(H||O||Q||ee)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[H,O,Q,ee]),react.useEffect(()=>{if(!t)return;let D=$=>{let pe=$.target,ye=pe.tagName==="INPUT"||pe.tagName==="TEXTAREA"||pe.isContentEditable;if($.key==="Escape"){$.preventDefault(),H||O||Q||ee||ne||ce?(S(false),Y(false),R(false),G(false),M(false),ie(false)):ye||a();return}if(ye&&$.key!=="Escape")return;let Re=$.metaKey||$.ctrlKey;switch($.key.toLowerCase()){case "s":$.preventDefault(),S(true);break;case "a":$.preventDefault(),R(true);break;case "p":$.preventDefault(),Y(true);break;case "l":$.preventDefault(),G(true);break;case "d":Re||($.preventDefault(),M(true),setTimeout(()=>oa.current?.focus(),0));break;case "e":Re||($.preventDefault(),ie(true));break;case "i":$.preventDefault(),u(true),setTimeout(()=>at.current?.focus(),0);break;case "t":$.preventDefault(),P(true);break;case "c":$.preventDefault(),Zt.current?.focus();break}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[t,a,H,O,Q,ee,ne,ce]);let xa=react.useCallback(D=>{let $=D.currentTarget.textContent?.trim()||"";if(b&&$!==b.title){let pe={...b,title:$};f(pe),r?.(b.id,{title:$});}},[b,r]),he=react.useCallback(D=>{D.key==="Enter"&&(D.preventDefault(),D.currentTarget.blur()),D.key==="Escape"&&(D.preventDefault(),D.currentTarget.textContent=b?.title||"",D.currentTarget.blur());},[b]),rt=react.useCallback(()=>{b&&e&&b.description!==e.description&&r?.(b.id,{description:b.description}),u(false);},[b,e,r]),Gt=react.useCallback(D=>{if(b){let $={...b,columnId:D};f($),r?.(b.id,{columnId:D}),S(false);}},[b,r]),Ft=react.useCallback(D=>{if(b){let $={...b,priority:D};f($),r?.(b.id,{priority:D}),Y(false);}},[b,r]),ka=react.useCallback(D=>{if(b){let $=b.assignedUserIds||[],pe=$.includes(D)?$.filter(Re=>Re!==D):[...$,D],ye={...b,assignedUserIds:pe};f(ye),r?.(b.id,{assignedUserIds:pe});}},[b,r]),se=react.useCallback(D=>{if(b){let $=b.labels||[],pe=$.includes(D)?$.filter(Re=>Re!==D):[...$,D],ye={...b,labels:pe};f(ye),r?.(b.id,{labels:pe});}},[b,r]),me=react.useCallback(D=>{if(b){let $=D.target.value,pe={...b,endDate:$};f(pe),r?.(b.id,{endDate:$}),M(false);}},[b,r]),K=react.useCallback(D=>{if(b){let $={...b,estimatedTime:parseFloat(D)||0};f($),r?.(b.id,{estimatedTime:parseFloat(D)||0});}},[b,r]),_=react.useCallback(()=>{if(C.trim()){let D={id:`subtask-${Date.now()}`,title:C.trim(),completed:false};w([...k,D]),E(""),P(false);}},[C,k]),Te=react.useCallback(D=>{w(k.map($=>$.id===D?{...$,completed:!$.completed}:$));},[k]),Ge=react.useCallback(D=>{w(k.filter($=>$.id!==D));},[k]),ae=react.useCallback(()=>{T.trim()&&b&&c&&(c(b.id,T.trim()),z(""));},[T,b,c]),le=react.useCallback(D=>{(D.metaKey||D.ctrlKey)&&D.key==="Enter"&&(D.preventDefault(),ae());},[ae]),Qt=D=>jsxRuntime.jsx(Mc__default.default,{remarkPlugins:[Ic__default.default],rehypePlugins:[Lc__default.default],components:{a:({node:$,...pe})=>jsxRuntime.jsx("a",{...pe,target:"_blank",rel:"noopener noreferrer"})},children:D}),Bt=m.filter(D=>U==="comments"?D.type.includes("COMMENT"):U==="history"?!D.type.includes("COMMENT"):true);if(!t||!e)return null;let X=b||e,V=n.filter(D=>X.assignedUserIds?.includes(D.id)),ve=k.filter(D=>D.completed).length;return jsxRuntime.jsx(Be,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:D=>D.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:vt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:xa,onKeyDown:he,children:X.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),X.coverImage&&jsxRuntime.jsx("div",{className:"modal-v2-cover",children:jsxRuntime.jsx("img",{src:X.coverImage,alt:`Cover for ${X.title}`,className:"w-full max-h-96 object-cover",onError:D=>{D.currentTarget.style.display="none";}})}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:De,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>S(!H),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:X.columnId||"No status"})]}),H&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(x.length>0?x:Fc.map(D=>({id:D,title:D}))).map(D=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${X.columnId===D.id?"active":""}`,onClick:()=>Gt(D.id),children:D.title},D.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:yt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>R(!Q),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:V.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:V.map(D=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:D.color},title:D.name,children:D.initials},D.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),Q&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:n.map(D=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${X.assignedUserIds?.includes(D.id)?"active":""}`,onClick:()=>ka(D.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:D.color},children:D.initials}),D.name,X.assignedUserIds?.includes(D.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},D.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ft,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Y(!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("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:X.priority||"None"})]}),O&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[Ac.map(D=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${D.toLowerCase()} ${X.priority===D?"active":""}`,onClick:()=>Ft(D),children:D},D)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ft(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ut,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>G(!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:X.labels&&X.labels.length>0?jsxRuntime.jsx("span",{children:X.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(D=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${X.labels?.includes(D)?"active":""}`,onClick:()=>se(D),children:[D,X.labels?.includes(D)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},D))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{M(!ne),setTimeout(()=>oa.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:X.endDate?new Date(X.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:oa,type:"date",value:typeof X.endDate=="string"?X.endDate.split("T")[0]:X.endDate?(()=>{let D=new Date(X.endDate),$=D.getUTCFullYear(),pe=String(D.getUTCMonth()+1).padStart(2,"0"),ye=String(D.getUTCDate()).padStart(2,"0");return `${$}-${pe}-${ye}`})():"",onChange:me,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ie(!ce),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:X.estimatedTime?`${X.estimatedTime}h`:"Not set"})]}),ce&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:X.estimatedTime||"",onChange:D=>K(D.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ie(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"}),jsxRuntime.jsxs("button",{className:"modal-v2-ai-button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Assist"]})]}),h?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:X.description||"",onChange:D=>{if(b){let $={...b,description:D.target.value};f($);}},onBlur:rt,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>u(true),children:X.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Qt(X.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"}),k.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ve,"/",k.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>P(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:[k.map(D=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${D.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Te(D.id),children:D.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:D.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ge(D.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},D.id)),v&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:C,onChange:D=>E(D.target.value),onKeyDown:D=>{D.key==="Enter"&&_(),D.key==="Escape"&&(P(false),E(""));},onBlur:_,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 ${U==="all"?"active":""}`,onClick:()=>L("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="comments"?"active":""}`,onClick:()=>L("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="history"?"active":""}`,onClick:()=>L("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Zt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:T,onChange:D=>z(D.target.value),onKeyDown:le,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:ae,disabled:!T.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Bt.map(D=>{let $=n.find(ye=>ye.id===D.userId);if(D.type.includes("COMMENT")){let ye=i.find(Re=>Re.id===D.metadata?.commentId);return ye?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[$&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:$.color},children:$.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:$?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(D.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:ye.content})]})]},D.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[D.type.includes("CREATED")&&"\u2795",D.type.includes("UPDATED")&&"\u270F\uFE0F",D.type.includes("MOVED")&&"\u27A1\uFE0F",D.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",D.type.includes("ASSIGNED")&&"\u{1F464}",D.type.includes("PRIORITY")&&"\u{1F3AF}",D.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:$?.name||"Unknown"})," ",D.type.replace(/_/g," ").toLowerCase(),D.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:D.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(D.timestamp).toLocaleString()})]})]},D.id)}),Bt.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 Hc({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function _o({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(i=>({...i,average:i.average??e.reduce((m,c)=>m+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"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(Hc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((i,m)=>i+m.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((i,m)=>i+m.completed,0)/e.length).toFixed(1)})]}),o&&e.some(i=>i.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((i,m)=>i+(m.planned||0),0)})]})]})]})}function Zc({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function Vo({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),i=e[e.length-1]?.remaining||0,m=e[e.length-1]?.ideal||0,c=n>0?(n-i)/n*100:0,s=i<=m;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Zc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:s?"#10B981":"#EF4444",fill:s?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:s?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:s?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:s?"#10B981":"#EF4444"},children:i})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:s?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:s?"#10B981":"#EF4444"},children:s?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var im={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},ai=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function lm({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let i=r+(o-r)*.5,m=e+i*Math.cos(-a*(Math.PI/180)),c=t+i*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:m,y:c,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function ri({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function jo({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((c,s)=>c+s.value,0),i=e.map(c=>({...c,totalValue:n,color:c.color||im[c.name]||ai[e.indexOf(c)%ai.length]})),m=i.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:i,cx:"50%",cy:"50%",labelLine:false,label:o?lm:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:i.map((c,s)=>jsxRuntime.jsx(recharts.Cell,{fill:m[s]},`cell-${s}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ri,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,s)=>{let p=s.payload,d=n>0?(p.value/n*100).toFixed(0):"0";return `${c} (${p.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:i,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ri,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:i.map((c,s)=>jsxRuntime.jsx(recharts.Cell,{fill:m[s]},`cell-${s}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,s)=>s.value>c.value?s:c).name})]})]})]})}var zr=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[i,m]=react.useState(false),[c,s]=react.useState(false),[p,d]=react.useState(false),[l,g]=react.useState(false);if(e.length===0)return null;let x=e.map(k=>k.id),y=k=>{r.onBulkUpdate?.(x,{priority:k}),m(false);},b=k=>{r.onBulkMove?.(x,k),s(false),a();},f=k=>{r.onBulkUpdate?.(x,{assignedUserIds:k}),d(false);},h=k=>{let w=new Set;e.forEach(P=>{P.labels?.forEach(C=>w.add(C));});let v=Array.from(new Set([...w,...k]));r.onBulkUpdate?.(x,{labels:v}),g(false);},u=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!i),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(k),children:[jsxRuntime.jsx("span",{className:A("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>s(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!l),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:u,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});zr.displayName="BulkOperationsToolbar";function um(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,i,m,c,s;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let x=a?.find(y=>y.id===g);i=`assignee-${g}`,m=x?.name||`User ${g}`,c=x?.color,s=x?.avatar,r.has(i)||r.set(i,{id:i,title:m,groupValue:g,cardIds:[],color:c,icon:s}),r.get(i).cardIds.push(o.id);}):(i="assignee-unassigned",m="Unassigned",c="#6b7280",s="\u{1F464}",r.has(i)||r.set(i,{id:i,title:m,groupValue:null,cardIds:[],color:c,icon:s}),r.get(i).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",i=`priority-${n}`;let l={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"}}[n];m=l.title,c=l.color,r.has(i)||r.set(i,{id:i,title:m,groupValue:n,cardIds:[],color:c}),r.get(i).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{i=`label-${g}`,m=g,c="#6b7280",r.has(i)||r.set(i,{id:i,title:m,groupValue:g,cardIds:[],color:c}),r.get(i).cardIds.push(o.id);}):(i="label-none",m="No Labels",c="#6b7280",r.has(i)||r.set(i,{id:i,title:m,groupValue:null,cardIds:[],color:c}),r.get(i).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function Ko({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,i]=react.useState(new Set),m=react.useMemo(()=>um(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(s=>{i(p=>{let d=new Set(p);return d.has(s)?d.delete(s):d.add(s),d});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(pa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:A("asakaa-swimlane-view",o),children:[m.map(s=>{let p=n.has(s.id),d=e.cards.filter(g=>s.cardIds.includes(g.id)),l={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(s.id),style:{borderLeft:s.color?`4px solid ${s.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[s.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:s.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:s.color},children:s.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",s.cardIds.length," ",s.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(pa,{board:l,callbacks:r,availableUsers:a})})]},s.id)}),m.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 Yo=[{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 Xo({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),i=react.useRef(null),m=Yo.find(s=>s.value===e)||Yo[0];react.useEffect(()=>{function s(p){n.current&&!n.current.contains(p.target)&&i.current&&!i.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let c=s=>{t(s),o(false);};return jsxRuntime.jsxs("div",{className:A("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:A("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:n,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:Yo.map(s=>jsxRuntime.jsxs("button",{onClick:()=>c(s.value),className:A("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===s.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:s.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:s.label}),e===s.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:s.description})]})]},s.value))})]})]})}var mr=[{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 hm(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(s=>e.key===s||e.code===s))return false;let o=t.modifiers||{},n=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,i=o.shift?e.shiftKey:!e.shiftKey,m=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return n&&i&&m&&c}function li(e={}){let{shortcuts:t=mr,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),n=react.useRef(a);react.useEffect(()=>{o.current=t,n.current=a;},[t,a]);let i=react.useCallback(c=>{o.current=[...o.current,c];},[]),m=react.useCallback(c=>{o.current=o.current.filter(s=>s.action!==c);},[]);return react.useEffect(()=>{function c(s){if(!n.current)return;let p=s.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&s.key!=="Escape"&&!s.ctrlKey&&!s.metaKey)){for(let d of o.current)if(hm(s,d)){r&&s.preventDefault();let l=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(l);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:i,unregisterShortcut:m,isEnabled:a}}function vm(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function ym(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function xm(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=ym(e),r=t?vm(t):"";return a?`${a} + ${r}`:r}function km(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function qo({shortcuts:e=mr,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function m(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let i=km(e);return jsxRuntime.jsxs("div",{className:A("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:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-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:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(i).map(([m,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(s=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:s.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:xm(s)})]},s.action))})]},m))})}),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 Jo=[{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,48 +42,48 @@
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function rs({templates:e,onSelectTemplate:t,className:r}){let[a,n]=Se.useState(false),o=Se.useRef(null),s=Se.useRef(null);Se.useEffect(()=>{function i(p){o.current&&!o.current.contains(p.target)&&s.current&&!s.current.contains(p.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},u=e.reduce((i,p)=>{let l=p.category||"Other";return i[l]||(i[l]=[]),i[l].push(p),i},{});return jsxRuntime.jsxs("div",{className:L("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:L("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(u).map(([i,p])=>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:p.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:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.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 ns({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,c]=Se.useState("export"),[u,i]=Se.useState("json"),[p,l]=Se.useState(null),d=Se.useRef(null);if(!t)return null;let m=async()=>{let y=n?.current||void 0,h=await Mi(e,u,y);Ii(h,u);},v=async y=>{let h=y.target.files?.[0];if(h){try{let g=await Fi(h),b=h.name.endsWith(".json")?"json":"csv",f=Li(g,b);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"}`]});}d.current&&(d.current.value="");}};return jsxRuntime.jsxs("div",{className:L("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:L("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:L("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:L("p-4 rounded-lg border-2 transition-all text-center",u===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:d,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>d.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"})]})]}),p&&jsxRuntime.jsxs("div",{className:L("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:L("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((y,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",y]},h))})]})]})]})]})]})}var Mf=["URGENT","HIGH","MEDIUM","LOW"],If=[{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"}],Af=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function os({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:s,onFilterHighPriority:c,availableUsers:u=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:l=true,compact:d=false,groupBy:m="none",onGroupByChange:v}){let[y,h]=Se.useState(true),g=Se.useCallback(x=>{r({search:x.target.value});},[r]),b=Se.useCallback(x=>{r({dateFilter:x.target.value});},[r]),f=Se.useCallback(x=>{a({by:x.target.value});},[a]),k=Se.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),w=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 ${d?"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"}),w&&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:b,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 D=x.target.value;r({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Mf.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),u.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:x=>{let D=x.target.value;r({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),u.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 D=x.target.value;r({labels:D==="all"?[]:[D]});},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:If.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:m,onChange:x=>v(x.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Af.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.value))})}),w&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ss({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:s,onExportGanttPNG:c,onExportGanttCSV:u}){let[i,p]=Se.useState(false),l=Se.useRef(null);Se.useEffect(()=>{let m=v=>{l.current&&!l.current.contains(v.target)&&p(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let d=m=>{m(),p(false);};return jsxRuntime.jsxs("div",{className:L("relative",a),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!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:()=>d(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:()=>d(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:()=>d(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:()=>d(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:()=>d(()=>u?.()),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:()=>d(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:()=>d(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 is={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"}},ls={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"}},cs={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"}},Yr={dark:is,light:ls,neutral:cs},Ln="dark";var Fn=Se.createContext(void 0),_f="asakaa-theme";function ac({children:e,defaultTheme:t=Ln,storageKey:r=_f}){let[a,n]=Se.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),o=Se.useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);Se.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,u=Yr[a];Object.entries(u.colors).forEach(([p,l])=>{l&&c.style.setProperty(`--theme-${Hf(p)}`,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(([p,l])=>{let d=u.colors[p];d&&c.style.setProperty(l,d);}),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:Yr};return jsxRuntime.jsx(Fn.Provider,{value:s,children:e})}function pa(){let e=Se.useContext(Fn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Hf(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ds({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=pa();return e?jsxRuntime.jsxs("div",{className:L("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(Yr).map(([o,s])=>jsxRuntime.jsxs("button",{onClick:()=>{n(o),t();},className:L("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 Ce={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 nc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ce[e]||Ce.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",Ce[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",Ce[e].bgSecondary),bgGrid:a("--theme-bg-card",Ce[e].bgGrid),bgWeekend:a("--theme-bg-hover",Ce[e].bgWeekend),border:a("--theme-border-primary",Ce[e].border),borderLight:a("--theme-border-subtle",Ce[e].borderLight),textPrimary:a("--theme-text-primary",Ce[e].textPrimary),textSecondary:a("--theme-text-secondary",Ce[e].textSecondary),textTertiary:a("--theme-text-tertiary",Ce[e].textTertiary),accent:a("--theme-accent-primary",Ce[e].accent),accentHover:a("--theme-accent-hover",Ce[e].accentHover),accentLight:a("--theme-accent-primary",Ce[e].accentLight),taskBarPrimary:a("--theme-accent-primary",Ce[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",Ce[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",Ce[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",Ce[e].dependency),dependencyHover:a("--theme-border-secondary",Ce[e].dependencyHover),criticalPath:a("--theme-error",Ce[e].criticalPath),criticalPathLight:a("--theme-error",Ce[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",Ce[e].today):e==="neutral"?a("--theme-text-primary",Ce[e].today):a("--theme-error",Ce[e].today),todayLight:e==="light"?a("--theme-accent-primary",Ce[e].todayLight):e==="neutral"?a("--theme-text-primary",Ce[e].todayLight):a("--theme-error",Ce[e].todayLight),milestone:a("--theme-warning",Ce[e].milestone),milestoneLight:a("--theme-warning",Ce[e].milestoneLight),statusTodo:a("--theme-text-tertiary",Ce[e].statusTodo),statusInProgress:a("--theme-accent-primary",Ce[e].statusInProgress),statusCompleted:a("--theme-success",Ce[e].statusCompleted),hoverBg:a("--theme-bg-hover",Ce[e].hoverBg),focusRing:a("--theme-accent-primary",Ce[e].focusRing)}}var Bn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},oc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},us={en:Bn,es:oc};function sc(e){return us[e]||us.en}function ms(e,t){let r=sc(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var ga=Se.createContext(Bn);function Ha(){return Se.useContext(ga)}function ig({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:o,onExportMSProject:s}){let[c,u]=Se.useState(false),[i,p]=Se.useState(null),l=Se.useRef(null),d=Ha();if(Se.useEffect(()=>{let h=g=>{l.current&&!l.current.contains(g.target)&&u(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||r||a||n||o||s))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet",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",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:o},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:s}].filter(h=>h.handler),y=async(h,g)=>{if(g){p(h);try{await g();}catch(b){console.error(`Export ${h} failed:`,b);}finally{p(null),u(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(!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:d.toolbar.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:v.map((h,g)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>y(h.id,h.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:g<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.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===h.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"})}):h.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:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function lg({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(o.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:s?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500,zIndex:s?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:n,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}}),o.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":a.textTertiary},children:o.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":a.textTertiary},children:o.label})]},o.value)})})}function cg({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",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 text-xs transition-all",style:{color:o?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500},whileHover:{color:o?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:n.label}),o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function dg({theme:e,value:t,onChange:r}){let[a,n]=Se.useState(false),o=Se.useRef(null),s=Ha();Se.useEffect(()=>{let i=p=>{o.current&&!o.current.contains(p.target)&&n(false);};return a&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=[{value:"compact",label:s.toolbar.compact||"Compact"},{value:"comfortable",label:s.toolbar.normal||"Normal"},{value:"spacious",label:s.toolbar.spacious||"Spacious"}],u=c.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:o,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(!a),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:a?e.accentLight:e.bgSecondary,border:`1px solid ${a?e.accent:e.borderLight}`,color:a?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${s.toolbar.density||"Density"}: ${u}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((i,p)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(i.value),n(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:p<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function On({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:s,rowDensity:c,onRowDensityChange:u,showThemeSelector:i=true,showCreateTaskButton:p=false,createTaskLabel:l,onCreateTask:d,onExportPNG:m,onExportPDF:v,onExportExcel:y,onExportCSV:h,onExportJSON:g,onExportMSProject:b}){let f=Ha(),k=m||v||y||h||g||b,w=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],x=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(cg,{options:w,value:t,onChange:D=>r(D),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(dg,{theme:e,value:c,onChange:u})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:d,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.toolbar.createTask})]}),(k||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ig,{theme:e,onExportPNG:m,onExportPDF:v,onExportExcel:y,onExportCSV:h,onExportJSON:g,onExportMSProject:b}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(lg,{options:x,value:o,onChange:D=>s(D),theme:e})]})]})}function zn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=Se.useState(false),[o,s]=Se.useState({x:0,y:0}),c=Se.useRef(null),u=Se.useRef(null);Se.useEffect(()=>{if(!a)return;let p=l=>{c.current&&!c.current.contains(l.target)&&n(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>{if(!a&&u.current){let p=u.current.getBoundingClientRect();s({x:p.left,y:p.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(Ye,{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(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.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:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},p.id))]})})})})]})}function ha({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=Se.useRef(null);return Se.useEffect(()=>{if(!e)return;let c=i=>{s.current&&!s.current.contains(i.target)&&n();},u=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u);}},[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:u=>{c.disabled||(u.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:u=>{u.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 lt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function vc({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:c,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:l,enableKeyboard:d=true}){let m=Se.useRef(false),v=Se.useCallback(f=>{m.current=f;},[]),y=Se.useCallback(f=>{let k=[],w=x=>{for(let D of x)k.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&w(D.subtasks);};return w(f),k},[]),h=Se.useCallback(()=>{let f=y(e);for(let k of f)if(t.has(k.id))return k;return null},[e,t,y]),g=Se.useCallback((f,k)=>{let w=y(e);if(w.length===0)return;let x=h();if(!x){r(w[0].id,false);return}let D=w.findIndex(T=>T.id===x.id);if(D===-1)return;let C=f==="up"?D-1:D+1;if(C<0||C>=w.length)return;let N=w[C];r(N.id,k);},[e,h,y,r]),b=Se.useCallback(f=>{if(!d)return;let k=f.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||m.current){f.key==="Escape"&&(k.blur(),m.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,C=Array.from(t),N=h();if(f.key==="ArrowUp"){f.preventDefault(),g("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),g("down",f.shiftKey);return}if(N&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!N.isExpanded||f.key==="ArrowLeft"&&N.isExpanded)&&p(N.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){C.length>0&&(f.preventDefault(),s(C,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){C.length>0&&(f.preventDefault(),c(C));return}if(f.key==="Tab"&&f.shiftKey){C.length>0&&(f.preventDefault(),u(C));return}if(f.key==="Enter"&&!f.shiftKey&&!D){N&&(f.preventDefault(),a(N.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!D){N&&(f.preventDefault(),a(N.id,"above"));return}if(f.key==="Enter"&&D){N&&(f.preventDefault(),l(N.id));return}if(f.key==="F2"){N&&(f.preventDefault(),i(N.id));return}if(f.key==="Delete"||f.key==="Backspace"&&D){C.length>0&&(f.preventDefault(),n(C));return}if(f.key==="d"&&D&&!f.shiftKey){C.length>0&&(f.preventDefault(),o(C));return}},[d,t,h,g,a,n,o,s,c,u,i,p,l]);return Se.useEffect(()=>{if(d)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[d,b]),{setIsEditing:v}}function xc(){let[e,t]=Se.useState(new Set),[r,a]=Se.useState(null),n=Se.useCallback(l=>{t(new Set([l])),a(l);},[]),o=Se.useCallback(l=>{t(d=>{let m=new Set(d);return m.has(l)?m.delete(l):m.add(l),m}),a(l);},[]),s=Se.useCallback((l,d)=>{if(!r){n(l);return}let m=d.indexOf(r),v=d.indexOf(l);if(m===-1||v===-1){n(l);return}let y=Math.min(m,v),h=Math.max(m,v),g=d.slice(y,h+1);t(new Set(g)),a(l);},[r,n]),c=Se.useCallback((l,d,m,v)=>{v?s(l,d):m?o(l):n(l);},[n,o,s]),u=Se.useCallback((l,d)=>{d?t(m=>{let v=new Set(m);return v.add(l),v}):n(l);},[n]),i=Se.useCallback(()=>{t(new Set),a(null);},[]),p=Se.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:c,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:p}}function ba(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 gs(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=gs(r.subtasks,t);if(a)return a}return null}function hs(e,t){if(t.length===0)return e;let r=ba(e),a=t[0],n=r.findIndex(l=>l.id===a);if(n<=0)return e;let o=r[n-1],s=(l,d)=>{let m=[];return {tasks:l.filter(y=>{if(d.has(y.id))return m.push(y),false;if(y.subtasks){let h=s(y.subtasks,d);y.subtasks=h.tasks,m.push(...h.removed);}return true}),removed:m}},c=(l,d,m)=>l.map(v=>v.id===d?{...v,subtasks:[...v.subtasks||[],...m],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,d,m)}:v),u=new Set(t),{tasks:i,removed:p}=s(e,u);return c(i,o.id,p)}function bs(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=gs(r,a);if(!n)continue;let o=gs(r,n.id),s=(i,p,l)=>{for(let d=0;d<i.length;d++){let m=i[d];if(m.id===p&&m.subtasks){let v=m.subtasks.findIndex(y=>y.id===l);if(v!==-1){let[y]=m.subtasks.splice(v,1);return y}}if(m.subtasks){let v=s(m.subtasks,p,l);if(v)return v}}return null},c=(i,p,l)=>{let d=i.findIndex(m=>m.id===p);if(d!==-1)return i.splice(d+1,0,l),i;for(let m of i)m.subtasks&&c(m.subtasks,p,l);return i},u=s(r,n.id,a);u&&(o&&o.subtasks?c(o.subtasks,n.id,u):c(r,n.id,u));}return r}function vs(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,c,u)=>{let i=s.findIndex(l=>l.id===c);if(i===-1){for(let l of s)if(l.subtasks&&o(l.subtasks,c,u))return true;return false}let p=u==="up"?i-1:i+1;return p<0||p>=s.length?false:([s[i],s[p]]=[s[p],s[i]],true)};return o(a,n,r),a}function $n(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 ys(e,t){let r=[...e];for(let a of t){let n=s=>{let c=s.findIndex(p=>p.id===a);if(c===-1){for(let p of s)if(p.subtasks&&n(p.subtasks))return true;return false}let u=s[c],i={...u,id:`${u.id}-copy-${Date.now()}`,name:`${u.name} (Copy)`,subtasks:u.subtasks?o(u.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 kc(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=u=>{let i=u.findIndex(l=>l.id===t);if(i===-1){for(let l of u)if(l.subtasks&&c(l.subtasks))return true;return false}let p=r==="above"?i:i+1;return u.splice(p,0,s),true};return c(a),{tasks:a,newTask:s}}function xs(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:xs(a.subtasks,t,r)}:a)}function ks(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:ks(r.subtasks,t)}:r)}function ws(e,t){let r=p=>{for(let l of p){if(l.id===t)return l;if(l.subtasks){let d=r(l.subtasks);if(d)return d}}return null},a=r(e),n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s=a?.startDate||n,c=a?.endDate||o,u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(s),endDate:new Date(c),color:a?.color||"#3B82F6"},i=p=>p.map(l=>{if(l.id===t){let d=l.subtasks||[];return {...l,subtasks:[...d,u],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:u}}var Tc={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"}},Dc=({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 Sc({status:e="todo",onChange:t,className:r}){let[a,n]=Se.useState(false),[o,s]=Se.useState({top:0,left:0}),c=Se.useRef(null),u=Se.useRef(null);Se.useEffect(()=>{if(a&&u.current){let d=u.current.getBoundingClientRect();s({top:d.bottom+window.scrollY+8,left:d.left+window.scrollX});}},[a]),Se.useEffect(()=>{let d=m=>{c.current&&!c.current.contains(m.target)&&!u.current?.contains(m.target)&&n(false);};if(a)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]),Se.useEffect(()=>{let d=m=>{m.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[a]);let i=d=>{t(d),n(false);},p=Tc[e],l=p.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:u,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:p.label,children:jsxRuntime.jsx(Dc,{icon:p.icon,color:l})}),a&&jsxRuntime.jsx(Ye,{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(Tc).map(([d,m])=>jsxRuntime.jsxs("button",{onClick:()=>i(d),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:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Dc,{icon:m.icon,color:m.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:m.label}),e===d&&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"})})]},d))})]})})]})}function Wn({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:s,onTaskContextMenu:c,onTaskToggle:u,scrollTop:i,columns:p,onToggleColumn:l,onColumnResize:d,onTaskUpdate:m,onTaskIndent:v,onTaskOutdent:y,onTaskMove:h,onMultiTaskDelete:g,onTaskDuplicate:b,onTaskCreate:f,onTaskRename:k,onCreateSubtask:w,onOpenTaskModal:x}){let D=Se.useContext(ga),[C,N]=Se.useState(null),[T,$]=Se.useState(false),[z,R]=Se.useState(null),[W,E]=Se.useState(""),O=Se.useRef(null),G=Se.useRef(null),[U,A]=Se.useState(null),[K,_]=Se.useState(0),[ae,M]=Se.useState(0),[de,ie]=Se.useState({isOpen:false,x:0,y:0,type:"header"});Se.useEffect(()=>{function X(j){O.current&&!O.current.contains(j.target)&&$(false);}if(T)return document.addEventListener("mousedown",X),()=>document.removeEventListener("mousedown",X)},[T]),Se.useEffect(()=>{z&&G.current&&(G.current.focus(),G.current.select());},[z]),Se.useEffect(()=>{if(!U)return;let X=Te=>{let We=Te.clientX-K,re=ae+We;d?.(U,re);},j=()=>{A(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",X),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="";}},[U,K,ae,d]);let{selectedTaskIds:kt,handleTaskClick:rt,isTaskSelected:ir}=xc(),{setIsEditing:De}=vc({tasks:e,selectedTaskIds:kt,onTaskSelect:(X,j)=>{let We=ba(e).map(re=>re.id);rt(X,We,j||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:X=>{let j=ba(e).find(Te=>Te.id===X);j&&zr(j);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:X=>{let j=ba(e).find(Te=>Te.id===X);j&&x&&x(j);},enableKeyboard:true}),bt=(X,j=0)=>{let Te=[];for(let We of X)Te.push({task:We,level:j}),We.subtasks&&We.subtasks.length>0&&We.isExpanded&&Te.push(...bt(We.subtasks,j+1));return Te},wt=bt(e),jt=48,hr=X=>!X.startDate||!X.endDate?"-":`${Math.ceil((X.endDate.getTime()-X.startDate.getTime())/(1e3*60*60*24))}d`,zr=X=>{R(X.id),E(X.name),De(true);},he=X=>{W.trim()&&W!==e.find(j=>j.id===X)?.name&&k?.(X,W.trim()),R(null),E(""),De(false);},at=()=>{R(null),E(""),De(false);},Kt=(X,j)=>{j.stopPropagation(),w?.(X.id);},Wt=(X,j,Te)=>{switch(X.id){case "name":let We=z===j.id,re=C===j.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Te*20}px`},children:[j.subtasks&&j.subtasks.length>0?jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),u?.(j.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:j.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:j.color||"#3B82F6",opacity:j.parentId?.6:1,borderColor:j.isMilestone?t.accent:"transparent",borderWidth:j.isMilestone?"2px":"0px"},title:j.isMilestone?"Milestone":j.parentId?"Subtask":"Task"}),We?jsxRuntime.jsx("input",{ref:G,type:"text",value:W,onChange:J=>E(J.target.value),onKeyDown:J=>{J.key==="Enter"?he(j.id):J.key==="Escape"&&at();},onBlur:()=>he(j.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:J=>J.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Te===0?"14px":Te===1?"13px":"12px",fontWeight:j.isMilestone?600:j.subtasks&&j.subtasks.length>0?500:400,opacity:Te===0?1:Te===1?.95:.88},title:j.name,children:j.name}),re&&!We&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:J=>Kt(j,J),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:J=>{J.stopPropagation(),zr(j);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":let le=j.startDate?typeof j.startDate=="string"?j.startDate:j.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:le||"",onChange:J=>{m?.(j.id,{startDate:J.target.value?new Date(J.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 lr=j.endDate?typeof j.endDate=="string"?j.endDate:j.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:lr||"",onChange:J=>{m?.(j.id,{endDate:J.target.value?new Date(J.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:hr(j)})});case "assignees":let Ut=a.filter(J=>j.assignees?.some(Y=>Y.name===J.name||Y.initials===J.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Vr,{assignedUsers:Ut,availableUsers:a,onChange:J=>{let Y=J.map(ve=>({id:ve.id,name:ve.name,initials:ve.initials,color:ve.color}));m?.(j.id,{assignees:Y.length>0?Y:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Sc,{status:j.status||"todo",onChange:J=>{m?.(j.id,{status:J,progress:J==="completed"?100:j.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${j.progress}%`,backgroundColor:j.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[j.progress,"%"]})]});default:return null}},$r=X=>[{id:"hide",label:"Hide Column",icon:lt.Hide,onClick:()=>l(X),disabled:X==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:lt.SortDesc,onClick:()=>{}}],se=X=>[{id:"edit",label:D?.contextMenu?.editTask||"Edit Task",icon:lt.Pencil,onClick:()=>{s?.(X);}},{id:"addSubtask",label:D?.contextMenu?.addSubtask||"Add Subtask",icon:lt.Add,onClick:()=>{w?.(X.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:D?.contextMenu?.markIncomplete||"Mark Incomplete",icon:lt.MarkIncomplete,onClick:()=>{m?.(X.id,{status:"todo",progress:0});},disabled:X.status==="todo"},{id:"setInProgress",label:D?.contextMenu?.setInProgress||"Set In Progress",icon:lt.SetInProgress,onClick:()=>{m?.(X.id,{status:"in-progress"});},disabled:X.status==="in-progress"},{id:"markComplete",label:D?.contextMenu?.markComplete||"Mark Complete",icon:lt.MarkComplete,onClick:()=>{m?.(X.id,{status:"completed",progress:100});},disabled:X.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:D?.contextMenu?.splitTask||"Split Task",icon:lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:D?.contextMenu?.deleteTask||"Delete Task",icon:lt.Delete,onClick:()=>{g?.([X.id]);}}],ue=p.filter(X=>X.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${jt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[ue.map((X,j)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${X.id==="name"?"justify-start":"justify-center"}`,style:{width:`${X.width}px`,minWidth:`${X.width}px`,maxWidth:`${X.width}px`,borderRight:j<ue.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box"},onContextMenu:Te=>{Te.preventDefault(),ie({isOpen:true,x:Te.clientX,y:Te.clientY,type:"header",columnId:X.id});},onMouseEnter:Te=>{Te.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Te=>{Te.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:X.label}),X.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500 transition-colors group",style:{backgroundColor:U===X.id?t.accent:"transparent"},onMouseDown:Te=>{Te.preventDefault(),Te.stopPropagation(),A(X.id),_(Te.clientX),M(X.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}})})]},X.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(zn,{columns:p,onToggleColumn:l,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>$(!T),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"}),T&&jsxRuntime.jsxs("div",{ref:O,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:X=>X.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:()=>$(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:wt.map(({task:X,level:j},Te)=>{let We=ir(X.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center cursor-pointer group",style:{height:`${r}px`,borderLeft:We?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:We?t.accentLight:Te%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>N(X.id),onMouseLeave:()=>N(null),onClick:re=>{let lr=ba(e).map(Y=>Y.id),J=navigator.platform.toUpperCase().indexOf("MAC")>=0?re.metaKey:re.ctrlKey;rt(X.id,lr,J,re.shiftKey),o?.(X);},onDoubleClick:re=>{re.stopPropagation(),s?.(X);},onContextMenu:re=>{re.preventDefault(),ie({isOpen:true,x:re.clientX,y:re.clientY,type:"task",task:X}),c?.(X,re);},whileHover:{backgroundColor:We?t.accentLight:t.hoverBg},children:ue.map((re,le)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${re.id==="name"?"justify-start":"justify-center"} ${le<ue.length-1?"border-r":""}`,style:{width:`${re.width}px`,minWidth:`${re.width}px`,maxWidth:`${re.width}px`,borderColor:C===X.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:Wt(re,X,re.id==="name"?j:0)},`${X.id}-${re.id}`))},X.id)})}),jsxRuntime.jsx(ha,{isOpen:de.isOpen,x:de.x,y:de.y,items:de.type==="header"&&de.columnId?$r(de.columnId):de.type==="task"&&de.task?se(de.task):[],onClose:()=>ie({...de,isOpen:false}),theme:t})]})}function Ec(e,t){let[r,a]=Se.useState("none"),[n,o]=Se.useState(0),[s,c]=Se.useState(e),[u,i]=Se.useState(t),[p,l]=Se.useState(null),[d,m]=Se.useState(null),[v,y]=Se.useState(null),[h,g]=Se.useState(null),[b,f]=Se.useState(0),[k,w]=Se.useState(0),[x,D]=Se.useState(null),[C,N]=Se.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:c,ghostWidth:u,setGhostWidth:i,connectionLine:p,setConnectionLine:l,hoveredTaskId:d,setHoveredTaskId:m,activeZone:v,setActiveZone:y,draggedSegmentIndex:h,setDraggedSegmentIndex:g,draggedSegmentStartX:b,setDraggedSegmentStartX:f,segmentDragOffsetX:k,setSegmentDragOffsetX:w,hoveredSegmentIndex:x,setHoveredSegmentIndex:D,isHovered:C,setIsHovered:N,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(W,E)=>{a("none"),l(null),m(null),c(W),i(E),w(0),g(null),f(0);}}}function Un({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:c,onClick:u,onDoubleClick:i,onContextMenu:p,onDateChange:l,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:v}){let y=Ec(t,a),h=Se.useRef(null),{dragMode:g,setDragMode:b,dragOffset:f,setDragOffset:k,ghostX:w,setGhostX:x,ghostWidth:D,setGhostWidth:C,connectionLine:N,setConnectionLine:T,hoveredTaskId:$,setHoveredTaskId:z,activeZone:R,setActiveZone:W,draggedSegmentIndex:E,setDraggedSegmentIndex:O,draggedSegmentStartX:G,setDraggedSegmentStartX:U,segmentDragOffsetX:A,setSegmentDragOffsetX:K,hoveredSegmentIndex:_,setHoveredSegmentIndex:ae,isHovered:M,setIsHovered:de,isDragging:ie,isResizing:kt,isConnecting:rt,resetDragState:ir}=y,De=32,bt=8,wt=e.endDate&&e.endDate<new Date&&e.progress<100,jt=e.isCriticalPath,hr=n.name==="neutral"||n.today==="#1C1917",he=(Y=>Y>=80?20:Y>=60?15:Y>=50?12:10)(a),at=a<50,Kt=a<40,Wt=Y=>Y.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),$r=()=>{let Y=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Y} day${Y!==1?"s":""}`},se=Y=>Math.round(Y/o)*o,ue=Y=>{let ve=Math.round(Y/o),S=new Date(s);return S.setDate(S.getDate()+ve),S},X=(Y,ve)=>{for(let S of m){if(S.id===e.id)continue;let H=5;if(Y>=S.x-H&&Y<=S.x+S.width+H&&ve>=S.y-H&&ve<=S.y+S.height+H)return S.id}return null},j=Se.useCallback((Y,ve,S)=>{Y.preventDefault(),Y.stopPropagation();let H=h.current?.ownerSVGElement;if(!H)return;let me=H.createSVGPoint();me.x=Y.clientX,me.y=Y.clientY;let ye=me.matrixTransform(H.getScreenCTM()?.inverse()),Be=S!==void 0?S:t,Ue=ve;if(!Ue){let Mt=ye.x-Be;Y.shiftKey?(Ue="connect",T({x:t+a,y:r+De/2})):Y.ctrlKey||Y.metaKey?Ue="move":Y.altKey?Ue=Mt<a/2?"resize-start":"resize-end":Kt?Mt<a/2?Ue="move":Ue="resize-end":at?Mt<=he/2?Ue="resize-start":Mt>=a-he/2?Ue="resize-end":Ue="move":Mt<=he?Ue="resize-start":Mt>=a-he?Ue="resize-end":Ue="move";}b(Ue),de(false),W(null),Ue==="move"?k(ye.x-Be):Ue==="connect"?T({x:t+a,y:r+De/2}):k(0),x(Be),C(a);},[t,a,r,De]),Te=Se.useCallback(Y=>{if(g==="none")return;let ve=h.current?.ownerSVGElement;if(!ve)return;let S=ve.createSVGPoint();S.x=Y.clientX,S.y=Y.clientY;let H=S.matrixTransform(ve.getScreenCTM()?.inverse());if(g==="connect"){T({x:H.x,y:H.y});let me=X(H.x,H.y);z(me);}else if(g==="move"){let me=H.x-f,ye=se(me);x(ye),C(a);let Be=Math.round((ye-t)/o);if(v?.(e.id,Be,true),e.segments&&e.segments.length>0&&E!==null){let Ue=ye-G;K(Ue);}}else if(g==="resize-start"){let me=H.x,ye=se(me),Be=t+a-ye;Be>=o&&(x(ye),C(Be));}else if(g==="resize-end"){let me=H.x,Be=se(me)-t;Be>=o&&C(Be);}},[g,t,a,o,f,e,se,E,G,X,z,T,x,C,K,v]),We=Se.useCallback(()=>{if(g!=="none"){if(g==="connect")$&&d&&d(e,$),T(null),z(null);else {let Y=e.endDate.getTime()-e.startDate.getTime(),ve,S,H=true;if(g==="move"){if(ve=ue(w),S=new Date(ve.getTime()+Y),e.segments&&e.segments.length>0&&E!==null){let me=Math.round(A/o),ye=e.segments.map((St,go)=>{if(go===E){let wa=new Date(St.startDate),Ca=new Date(St.endDate);return wa.setDate(wa.getDate()+me),Ca.setDate(Ca.getDate()+me),{startDate:wa,endDate:Ca}}return St}),Be=ye.flatMap(St=>[St.startDate,St.endDate]),Ue=new Date(Math.min(...Be.map(St=>St.getTime()))),Mt=new Date(Math.max(...Be.map(St=>St.getTime())));l?.({...e,segments:ye},Ue,Mt),ir(t,a);return}}else g==="resize-start"?(ve=ue(w),S=e.endDate,ve>=S&&(console.warn("Invalid date range: start date must be before end date"),H=false)):g==="resize-end"?(ve=e.startDate,S=ue(w+D),S<=ve&&(console.warn("Invalid date range: end date must be after start date"),H=false)):H=false;H&&ve&&S&&(S.getTime()-ve.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,ve,S));}v?.(e.id,0,false),ir(t,a);}},[g,w,D,e,l,$,d,t,a,o,ue,A,E,ir,v]);Se.useEffect(()=>{if(g==="none")return;let Y=S=>{Te(S);},ve=()=>{We();};return window.addEventListener("mousemove",Y),window.addEventListener("mouseup",ve),()=>{window.removeEventListener("mousemove",Y),window.removeEventListener("mouseup",ve);}},[g,Te,We]);let re=ie&&!rt?w:t,le=ie&&!rt?D:a,lr=c.taskTooltip(e),Ut=typeof lr=="string"?lr:"",J=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!ie&&de(true),onMouseLeave:()=>{ie||(de(false),W(null));},onClick:()=>!ie&&u?.(e),onDoubleClick:Y=>{ie||(Y.stopPropagation(),i?.(e));},onContextMenu:Y=>{Y.preventDefault(),p?.(e,Y);},children:[Ut&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:Ut}}),M&&!ie&&!at&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:he,height:De,fill:R==="resize-start"?n.accent:"transparent",opacity:R==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-start"),onMouseDown:Y=>j(Y,"resize-start")}),jsxRuntime.jsx("rect",{x:t+he,y:r,width:a-he*2,height:De,fill:R==="move"?n.accent:"transparent",opacity:R==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>W("move"),onMouseDown:Y=>j(Y,"move")}),jsxRuntime.jsx("rect",{x:t+a-he,y:r,width:he,height:De,fill:R==="resize-end"?n.accent:"transparent",opacity:R==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-end"),onMouseDown:Y=>j(Y,"resize-end")})]}),M&&!ie&&Kt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:De,fill:R==="move"?n.accent:"transparent",opacity:R==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>W("move"),onMouseDown:Y=>j(Y,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:De,fill:R==="resize-end"?n.accent:"transparent",opacity:R==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-end"),onMouseDown:Y=>j(Y,"resize-end")}),M&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+De-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ie&&!rt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:r,width:D,height:De,rx:bt,fill:n.accent,opacity:.5,stroke:n.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:re,y:r,width:le,height:De,rx:bt,fill:e.isCriticalPath||wt?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":J,initial:{opacity:0,scale:.95},animate:{opacity:ie&&!rt?.15:e.parentId?.6:M?.9:.8,scale:M&&!ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Y=>j(Y),style:{cursor:ie?rt?"crosshair":kt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:re,y:r,width:le*(e.progress/100),height:De,rx:bt,fill:e.isCriticalPath||wt?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((Y,ve)=>{let S=(Y.startDate.getTime()-s.getTime())/864e5*o,me=(Y.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-S+o,ye=ie&&g==="move"&&E===ve,Be=_===ve,Ue=ye?S+A:S;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ie&&ae(ve),onMouseLeave:()=>!ie&&ae(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Ue,y:r,width:me,height:De,rx:bt,fill:e.isCriticalPath||wt?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:ye||e.parentId?.6:Be?.9:.8,scale:Be&&!ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Mt=>{Mt.stopPropagation(),O(ve),U(S),j(Mt,void 0,S);},style:{cursor:ie?rt?"crosshair":kt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Ue,y:r,width:me*(e.progress/100),height:De,rx:bt,fill:e.isCriticalPath||wt?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ve}`)}),hr&&(wt||jt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jt&&!wt&&jsxRuntime.jsx("rect",{x:re,y:r,width:le,height:De,rx:bt,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),wt&&jsxRuntime.jsx("rect",{x:re,y:r,width:le,height:De,rx:bt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),le>60&&!e.segments&&(()=>{let Y=c.taskLabel(e),ve=typeof Y=="string"?Y:e.name,S=ve.length>Math.floor(le/8)?`${ve.substring(0,Math.floor(le/8))}...`:ve;return jsxRuntime.jsx("text",{x:re+12,y:r+De/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S})})(),le>100&&e.progress>0&&e.progress<100&&!ie&&!e.segments&&jsxRuntime.jsxs("text",{x:re+le-12,y:r+De/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&&le>80&&!ie&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:re+le-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:re+le-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(M||kt)&&!rt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:at?re-15:re-10,y:r-5,width:at?25:20,height:De+10,fill:"transparent",onMouseDown:Y=>j(Y,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:at?re-8:re-3,y:r+6,width:at?8:6,height:at?De-12:De-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:re+le-10,y:r-5,width:at?25:20,height:De+10,fill:"transparent",onMouseDown:Y=>j(Y,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:at?re+le:re+le-3,y:r+6,width:at?8:6,height:at?De-12:De-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:M&&!ie&&!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+De/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:Y=>{Y.stopPropagation(),j(Y,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+De/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),rt&&N&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+De/2,x2:N.x,y2:N.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:N.x,cy:N.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:N.x+15,y:N.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:N.x+10},animate:{opacity:1,x:N.x+15},transition:{duration:.2},children:"Connect"})]}),(M||ie)&&!rt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:re-2,y:r-2,width:le+4,height:De+4,rx:bt+2,fill:"none",stroke:ie?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:ie?.6:.4,initial:{opacity:0},animate:{opacity:ie?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),kt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+D,y1:0,x2:w+D,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&!ie&&!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:re+le/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 ${re+le/2-6} ${r-13} L ${re+le/2} ${r-3} L ${re+le/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:re+le/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:re+le/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:re+le/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Wt(e.startDate)}),jsxRuntime.jsx("text",{x:re+le/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:re+le/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Wt(e.endDate)}),jsxRuntime.jsx("text",{x:re+le/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:re+le/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$r()}),jsxRuntime.jsx("text",{x:re+le/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:re+le/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:re+le/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:re+le/2-50,y:r-25,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Y=>Y.name).join(", ").substring(0,30),e.assignees.map(Y=>Y.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:re+le/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Kt?"Left: move \u2022 Right: resize":at?"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 _n({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[s,c]=Se.useState(false),u=r-e,i=a-t,p=e+u/2,l=`M ${e} ${t} C ${p} ${t}, ${p} ${a}, ${r} ${a}`,d=6,m=Math.atan2(i,u),v=r-d*Math.cos(m-Math.PI/6),y=a-d*Math.sin(m-Math.PI/6),h=r-d*Math.cos(m+Math.PI/6),g=a-d*Math.sin(m+Math.PI/6),b=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:b,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 ${v} ${y} M ${r} ${a} L ${h} ${g}`,fill:"none",stroke:b,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:b,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:p,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:p-4,y1:(t+a)/2-4,x2:p+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:p+4,y1:(t+a)/2-4,x2:p-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Vn({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=Se.useState(false),c=16,u=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:u(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 q={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(p=>{p.dependencies&&a.set(p.id,p.dependencies),p.subtasks&&n(p.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let s=new Set,c=new Set,u=i=>{if(!s.has(i)){s.add(i),c.add(i);let p=a.get(i)||[];for(let l of p){if(!s.has(l)&&u(l))return true;if(c.has(l))return true}}return c.delete(i),false};return u(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=q.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=q.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=q.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=q.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
|
|
46
|
-
`)},formatDate:e=>{let t=e.getFullYear(),
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Zo({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),i=react.useRef(null);react.useEffect(()=>{function s(p){n.current&&!n.current.contains(p.target)&&i.current&&!i.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let m=s=>{t(s),o(false);},c=e.reduce((s,p)=>{let d=p.category||"Other";return s[d]||(s[d]=[]),s[d].push(p),s},{});return jsxRuntime.jsxs("div",{className:A("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",s.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",s.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:A("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:n,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([s,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:s})}),jsxRuntime.jsx("div",{children:p.map(d=>jsxRuntime.jsxs("button",{onClick:()=>m(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},s)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function en({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[i,m]=react.useState("export"),[c,s]=react.useState("json"),[p,d]=react.useState(null),l=react.useRef(null);if(!t)return null;let g=async()=>{let y=o?.current||void 0,b=await Es(e,c,y);Ps(b,c);},x=async y=>{let b=y.target.files?.[0];if(b){try{let f=await Ls(b),h=b.name.endsWith(".json")?"json":"csv",u=Is(f,h);d(u),u.success&&r&&r(u,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}l.current&&(l.current.value="");}};return jsxRuntime.jsxs("div",{className:A("fixed inset-0 z-[9999] flex items-center justify-center",n),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>m("export"),className:A("flex-1 px-6 py-4 font-semibold transition-colors",i==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>m("import"),className:A("flex-1 px-6 py-4 font-semibold transition-colors",i==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[i==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(y=>jsxRuntime.jsxs("button",{onClick:()=>s(y),className:A("p-4 rounded-lg border-2 transition-all text-center",c===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:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),i==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:l,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>l.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"})]})]}),p&&jsxRuntime.jsxs("div",{className:A("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:A("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((y,b)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",y]},b))})]})]})]})]})]})}var Nm=["URGENT","HIGH","MEDIUM","LOW"],Sm=[{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"}],Em=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function tn({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:i,onFilterHighPriority:m,availableUsers:c=[],availableLabels:s=[],availableColumns:p=[],showQuickFilters:d=true,compact:l=false,groupBy:g="none",onGroupByChange:x}){let[y,b]=react.useState(true),f=react.useCallback(v=>{a({search:v.target.value});},[a]),h=react.useCallback(v=>{a({dateFilter:v.target.value});},[a]),u=react.useCallback(v=>{r({by:v.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),w=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 ${l?"filter-bar--compact":""} ${y?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>b(!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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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"}),w&&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:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),m&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:v=>{let P=v.target.value;a({priorities:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Nm.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:v=>{let P=v.target.value;a({assignees:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(v=>jsxRuntime.jsx("option",{value:v.id,children:v.name},v.id))]})}),s.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:v=>{let P=v.target.value;a({labels:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),s.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]})}),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:u,className:"filter-bar__select filter-bar__select--sm",children:Sm.map(v=>jsxRuntime.jsx("option",{value:v.value,children:v.label},v.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:v=>x(v.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Em.map(v=>jsxRuntime.jsx("option",{value:v.value,children:v.label},v.value))})}),w&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function an({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:i,onExportGanttPNG:m,onExportGanttCSV:c}){let[s,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&p(false);};return s&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[s]);let l=g=>{g(),p(false);};return jsxRuntime.jsxs("div",{className:A("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!s),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":s,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),s&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>l(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>l(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"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:()=>l(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>l(async()=>await m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[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:()=>l(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>l(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>l(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var rn={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"}},on={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"}},nn={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"}},Ea={dark:rn,light:on,neutral:nn},Gr="dark";var $r=react.createContext(void 0),zm="asakaa-theme";function mi({children:e,defaultTheme:t=Gr,storageKey:a=zm}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),n=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,c=Ea[r];Object.entries(c.colors).forEach(([p,d])=>{d&&m.style.setProperty(`--theme-${Um(p)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,d])=>{let l=c.colors[p];l&&m.style.setProperty(d,l);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let i={theme:r,setTheme:n,themes:Ea};return jsxRuntime.jsx($r.Provider,{value:i,children:e})}function ja(){let e=react.useContext($r);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Um(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function sn({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ja();return e?jsxRuntime.jsxs("div",{className:A("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ea).map(([n,i])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:A("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:i.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:i.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&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"})})]},n))})]})]}):null}var Ce={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 pi(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ce[e]||Ce.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,i)=>a.getPropertyValue(n).trim()||i;return {bgPrimary:r("--theme-bg-primary",Ce[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ce[e].bgSecondary),bgGrid:r("--theme-bg-card",Ce[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ce[e].bgWeekend),border:r("--theme-border-primary",Ce[e].border),borderLight:r("--theme-border-subtle",Ce[e].borderLight),textPrimary:r("--theme-text-primary",Ce[e].textPrimary),textSecondary:r("--theme-text-secondary",Ce[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ce[e].textTertiary),accent:r("--theme-accent-primary",Ce[e].accent),accentHover:r("--theme-accent-hover",Ce[e].accentHover),accentLight:r("--theme-accent-primary",Ce[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ce[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ce[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ce[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ce[e].dependency),dependencyHover:r("--theme-border-secondary",Ce[e].dependencyHover),criticalPath:r("--theme-error",Ce[e].criticalPath),criticalPathLight:r("--theme-error",Ce[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ce[e].today):e==="neutral"?r("--theme-text-primary",Ce[e].today):r("--theme-error",Ce[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ce[e].todayLight):e==="neutral"?r("--theme-text-primary",Ce[e].todayLight):r("--theme-error",Ce[e].todayLight),milestone:r("--theme-warning",Ce[e].milestone),milestoneLight:r("--theme-warning",Ce[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ce[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ce[e].statusInProgress),statusCompleted:r("--theme-success",Ce[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ce[e].hoverBg),focusRing:r("--theme-accent-primary",Ce[e].focusRing)}}var Wr={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},ui={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},ln={en:Wr,es:ui};function gi(e){return ln[e]||ln.en}function dn(e,t){let a=gi(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var Ya=react.createContext(Wr);function pr(){return react.useContext(Ya)}function ap({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:i}){let[m,c]=react.useState(false),[s,p]=react.useState(null),d=react.useRef(null),l=pr();if(react.useEffect(()=>{let b=f=>{d.current&&!d.current.contains(f.target)&&c(false);};return m&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[m]),!(t||a||r||o||n||i))return null;let x=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:i}].filter(b=>b.handler),y=async(b,f)=>{if(f){p(b);try{await f();}catch(h){console.error(`Export ${b} failed:`,h);}finally{p(null),c(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#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:l.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&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:x.map((b,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>y(b.id,b.handler),disabled:s!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<x.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:s===b.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):b.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function rp({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(n=>{let i=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(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:i?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:i?600:500,zIndex:i?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[i&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:i?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:i?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function op({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function np({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),i=pr();react.useEffect(()=>{let s=p=>{n.current&&!n.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let m=[{value:"compact",label:i.toolbar.compact||"Compact"},{value:"comfortable",label:i.toolbar.normal||"Normal"},{value:"spacious",label:i.toolbar.spacious||"Spacious"}],c=m.find(s=>s.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${i.toolbar.density||"Density"}: ${c}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((s,p)=>{let d=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(s.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:p<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:s.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},s.value)})})})})]})}function Hr({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:i,rowDensity:m,onRowDensityChange:c,showThemeSelector:s=true,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:l,onExportPNG:g,onExportPDF:x,onExportExcel:y,onExportCSV:b,onExportJSON:f,onExportMSProject:h}){let u=pr(),k=g||x||y||b||f||h,w=[{value:"day",label:u.toolbar.day},{value:"week",label:u.toolbar.week},{value:"month",label:u.toolbar.month}],v=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(op,{options:w,value:t,onChange:P=>a(P),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(np,{theme:e,value:m,onChange:c})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:l,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:d||u.toolbar.createTask})]}),(k||s)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ap,{theme:e,onExportPNG:g,onExportPDF:x,onExportExcel:y,onExportCSV:b,onExportJSON:f,onExportMSProject:h}),s&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),s&&jsxRuntime.jsx(rp,{options:v,value:n,onChange:P=>i(P),theme:e})]})]})}function _r({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,i]=react.useState({x:0,y:0}),m=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=d=>{m.current&&!m.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let s=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();i({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,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:`${n.x}px`,top:`${n.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),s.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Xa({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let i=react.useRef(null);return react.useEffect(()=>{if(!e)return;let m=s=>{i.current&&!i.current.contains(s.target)&&o();},c=s=>{s.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",c);}},[e,o]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg shadow-xl",style:{left:`${t}px`,top:`${a}px`,backgroundColor:n.bgSecondary,border:`1px solid ${n.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:c=>{m.disabled||(c.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},m.id))})})}):null}var it={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Ni({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:i,onTaskIndent:m,onTaskOutdent:c,onTaskRename:s,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:l=true}){let g=react.useRef(false),x=react.useCallback(u=>{g.current=u;},[]),y=react.useCallback(u=>{let k=[],w=v=>{for(let P of v)k.push(P),P.subtasks&&P.subtasks.length>0&&P.isExpanded&&w(P.subtasks);};return w(u),k},[]),b=react.useCallback(()=>{let u=y(e);for(let k of u)if(t.has(k.id))return k;return null},[e,t,y]),f=react.useCallback((u,k)=>{let w=y(e);if(w.length===0)return;let v=b();if(!v){a(w[0].id,false);return}let P=w.findIndex(T=>T.id===v.id);if(P===-1)return;let C=u==="up"?P-1:P+1;if(C<0||C>=w.length)return;let E=w[C];a(E.id,k);},[e,b,y,a]),h=react.useCallback(u=>{if(!l)return;let k=u.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||g.current){u.key==="Escape"&&(k.blur(),g.current=false);return}let P=navigator.platform.toUpperCase().indexOf("MAC")>=0?u.metaKey:u.ctrlKey,C=Array.from(t),E=b();if(u.key==="ArrowUp"){u.preventDefault(),f("up",u.shiftKey);return}if(u.key==="ArrowDown"){u.preventDefault(),f("down",u.shiftKey);return}if(E&&(u.key==="ArrowRight"||u.key==="ArrowLeft")){E.subtasks&&E.subtasks.length>0&&(u.preventDefault(),(u.key==="ArrowRight"&&!E.isExpanded||u.key==="ArrowLeft"&&E.isExpanded)&&p(E.id));return}if(u.altKey&&(u.key==="ArrowUp"||u.key==="ArrowDown")){C.length>0&&(u.preventDefault(),i(C,u.key==="ArrowUp"?"up":"down"));return}if(u.key==="Tab"&&!u.shiftKey){C.length>0&&(u.preventDefault(),m(C));return}if(u.key==="Tab"&&u.shiftKey){C.length>0&&(u.preventDefault(),c(C));return}if(u.key==="Enter"&&!u.shiftKey&&!P){E&&(u.preventDefault(),r(E.id,"below"));return}if(u.key==="Enter"&&u.shiftKey&&!P){E&&(u.preventDefault(),r(E.id,"above"));return}if(u.key==="Enter"&&P){E&&(u.preventDefault(),d(E.id));return}if(u.key==="F2"){E&&(u.preventDefault(),s(E.id));return}if(u.key==="Delete"||u.key==="Backspace"&&P){C.length>0&&(u.preventDefault(),o(C));return}if(u.key==="d"&&P&&!u.shiftKey){C.length>0&&(u.preventDefault(),n(C));return}},[l,t,b,f,r,o,n,i,m,c,s,p,d]);return react.useEffect(()=>{if(l)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[l,h]),{setIsEditing:x}}function Ei(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),n=react.useCallback(d=>{t(l=>{let g=new Set(l);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),i=react.useCallback((d,l)=>{if(!a){o(d);return}let g=l.indexOf(a),x=l.indexOf(d);if(g===-1||x===-1){o(d);return}let y=Math.min(g,x),b=Math.max(g,x),f=l.slice(y,b+1);t(new Set(f)),r(d);},[a,o]),m=react.useCallback((d,l,g,x)=>{x?i(d,l):g?n(d):o(d);},[o,n,i]),c=react.useCallback((d,l)=>{l?t(g=>{let x=new Set(g);return x.add(d),x}):o(d);},[o]),s=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:i,handleTaskClick:m,handleKeyboardSelection:c,clearSelection:s,isTaskSelected:p}}function qa(e){let t=[],a=(r,o,n=0)=>{for(let i=0;i<r.length;i++){let m={...r[i],parentId:o,level:n,position:i};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,n+1);}};return a(e),t}function pn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=pn(a.subtasks,t);if(r)return r}return null}function un(e,t){if(t.length===0)return e;let a=qa(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let n=a[o-1],i=(d,l)=>{let g=[];return {tasks:d.filter(y=>{if(l.has(y.id))return g.push(y),false;if(y.subtasks){let b=i(y.subtasks,l);y.subtasks=b.tasks,g.push(...b.removed);}return true}),removed:g}},m=(d,l,g)=>d.map(x=>x.id===l?{...x,subtasks:[...x.subtasks||[],...g],isExpanded:true}:x.subtasks?{...x,subtasks:m(x.subtasks,l,g)}:x),c=new Set(t),{tasks:s,removed:p}=i(e,c);return m(s,n.id,p)}function gn(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=pn(a,r);if(!o)continue;let n=pn(a,o.id),i=(s,p,d)=>{for(let l=0;l<s.length;l++){let g=s[l];if(g.id===p&&g.subtasks){let x=g.subtasks.findIndex(y=>y.id===d);if(x!==-1){let[y]=g.subtasks.splice(x,1);return y}}if(g.subtasks){let x=i(g.subtasks,p,d);if(x)return x}}return null},m=(s,p,d)=>{let l=s.findIndex(g=>g.id===p);if(l!==-1)return s.splice(l+1,0,d),s;for(let g of s)g.subtasks&&m(g.subtasks,p,d);return s},c=i(a,o.id,r);c&&(n&&n.subtasks?m(n.subtasks,o.id,c):m(a,o.id,c));}return a}function fn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(i,m,c)=>{let s=i.findIndex(d=>d.id===m);if(s===-1){for(let d of i)if(d.subtasks&&n(d.subtasks,m,c))return true;return false}let p=c==="up"?s-1:s+1;return p<0||p>=i.length?false:([i[s],i[p]]=[i[p],i[s]],true)};return n(r,o,a),r}function Vr(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function hn(e,t){let a=[...e];for(let r of t){let o=i=>{let m=i.findIndex(p=>p.id===r);if(m===-1){for(let p of i)if(p.subtasks&&o(p.subtasks))return true;return false}let c=i[m],s={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?n(c.subtasks):void 0};return i.splice(m+1,0,s),true},n=i=>i.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?n(m.subtasks):void 0}));o(a);}return a}function Pi(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let i={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},m=c=>{let s=c.findIndex(d=>d.id===t);if(s===-1){for(let d of c)if(d.subtasks&&m(d.subtasks))return true;return false}let p=a==="above"?s:s+1;return c.splice(p,0,i),true};return m(r),{tasks:r,newTask:i}}function bn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:bn(r.subtasks,t,a)}:r)}function vn(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:vn(a.subtasks,t)}:a)}function yn(e,t){let a=p=>{for(let d of p){if(d.id===t)return d;if(d.subtasks){let l=a(d.subtasks);if(l)return l}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let i=r?.startDate||o,m=r?.endDate||n,c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(i),endDate:new Date(m),color:r?.color||"#3B82F6"},s=p=>p.map(d=>{if(d.id===t){let l=d.subtasks||[];return {...d,subtasks:[...l,c],isExpanded:true}}return d.subtasks?{...d,subtasks:s(d.subtasks)}:d});return {tasks:s(e),newTask:c}}var Li={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"}},Ai=({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 Fi({status:e="todo",onChange:t,className:a}){let[r,o]=react.useState(false),[n,i]=react.useState({top:0,left:0}),m=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(r&&c.current){let l=c.current.getBoundingClientRect();i({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[r]),react.useEffect(()=>{let l=g=>{m.current&&!m.current.contains(g.target)&&!c.current?.contains(g.target)&&o(false);};if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]),react.useEffect(()=>{let l=g=>{g.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r]);let s=l=>{t(l),o(false);},p=Li[e],d=p.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>o(!r),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${d}10`,boxShadow:`0 0 0 2px ${d}30 inset`},title:p.label,children:jsxRuntime.jsx(Ai,{icon:p.icon,color:d})}),r&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"absolute",top:`${n.top}px`,left:`${n.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(Li).map(([l,g])=>jsxRuntime.jsxs("button",{onClick:()=>s(l),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:g.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ai,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===l&&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"})})]},l))})]})})]})}function jr({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:i,onTaskContextMenu:m,onTaskToggle:c,scrollTop:s,columns:p,onToggleColumn:d,onColumnResize:l,onTaskUpdate:g,onTaskIndent:x,onTaskOutdent:y,onTaskMove:b,onMultiTaskDelete:f,onTaskDuplicate:h,onTaskCreate:u,onTaskRename:k,onCreateSubtask:w,onOpenTaskModal:v}){let P=react.useContext(Ya),[C,E]=react.useState(null),[T,z]=react.useState(false),[U,L]=react.useState(null),[H,S]=react.useState(""),O=react.useRef(null),Y=react.useRef(null),[Q,R]=react.useState(null),[ee,G]=react.useState(0),[ne,M]=react.useState(0),[ce,ie]=react.useState({isOpen:false,x:0,y:0,type:"header"});react.useEffect(()=>{function K(_){O.current&&!O.current.contains(_.target)&&z(false);}if(T)return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[T]),react.useEffect(()=>{U&&Y.current&&(Y.current.focus(),Y.current.select());},[U]),react.useEffect(()=>{if(!Q)return;let K=Te=>{let Ge=Te.clientX-ee,ae=ne+Ge;l?.(Q,ae);},_=()=>{R(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",_),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",_),document.body.style.cursor="",document.body.style.userSelect="";}},[Q,ee,ne,l]);let{selectedTaskIds:vt,handleTaskClick:at,isTaskSelected:Zt}=Ei(),{setIsEditing:De}=Ni({tasks:e,selectedTaskIds:vt,onTaskSelect:(K,_)=>{let Ge=qa(e).map(ae=>ae.id);at(K,Ge,_||false,false);},onTaskCreate:u||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:b||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:K=>{let _=qa(e).find(Te=>Te.id===K);_&&xa(_);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:K=>{let _=qa(e).find(Te=>Te.id===K);_&&v&&v(_);},enableKeyboard:true}),ft=(K,_=0)=>{let Te=[];for(let Ge of K)Te.push({task:Ge,level:_}),Ge.subtasks&&Ge.subtasks.length>0&&Ge.isExpanded&&Te.push(...ft(Ge.subtasks,_+1));return Te},yt=ft(e),Ut=48,oa=K=>!K.startDate||!K.endDate?"-":`${Math.ceil((K.endDate.getTime()-K.startDate.getTime())/(1e3*60*60*24))}d`,xa=K=>{L(K.id),S(K.name),De(true);},he=K=>{H.trim()&&H!==e.find(_=>_.id===K)?.name&&k?.(K,H.trim()),L(null),S(""),De(false);},rt=()=>{L(null),S(""),De(false);},Gt=(K,_)=>{_.stopPropagation(),w?.(K.id);},Ft=(K,_,Te)=>{switch(K.id){case "name":let Ge=U===_.id,ae=C===_.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Te*20}px`},children:[_.subtasks&&_.subtasks.length>0?jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),c?.(_.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:_.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:_.color||"#3B82F6",opacity:_.parentId?.6:1,borderColor:_.isMilestone?t.accent:"transparent",borderWidth:_.isMilestone?"2px":"0px"},title:_.isMilestone?"Milestone":_.parentId?"Subtask":"Task"}),Ge?jsxRuntime.jsx("input",{ref:Y,type:"text",value:H,onChange:X=>S(X.target.value),onKeyDown:X=>{X.key==="Enter"?he(_.id):X.key==="Escape"&&rt();},onBlur:()=>he(_.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:X=>X.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Te===0?"14px":Te===1?"13px":"12px",fontWeight:_.isMilestone?600:_.subtasks&&_.subtasks.length>0?500:400,opacity:Te===0?1:Te===1?.95:.88},title:_.name,children:_.name}),ae&&!Ge&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:X=>Gt(_,X),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:X=>{X.stopPropagation(),xa(_);},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 le=_.startDate?typeof _.startDate=="string"?_.startDate:_.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:X=>X.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:le||"",onChange:X=>{g?.(_.id,{startDate:X.target.value?new Date(X.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 Qt=_.endDate?typeof _.endDate=="string"?_.endDate:_.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:X=>X.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:Qt||"",onChange:X=>{g?.(_.id,{endDate:X.target.value?new Date(X.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:oa(_)})});case "assignees":let Bt=r.filter(X=>_.assignees?.some(V=>V.name===X.name||V.initials===X.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:X=>X.stopPropagation(),children:jsxRuntime.jsx(Ta,{assignedUsers:Bt,availableUsers:r,onChange:X=>{let V=X.map(ve=>({id:ve.id,name:ve.name,initials:ve.initials,color:ve.color}));g?.(_.id,{assignees:V.length>0?V:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:X=>X.stopPropagation(),children:jsxRuntime.jsx(Fi,{status:_.status||"todo",onChange:X=>{g?.(_.id,{status:X,progress:X==="completed"?100:_.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${_.progress}%`,backgroundColor:_.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[_.progress,"%"]})]});default:return null}},ka=K=>[{id:"hide",label:"Hide Column",icon:it.Hide,onClick:()=>d(K),disabled:K==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:it.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:it.SortDesc,onClick:()=>{}}],se=K=>[{id:"edit",label:P?.contextMenu?.editTask||"Edit Task",icon:it.Pencil,onClick:()=>{i?.(K);}},{id:"addSubtask",label:P?.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{w?.(K.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:P?.contextMenu?.markIncomplete||"Mark Incomplete",icon:it.MarkIncomplete,onClick:()=>{g?.(K.id,{status:"todo",progress:0});},disabled:K.status==="todo"},{id:"setInProgress",label:P?.contextMenu?.setInProgress||"Set In Progress",icon:it.SetInProgress,onClick:()=>{g?.(K.id,{status:"in-progress"});},disabled:K.status==="in-progress"},{id:"markComplete",label:P?.contextMenu?.markComplete||"Mark Complete",icon:it.MarkComplete,onClick:()=>{g?.(K.id,{status:"completed",progress:100});},disabled:K.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:P?.contextMenu?.splitTask||"Split Task",icon:it.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:P?.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{f?.([K.id]);}}],me=p.filter(K=>K.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Ut}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[me.map((K,_)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${K.id==="name"?"justify-start":"justify-center"}`,style:{width:`${K.width}px`,minWidth:`${K.width}px`,maxWidth:`${K.width}px`,borderRight:_<me.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box"},onContextMenu:Te=>{Te.preventDefault(),ie({isOpen:true,x:Te.clientX,y:Te.clientY,type:"header",columnId:K.id});},onMouseEnter:Te=>{Te.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Te=>{Te.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:K.label}),K.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500 transition-colors group",style:{backgroundColor:Q===K.id?t.accent:"transparent"},onMouseDown:Te=>{Te.preventDefault(),Te.stopPropagation(),R(K.id),G(Te.clientX),M(K.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute right-0 top-2 bottom-2 w-0.5 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:t.accent}})})]},K.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(_r,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>z(!T),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"}),T&&jsxRuntime.jsxs("div",{ref:O,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:K=>K.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>z(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:yt.map(({task:K,level:_},Te)=>{let Ge=Zt(K.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center cursor-pointer group",style:{height:`${a}px`,borderLeft:Ge?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ge?t.accentLight:Te%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>E(K.id),onMouseLeave:()=>E(null),onClick:ae=>{let Qt=qa(e).map(V=>V.id),X=navigator.platform.toUpperCase().indexOf("MAC")>=0?ae.metaKey:ae.ctrlKey;at(K.id,Qt,X,ae.shiftKey),n?.(K);},onDoubleClick:ae=>{ae.stopPropagation(),i?.(K);},onContextMenu:ae=>{ae.preventDefault(),ie({isOpen:true,x:ae.clientX,y:ae.clientY,type:"task",task:K}),m?.(K,ae);},whileHover:{backgroundColor:Ge?t.accentLight:t.hoverBg},children:me.map((ae,le)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${ae.id==="name"?"justify-start":"justify-center"} ${le<me.length-1?"border-r":""}`,style:{width:`${ae.width}px`,minWidth:`${ae.width}px`,maxWidth:`${ae.width}px`,borderColor:C===K.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:Ft(ae,K,ae.id==="name"?_:0)},`${K.id}-${ae.id}`))},K.id)})}),jsxRuntime.jsx(Xa,{isOpen:ce.isOpen,x:ce.x,y:ce.y,items:ce.type==="header"&&ce.columnId?ka(ce.columnId):ce.type==="task"&&ce.task?se(ce.task):[],onClose:()=>ie({...ce,isOpen:false}),theme:t})]})}function Ri(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[i,m]=react.useState(e),[c,s]=react.useState(t),[p,d]=react.useState(null),[l,g]=react.useState(null),[x,y]=react.useState(null),[b,f]=react.useState(null),[h,u]=react.useState(0),[k,w]=react.useState(0),[v,P]=react.useState(null),[C,E]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:i,setGhostX:m,ghostWidth:c,setGhostWidth:s,connectionLine:p,setConnectionLine:d,hoveredTaskId:l,setHoveredTaskId:g,activeZone:x,setActiveZone:y,draggedSegmentIndex:b,setDraggedSegmentIndex:f,draggedSegmentStartX:h,setDraggedSegmentStartX:u,segmentDragOffsetX:k,setSegmentDragOffsetX:w,hoveredSegmentIndex:v,setHoveredSegmentIndex:P,isHovered:C,setIsHovered:E,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,S)=>{r("none"),d(null),g(null),m(H),s(S),w(0),f(null),u(0);}}}function Kr({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:i,templates:m,onClick:c,onDoubleClick:s,onContextMenu:p,onDateChange:d,onDependencyCreate:l,allTaskPositions:g=[],onDragMove:x}){let y=Ri(t,r),b=react.useRef(null),{dragMode:f,setDragMode:h,dragOffset:u,setDragOffset:k,ghostX:w,setGhostX:v,ghostWidth:P,setGhostWidth:C,connectionLine:E,setConnectionLine:T,hoveredTaskId:z,setHoveredTaskId:U,activeZone:L,setActiveZone:H,draggedSegmentIndex:S,setDraggedSegmentIndex:O,draggedSegmentStartX:Y,setDraggedSegmentStartX:Q,segmentDragOffsetX:R,setSegmentDragOffsetX:ee,hoveredSegmentIndex:G,setHoveredSegmentIndex:ne,isHovered:M,setIsHovered:ce,isDragging:ie,isResizing:vt,isConnecting:at,resetDragState:Zt}=y,De=32,ft=8,yt=e.endDate&&e.endDate<new Date&&e.progress<100,Ut=e.isCriticalPath,oa=o.name==="neutral"||o.today==="#1C1917",he=(V=>V>=80?20:V>=60?15:V>=50?12:10)(r),rt=r<50,Gt=r<40,Ft=V=>V.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ka=()=>{let V=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${V} day${V!==1?"s":""}`},se=V=>Math.round(V/n)*n,me=V=>{let ve=Math.round(V/n),D=new Date(i);return D.setDate(D.getDate()+ve),D},K=(V,ve)=>{for(let D of g){if(D.id===e.id)continue;let $=5;if(V>=D.x-$&&V<=D.x+D.width+$&&ve>=D.y-$&&ve<=D.y+D.height+$)return D.id}return null},_=react.useCallback((V,ve,D)=>{V.preventDefault(),V.stopPropagation();let $=b.current?.ownerSVGElement;if(!$)return;let pe=$.createSVGPoint();pe.x=V.clientX,pe.y=V.clientY;let ye=pe.matrixTransform($.getScreenCTM()?.inverse()),Re=D!==void 0?D:t,$e=ve;if(!$e){let Dt=ye.x-Re;V.shiftKey?($e="connect",T({x:t+r,y:a+De/2})):V.ctrlKey||V.metaKey?$e="move":V.altKey?$e=Dt<r/2?"resize-start":"resize-end":Gt?Dt<r/2?$e="move":$e="resize-end":rt?Dt<=he/2?$e="resize-start":Dt>=r-he/2?$e="resize-end":$e="move":Dt<=he?$e="resize-start":Dt>=r-he?$e="resize-end":$e="move";}h($e),ce(false),H(null),$e==="move"?k(ye.x-Re):$e==="connect"?T({x:t+r,y:a+De/2}):k(0),v(Re),C(r);},[t,r,a,De]),Te=react.useCallback(V=>{if(f==="none")return;let ve=b.current?.ownerSVGElement;if(!ve)return;let D=ve.createSVGPoint();D.x=V.clientX,D.y=V.clientY;let $=D.matrixTransform(ve.getScreenCTM()?.inverse());if(f==="connect"){T({x:$.x,y:$.y});let pe=K($.x,$.y);U(pe);}else if(f==="move"){let pe=$.x-u,ye=se(pe);v(ye),C(r);let Re=Math.round((ye-t)/n);if(x?.(e.id,Re,true),e.segments&&e.segments.length>0&&S!==null){let $e=ye-Y;ee($e);}}else if(f==="resize-start"){let pe=$.x,ye=se(pe),Re=t+r-ye;Re>=n&&(v(ye),C(Re));}else if(f==="resize-end"){let pe=$.x,Re=se(pe)-t;Re>=n&&C(Re);}},[f,t,r,n,u,e,se,S,Y,K,U,T,v,C,ee,x]),Ge=react.useCallback(()=>{if(f!=="none"){if(f==="connect")z&&l&&l(e,z),T(null),U(null);else {let V=e.endDate.getTime()-e.startDate.getTime(),ve,D,$=true;if(f==="move"){if(ve=me(w),D=new Date(ve.getTime()+V),e.segments&&e.segments.length>0&&S!==null){let pe=Math.round(R/n),ye=e.segments.map((wt,ko)=>{if(ko===S){let tr=new Date(wt.startDate),ar=new Date(wt.endDate);return tr.setDate(tr.getDate()+pe),ar.setDate(ar.getDate()+pe),{startDate:tr,endDate:ar}}return wt}),Re=ye.flatMap(wt=>[wt.startDate,wt.endDate]),$e=new Date(Math.min(...Re.map(wt=>wt.getTime()))),Dt=new Date(Math.max(...Re.map(wt=>wt.getTime())));d?.({...e,segments:ye},$e,Dt),Zt(t,r);return}}else f==="resize-start"?(ve=me(w),D=e.endDate,ve>=D&&(console.warn("Invalid date range: start date must be before end date"),$=false)):f==="resize-end"?(ve=e.startDate,D=me(w+P),D<=ve&&(console.warn("Invalid date range: end date must be after start date"),$=false)):$=false;$&&ve&&D&&(D.getTime()-ve.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,ve,D));}x?.(e.id,0,false),Zt(t,r);}},[f,w,P,e,d,z,l,t,r,n,me,R,S,Zt,x]);react.useEffect(()=>{if(f==="none")return;let V=D=>{Te(D);},ve=()=>{Ge();};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",ve),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",ve);}},[f,Te,Ge]);let ae=ie&&!at?w:t,le=ie&&!at?P:r,Qt=m.taskTooltip(e),Bt=typeof Qt=="string"?Qt:"",X=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,onMouseEnter:()=>!ie&&ce(true),onMouseLeave:()=>{ie||(ce(false),H(null));},onClick:()=>!ie&&c?.(e),onDoubleClick:V=>{ie||(V.stopPropagation(),s?.(e));},onContextMenu:V=>{V.preventDefault(),p?.(e,V);},children:[Bt&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:Bt}}),M&&!ie&&!rt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:he,height:De,fill:L==="resize-start"?o.accent:"transparent",opacity:L==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>H("resize-start"),onMouseDown:V=>_(V,"resize-start")}),jsxRuntime.jsx("rect",{x:t+he,y:a,width:r-he*2,height:De,fill:L==="move"?o.accent:"transparent",opacity:L==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>H("move"),onMouseDown:V=>_(V,"move")}),jsxRuntime.jsx("rect",{x:t+r-he,y:a,width:he,height:De,fill:L==="resize-end"?o.accent:"transparent",opacity:L==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>H("resize-end"),onMouseDown:V=>_(V,"resize-end")})]}),M&&!ie&&Gt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:De,fill:L==="move"?o.accent:"transparent",opacity:L==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>H("move"),onMouseDown:V=>_(V,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:De,fill:L==="resize-end"?o.accent:"transparent",opacity:L==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>H("resize-end"),onMouseDown:V=>_(V,"resize-end")}),M&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+De-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ie&&!at&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:a,width:P,height:De,rx:ft,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ae,y:a,width:le,height:De,rx:ft,fill:e.isCriticalPath||yt?"#DC2626":e.color?e.color:o.taskBarPrimary,"data-task-class":X,initial:{opacity:0,scale:.95},animate:{opacity:ie&&!at?.15:e.parentId?.6:M?.9:.8,scale:M&&!ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V=>_(V),style:{cursor:ie?at?"crosshair":vt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ae,y:a,width:le*(e.progress/100),height:De,rx:ft,fill:e.isCriticalPath||yt?"#DC2626":e.color?e.color:o.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((V,ve)=>{let D=(V.startDate.getTime()-i.getTime())/864e5*n,pe=(V.endDate.getTime()-i.getTime())/(1e3*60*60*24)*n-D+n,ye=ie&&f==="move"&&S===ve,Re=G===ve,$e=ye?D+R:D;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ie&&ne(ve),onMouseLeave:()=>!ie&&ne(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:$e,y:a,width:pe,height:De,rx:ft,fill:e.isCriticalPath||yt?"#DC2626":e.color?e.color:o.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:ye||e.parentId?.6:Re?.9:.8,scale:Re&&!ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Dt=>{Dt.stopPropagation(),O(ve),Q(D),_(Dt,void 0,D);},style:{cursor:ie?at?"crosshair":vt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:$e,y:a,width:pe*(e.progress/100),height:De,rx:ft,fill:e.isCriticalPath||yt?"#DC2626":e.color?e.color:o.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ve}`)}),oa&&(yt||Ut)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ut&&!yt&&jsxRuntime.jsx("rect",{x:ae,y:a,width:le,height:De,rx:ft,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),yt&&jsxRuntime.jsx("rect",{x:ae,y:a,width:le,height:De,rx:ft,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),le>60&&!e.segments&&(()=>{let V=m.taskLabel(e),ve=typeof V=="string"?V:e.name,D=ve.length>Math.floor(le/8)?`${ve.substring(0,Math.floor(le/8))}...`:ve;return jsxRuntime.jsx("text",{x:ae+12,y:a+De/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:D})})(),le>100&&e.progress>0&&e.progress<100&&!ie&&!e.segments&&jsxRuntime.jsxs("text",{x:ae+le-12,y:a+De/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&&le>80&&!ie&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ae+le-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ae+le-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(M||vt)&&!at&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:rt?ae-15:ae-10,y:a-5,width:rt?25:20,height:De+10,fill:"transparent",onMouseDown:V=>_(V,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?ae-8:ae-3,y:a+6,width:rt?8:6,height:rt?De-12:De-16,rx:3,fill:f==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:f==="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:ae+le-10,y:a-5,width:rt?25:20,height:De+10,fill:"transparent",onMouseDown:V=>_(V,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?ae+le:ae+le-3,y:a+6,width:rt?8:6,height:rt?De-12:De-16,rx:3,fill:f==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:f==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&!ie&&!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+r+8,cy:a+De/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:V=>{V.stopPropagation(),_(V,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+De/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),at&&E&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+De/2,x2:E.x,y2:E.y,stroke:z?o.statusCompleted:o.accent,strokeWidth:z?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:z?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:E.x,cy:E.y,r:z?8:6,fill:z?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),z&&jsxRuntime.jsx(framerMotion.motion.text,{x:E.x+15,y:E.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:E.x+10},animate:{opacity:1,x:E.x+15},transition:{duration:.2},children:"Connect"})]}),(M||ie)&&!at&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ae-2,y:a-2,width:le+4,height:De+4,rx:ft+2,fill:"none",stroke:ie?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ie?.6:.4,initial:{opacity:0},animate:{opacity:ie?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),vt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+P,y1:0,x2:w+P,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&!ie&&!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:ae+le/2-120,y:a-95,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${ae+le/2-6} ${a-13} L ${ae+le/2} ${a-3} L ${ae+le/2+6} ${a-13}`,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:ae+le/2,y:a-73,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:ae+le/2-110,y:a-55,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ae+le/2-70,y:a-55,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ft(e.startDate)}),jsxRuntime.jsx("text",{x:ae+le/2-110,y:a-40,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ae+le/2-70,y:a-40,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ft(e.endDate)}),jsxRuntime.jsx("text",{x:ae+le/2+10,y:a-55,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ae+le/2+65,y:a-55,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ka()}),jsxRuntime.jsx("text",{x:ae+le/2+10,y:a-40,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ae+le/2+65,y:a-40,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:ae+le/2-110,y:a-25,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ae+le/2-50,y:a-25,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(V=>V.name).join(", ").substring(0,30),e.assignees.map(V=>V.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:ae+le/2,y:a-18,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Gt?"Left: move \u2022 Right: resize":rt?"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 Xr({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n}){let[i,m]=react.useState(false),c=a-e,s=r-t,p=e+c/2,d=`M ${e} ${t} C ${p} ${t}, ${p} ${r}, ${a} ${r}`,l=6,g=Math.atan2(s,c),x=a-l*Math.cos(g-Math.PI/6),y=r-l*Math.sin(g-Math.PI/6),b=a-l*Math.cos(g+Math.PI/6),f=r-l*Math.sin(g+Math.PI/6),h=o.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d,fill:"none",stroke:h,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:i?1:.6,strokeWidth:i?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${x} ${y} M ${a} ${r} L ${b} ${f}`,fill:"none",stroke:h,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:i?1:.6,scale:i?1.1:1,strokeWidth:i?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:h,initial:{scale:0},animate:{scale:i?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),i&&n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:u=>{u.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:p,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:p-4,y1:(t+r)/2-4,x2:p+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:p+4,y1:(t+r)/2-4,x2:p-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Jr({task:e,x:t,y:a,theme:r,onClick:o}){let[n,i]=react.useState(false),m=16,c=s=>s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var j={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=s=>{s.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let i=new Set,m=new Set,c=s=>{if(!i.has(s)){i.add(s),m.add(s);let p=r.get(s)||[];for(let d of p){if(!i.has(d)&&c(d))return true;if(m.has(d))return true}}return m.delete(s),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=j.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=j.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=j.findTaskById(e,o);if(n)a.unshift(n),o=n.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=j.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(n.join(","));}),r.join(`
|
|
46
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=j.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=j.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>j.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=j.findTaskById(e,t);return !a||!a.dependencies?[]:j.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>j.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>j.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=j.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let n=t[o];if(!a||n===void 0||n>=a.length||(r=a[n],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>j.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,n=j.flattenTasks(e);if(n.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let i=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],m=n.map(c=>{let s=c.startDate&&c.endDate?j.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?j.formatDate(c.startDate):"N/A",c.endDate?j.formatDate(c.endDate):"N/A",s>0?`${s} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:i,body:m,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=j.flattenTasks(e).map(c=>{let s=c.startDate&&c.endDate?j.calculateDuration(c.startDate,c.endDate):0;return {"Task ID":c.id,"Task Name":c.name,"Start Date":c.startDate?j.formatDate(c.startDate):"","End Date":c.endDate?j.formatDate(c.endDate):"","Duration (days)":s>0?s:"","Progress (%)":c.progress,Status:c.status||"",Assignees:c.assignees?.map(p=>p.name).join(", ")||"",Dependencies:c.dependencies?.join(", ")||"","Is Milestone":c.isMilestone?"Yes":"No","Parent ID":c.parentId||"",Level:c.level||0}}),n=a.utils.json_to_sheet(o),i=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];n["!cols"]=i;let m=a.utils.book_new();a.utils.book_append_sheet(m,n,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=j.flattenTasks(e),o=new Map;r.forEach((l,g)=>{o.set(l.id,g+1);});let n=l=>l.toISOString().replace("Z",""),i=j.getEarliestStartDate(e)||new Date,m=j.getLatestEndDate(e)||new Date,c=r.map((l,g)=>{let x=o.get(l.id),y=l.startDate&&l.endDate?j.calculateDuration(l.startDate,l.endDate):0,b=(l.dependencies||[]).filter(f=>o.has(f)).map(f=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
|
-
<PredecessorUID>${
|
|
48
|
+
<PredecessorUID>${o.get(f)}</PredecessorUID>
|
|
49
49
|
<Type>1</Type>
|
|
50
50
|
<CrossProject>0</CrossProject>
|
|
51
51
|
<LinkLag>0</LinkLag>
|
|
52
52
|
<LagFormat>7</LagFormat>
|
|
53
53
|
</PredecessorLink>`).join("");return `
|
|
54
54
|
<Task>
|
|
55
|
-
<UID>${
|
|
56
|
-
<ID>${
|
|
57
|
-
<Name>${
|
|
55
|
+
<UID>${x}</UID>
|
|
56
|
+
<ID>${g+1}</ID>
|
|
57
|
+
<Name>${l.name.replace(/[<>&'"]/g,f=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[f]||f)}</Name>
|
|
58
58
|
<Type>0</Type>
|
|
59
59
|
<IsNull>0</IsNull>
|
|
60
|
-
<CreateDate>${
|
|
61
|
-
<WBS>${
|
|
62
|
-
<OutlineNumber>${
|
|
63
|
-
<OutlineLevel>${
|
|
60
|
+
<CreateDate>${n(new Date)}</CreateDate>
|
|
61
|
+
<WBS>${g+1}</WBS>
|
|
62
|
+
<OutlineNumber>${g+1}</OutlineNumber>
|
|
63
|
+
<OutlineLevel>${l.level||0}</OutlineLevel>
|
|
64
64
|
<Priority>500</Priority>
|
|
65
|
-
<Start>${
|
|
66
|
-
<Finish>${
|
|
65
|
+
<Start>${l.startDate?n(l.startDate):""}</Start>
|
|
66
|
+
<Finish>${l.endDate?n(l.endDate):""}</Finish>
|
|
67
67
|
<Duration>PT${y*8}H0M0S</Duration>
|
|
68
68
|
<DurationFormat>7</DurationFormat>
|
|
69
69
|
<Work>PT${y*8}H0M0S</Work>
|
|
70
|
-
<Stop>${
|
|
71
|
-
<Resume>${
|
|
70
|
+
<Stop>${l.endDate?n(l.endDate):""}</Stop>
|
|
71
|
+
<Resume>${l.startDate?n(l.startDate):""}</Resume>
|
|
72
72
|
<ResumeValid>0</ResumeValid>
|
|
73
73
|
<EffortDriven>1</EffortDriven>
|
|
74
74
|
<Recurring>0</Recurring>
|
|
75
75
|
<OverAllocated>0</OverAllocated>
|
|
76
76
|
<Estimated>0</Estimated>
|
|
77
|
-
<Milestone>${
|
|
78
|
-
<Summary>${
|
|
79
|
-
<Critical>${
|
|
77
|
+
<Milestone>${l.isMilestone?"1":"0"}</Milestone>
|
|
78
|
+
<Summary>${l.subtasks&&l.subtasks.length>0?"1":"0"}</Summary>
|
|
79
|
+
<Critical>${l.isCriticalPath?"1":"0"}</Critical>
|
|
80
80
|
<IsSubproject>0</IsSubproject>
|
|
81
81
|
<IsSubprojectReadOnly>0</IsSubprojectReadOnly>
|
|
82
82
|
<ExternalTask>0</ExternalTask>
|
|
83
|
-
<EarlyStart>${
|
|
84
|
-
<EarlyFinish>${
|
|
85
|
-
<LateStart>${
|
|
86
|
-
<LateFinish>${
|
|
83
|
+
<EarlyStart>${l.startDate?n(l.startDate):""}</EarlyStart>
|
|
84
|
+
<EarlyFinish>${l.endDate?n(l.endDate):""}</EarlyFinish>
|
|
85
|
+
<LateStart>${l.startDate?n(l.startDate):""}</LateStart>
|
|
86
|
+
<LateFinish>${l.endDate?n(l.endDate):""}</LateFinish>
|
|
87
87
|
<StartVariance>0</StartVariance>
|
|
88
88
|
<FinishVariance>0</FinishVariance>
|
|
89
89
|
<WorkVariance>0</WorkVariance>
|
|
@@ -91,22 +91,22 @@
|
|
|
91
91
|
<TotalSlack>0</TotalSlack>
|
|
92
92
|
<FixedCost>0</FixedCost>
|
|
93
93
|
<FixedCostAccrual>3</FixedCostAccrual>
|
|
94
|
-
<PercentComplete>${
|
|
95
|
-
<PercentWorkComplete>${
|
|
94
|
+
<PercentComplete>${l.progress}</PercentComplete>
|
|
95
|
+
<PercentWorkComplete>${l.progress}</PercentWorkComplete>
|
|
96
96
|
<Cost>0</Cost>
|
|
97
97
|
<OvertimeCost>0</OvertimeCost>
|
|
98
98
|
<OvertimeWork>PT0H0M0S</OvertimeWork>
|
|
99
|
-
<ActualStart>${
|
|
100
|
-
<ActualFinish>${
|
|
101
|
-
<ActualDuration>PT${Math.round(y*
|
|
99
|
+
<ActualStart>${l.progress>0&&l.startDate?n(l.startDate):""}</ActualStart>
|
|
100
|
+
<ActualFinish>${l.progress===100&&l.endDate?n(l.endDate):""}</ActualFinish>
|
|
101
|
+
<ActualDuration>PT${Math.round(y*l.progress/100)*8}H0M0S</ActualDuration>
|
|
102
102
|
<ActualCost>0</ActualCost>
|
|
103
103
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
104
|
-
<ActualWork>PT${Math.round(y*
|
|
104
|
+
<ActualWork>PT${Math.round(y*l.progress/100)*8}H0M0S</ActualWork>
|
|
105
105
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
106
106
|
<RegularWork>PT${y*8}H0M0S</RegularWork>
|
|
107
|
-
<RemainingDuration>PT${Math.round(y*(100-
|
|
107
|
+
<RemainingDuration>PT${Math.round(y*(100-l.progress)/100)*8}H0M0S</RemainingDuration>
|
|
108
108
|
<RemainingCost>0</RemainingCost>
|
|
109
|
-
<RemainingWork>PT${Math.round(y*(100-
|
|
109
|
+
<RemainingWork>PT${Math.round(y*(100-l.progress)/100)*8}H0M0S</RemainingWork>
|
|
110
110
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
111
111
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
112
112
|
<ACWP>0</ACWP>
|
|
@@ -125,17 +125,17 @@
|
|
|
125
125
|
<PhysicalPercentComplete>0</PhysicalPercentComplete>
|
|
126
126
|
<EarnedValueMethod>0</EarnedValueMethod>
|
|
127
127
|
<IsPublished>1</IsPublished>
|
|
128
|
-
<CommitmentType>0</CommitmentType>${
|
|
129
|
-
</Task>`}).join(""),
|
|
128
|
+
<CommitmentType>0</CommitmentType>${b}
|
|
129
|
+
</Task>`}).join(""),s=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
130
130
|
<Project xmlns="http://schemas.microsoft.com/project">
|
|
131
131
|
<SaveVersion>14</SaveVersion>
|
|
132
|
-
<Name>${t.replace(/[<>&'"]/g,
|
|
133
|
-
<Title>${t.replace(/[<>&'"]/g,
|
|
134
|
-
<CreationDate>${
|
|
135
|
-
<LastSaved>${
|
|
132
|
+
<Name>${t.replace(/[<>&'"]/g,l=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[l]||l)}</Name>
|
|
133
|
+
<Title>${t.replace(/[<>&'"]/g,l=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[l]||l)}</Title>
|
|
134
|
+
<CreationDate>${n(new Date)}</CreationDate>
|
|
135
|
+
<LastSaved>${n(new Date)}</LastSaved>
|
|
136
136
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
137
|
-
<StartDate>${
|
|
138
|
-
<FinishDate>${
|
|
137
|
+
<StartDate>${n(i)}</StartDate>
|
|
138
|
+
<FinishDate>${n(m)}</FinishDate>
|
|
139
139
|
<FYStartDate>1</FYStartDate>
|
|
140
140
|
<CriticalSlackLimit>0</CriticalSlackLimit>
|
|
141
141
|
<CurrencyDigits>2</CurrencyDigits>
|
|
@@ -172,13 +172,13 @@
|
|
|
172
172
|
<MoveCompletedEndsForward>0</MoveCompletedEndsForward>
|
|
173
173
|
<BaselineForEarnedValue>0</BaselineForEarnedValue>
|
|
174
174
|
<AutoAddNewResourcesAndTasks>1</AutoAddNewResourcesAndTasks>
|
|
175
|
-
<CurrentDate>${
|
|
175
|
+
<CurrentDate>${n(new Date)}</CurrentDate>
|
|
176
176
|
<MicrosoftProjectServerURL>1</MicrosoftProjectServerURL>
|
|
177
177
|
<Autolink>1</Autolink>
|
|
178
178
|
<NewTaskStartDate>0</NewTaskStartDate>
|
|
179
179
|
<DefaultTaskEVMethod>0</DefaultTaskEVMethod>
|
|
180
180
|
<ProjectExternallyEdited>0</ProjectExternallyEdited>
|
|
181
|
-
<ExtendedCreationDate>${
|
|
181
|
+
<ExtendedCreationDate>${n(new Date)}</ExtendedCreationDate>
|
|
182
182
|
<ActualsInSync>0</ActualsInSync>
|
|
183
183
|
<RemoveFileProperties>0</RemoveFileProperties>
|
|
184
184
|
<AdminProject>0</AdminProject>
|
|
@@ -271,11 +271,11 @@
|
|
|
271
271
|
</WeekDays>
|
|
272
272
|
</Calendar>
|
|
273
273
|
</Calendars>
|
|
274
|
-
<Tasks>${
|
|
274
|
+
<Tasks>${c}
|
|
275
275
|
</Tasks>
|
|
276
|
-
</Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(p),l.download=r,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=q.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 p=i.startDate&&i.endDate?q.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let v=t.find(y=>y.id===m);if(v){n(v);let y=a.get(m)?.ef||0;l=Math.max(l,y);}}let d=l+p;a.set(i.id,{es:l,ef:d});};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 p=i.startDate&&i.endDate?q.calculateDuration(i.startDate,i.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(i.id)),d=o;if(l.length>0)for(let v of l){c(v);let y=s.get(v.id)?.ls||0;d=Math.min(d,y);}let m=d-p;s.set(i.id,{ls:m,lf:d});};r.forEach(c);let u=[];for(let i of r){let p=a.get(i.id),l=s.get(i.id);if(p&&l){let d=l.ls-p.es;Math.abs(d)<.01&&u.push(i.id);}}return u},calculateSlack:(e,t)=>{let r=q.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(q.calculateCriticalPath(e).includes(t))return 0;let n=q.getDependentTasks(e,t);if(n.length===0){let c=q.getLatestEndDate(e);if(!c)return null;let u=q.calculateDuration(r.endDate,c);return Math.max(0,u)}let o=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,u)=>c-u)[0];if(!o)return null;let s=q.calculateDuration(r.endDate,new Date(o));return Math.max(0,s)},isOnCriticalPath:(e,t)=>q.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r)=>{let a=q.findTaskById(e,t);if(!a||!a.endDate)return e;let n=q.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=q.calculateDuration(s.startDate,s.endDate),u;r!==void 0?(u=new Date(s.startDate),u.setDate(u.getDate()+r)):(u=new Date(a.endDate),u.setDate(u.getDate()+1));let i=q.calculateEndDate(u,c),p=l=>l.map(d=>d.id===s.id?{...d,startDate:u,endDate:i}:d.subtasks?{...d,subtasks:p(d.subtasks)}:d);o=p(o),o=q.autoScheduleDependents(o,s.id,r);}return o},calculateCascadePreview:(e,t,r,a,n,o,s,c)=>{if(r===0)return [];let u=[],i=n.getTime(),p=1e3*60*60*24,l=q.findTaskById(e,t);if(!l||!l.endDate)return [];let d=(m,v,y=new Set)=>{if(y.has(m))return;y.add(m);let h=q.getDependentTasks(e,m);for(let g of h){if(!g.startDate||!g.endDate)continue;let b=a.findIndex($=>$.id===g.id);if(b===-1)continue;let f=g.startDate.getTime(),w=(g.endDate.getTime()-f)/p,D=(f-i)/p*o,C=D+v*o,N=Math.max(w*o,o),T=c+b*s+12;u.push({taskId:g.id,taskName:g.name,originalX:D,previewX:C,width:N,y:T,rowIndex:b,daysDelta:v,color:g.color}),d(g.id,v,y);}};return d(t,r),u},splitTask:(e,t,r,a=3)=>{let n=q.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 u=[{startDate:new Date(n.startDate),endDate:o},{startDate:s,endDate:c}],i=p=>p.map(l=>l.id===n.id?{...l,endDate:c,segments:u}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function Yn({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:s,templates:c,onTaskClick:u,onTaskDblClick:i,onTaskContextMenu:p,onTaskDateChange:l,onDependencyCreate:d,onDependencyDelete:m}){let[y,h]=Se.useState([]),g=Math.ceil((o.getTime()-n.getTime())/(1e3*60*60*24)),b=a==="day"?60:a==="week"?20:8,f=g*b*s,k=E=>{let O=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),G=O.getUTCDay()||7;O.setUTCDate(O.getUTCDate()+4-G);let U=new Date(Date.UTC(O.getUTCFullYear(),0,1));return Math.ceil(((O.getTime()-U.getTime())/864e5+1)/7)},w=E=>{let O=E.getDay();return O===0||O===6},x=Se.useCallback(E=>{let O=Math.round(E/(b*s)),G=new Date(n);return G.setDate(G.getDate()+O),G},[n,b,s]),D=Se.useCallback((E,O)=>{if(O.startDate&&O.endDate)return;let G=E.currentTarget.ownerSVGElement;if(!G)return;let U=G.createSVGPoint();U.x=E.clientX,U.y=E.clientY;let A=U.matrixTransform(G.getScreenCTM()?.inverse()),K=x(A.x),_=new Date(K);_.setDate(_.getDate()+1),l?.(O,K,_);},[x,l]),C=Se.useMemo(()=>{let E=A=>A.map(K=>{if(K.subtasks&&K.subtasks.length>0){let _=E(K.subtasks),ae=_.filter(M=>M.startDate&&M.endDate);if(ae.length>0){let M=ae.map(rt=>rt.startDate.getTime()),de=ae.map(rt=>rt.endDate.getTime()),ie=new Date(Math.min(...M)),kt=new Date(Math.max(...de));return {...K,subtasks:_,startDate:K.startDate||ie,endDate:K.endDate||kt}}return {...K,subtasks:_}}return K}),O=(A,K=[])=>{for(let _ of A)K.push(_),_.subtasks&&_.subtasks.length>0&&(_.isExpanded===void 0||_.isExpanded)&&O(_.subtasks,K);return K},G=E(e);return O(G)},[e]),N=Se.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let O=E.startDate.getTime(),G=E.endDate.getTime(),U=n.getTime(),A=(O-U)/(1e3*60*60*24),K=(G-O)/(1e3*60*60*24),_=A*b*s,ae=Math.max(b*s,40),M=Math.max(K*b*s,ae);return {x:_,width:M}},[n,b,s]),T=Se.useMemo(()=>C.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:O,width:G}=N(E),A=C.findIndex(K=>K.id===E.id)*r+12;return {id:E.id,x:O,y:A,width:G,height:32}}),[C,N]),$=Se.useCallback((E,O,G)=>{if(!G||O===0){h([]);return}let U=q.calculateCascadePreview(e,E,O,C,n,b*s,r,48);h(U);},[e,C,n,b,s,r,48]),z=Se.useMemo(()=>{let E=[],O=new Date(n);for(;O<=o;){let A=(O.getTime()-n.getTime())/864e5*b*s;if(a==="day")E.push({date:new Date(O),label:O.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:A}),O.setDate(O.getDate()+1);else if(a==="week"){let K=k(O);E.push({date:new Date(O),label:`Week ${K}`,x:A}),O.setDate(O.getDate()+7);}else E.push({date:new Date(O),label:O.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:A}),O.setMonth(O.getMonth()+1);}return E},[n,o,a,b,s]),R=Se.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*b*s,[n,b,s]),W=Math.max(C.length*r,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(f,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(f,1e3),height:48,fill:t.bgGrid}),z.map((E,O)=>jsxRuntime.jsxs("g",{children:[O>0&&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-${O}`)),R>=0&&R<=f&&jsxRuntime.jsx("circle",{cx:R,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(f,1e3),height:W,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:W,fill:t.bgPrimary}),z.map((E,O)=>{let G=z[O+1]?.x||f,U=w(E.date);return jsxRuntime.jsxs("g",{children:[U&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:G-E.x,height:C.length*r,fill:t.bgWeekend,opacity:1}),O>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:C.length*r,stroke:t.border,strokeWidth:1,opacity:.1})]},O)}),R>=0&&R<=f&&jsxRuntime.jsx("line",{x1:R,y1:0,x2:R,y2:C.length*r,stroke:t.today,strokeWidth:2,opacity:1}),C.map((E,O)=>{let G=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:O*r,width:f,height:r,fill:O%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!G&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:O*r,width:f,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:U=>D(U,E),onMouseEnter:U=>{U.currentTarget.setAttribute("fill",t.accentLight),U.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:U=>{U.currentTarget.setAttribute("fill","transparent"),U.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:R>0?R:100,y:O*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${E.id}`)]})]},`row-group-${E.id}`)}),C.map((E,O)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(G=>{let U=C.find(ae=>ae.id===G);if(!U||!U.startDate||!U.endDate)return null;let A=C.findIndex(ae=>ae.id===G),K=N(U),_=N(E);return jsxRuntime.jsx(_n,{x1:K.x+K.width,y1:A*r+r/2,x2:_.x,y2:O*r+r/2,theme:t,onDelete:()=>m?.(E.id,G)},`dep-${G}-${E.id}`)})),C.map((E,O)=>{if(!E.startDate||!E.endDate)return null;let{x:G,width:U}=N(E),A=O*r+12,K=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Vn,{task:E,x:G+U/2,y:A+16,theme:t,onClick:u},E.id):K?jsxRuntime.jsxs("g",{onClick:()=>u?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:G,y:A,width:U,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:G,y1:A,x2:G+U,y2:A,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:G,y1:A,x2:G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:G+U,y1:A,x2:G+U,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:G,y1:A+32,x2:G+U,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),U>60&&jsxRuntime.jsx("text",{x:G+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(Un,{task:E,x:G,y:A,width:U,theme:t,dayWidth:b*s,startDate:n,templates:c,onClick:u,onDoubleClick:i,onContextMenu:p,onDateChange:l,onDependencyCreate:d,allTaskPositions:T,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 Ic=[{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 Ac({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:Ic.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:Ic.find(a=>a.value===e)?.name||"Personalizado"})]})}function qn({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:s=false,mode:c=r?"edit":"create",theme:u="dark"}){let i=Ce[u]||Ce.dark,p={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},l={color:i.textSecondary},[d,m]=Se.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[v,y]=Se.useState({});Se.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 d.name.trim()||(f.name="El nombre es requerido"),d.startDate&&d.endDate&&d.startDate>d.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(d),t();}catch(k){console.error("Error submitting task:",k);}},b=(f,k)=>{m(w=>{let x={...w,[f]:k};if(f==="progress"){let D=typeof k=="number"?k:parseInt(k,10);D===100&&w.status!=="completed"?x.status="completed":D>0&&D<100&&w.status==="todo"?x.status="in-progress":D===0&&w.status==="in-progress"&&(x.status="todo");}return x}),v[f]&&y(w=>{let x={...w};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:d.name,onChange:f=>b("name",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,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}),v.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"}),v.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:d.startDate?d.startDate.toISOString().split("T")[0]:"",onChange:f=>b("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:p,disabled:s||d.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:d.endDate?d.endDate.toISOString().split("T")[0]:"",onChange:f=>b("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:p,disabled:s||d.isMilestone}),v.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"}),v.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:d.status,onChange:f=>b("status",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,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(Ac,{value:d.color,onChange:f=>b("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:d.progress<30?"#EF4444":d.progress<70?"#F59E0B":"#10B981",backgroundColor:d.progress<30?"rgba(239, 68, 68, 0.1)":d.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[d.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:d.progress,onChange:f=>b("progress",parseInt(f.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:d.progress<30?"#EF4444":d.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:`${d.progress}%`,backgroundColor:d.progress<30?"rgba(239, 68, 68, 0.3)":d.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:()=>b("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:d.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.bgSecondary,color:d.progress===f?"#FFFFFF":i.textSecondary,border:`1px solid ${d.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:d.isMilestone,onChange:f=>b("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:k=>k.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:k=>k.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:d.assignees?.some(k=>k.name===f.name),onChange:k=>{let w=k.target.checked?[...d.assignees||[],{name:f.name,avatar:f.avatar,initials:f.name.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(d.assignees||[]).filter(x=>x.name!==f.name);b("assignees",w);},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:k=>k.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:k=>k.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:d.dependencies?.includes(f.id),onChange:k=>{let w=k.target.checked?[...d.dependencies||[],f.id]:(d.dependencies||[]).filter(x=>x!==f.id);b("dependencies",w);},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 dh=['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"'],Wc=()=>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"})]}),uh=()=>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"})}),mh=()=>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"})}),ph=()=>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"})}),fh=()=>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 Xn({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:o,onTaskDelete:s,onDependencyCreate:c,onDependencyDelete:u}){let[i,p]=Se.useState(false),[l,d]=Se.useState(false),[m,v]=Se.useState([]),[y,h]=Se.useState(""),[g,b]=Se.useState(false),[f,k]=Se.useState(true),w=Se.useRef(null),x=Se.useRef(null),D=Se.useRef(null),{enabled:C=true,placeholder:N='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:$,suggestions:z=dh,maxHistory:R=50}=r;Se.useEffect(()=>{x.current&&x.current.scrollIntoView({behavior:"smooth"});},[m]),Se.useEffect(()=>{i&&!l&&w.current&&setTimeout(()=>w.current?.focus(),100);},[i,l]);let W=Se.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&&u?.(A.taskId,A.dependencyFrom);break}},[n,o,s,c,u]),E=Se.useCallback(async A=>{if(!A.trim()||g)return;let K={id:`user-${Date.now()}`,role:"user",content:A,timestamp:new Date};v(ae=>[...ae.slice(-(R-1)),K]),h(""),k(false),b(true);let _={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(ae=>[...ae,_]);try{if($){let ae=await $(A,e);v(M=>{let de=M.filter(kt=>!kt.isLoading),ie={id:`assistant-${Date.now()}`,role:"assistant",content:ae.message,timestamp:new Date,command:ae};return [...de,ie]}),W(ae);}else v(ae=>[...ae.filter(de=>!de.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(ae){v(M=>[...M.filter(ie=>!ie.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ae instanceof Error?ae.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[g,R,$,e,W]),O=A=>{A.preventDefault(),E(y);},G=A=>{h(A),w.current?.focus();};if(Se.useEffect(()=>{let A=K=>{(K.metaKey||K.ctrlKey)&&K.key==="k"&&(K.preventDefault(),p(_=>!_),i||d(false)),K.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[i]),!C)return null;let U={"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(Ye,{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 ${U[T]} 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:()=>p(true),children:[jsxRuntime.jsx(Wc,{}),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:D,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 ${U[T]} 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(Wc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>d(A=>!A),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(ph,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(mh,{})})]})]}),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:z.slice(0,4).map((A,K)=>jsxRuntime.jsx("button",{onClick:()=>G(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},K))})]}),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(fh,{}):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:O,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:w,type:"text",value:y,onChange:A=>h(A.target.value),placeholder:N,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(uh,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Uc(e,t=50){let[r,a]=Se.useState({past:[],present:e,future:[]}),n=Se.useRef(false),o=Se.useCallback((i,p=true)=>{a(l=>{let d=typeof i=="function"?i(l.present):i;if(n.current)return {...l,present:d};if(!p)return {...l,present:d};let m=[...l.past,l.present];return m.length>t&&m.shift(),{past:m,present:d,future:[]}});},[t]),s=Se.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let p=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:p,future:[i.present,...i.future]}});},[]),c=Se.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let p=i.future[0],l=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:p,future:l}});},[]),u=Se.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:u}}function Gc({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){Se.useEffect(()=>{if(!n)return;let o=s=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=c?s.metaKey:s.ctrlKey;if(u&&s.key==="z"&&!s.shiftKey&&r){s.preventDefault(),e();return}if(a){if(!c&&u&&s.key==="y"){s.preventDefault(),t();return}if(c&&u&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var vh={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${q.formatDate(e.startDate)} - ${q.formatDate(e.endDate)}`);let r=q.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=>q.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function _c(e){return {...vh,...e}}var wh=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},jc=Se.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:o,timeScale:s="week",rowDensity:c="comfortable",showThemeSelector:u=true,showExportButton:i=true,availableUsers:p=[],templates:l,enableAutoCriticalPath:d=true,aiAssistant:m,locale:v="en",customTranslations:y,showCreateTaskButton:h=false,createTaskLabel:g,onCreateTask:b,onThemeChange:f,onTaskClick:k,onTaskDblClick:w,onTaskContextMenu:x,onTaskUpdate:D,onProgressChange:C,onTaskEdit:N,onTaskAddSubtask:T,onTaskMarkIncomplete:$,onTaskSetInProgress:z,onDependencyCreate:R,onDependencyDelete:W,onBeforeTaskAdd:E,onAfterTaskAdd:O,onBeforeTaskUpdate:G,onAfterTaskUpdate:U}=r,K=Se.useContext(Fn)?.theme,[_,ae]=Se.useState(K||o||"dark"),[M,de]=Se.useState(s),[ie,kt]=Se.useState(c),[rt,ir]=Se.useState(1),[De,bt]=Se.useState(0),[wt,jt]=Se.useState(false),[hr,zr]=Se.useState(null),[he,at]=Se.useState({isOpen:false,x:0,y:0,task:null}),[Kt,Wt]=Se.useState(null);Se.useEffect(()=>{K&&K!==_&&ae(K);},[K]),Se.useEffect(()=>{o&&o!==_&&ae(o);},[o]);let $r=Se.useCallback(P=>{ae(P),f?.(P);},[f]),{state:se,setState:ue,undo:X,redo:j,canUndo:Te,canRedo:We,clearHistory:re}=Uc(t,50);Se.useEffect(()=>{ue(t);},[t,ue]),Se.useEffect(()=>{a&&a(se);},[se,a]);let le=Se.useMemo(()=>ms(v,y),[v,y]),lr=Se.useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:false},{id:"startDate",label:P.columns.startDate,width:110,visible:false,sortable:true},{id:"endDate",label:P.columns.endDate,width:110,visible:false,sortable:true},{id:"duration",label:P.columns.duration,width:80,visible:false,sortable:true},{id:"assignees",label:P.columns.assignees,width:120,visible:false,sortable:false},{id:"status",label:P.columns.status,width:80,visible:false,sortable:true},{id:"progress",label:P.columns.progress,width:120,visible:false,sortable:true}],[]),[Ut,J]=Se.useState(()=>lr(le));Se.useEffect(()=>{J(P=>P.map(I=>({...I,label:le.columns[I.id==="name"?"taskName":I.id]||I.label})));},[le]);let Y=Se.useMemo(()=>Ut.filter(P=>P.visible).reduce((P,I)=>P+I.width,0)+60,[Ut]),ve=hr||Y,S=Se.useRef(null),H=Se.useRef(null),me=Se.useRef(null),ye=Se.useMemo(()=>nc(_),[_]),Be=Se.useMemo(()=>({theme:ye,themeName:_}),[ye,_]),Ue=Se.useMemo(()=>_c(l),[l]),Mt=Se.useMemo(()=>{if(!d)return se;let P=q.calculateCriticalPath(se),I=V=>V.map(ee=>({...ee,isCriticalPath:P.includes(ee.id),subtasks:ee.subtasks?I(ee.subtasks):void 0}));return I(se)},[se,d]),St=wh(ie);Gc({undo:X,redo:j,canUndo:Te,canRedo:We,enabled:true}),Se.useImperativeHandle(n,()=>({getTask:P=>q.findTaskById(se,P),addTask:(P,I)=>{ue(V=>{if(!I)return [...V,{...P,level:0}];let ee=oe=>oe.map(ce=>ce.id===I?{...ce,subtasks:[...ce.subtasks||[],{...P,parentId:I,level:(ce.level||0)+1}],isExpanded:true}:ce.subtasks?{...ce,subtasks:ee(ce.subtasks)}:ce);return ee(V)});},updateTask:(P,I)=>{ue(V=>{let ee=oe=>oe.map(ce=>ce.id===P?{...ce,...I}:ce.subtasks?{...ce,subtasks:ee(ce.subtasks)}:ce);return ee(V)});},deleteTask:P=>{ue(I=>{let V=ee=>ee.filter(oe=>oe.id===P?false:(oe.subtasks&&(oe.subtasks=V(oe.subtasks)),true));return V(I)});},deleteTasks:P=>{ue(I=>$n(I,P));},duplicateTask:P=>{ue(I=>ys(I,[P]));},splitTask:(P,I,V=3)=>{ue(ee=>q.splitTask(ee,P,I,V));},calculateEndDate:q.calculateEndDate,calculateDuration:q.calculateDuration,validateDependency:(P,I)=>!q.validateDependencies(se,P,I),getAllTasks:()=>q.flattenTasks(se),getTasksByStatus:P=>q.flattenTasks(se).filter(I=>I.status===P),getTasksByParent:P=>P?q.findTaskById(se,P)?.subtasks||[]:se.filter(V=>!V.parentId),getCriticalPath:()=>q.flattenTasks(se).filter(P=>P.isCriticalPath),indentTask:P=>{ue(I=>hs(I,[P]));},outdentTask:P=>{ue(I=>bs(I,[P]));},moveTask:(P,I)=>{ue(V=>vs(V,[P],I));},createSubtask:async P=>{let{tasks:I,newTask:V}=ws(se,P);if(E){let ee=E({...V,parentId:P});if((ee instanceof Promise?await ee:ee)===false)return}ue(I),O&&O({...V,parentId:P});},scrollToTask:P=>{let V=q.flattenTasks(se).findIndex(ee=>ee.id===P);if(V!==-1&&S.current){let ee=V*St;S.current.scrollTo({top:ee,behavior:"smooth"}),H.current&&H.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(P,I=2e3)=>{},expandTask:P=>{ue(I=>{let V=ee=>ee.map(oe=>oe.id===P?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:V(oe.subtasks)}:oe);return V(I)});},collapseTask:P=>{ue(I=>{let V=ee=>ee.map(oe=>oe.id===P?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:V(oe.subtasks)}:oe);return V(I)});},expandAll:()=>{ue(P=>{let I=V=>V.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?I(ee.subtasks):void 0}));return I(P)});},collapseAll:()=>{ue(P=>{let I=V=>V.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?I(ee.subtasks):void 0}));return I(P)});},undo:X,redo:j,canUndo:()=>Te,canRedo:()=>We,clearHistory:re,exportToPNG:async()=>{if(!me.current)throw new Error("Gantt container not found");let P=await Hc__default.default(me.current,{backgroundColor:ye.bgPrimary,scale:2});return new Promise((I,V)=>{P.toBlob(ee=>{ee?I(ee):V(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async P=>{await q.exportToPDF(se,P);},exportToExcel:async P=>{await q.exportToExcel(se,P);},exportToJSON:()=>q.exportToJSON(se),exportToCSV:()=>q.exportToCSV(se),importFromJSON:P=>{let I=q.importFromJSON(P);ue(I);},getTasks:()=>se,refresh:()=>{ue(P=>[...P]);},clearAll:()=>{ue([]);}}),[se,X,j,Te,We,re,ye,St]);let go=Se.useCallback(P=>{J(I=>I.map(V=>V.id===P?{...V,visible:!V.visible}:V));},[]),wa=Se.useCallback((P,I)=>{J(V=>V.map(ee=>{if(ee.id!==P)return ee;let oe=ee.minWidth??100,ce=ee.maxWidth??800,nt=Math.max(oe,Math.min(ce,I));return {...ee,width:nt}}));},[]),Ca=Se.useCallback(P=>{ue(I=>ks(I,P)),r.onTaskToggleExpand?.(P);},[r]),aa=Se.useCallback((P,I)=>{if(G&&G(P,I)===false)return;let ee=q.findTaskById(se,P)?.progress,oe=nt=>nt.map(vt=>vt.id===P?{...vt,...I}:vt.subtasks?{...vt,subtasks:oe(vt.subtasks)}:vt);ue(oe(se));let ce=q.findTaskById(oe(se),P);ce&&(D?.(ce),U?.(ce),I.progress!==void 0&&ee!==void 0&&I.progress!==ee&&C?.(P,ee,I.progress));},[se,D,G,U,C]),nu=Se.useCallback(P=>{P.length!==0&&(ue(I=>hs(I,P)),r.onTaskIndent?.(P[0]));},[r]),ou=Se.useCallback(P=>{P.length!==0&&(ue(I=>bs(I,P)),r.onTaskOutdent?.(P[0]));},[r]),su=Se.useCallback((P,I)=>{P.length!==0&&(ue(V=>vs(V,P,I)),r.onTaskMove?.(P[0],I));},[r]),ki=Se.useCallback(P=>{r.onMultiTaskDelete?r.onMultiTaskDelete(P):(ue(I=>$n(I,P)),P.forEach(I=>r.onTaskDelete?.(I)));},[r]),iu=Se.useCallback(P=>{ue(I=>ys(I,P)),P.forEach(I=>r.onTaskDuplicate?.(I));},[r]),lu=Se.useCallback((P,I)=>{ue(V=>{let{tasks:ee,newTask:oe}=kc(V,P,I);return E&&E(oe)===false?V:(r.onTaskCreate?.(oe.parentId,oe.position||0),O?.(oe),ee)});},[r,E,O]),cu=Se.useCallback((P,I)=>{ue(V=>xs(V,P,I)),r.onTaskRename?.(P,I);},[r]),wi=Se.useCallback(P=>{ue(I=>{let{tasks:V}=ws(I,P);return r.onTaskCreate?.(P,0),V});},[r]),du=Se.useCallback((P,I,V)=>{let ee=P.startDate?Math.round((I.getTime()-P.startDate.getTime())/864e5):0,oe=vt=>vt.map(Yt=>Yt.id===P.id?{...Yt,startDate:I,endDate:V,...P.segments&&{segments:P.segments}}:Yt.subtasks?{...Yt,subtasks:oe(Yt.subtasks)}:Yt),ce=oe(se);ce=q.autoScheduleDependents(ce,P.id,ee),ue(ce);let nt={...P,startDate:I,endDate:V};D?.(nt);},[se,D]),uu=Se.useCallback((P,I)=>{x?.(P,I),at({isOpen:true,x:I.clientX,y:I.clientY,task:P});},[x]),mu=Se.useCallback((P,I)=>{let V=q.splitTask(se,P.id,I);ue(V),at({isOpen:false,x:0,y:0,task:null});},[se]),Ci=Se.useCallback(P=>{w?.(P),N||Wt(P);},[w,N]),Ti=Se.useCallback((P,I,V)=>{let ee=new Map,oe=qt=>{qt.forEach(br=>{br.dependencies&&ee.set(br.id,br.dependencies),br.subtasks&&oe(br.subtasks);});};oe(V);let ce=ee.get(I)||[];ee.set(I,[...ce,P]);let nt=new Set,vt=new Set,Yt=qt=>{if(!nt.has(qt)){nt.add(qt),vt.add(qt);let br=ee.get(qt)||[];for(let Ta of br){if(!nt.has(Ta)&&Yt(Ta))return true;if(vt.has(Ta))return true}}return vt.delete(qt),false};return Yt(I)},[]),Di=Se.useCallback((P,I)=>{if(Ti(P.id,I,se)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
276
|
+
</Project>`,p=new Blob([s],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=j.flattenTasks(e),a=t.filter(s=>s.startDate&&s.endDate);if(a.length===0)return [];let r=new Map,o=s=>{if(r.has(s.id))return;let p=s.startDate&&s.endDate?j.calculateDuration(s.startDate,s.endDate):0,d=0;if(s.dependencies&&s.dependencies.length>0)for(let g of s.dependencies){let x=t.find(y=>y.id===g);if(x){o(x);let y=r.get(g)?.ef||0;d=Math.max(d,y);}}let l=d+p;r.set(s.id,{es:d,ef:l});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(s=>s.ef)),i=new Map,m=s=>{if(i.has(s.id))return;let p=s.startDate&&s.endDate?j.calculateDuration(s.startDate,s.endDate):0,d=t.filter(x=>x.dependencies&&x.dependencies.includes(s.id)),l=n;if(d.length>0)for(let x of d){m(x);let y=i.get(x.id)?.ls||0;l=Math.min(l,y);}let g=l-p;i.set(s.id,{ls:g,lf:l});};a.forEach(m);let c=[];for(let s of a){let p=r.get(s.id),d=i.get(s.id);if(p&&d){let l=d.ls-p.es;Math.abs(l)<.01&&c.push(s.id);}}return c},calculateSlack:(e,t)=>{let a=j.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(j.calculateCriticalPath(e).includes(t))return 0;let o=j.getDependentTasks(e,t);if(o.length===0){let m=j.getLatestEndDate(e);if(!m)return null;let c=j.calculateDuration(a.endDate,m);return Math.max(0,c)}let n=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,c)=>m-c)[0];if(!n)return null;let i=j.calculateDuration(a.endDate,new Date(n));return Math.max(0,i)},isOnCriticalPath:(e,t)=>j.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=j.findTaskById(e,t);if(!r||!r.endDate)return e;let o=j.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let i of o){if(!i.startDate||!i.endDate)continue;let m=j.calculateDuration(i.startDate,i.endDate),c;a!==void 0?(c=new Date(i.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let s=j.calculateEndDate(c,m),p=d=>d.map(l=>l.id===i.id?{...l,startDate:c,endDate:s}:l.subtasks?{...l,subtasks:p(l.subtasks)}:l);n=p(n),n=j.autoScheduleDependents(n,i.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,i,m)=>{if(a===0)return [];let c=[],s=o.getTime(),p=1e3*60*60*24,d=j.findTaskById(e,t);if(!d||!d.endDate)return [];let l=(g,x,y=new Set)=>{if(y.has(g))return;y.add(g);let b=j.getDependentTasks(e,g);for(let f of b){if(!f.startDate||!f.endDate)continue;let h=r.findIndex(z=>z.id===f.id);if(h===-1)continue;let u=f.startDate.getTime(),w=(f.endDate.getTime()-u)/p,P=(u-s)/p*n,C=P+x*n,E=Math.max(w*n,n),T=m+h*i+12;c.push({taskId:f.id,taskName:f.name,originalX:P,previewX:C,width:E,y:T,rowIndex:h,daysDelta:x,color:f.color}),l(f.id,x,y);}};return l(t,a),c},splitTask:(e,t,a,r=3)=>{let o=j.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let n=new Date(a);n.setDate(n.getDate()-1);let i=new Date(a);i.setDate(i.getDate()+r);let m=new Date(o.endDate);m.setDate(m.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:n},{startDate:i,endDate:m}],s=p=>p.map(d=>d.id===o.id?{...d,endDate:m,segments:c}:d.subtasks?{...d,subtasks:s(d.subtasks)}:d);return s(e)}};function eo({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:i,templates:m,onTaskClick:c,onTaskDblClick:s,onTaskContextMenu:p,onTaskDateChange:d,onDependencyCreate:l,onDependencyDelete:g}){let[y,b]=react.useState([]),f=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),h=r==="day"?60:r==="week"?20:8,u=f*h*i,k=S=>{let O=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),Y=O.getUTCDay()||7;O.setUTCDate(O.getUTCDate()+4-Y);let Q=new Date(Date.UTC(O.getUTCFullYear(),0,1));return Math.ceil(((O.getTime()-Q.getTime())/864e5+1)/7)},w=S=>{let O=S.getDay();return O===0||O===6},v=react.useCallback(S=>{let O=Math.round(S/(h*i)),Y=new Date(o);return Y.setDate(Y.getDate()+O),Y},[o,h,i]),P=react.useCallback((S,O)=>{if(O.startDate&&O.endDate)return;let Y=S.currentTarget.ownerSVGElement;if(!Y)return;let Q=Y.createSVGPoint();Q.x=S.clientX,Q.y=S.clientY;let R=Q.matrixTransform(Y.getScreenCTM()?.inverse()),ee=v(R.x),G=new Date(ee);G.setDate(G.getDate()+1),d?.(O,ee,G);},[v,d]),C=react.useMemo(()=>{let S=R=>R.map(ee=>{if(ee.subtasks&&ee.subtasks.length>0){let G=S(ee.subtasks),ne=G.filter(M=>M.startDate&&M.endDate);if(ne.length>0){let M=ne.map(at=>at.startDate.getTime()),ce=ne.map(at=>at.endDate.getTime()),ie=new Date(Math.min(...M)),vt=new Date(Math.max(...ce));return {...ee,subtasks:G,startDate:ee.startDate||ie,endDate:ee.endDate||vt}}return {...ee,subtasks:G}}return ee}),O=(R,ee=[])=>{for(let G of R)ee.push(G),G.subtasks&&G.subtasks.length>0&&(G.isExpanded===void 0||G.isExpanded)&&O(G.subtasks,ee);return ee},Y=S(e);return O(Y)},[e]),E=react.useCallback(S=>{if(!S.startDate||!S.endDate)return {x:0,width:0};let O=S.startDate.getTime(),Y=S.endDate.getTime(),Q=o.getTime(),R=(O-Q)/(1e3*60*60*24),ee=(Y-O)/(1e3*60*60*24),G=R*h*i,ne=Math.max(h*i,40),M=Math.max(ee*h*i,ne);return {x:G,width:M}},[o,h,i]),T=react.useMemo(()=>C.filter(S=>S.startDate&&S.endDate).map(S=>{let{x:O,width:Y}=E(S),R=C.findIndex(ee=>ee.id===S.id)*a+12;return {id:S.id,x:O,y:R,width:Y,height:32}}),[C,E]),z=react.useCallback((S,O,Y)=>{if(!Y||O===0){b([]);return}let Q=j.calculateCascadePreview(e,S,O,C,o,h*i,a,48);b(Q);},[e,C,o,h,i,a,48]),U=react.useMemo(()=>{let S=[],O=new Date(o);for(;O<=n;){let R=(O.getTime()-o.getTime())/864e5*h*i;if(r==="day")S.push({date:new Date(O),label:O.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:R}),O.setDate(O.getDate()+1);else if(r==="week"){let ee=k(O);S.push({date:new Date(O),label:`Week ${ee}`,x:R}),O.setDate(O.getDate()+7);}else S.push({date:new Date(O),label:O.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:R}),O.setMonth(O.getMonth()+1);}return S},[o,n,r,h,i]),L=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*h*i,[o,h,i]),H=Math.max(C.length*a,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,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(u,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(u,1e3),height:48,fill:t.bgGrid}),U.map((S,O)=>jsxRuntime.jsxs("g",{children:[O>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:S.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:S.label})]},`header-${O}`)),L>=0&&L<=u&&jsxRuntime.jsx("circle",{cx:L,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(u,1e3),height:H,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(u,1e3),height:H,fill:t.bgPrimary}),U.map((S,O)=>{let Y=U[O+1]?.x||u,Q=w(S.date);return jsxRuntime.jsxs("g",{children:[Q&&jsxRuntime.jsx("rect",{x:S.x,y:0,width:Y-S.x,height:C.length*a,fill:t.bgWeekend,opacity:1}),O>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:C.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},O)}),L>=0&&L<=u&&jsxRuntime.jsx("line",{x1:L,y1:0,x2:L,y2:C.length*a,stroke:t.today,strokeWidth:2,opacity:1}),C.map((S,O)=>{let Y=S.startDate&&S.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:O*a,width:u,height:a,fill:O%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${S.id}`),!Y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:O*a,width:u,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Q=>P(Q,S),onMouseEnter:Q=>{Q.currentTarget.setAttribute("fill",t.accentLight),Q.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:Q=>{Q.currentTarget.setAttribute("fill","transparent"),Q.currentTarget.setAttribute("opacity","1");}},`clickable-${S.id}`),jsxRuntime.jsx("text",{x:L>0?L:100,y:O*a+a/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-${S.id}`)]})]},`row-group-${S.id}`)}),C.map((S,O)=>!S.dependencies||S.dependencies.length===0||!S.startDate||!S.endDate?null:S.dependencies.map(Y=>{let Q=C.find(ne=>ne.id===Y);if(!Q||!Q.startDate||!Q.endDate)return null;let R=C.findIndex(ne=>ne.id===Y),ee=E(Q),G=E(S);return jsxRuntime.jsx(Xr,{x1:ee.x+ee.width,y1:R*a+a/2,x2:G.x,y2:O*a+a/2,theme:t,onDelete:()=>g?.(S.id,Y)},`dep-${Y}-${S.id}`)})),C.map((S,O)=>{if(!S.startDate||!S.endDate)return null;let{x:Y,width:Q}=E(S),R=O*a+12,ee=S.subtasks&&S.subtasks.length>0&&!S.isMilestone;return S.isMilestone?jsxRuntime.jsx(Jr,{task:S,x:Y+Q/2,y:R+16,theme:t,onClick:c},S.id):ee?jsxRuntime.jsxs("g",{onClick:()=>c?.(S),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:Y,y:R,width:Q,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:Y,y1:R,x2:Y+Q,y2:R,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Y,y1:R,x2:Y,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Y+Q,y1:R,x2:Y+Q,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Y,y1:R+32,x2:Y+Q,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),Q>60&&jsxRuntime.jsx("text",{x:Y+12,y:R+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S.name})]},S.id):jsxRuntime.jsx(Kr,{task:S,x:Y,y:R,width:Q,theme:t,dayWidth:h*i,startDate:o,templates:m,onClick:c,onDoubleClick:s,onContextMenu:p,onDateChange:d,onDependencyCreate:l,allTaskPositions:T,onDragMove:z},S.id)}),y.map(S=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:S.previewX,y:S.y-48,width:S.width,height:32,rx:8,fill:S.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(S.daysDelta)>0&&jsxRuntime.jsx("text",{x:S.previewX+S.width/2,y:S.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:S.daysDelta>0?`+${S.daysDelta}d`:`${S.daysDelta}d`})]},`cascade-preview-${S.taskId}`))]})]})}var Gi=[{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 $i({value:e="#6366F1",onChange:t,disabled:a=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Gi.map(r=>{let o=e===r.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!a&&t(r.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:r.value,boxShadow:o?`0 0 0 2px #FFFFFF, 0 0 0 4px ${r.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},whileHover:a?{}:{scale:1.1},whileTap:a?{}:{scale:.95},title:r.name,disabled:a,children:o&&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})})},r.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:Gi.find(r=>r.value===e)?.name||"Personalizado"})]})}function to({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:i=false,mode:m=a?"edit":"create",theme:c="dark"}){let s=Ce[c]||Ce.dark,p={backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.textPrimary},d={color:s.textSecondary},[l,g]=react.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[x,y]=react.useState({});react.useEffect(()=>{g(a?{name:a.name,startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[a,e]);let b=()=>{let u={};return l.name.trim()||(u.name="El nombre es requerido"),l.startDate&&l.endDate&&l.startDate>l.endDate&&(u.endDate="La fecha de fin debe ser posterior a la de inicio"),y(u),Object.keys(u).length===0},f=async u=>{if(u.preventDefault(),!!b())try{await n(l),t();}catch(k){console.error("Error submitting task:",k);}},h=(u,k)=>{g(w=>{let v={...w,[u]:k};if(u==="progress"){let P=typeof k=="number"?k:parseInt(k,10);P===100&&w.status!=="completed"?v.status="completed":P>0&&P<100&&w.status==="todo"?v.status="in-progress":P===0&&w.status==="in-progress"&&(v.status="todo");}return v}),x[u]&&y(w=>{let v={...w};return delete v[u],v});};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:s.bgPrimary,border:`1px solid ${s.border}`},onClick:u=>u.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${s.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:s.textPrimary},children:m==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:u=>u.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:u=>u.currentTarget.style.backgroundColor="transparent",disabled:i,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:f,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:d,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:l.name,onChange:u=>h("name",u.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,onFocus:u=>u.currentTarget.style.borderColor=s.accent,onBlur:u=>u.currentTarget.style.borderColor=s.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:i}),x.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),x.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsxRuntime.jsx("input",{type:"date",value:l.startDate?l.startDate.toISOString().split("T")[0]:"",onChange:u=>h("startDate",u.target.value?new Date(u.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,disabled:i||l.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsxRuntime.jsx("input",{type:"date",value:l.endDate?l.endDate.toISOString().split("T")[0]:"",onChange:u=>h("endDate",u.target.value?new Date(u.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,disabled:i||l.isMilestone}),x.endDate&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),x.endDate]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:l.status,onChange:u=>h("status",u.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,disabled:i,children:[jsxRuntime.jsx("option",{value:"todo",children:"Por Hacer"}),jsxRuntime.jsx("option",{value:"in-progress",children:"En Progreso"}),jsxRuntime.jsx("option",{value:"completed",children:"Completada"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-3 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx($i,{value:l.color,onChange:u=>h("color",u),disabled:i}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:s.textTertiary},children:a?.parentId?"Esta subtarea hereda el color de su tarea padre":a?.subtasks&&a.subtasks.length>0?"Las subtareas heredar\xE1n este color con menor opacidad":"Elige un color para organizar visualmente tus tareas"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:d,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-2 py-0.5 rounded text-sm",style:{color:l.progress<30?"#EF4444":l.progress<70?"#F59E0B":"#10B981",backgroundColor:l.progress<30?"rgba(239, 68, 68, 0.1)":l.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[l.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:l.progress,onChange:u=>h("progress",parseInt(u.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:s.bgSecondary,accentColor:l.progress<30?"#EF4444":l.progress<70?"#F59E0B":"#10B981"},disabled:i}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${l.progress}%`,backgroundColor:l.progress<30?"rgba(239, 68, 68, 0.3)":l.progress<70?"rgba(245, 158, 11, 0.3)":"rgba(16, 185, 129, 0.3)"}})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-3 gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:s.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(u=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>h("progress",u),disabled:i,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:l.progress===u?u<30?"#EF4444":u<70?"#F59E0B":"#10B981":s.bgSecondary,color:l.progress===u?"#FFFFFF":s.textSecondary,border:`1px solid ${l.progress===u?u<30?"#EF4444":u<70?"#F59E0B":"#10B981":s.borderLight}`},children:[u,"%"]},u))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:s.textTertiary},children:[jsxRuntime.jsx("span",{children:"0%"}),jsxRuntime.jsx("span",{children:"25%"}),jsxRuntime.jsx("span",{children:"50%"}),jsxRuntime.jsx("span",{children:"75%"}),jsxRuntime.jsx("span",{children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:l.isMilestone,onChange:u=>h("isMilestone",u.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:s.accent},disabled:i}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:s.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),o.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:o.map(u=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:k=>k.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:k=>k.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:l.assignees?.some(k=>k.name===u.name),onChange:k=>{let w=k.target.checked?[...l.assignees||[],{name:u.name,avatar:u.avatar,initials:u.name.split(" ").map(v=>v[0]).join("").toUpperCase().slice(0,2),color:s.accent}]:(l.assignees||[]).filter(v=>v.name!==u.name);h("assignees",w);},className:"w-4 h-4 rounded",style:{accentColor:s.accent},disabled:i}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:s.accent},children:u.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:s.textPrimary},children:u.name})]})]},u.id))})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:r.filter(u=>u.id!==a?.id).map(u=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:k=>k.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:k=>k.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:l.dependencies?.includes(u.id),onChange:k=>{let w=k.target.checked?[...l.dependencies||[],u.id]:(l.dependencies||[]).filter(v=>v!==u.id);h("dependencies",w);},className:"w-4 h-4 rounded",style:{accentColor:s.accent},disabled:i}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:s.textPrimary},children:u.name})]},u.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${s.border}`,backgroundColor:s.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:u=>{u.currentTarget.style.color=s.textPrimary,u.currentTarget.style.backgroundColor=s.hoverBg;},onMouseLeave:u=>{u.currentTarget.style.color=s.textSecondary,u.currentTarget.style.backgroundColor="transparent";},disabled:i,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:f,disabled:i,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:s.accent,color:"#FFFFFF"},onMouseEnter:u=>!i&&(u.currentTarget.style.backgroundColor=s.accentHover),onMouseLeave:u=>!i&&(u.currentTarget.style.backgroundColor=s.accent),children:i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),m==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var nu=['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"'],Yi=()=>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"})]}),su=()=>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"})}),iu=()=>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"})}),lu=()=>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"})}),du=()=>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 ao({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:i,onDependencyCreate:m,onDependencyDelete:c}){let[s,p]=react.useState(false),[d,l]=react.useState(false),[g,x]=react.useState([]),[y,b]=react.useState(""),[f,h]=react.useState(false),[u,k]=react.useState(true),w=react.useRef(null),v=react.useRef(null),P=react.useRef(null),{enabled:C=true,placeholder:E='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:z,suggestions:U=nu,maxHistory:L=50}=a;react.useEffect(()=>{v.current&&v.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{s&&!d&&w.current&&setTimeout(()=>w.current?.focus(),100);},[s,d]);let H=react.useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&n?.(R.newTask);break;case "delete_task":R.taskId&&i?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&m?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&c?.(R.taskId,R.dependencyFrom);break}},[o,n,i,m,c]),S=react.useCallback(async R=>{if(!R.trim()||f)return;let ee={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};x(ne=>[...ne.slice(-(L-1)),ee]),b(""),k(false),h(true);let G={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(ne=>[...ne,G]);try{if(z){let ne=await z(R,e);x(M=>{let ce=M.filter(vt=>!vt.isLoading),ie={id:`assistant-${Date.now()}`,role:"assistant",content:ne.message,timestamp:new Date,command:ne};return [...ce,ie]}),H(ne);}else x(ne=>[...ne.filter(ce=>!ce.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(ne){x(M=>[...M.filter(ie=>!ie.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ne instanceof Error?ne.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[f,L,z,e,H]),O=R=>{R.preventDefault(),S(y);},Y=R=>{b(R),w.current?.focus();};if(react.useEffect(()=>{let R=ee=>{(ee.metaKey||ee.ctrlKey)&&ee.key==="k"&&(ee.preventDefault(),p(G=>!G),s||l(false)),ee.key==="Escape"&&s&&p(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[s]),!C)return null;let Q={"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(Be,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!s&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${Q[T]} 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:()=>p(true),children:[jsxRuntime.jsx(Yi,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:P,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Q[T]} 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(Yi,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>l(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(lu,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(iu,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&u&&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:U.slice(0,4).map((R,ee)=>jsxRuntime.jsx("button",{onClick:()=>Y(R),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:R.length>30?R.slice(0,30)+"...":R},ee))})]}),g.map(R=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsxRuntime.jsx(du,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsxRuntime.jsx("div",{ref:v})]}),jsxRuntime.jsxs("form",{onSubmit:O,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:w,type:"text",value:y,onChange:R=>b(R.target.value),placeholder:E,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!y.trim()||f,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(su,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Xi(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((s,p=true)=>{r(d=>{let l=typeof s=="function"?s(d.present):s;if(o.current)return {...d,present:l};if(!p)return {...d,present:l};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:l,future:[]}});},[t]),i=react.useCallback(()=>{r(s=>{if(s.past.length===0)return s;let p=s.past[s.past.length-1],d=s.past.slice(0,s.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[s.present,...s.future]}});},[]),m=react.useCallback(()=>{r(s=>{if(s.future.length===0)return s;let p=s.future[0],d=s.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...s.past,s.present],present:p,future:d}});},[]),c=react.useCallback(()=>{r(s=>({past:[],present:s.present,future:[]}));},[]);return {state:a.present,setState:n,undo:i,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function qi({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=i=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=m?i.metaKey:i.ctrlKey;if(c&&i.key==="z"&&!i.shiftKey&&a){i.preventDefault(),e();return}if(r){if(!m&&c&&i.key==="y"){i.preventDefault(),t();return}if(m&&c&&i.shiftKey&&i.key==="z"){i.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var uu={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${j.formatDate(e.startDate)} - ${j.formatDate(e.endDate)}`);let a=j.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>j.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Ji(e){return {...uu,...e}}var bu=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},el=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:i="week",rowDensity:m="comfortable",showThemeSelector:c=true,showExportButton:s=true,availableUsers:p=[],templates:d,enableAutoCriticalPath:l=true,aiAssistant:g,locale:x="en",customTranslations:y,showCreateTaskButton:b=false,createTaskLabel:f,onCreateTask:h,onThemeChange:u,onTaskClick:k,onTaskDblClick:w,onTaskContextMenu:v,onTaskUpdate:P,onProgressChange:C,onTaskEdit:E,onTaskAddSubtask:T,onTaskMarkIncomplete:z,onTaskSetInProgress:U,onDependencyCreate:L,onDependencyDelete:H,onBeforeTaskAdd:S,onAfterTaskAdd:O,onBeforeTaskUpdate:Y,onAfterTaskUpdate:Q}=a,ee=react.useContext($r)?.theme,[G,ne]=react.useState(ee||n||"dark"),[M,ce]=react.useState(i),[ie,vt]=react.useState(m),[at,Zt]=react.useState(1),[De,ft]=react.useState(0),[yt,Ut]=react.useState(false),[oa,xa]=react.useState(null),[he,rt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Gt,Ft]=react.useState(null);react.useEffect(()=>{ee&&ee!==G&&ne(ee);},[ee]),react.useEffect(()=>{n&&n!==G&&ne(n);},[n]);let ka=react.useCallback(N=>{ne(N),u?.(N);},[u]),{state:se,setState:me,undo:K,redo:_,canUndo:Te,canRedo:Ge,clearHistory:ae}=Xi(t,50);react.useEffect(()=>{me(t);},[t,me]),react.useEffect(()=>{r&&r(se);},[se,r]);let le=react.useMemo(()=>dn(x,y),[x,y]),Qt=react.useCallback(N=>[{id:"name",label:N.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:false},{id:"startDate",label:N.columns.startDate,width:110,visible:false,sortable:true},{id:"endDate",label:N.columns.endDate,width:110,visible:false,sortable:true},{id:"duration",label:N.columns.duration,width:80,visible:false,sortable:true},{id:"assignees",label:N.columns.assignees,width:120,visible:false,sortable:false},{id:"status",label:N.columns.status,width:80,visible:false,sortable:true},{id:"progress",label:N.columns.progress,width:120,visible:false,sortable:true}],[]),[Bt,X]=react.useState(()=>Qt(le));react.useEffect(()=>{X(N=>N.map(I=>({...I,label:le.columns[I.id==="name"?"taskName":I.id]||I.label})));},[le]);let V=react.useMemo(()=>Bt.filter(N=>N.visible).reduce((N,I)=>N+I.width,0)+60,[Bt]),ve=oa||V,D=react.useRef(null),$=react.useRef(null),pe=react.useRef(null),ye=react.useMemo(()=>pi(G),[G]),Re=react.useMemo(()=>({theme:ye,themeName:G}),[ye,G]),$e=react.useMemo(()=>Ji(d),[d]),Dt=react.useMemo(()=>{if(!l)return se;let N=j.calculateCriticalPath(se),I=W=>W.map(Z=>({...Z,isCriticalPath:N.includes(Z.id),subtasks:Z.subtasks?I(Z.subtasks):void 0}));return I(se)},[se,l]),wt=bu(ie);qi({undo:K,redo:_,canUndo:Te,canRedo:Ge,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>j.findTaskById(se,N),addTask:(N,I)=>{me(W=>{if(!I)return [...W,{...N,level:0}];let Z=oe=>oe.map(de=>de.id===I?{...de,subtasks:[...de.subtasks||[],{...N,parentId:I,level:(de.level||0)+1}],isExpanded:true}:de.subtasks?{...de,subtasks:Z(de.subtasks)}:de);return Z(W)});},updateTask:(N,I)=>{me(W=>{let Z=oe=>oe.map(de=>de.id===N?{...de,...I}:de.subtasks?{...de,subtasks:Z(de.subtasks)}:de);return Z(W)});},deleteTask:N=>{me(I=>{let W=Z=>Z.filter(oe=>oe.id===N?false:(oe.subtasks&&(oe.subtasks=W(oe.subtasks)),true));return W(I)});},deleteTasks:N=>{me(I=>Vr(I,N));},duplicateTask:N=>{me(I=>hn(I,[N]));},splitTask:(N,I,W=3)=>{me(Z=>j.splitTask(Z,N,I,W));},calculateEndDate:j.calculateEndDate,calculateDuration:j.calculateDuration,validateDependency:(N,I)=>!j.validateDependencies(se,N,I),getAllTasks:()=>j.flattenTasks(se),getTasksByStatus:N=>j.flattenTasks(se).filter(I=>I.status===N),getTasksByParent:N=>N?j.findTaskById(se,N)?.subtasks||[]:se.filter(W=>!W.parentId),getCriticalPath:()=>j.flattenTasks(se).filter(N=>N.isCriticalPath),indentTask:N=>{me(I=>un(I,[N]));},outdentTask:N=>{me(I=>gn(I,[N]));},moveTask:(N,I)=>{me(W=>fn(W,[N],I));},createSubtask:async N=>{let{tasks:I,newTask:W}=yn(se,N);if(S){let Z=S({...W,parentId:N});if((Z instanceof Promise?await Z:Z)===false)return}me(I),O&&O({...W,parentId:N});},scrollToTask:N=>{let W=j.flattenTasks(se).findIndex(Z=>Z.id===N);if(W!==-1&&D.current){let Z=W*wt;D.current.scrollTo({top:Z,behavior:"smooth"}),$.current&&$.current.scrollTo({top:Z,behavior:"smooth"});}},highlightTask:(N,I=2e3)=>{},expandTask:N=>{me(I=>{let W=Z=>Z.map(oe=>oe.id===N?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe);return W(I)});},collapseTask:N=>{me(I=>{let W=Z=>Z.map(oe=>oe.id===N?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe);return W(I)});},expandAll:()=>{me(N=>{let I=W=>W.map(Z=>({...Z,isExpanded:true,subtasks:Z.subtasks?I(Z.subtasks):void 0}));return I(N)});},collapseAll:()=>{me(N=>{let I=W=>W.map(Z=>({...Z,isExpanded:false,subtasks:Z.subtasks?I(Z.subtasks):void 0}));return I(N)});},undo:K,redo:_,canUndo:()=>Te,canRedo:()=>Ge,clearHistory:ae,exportToPNG:async()=>{if(!pe.current)throw new Error("Gantt container not found");let N=await Zi__default.default(pe.current,{backgroundColor:ye.bgPrimary,scale:2});return new Promise((I,W)=>{N.toBlob(Z=>{Z?I(Z):W(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await j.exportToPDF(se,N);},exportToExcel:async N=>{await j.exportToExcel(se,N);},exportToJSON:()=>j.exportToJSON(se),exportToCSV:()=>j.exportToCSV(se),importFromJSON:N=>{let I=j.importFromJSON(N);me(I);},getTasks:()=>se,refresh:()=>{me(N=>[...N]);},clearAll:()=>{me([]);}}),[se,K,_,Te,Ge,ae,ye,wt]);let ko=react.useCallback(N=>{X(I=>I.map(W=>W.id===N?{...W,visible:!W.visible}:W));},[]),tr=react.useCallback((N,I)=>{X(W=>W.map(Z=>{if(Z.id!==N)return Z;let oe=Z.minWidth??100,de=Z.maxWidth??800,ot=Math.max(oe,Math.min(de,I));return {...Z,width:ot}}));},[]),ar=react.useCallback(N=>{me(I=>vn(I,N)),a.onTaskToggleExpand?.(N);},[a]),Oa=react.useCallback((N,I)=>{if(Y&&Y(N,I)===false)return;let Z=j.findTaskById(se,N)?.progress,oe=ot=>ot.map(ht=>ht.id===N?{...ht,...I}:ht.subtasks?{...ht,subtasks:oe(ht.subtasks)}:ht);me(oe(se));let de=j.findTaskById(oe(se),N);de&&(P?.(de),Q?.(de),I.progress!==void 0&&Z!==void 0&&I.progress!==Z&&C?.(N,Z,I.progress));},[se,P,Y,Q,C]),pd=react.useCallback(N=>{N.length!==0&&(me(I=>un(I,N)),a.onTaskIndent?.(N[0]));},[a]),ud=react.useCallback(N=>{N.length!==0&&(me(I=>gn(I,N)),a.onTaskOutdent?.(N[0]));},[a]),gd=react.useCallback((N,I)=>{N.length!==0&&(me(W=>fn(W,N,I)),a.onTaskMove?.(N[0],I));},[a]),vs=react.useCallback(N=>{a.onMultiTaskDelete?a.onMultiTaskDelete(N):(me(I=>Vr(I,N)),N.forEach(I=>a.onTaskDelete?.(I)));},[a]),fd=react.useCallback(N=>{me(I=>hn(I,N)),N.forEach(I=>a.onTaskDuplicate?.(I));},[a]),hd=react.useCallback((N,I)=>{me(W=>{let{tasks:Z,newTask:oe}=Pi(W,N,I);return S&&S(oe)===false?W:(a.onTaskCreate?.(oe.parentId,oe.position||0),O?.(oe),Z)});},[a,S,O]),bd=react.useCallback((N,I)=>{me(W=>bn(W,N,I)),a.onTaskRename?.(N,I);},[a]),ys=react.useCallback(N=>{me(I=>{let{tasks:W}=yn(I,N);return a.onTaskCreate?.(N,0),W});},[a]),vd=react.useCallback((N,I,W)=>{let Z=N.startDate?Math.round((I.getTime()-N.startDate.getTime())/864e5):0,oe=ht=>ht.map($t=>$t.id===N.id?{...$t,startDate:I,endDate:W,...N.segments&&{segments:N.segments}}:$t.subtasks?{...$t,subtasks:oe($t.subtasks)}:$t),de=oe(se);de=j.autoScheduleDependents(de,N.id,Z),me(de);let ot={...N,startDate:I,endDate:W};P?.(ot);},[se,P]),yd=react.useCallback((N,I)=>{v?.(N,I),rt({isOpen:true,x:I.clientX,y:I.clientY,task:N});},[v]),xd=react.useCallback((N,I)=>{let W=j.splitTask(se,N.id,I);me(W),rt({isOpen:false,x:0,y:0,task:null});},[se]),xs=react.useCallback(N=>{w?.(N),E||Ft(N);},[w,E]),ks=react.useCallback((N,I,W)=>{let Z=new Map,oe=Wt=>{Wt.forEach(na=>{na.dependencies&&Z.set(na.id,na.dependencies),na.subtasks&&oe(na.subtasks);});};oe(W);let de=Z.get(I)||[];Z.set(I,[...de,N]);let ot=new Set,ht=new Set,$t=Wt=>{if(!ot.has(Wt)){ot.add(Wt),ht.add(Wt);let na=Z.get(Wt)||[];for(let rr of na){if(!ot.has(rr)&&$t(rr))return true;if(ht.has(rr))return true}}return ht.delete(Wt),false};return $t(I)},[]),ws=react.useCallback((N,I)=>{if(ks(N.id,I,se)){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
|
|
278
|
+
Task dependencies must flow in one direction only.`);return}let W=Z=>Z.map(oe=>{if(oe.id===I){let de=oe.dependencies||[];if(!de.includes(N.id))return {...oe,dependencies:[...de,N.id]}}return oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe});me(W(se)),L?.(N.id,I);},[se,L,ks]),Cs=react.useCallback((N,I)=>{let W=Z=>Z.map(oe=>{if(oe.id===N&&oe.dependencies){let de=oe.dependencies.filter(ot=>ot!==I);return {...oe,dependencies:de}}return oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe});me(W(se)),H?.(N,I);},[se,H]),{startDate:kd,endDate:wd}=react.useMemo(()=>{let N=se.filter(de=>de.startDate&&de.endDate);if(N.length===0){let de=new Date,ot=new Date(de);ot.setDate(ot.getDate()-30);let ht=new Date(de);return ht.setDate(ht.getDate()+60),{startDate:ot,endDate:ht}}let I=N.flatMap(de=>[de.startDate,de.endDate]).filter(de=>de!==void 0),W=new Date(Math.min(...I.map(de=>de.getTime()))),Z=new Date(Math.max(...I.map(de=>de.getTime()))),oe=M==="day"?7:M==="week"?14:30;return W.setDate(W.getDate()-oe),Z.setDate(Z.getDate()+oe),{startDate:W,endDate:Z}},[se,M]),Cd=react.useCallback(async()=>{if(!pe.current)return;let N=await Zi__default.default(pe.current,{backgroundColor:ye.bgPrimary,scale:2}),I=document.createElement("a");I.download="gantt-chart.png",I.href=N.toDataURL("image/png"),I.click();},[ye]),Td=react.useCallback(async()=>{await j.exportToPDF(se);},[se]),Dd=react.useCallback(async()=>{await j.exportToExcel(se);},[se]),Nd=react.useCallback(()=>{let N=j.exportToCSV(se),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);},[se]),Sd=react.useCallback(()=>{let N=j.exportToJSON(se),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);},[se]),Ed=react.useCallback(()=>{j.exportToMSProject(se,"Gantt Project","project.xml");},[se]),Pd=N=>{N.preventDefault(),Ut(true);};return react.useEffect(()=>{let N=$.current,I=D.current;if(!N||!I)return;let W=I.querySelector(".gantt-taskgrid-content"),Z=()=>{let ot=N.scrollTop;ft(ot),W&&(W.style.transform=`translateY(-${ot}px)`);},oe=ot=>{if(yt&&I){let $t=I.parentElement?.getBoundingClientRect()?.left||0,Wt=ot.clientX-$t,na=200,rr=Math.min(window.innerWidth-300,800);Wt>=na&&Wt<=rr&&xa(Wt);}},de=()=>{Ut(false);};return N.addEventListener("scroll",Z),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",de),()=>{N.removeEventListener("scroll",Z),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",de);}},[yt]),jsxRuntime.jsx(Ya.Provider,{value:le,children:jsxRuntime.jsx(No.Provider,{value:Re,children:jsxRuntime.jsxs("div",{ref:pe,className:"flex flex-col h-full w-full",style:{backgroundColor:ye.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Hr,{theme:ye,timeScale:M,onTimeScaleChange:ce,zoom:at,onZoomChange:Zt,currentTheme:G,onThemeChange:ka,rowDensity:ie,onRowDensityChange:vt,showThemeSelector:c,showCreateTaskButton:b,createTaskLabel:f,onCreateTask:h,onExportPNG:s?Cd:void 0,onExportPDF:s?Td:void 0,onExportExcel:s?Dd:void 0,onExportCSV:s?Nd:void 0,onExportJSON:s?Sd:void 0,onExportMSProject:s?Ed:void 0}),jsxRuntime.jsxs("div",{ref:D,className:"flex-1 flex min-h-0",style:{overflow:"hidden"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:ve,overflow:"hidden"},children:jsxRuntime.jsx(jr,{tasks:Dt,theme:ye,rowHeight:wt,availableUsers:p,templates:$e,onTaskClick:k,onTaskDblClick:xs,onTaskContextMenu:v,onTaskToggle:ar,scrollTop:De,columns:Bt,onToggleColumn:ko,onColumnResize:tr,onTaskUpdate:Oa,onTaskIndent:pd,onTaskOutdent:ud,onTaskMove:gd,onMultiTaskDelete:vs,onTaskDuplicate:fd,onTaskCreate:hd,onTaskRename:bd,onCreateSubtask:ys,onOpenTaskModal:k?N=>k(N):void 0})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Pd}),jsxRuntime.jsx("div",{ref:$,className:"gantt-timeline-scroll flex-1 overflow-auto",style:{minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(eo,{tasks:Dt,theme:ye,rowHeight:wt,timeScale:M,startDate:kd,endDate:wd,zoom:at,templates:$e,onTaskClick:k,onTaskDblClick:xs,onTaskContextMenu:yd,onTaskDateChange:vd,onDependencyCreate:ws,onDependencyDelete:Cs})})]}),he.task&&jsxRuntime.jsx(Xa,{isOpen:he.isOpen,x:he.x,y:he.y,theme:ye,onClose:()=>rt({isOpen:false,x:0,y:0,task:null}),items:[{id:"edit",label:le.contextMenu?.editTask||"Edit Task",icon:it.Pencil,onClick:()=>{he.task&&(E?E(he.task):Ft(he.task));}},{id:"addSubtask",label:le.contextMenu?.addSubtask||"Add Subtask",icon:it.Add,onClick:()=>{he.task&&(T?T(he.task):ys(he.task.id));}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:le.contextMenu?.markIncomplete||"Mark Incomplete",icon:it.MarkIncomplete,onClick:()=>{he.task&&(z?z(he.task):Oa(he.task.id,{status:"todo",progress:0}));},disabled:he.task?.status==="todo"},{id:"setInProgress",label:le.contextMenu?.setInProgress||"Set In Progress",icon:it.SetInProgress,onClick:()=>{he.task&&(U?U(he.task):Oa(he.task.id,{status:"in-progress"}));},disabled:he.task?.status==="in-progress"},{id:"markComplete",label:le.contextMenu?.markComplete||"Mark Complete",icon:it.MarkComplete,onClick:()=>{he.task&&Oa(he.task.id,{status:"completed",progress:100});},disabled:he.task?.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:le.contextMenu?.splitTask||"Split Task",icon:it.Split,onClick:()=>{if(!he.task?.startDate||!he.task?.endDate){console.warn("Cannot split task without dates");return}let N=he.task.startDate.getTime(),I=he.task.endDate.getTime(),W=N+(I-N)/2,Z=new Date(W);xd(he.task,Z);},disabled:!he.task?.startDate||!he.task?.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:le.contextMenu?.deleteTask||"Delete Task",icon:it.Delete,onClick:()=>{he.task&&vs([he.task.id]);}}]}),Gt&&jsxRuntime.jsx(to,{isOpen:true,onClose:()=>Ft(null),task:Gt,onSubmit:N=>{Oa(Gt.id,N),Ft(null);},mode:"edit",theme:G}),g?.enabled&&jsxRuntime.jsx(ao,{tasks:se,theme:ye,config:g,onTasksUpdate:me,onTaskUpdate:Oa,onTaskCreate:N=>{me(I=>[...I,N]);},onTaskDelete:N=>{me(I=>Vr(I,[N]));},onDependencyCreate:(N,I)=>{let W=j.findTaskById(se,N);W&&ws(W,I);},onDependencyDelete:Cs})]})})})});var tl=`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
|
|
@@ -316,39 +316,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
316
316
|
|
|
317
317
|
Always try to match task names case-insensitively and handle partial matches.
|
|
318
318
|
If you can't find a task by name, search through the provided task list.
|
|
319
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
320
|
-
${
|
|
319
|
+
If ambiguous, ask for clarification in the message field.`;function al(e){return `CURRENT TASKS:
|
|
320
|
+
${rl(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",n=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",i=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${n}, ${r.progress}%, ${r.status||"todo"}) ${i}`}).join(`
|
|
321
321
|
`)}
|
|
322
322
|
|
|
323
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function qc(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Dr(e,t){let r=qc(e),a=t.toLowerCase().trim(),n=r.find(c=>c.name.toLowerCase()===a);if(n)return n;let o=r.find(c=>c.name.toLowerCase().includes(a));if(o)return o;let s=a.split(/\s+/);return r.find(c=>{let u=c.name.toLowerCase();return s.every(i=>u.includes(i))})}function Is(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let d=new Date(a);return d.setDate(d.getDate()+1),d}if(r==="yesterday"||r==="ayer"){let d=new Date(a);return d.setDate(d.getDate()-1),d}if(r==="next week"||r==="la pr\xF3xima semana"){let d=new Date(a);return d.setDate(d.getDate()+7),d}let n=r.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let m={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[n[1].toLowerCase()];if(m!==void 0){let v=new Date(a),y=v.getDay(),h=m-y;return h<=0&&(h+=7),v.setDate(v.getDate()+h),v}}let o=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(o&&o[1]&&o[2]){let d=parseInt(o[1],10),m=o[2].toLowerCase(),v=new Date(a);return m==="day"||m==="d\xEDa"||m==="dias"?v.setDate(v.getDate()+d):m==="week"||m==="semana"||m==="semanas"?v.setDate(v.getDate()+d*7):(m==="month"||m==="mes"||m==="meses")&&v.setMonth(v.getMonth()+d),v}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let c=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let d=parseInt(c[1],10),m=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,m,d)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=r.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let d=parseInt(i[1],10),m=u[i[2].toLowerCase()],v=i[3]?parseInt(i[3],10):a.getFullYear();if(m!==void 0)return new Date(v,m,d)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let d=p[l[1].toLowerCase()],m=parseInt(l[2],10),v=l[3]?parseInt(l[3],10):a.getFullYear();if(d!==void 0)return new Date(v,d,m)}return null}function As(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function Ls(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function Xc(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function Jc(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),p=a[2].trim(),l=Dr(t,i),d=Is(p);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(d);return v.setDate(v.getDate()+m),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:d,endDate:v},message:`Moved "${l.name}" to ${d.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),p=n[2].trim(),l=Dr(t,i),d=As(p);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!d||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let m=new Date(l.endDate);return m.setDate(m.getDate()+d),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:m},message:`Extended "${l.name}" by ${d} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let o=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),p=o[2].trim(),l=Dr(t,i),d=Ls(p);return l?d===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:d},message:`Set "${l.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let s=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),p=s[2].trim(),l=Dr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:p},message:`Renamed "${l.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let c=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),p=c[2].trim(),l=Dr(t,i),d=Dr(t,p);return l?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:l.id,dependencyTo:d.id,message:`Linked "${l.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let u=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),p=Dr(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Zc(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function Ch(e){if(e)switch(e.toUpperCase()){case "TODO":case "BLOCKED":return "todo";case "IN_PROGRESS":case "REVIEW":return "in-progress";case "DONE":return "completed";default:return "todo"}}function Th(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return "TODO"}}function Zn(e,t=[],r=[]){let a=e.assignedUserIds?.map(p=>{let l=r.find(d=>d.id===p);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(p=>p!==null),n=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Zn(p,t,r)),o;e.dependencies&&(typeof e.dependencies[0]=="string"?o=e.dependencies:o=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let s=p=>{if(p)return typeof p=="string"?new Date(p):p},c=s(e.startDate),u=s(e.endDate),i=e.metadata?.isMilestone===true||c&&u&&Math.abs(u.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:u,progress:e.progress||0,status:Ch(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:o?.length?o:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Qc(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(o=>o.name===a.name||o.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:Th(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function ed(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>Zn(a,e,t))}var Fs={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Bs={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Qn={en:Fs,es:Bs};function Os(e){return Qn[e]||Qn.en}function eo(e,t){let r=Os(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}function nd(e,t=0){let r=[];for(let a of e)r.push({...a,level:t,hasChildren:(a.subtasks?.length||0)>0,parentPath:[a.id]}),a.subtasks?.length&&a.isExpanded!==false&&r.push(...nd(a.subtasks,t+1));return r}function Fh({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function od({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:o,style:s}){let{theme:c="dark",locale:u="en",customTranslations:i,showSearch:p=true,showHierarchy:l=true}=t,d=eo(u,i),m=c==="dark",[v,y]=Se.useState(new Set),[h,g]=Se.useState("startDate"),[b,f]=Se.useState("asc"),[k,w]=Se.useState("");Se.useMemo(()=>{let T=new Set;function $(z){for(let R of z)R.subtasks?.length&&(T.add(R.id),$(R.subtasks));}$(e),y(T);},[e]);let x=Se.useCallback(T=>{y($=>{let z=new Set($);return z.has(T)?z.delete(T):z.add(T),z}),r.onTaskToggleExpand?.(T);},[r]),D=Se.useCallback(T=>{h===T?f($=>$==="asc"?"desc":"asc"):(g(T),f("asc")),r.onSortChange?.({column:T,direction:b==="asc"?"desc":"asc"});},[h,b,r]),C=Se.useMemo(()=>{let T=nd(e);if(k.trim()){let z=k.toLowerCase();T=T.filter(R=>R.name.toLowerCase().includes(z));}let $=[];for(let z of T){let R=z.level===0;z.level>0&&(R=true),(R||k.trim())&&$.push(z);}return k.trim()&&$.sort((z,R)=>{let W,E;switch(h){case "name":W=z.name.toLowerCase(),E=R.name.toLowerCase();break;case "startDate":W=z.startDate?.getTime()||0,E=R.startDate?.getTime()||0;break;case "endDate":W=z.endDate?.getTime()||0,E=R.endDate?.getTime()||0;break;case "progress":W=z.progress||0,E=R.progress||0;break;case "status":W=z.status||"todo",E=R.status||"todo";break;default:return 0}return W<E?b==="asc"?-1:1:W>E?b==="asc"?1:-1:0}),$},[e,k,h,b]),N=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(u==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return a?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",o),style:s,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:L("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:[d.empty.noTasks,"..."]})]})}):n?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",o),style:s,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:L("text-lg font-semibold mb-2",m?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:L("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",o),style:s,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:L("text-lg font-semibold mb-2",m?"text-white":"text-gray-900"),children:d.empty.noTasks}),jsxRuntime.jsx("p",{className:L("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:d.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:L("flex-1 flex flex-col w-full h-full overflow-hidden",m?"bg-[#0F1117]":"bg-white",o),style:s,children:[jsxRuntime.jsx("div",{className:L("flex-shrink-0 px-6 py-4 border-b",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:L("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",m?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:k,onChange:T=>w(T.target.value),placeholder:d.toolbar.searchPlaceholder,className:L("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",m?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:L("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:[C.length," ",d.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:L("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",m?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>D("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>D("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>D("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>D("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>D("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C.map((T,$)=>{let z=v.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:$*.02},className:L("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",m?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:l?`${24+T.level*24}px`:void 0},onClick:()=>r.onTaskClick?.(T),onDoubleClick:()=>r.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[l&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),x(T.id);},className:L("p-0.5 rounded",m?"hover:bg-white/10":"hover:bg-gray-200"),children:z?jsxRuntime.jsx(lucideReact.ChevronDown,{className:L("w-4 h-4",m?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:L("w-4 h-4",m?"text-[#9CA3AF]":"text-gray-400")})}),l&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),r.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Fh,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:L("truncate",m?"text-white":"text-gray-900",T.progress===100&&(m?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:L("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":m?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?d.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?d.status.inProgress:d.status.todo})}),jsxRuntime.jsxs("div",{className:L("col-span-2 flex items-center gap-1 text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),N(T.startDate)]}),jsxRuntime.jsxs("div",{className:L("col-span-2 flex items-center gap-1 text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),N(T.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:L("flex-1 h-1.5 rounded-full overflow-hidden",m?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:L("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:L("text-xs w-8",m?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),C.length===0&&k&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:L("w-12 h-12 mx-auto mb-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:L(m?"text-[#9CA3AF]":"text-gray-600"),children:d.empty.noResults})]})})]})]})}var zs={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},$s={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da"},Ws={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},ro={dark:zs,light:$s,neutral:Ws};function sd(e){return ro[e]||ro.dark}var Us={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Gs={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},ao={en:Us,es:Gs};function Xa(e){return ao[e]||ao.en}function no(e,t){let r=Xa(e);return t?{navigation:{...r.navigation,...t.navigation},weekdays:{...r.weekdays,...t.weekdays},weekdaysFull:{...r.weekdaysFull,...t.weekdaysFull},months:{...r.months,...t.months},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},tooltips:{...r.tooltips,...t.tooltips}}:r}function id(e){let t=Xa(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function ld(e,t=0,r=true){let a=Xa(e),n=r?[a.weekdays.sun,a.weekdays.mon,a.weekdays.tue,a.weekdays.wed,a.weekdays.thu,a.weekdays.fri,a.weekdays.sat]:[a.weekdaysFull.sunday,a.weekdaysFull.monday,a.weekdaysFull.tuesday,a.weekdaysFull.wednesday,a.weekdaysFull.thursday,a.weekdaysFull.friday,a.weekdaysFull.saturday];return [...n.slice(t),...n.slice(0,t)]}function Hh(e){let t=[];function r(a){for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);}return r(e),t}function Hs(e,t){if(!t.startDate||!t.endDate)return false;let r=new Date(e.getFullYear(),e.getMonth(),e.getDate()),a=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),n=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return r>=a&&r<=n}function Vh({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function ud({tasks:e,config:t={},callbacks:r={},initialDate:a,isLoading:n=false,error:o,className:s,style:c}){let{theme:u="dark",locale:i="en",customTranslations:p}=t,l=no(i,p),d=u==="dark",[m,v]=Se.useState(a||new Date),[y,h]=Se.useState(null),g=Se.useCallback(()=>{v(new Date(m.getFullYear(),m.getMonth()-1,1));},[m]),b=Se.useCallback(()=>{v(new Date(m.getFullYear(),m.getMonth()+1,1));},[m]),f=Se.useCallback(()=>{v(new Date);},[]),k=Se.useMemo(()=>{let C=m.getFullYear(),N=m.getMonth(),T=new Date(C,N,1),$=new Date(C,N+1,0),z=T.getDay(),R=$.getDate(),W=Hh(e),E=new Date;E.setHours(0,0,0,0);let O=[],G=z,U=new Date(C,N,0).getDate();for(let K=G-1;K>=0;K--){let _=new Date(C,N-1,U-K);O.push({date:_,isCurrentMonth:false,isToday:false,isWeekend:_.getDay()===0||_.getDay()===6,events:W.filter(ae=>Hs(_,ae)).map(ae=>({id:ae.id,title:ae.name,start:ae.startDate,end:ae.endDate,task:ae}))});}for(let K=1;K<=R;K++){let _=new Date(C,N,K),ae=_.getTime()===E.getTime();O.push({date:_,isCurrentMonth:true,isToday:ae,isWeekend:_.getDay()===0||_.getDay()===6,events:W.filter(M=>Hs(_,M)).map(M=>({id:M.id,title:M.name,start:M.startDate,end:M.endDate,task:M}))});}let A=42-O.length;for(let K=1;K<=A;K++){let _=new Date(C,N+1,K);O.push({date:_,isCurrentMonth:false,isToday:false,isWeekend:_.getDay()===0||_.getDay()===6,events:W.filter(ae=>Hs(_,ae)).map(ae=>({id:ae.id,title:ae.name,start:ae.startDate,end:ae.endDate,task:ae}))});}return O},[m,e]),w=i==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],x=m.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),D=Se.useCallback(C=>{let N=C.progress===100?0:100,T=N===100?"completed":"todo";r.onTaskUpdate?.({...C,status:T,progress:N});},[r]);return n?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",d?"bg-[#0F1117]":"bg-white",s),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:L("text-sm",d?"text-[#9CA3AF]":"text-gray-600"),children:[l.labels.noEvents,"..."]})]})}):o?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",d?"bg-[#0F1117]":"bg-white",s),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:L("text-lg font-semibold mb-2",d?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:L("text-sm",d?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",d?"bg-[#0F1117]":"bg-white",s),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:L("text-lg font-semibold mb-2",d?"text-white":"text-gray-900"),children:l.labels.noEvents}),jsxRuntime.jsx("p",{className:L("text-sm",d?"text-[#9CA3AF]":"text-gray-600"),children:l.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:L("flex-1 flex flex-col w-full h-full overflow-hidden",d?"bg-[#0F1117]":"bg-white",s),style:c,children:[jsxRuntime.jsx("div",{className:L("flex-shrink-0 px-6 py-4 border-b",d?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:L("text-xl font-semibold capitalize",d?"text-white":"text-gray-900"),children:x}),jsxRuntime.jsx("button",{onClick:f,className:L("px-3 py-1.5 text-sm rounded-lg transition-colors",d?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:l.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:g,className:L("p-2 rounded-lg transition-colors",d?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:L("w-5 h-5",d?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:b,className:L("p-2 rounded-lg transition-colors",d?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:L("w-5 h-5",d?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 overflow-auto",children:jsxRuntime.jsxs("div",{className:"h-full flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:w.map(C=>jsxRuntime.jsx("div",{className:L("py-2 text-center text-xs font-medium uppercase",d?"text-[#9CA3AF]":"text-gray-500"),children:C},C))}),jsxRuntime.jsx("div",{className:L("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",d?"bg-white/5":"bg-gray-200"),children:k.map((C,N)=>jsxRuntime.jsxs("div",{className:L("min-h-[100px] p-2 transition-colors",d?"bg-[#0F1117]":"bg-white",!C.isCurrentMonth&&(d?"bg-[#0F1117]/50":"bg-gray-50"),C.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsx("div",{className:L("text-sm font-medium mb-1",C.isToday?"text-[#3B82F6]":C.isCurrentMonth?d?"text-white":"text-gray-900":d?"text-[#6B7280]":"text-gray-400"),children:C.date.getDate()}),jsxRuntime.jsxs("div",{className:"space-y-1 overflow-y-auto max-h-[80px]",children:[C.events.slice(0,3).map(T=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{h(T.task),r.onEventClick?.(T);},whileHover:{scale:1.02},className:L("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",T.task.progress===100?d?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":d?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Vh,{task:T.task}),jsxRuntime.jsx("span",{className:"truncate",children:T.title})]},T.id)),C.events.length>3&&jsxRuntime.jsxs("div",{className:L("text-xs px-1.5",d?"text-[#6B7280]":"text-gray-400"),children:["+",C.events.length-3," ",i==="es"?"m\xE1s":"more"]})]})]},N))})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,x:300},animate:{opacity:1,x:0},exit:{opacity:0,x:300},className:L("fixed right-0 top-0 h-full w-80 border-l shadow-xl z-50",d?"bg-[#1A1D25] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:L("p-4 border-b flex items-center justify-between",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:L("font-semibold",d?"text-white":"text-gray-900"),children:i==="es"?"Detalle de tarea":"Task Detail"}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:L("p-1 rounded",d?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("div",{className:"p-4 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("text-xs uppercase",d?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Nombre":"Name"}),jsxRuntime.jsx("p",{className:L("font-medium",d?"text-white":"text-gray-900"),children:y.name})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("text-xs uppercase",d?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Inicio":"Start"}),jsxRuntime.jsx("p",{className:L("text-sm",d?"text-white":"text-gray-900"),children:y.startDate?.toLocaleDateString(i==="es"?"es-ES":"en-US")||"-"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("text-xs uppercase",d?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Fin":"End"}),jsxRuntime.jsx("p",{className:L("text-sm",d?"text-white":"text-gray-900"),children:y.endDate?.toLocaleDateString(i==="es"?"es-ES":"en-US")||"-"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:L("text-xs uppercase mb-2 block",d?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:L("flex-1 h-2 rounded-full overflow-hidden",d?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:L("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:L("text-sm font-medium w-10",d?"text-white":"text-gray-900"),children:[y.progress||0,"%"]})]})]}),jsxRuntime.jsx("button",{onClick:()=>{D(y),h(null);},className:L("w-full py-2 rounded-lg font-medium transition-colors",y.progress===100?"bg-gray-500/10 text-gray-500 hover:bg-gray-500/20":"bg-green-500/10 text-green-500 hover:bg-green-500/20"),children:y.progress===100?i==="es"?"Marcar como pendiente":"Mark as pending":i==="es"?"Marcar como completada":"Mark as complete"})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(null),className:"fixed inset-0 bg-black/20 z-40"})})]})}var Vs={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},js={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da"},Ks={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1"},so={dark:Vs,light:js,neutral:Ks};function md(e){return so[e]||so.dark}function Kh({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:o,onDeleteStack:s,className:c}){let[u,i]=Se.useState(false),p=Se.useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),l=Se.useMemo(()=>{let m=p.length,v=new Set(p.flatMap(g=>g.assignedUserIds||[])).size,y=p.map(g=>g.priority).filter(Boolean),h=new Set(p.flatMap(g=>g.labels||[])).size;return {totalCards:m,uniqueAssignees:v,priorities:y,labels:h}},[p]),d=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:L("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:d,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:L("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),u&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:m=>{m.stopPropagation(),s?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(m=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(m),children:r(m)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(m),children:[jsxRuntime.jsx("h4",{children:m.title}),m.description&&jsxRuntime.jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),o?.(e.id,m.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},m.id))})})]})}var fd={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ja(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function Za(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function gd(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function hd({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:o,config:s,className:c}){let u=Se.useMemo(()=>({...fd,...s}),[s]),[i,p]=Se.useState(new Set),l=Se.useRef(null),d=Se.useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(f=>{let k=f.timestamp.toISOString().split("T")[0],w=b.get(k);w?w.push(f):b.set(k,[f]);}),Array.from(b.entries()).sort((f,k)=>k[0].localeCompare(f[0])).map(([f,k])=>({date:new Date(f),events:k.sort((w,x)=>x.timestamp.getTime()-w.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:m,uniqueTypes:v}=Se.useMemo(()=>{let b=new Set,f=new Set;return e.forEach(k=>{b.add(k.userId),f.add(k.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(f)}},[e]),y=b=>{p(f=>{let k=new Set(f);return k.has(b)?k.delete(b):k.add(b),k});},h=b=>{let k=new Date().getTime()-b.getTime(),w=Math.floor(k/6e4),x=Math.floor(k/36e5),D=Math.floor(k/864e5);return w<1?"just now":w<60?`${w}m ago`:x<24?`${x}h ago`:D<7?`${D}d ago`:b.toLocaleDateString()},g=Se.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return Se.useEffect(()=>{if(o&&l.current){let b=l.current.querySelector(`[data-event-id="${o}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[o]),e.length===0?jsxRuntime.jsxs("div",{className:L("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:L("history-timeline",u.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let f=b.target.value;r({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(b=>jsxRuntime.jsxs("option",{value:b,children:[Za(b)," ",b.replace("_"," ")]},b))]}),m.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let f=b.target.value;r({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),m.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>r({...t,searchTerm:b.target.value})})]}),g>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",g,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:d.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[u.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((f,k)=>{let w=i.has(f.id),x=o===f.id,D=gd(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:L("history-timeline-event",w&&"expanded",x&&"selected"),onClick:()=>n?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:u.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Za(f.type)})}),k<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[u.showAvatars&&f.userAvatar&&jsxRuntime.jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Ja(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:u.useRelativeTime?h(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),y(f.id);},children:[w?"\u25BC":"\u25B6"," Show changes"]}),w&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([C,N])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(N.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(N.to)})]})]},C)),f.metadata&&Object.keys(f.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(f.metadata).map(([C,N])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(N)})]},C))]})]})]})]},f.id)})})]},b.date?.toISOString()||"all"))})]})}function vd({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:o,onNext:s,onGoToEvent:c,onSpeedChange:u,className:i}){let p=[.5,1,1.5,2,3],l=Se.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=Se.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:L("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:L("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&Za(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&Ja(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:m=>c(parseInt(m.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((m,v)=>jsxRuntime.jsx("div",{className:L("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>c(v),title:Ja(m)},m.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(m=>jsxRuntime.jsxs("button",{className:L("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>u(m),children:[m,"x"]},m))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(m=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxRuntime.jsxs("div",{className:L("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Ys(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function qs(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function yd(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function xd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Qh(e,t,r,a,n,o=100){let s=e.map(u=>({...u,x:u.x??r/2+Math.random()*100-50,y:u.y??a/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(s.map(u=>[u.id,u]));for(let u=0;u<o;u++){let i=1-u/o;s.forEach(p=>{let l=r/2,d=a/2;p.vx+=(l-p.x)*n.centerForce*i,p.vy+=(d-p.y)*n.centerForce*i,s.forEach(m=>{if(p.id===m.id)return;let v=p.x-m.x,y=p.y-m.y,h=Math.sqrt(v*v+y*y)||1,g=n.chargeStrength*i/(h*h);p.vx+=v/h*g,p.vy+=y/h*g;});}),t.forEach(p=>{let l=c.get(typeof p.source=="string"?p.source:p.source.id),d=c.get(typeof p.target=="string"?p.target:p.target.id);if(!l||!d)return;let m=d.x-l.x,v=d.y-l.y,y=Math.sqrt(m*m+v*v)||1,h=(y-n.linkDistance)/y*n.forceStrength*i;l.vx+=m*h,l.vy+=v*h,d.vx-=m*h,d.vy-=v*h;}),s.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,p.x)),p.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return s}function kd({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:o,stats:s,onInteraction:c,className:u}){let i=Se.useRef(null),[p,l]=Se.useState([]),[d,m]=Se.useState(null),[v,y]=Se.useState(null),[h,g]=Se.useState(null),[b,f]=Se.useState(1),[k,w]=Se.useState({x:0,y:0});Se.useEffect(()=>{if(e.length===0)return;let R=Qh(e,t,r.width,r.height,r,150);l(R);},[e,t,r]);let x=Se.useCallback((R,W)=>{r.enableDragging&&(W.stopPropagation(),m(R));},[r.enableDragging]),D=Se.useCallback(R=>{if(!d||!i.current)return;let E=i.current.getBoundingClientRect(),O=(R.clientX-E.left-k.x)/b,G=(R.clientY-E.top-k.y)/b;l(U=>U.map(A=>A.id===d?{...A,x:O,y:G,fx:O,fy:G}:A));},[d,b,k]),C=Se.useCallback(()=>{m(null);},[]),N=Se.useCallback((R,W)=>{W.stopPropagation(),c?.({type:"node-click",node:R,position:{x:W.clientX,y:W.clientY}});},[c]),T=Se.useCallback((R,W)=>{W.stopPropagation(),c?.({type:"edge-click",edge:R,position:{x:W.clientX,y:W.clientY}});},[c]),$=Se.useCallback(R=>{let W=p.find(E=>E.id===R);return W?{x:W.x,y:W.y}:{x:0,y:0}},[p]),z=Se.useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let W=R.card.priority;return W==="URGENT"?"#ef4444":W==="HIGH"?"#f59e0b":W==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[r.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:L("relationships-graph-empty",u),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:L("relationships-graph",u),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),o&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(R=>Math.min(R+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),w({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Ys(R)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[yd(R)," ",qs(R)]})]},R))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:D,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let W=$(typeof R.source=="string"?R.source:R.source.id),E=$(typeof R.target=="string"?R.target:R.target.id),O=xd(R.type),G=h===R.id,U=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:L("relationships-graph-edge",G&&"hovered",U&&"critical"),onMouseEnter:()=>g(R.id),onMouseLeave:()=>g(null),onClick:A=>T(R,A),children:[jsxRuntime.jsx("line",{x1:W.x,y1:W.y,x2:E.x,y2:E.y,stroke:Ys(R.type),strokeWidth:U?r.edgeWidth*2:r.edgeWidth,strokeOpacity:G?1:.6,markerEnd:O?"url(#arrowhead)":void 0}),r.showEdgeLabels&&G&&jsxRuntime.jsx("text",{x:(W.x+E.x)/2,y:(W.y+E.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:qs(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(R=>{let W=v===R.id,E=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:L("relationships-graph-node",W&&"hovered",E&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:O=>x(R.id,O),onMouseEnter:()=>y(R.id),onMouseLeave:()=>y(null),onClick:O=>N(R,O),children:[jsxRuntime.jsx("circle",{r:E?r.nodeSize*1.2:r.nodeSize,fill:z(R),stroke:E?"#fbbf24":"#ffffff",strokeWidth:E?3:2,opacity:W?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Td({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[o,s]=Se.useState(""),[c,u]=Se.useState(false),[i,p]=Se.useState(null),[l,d]=Se.useState(null),m=Se.useRef(null),v=c||n;Se.useEffect(()=>{e&&m.current&&m.current.focus();},[e]),Se.useEffect(()=>{let b=f=>{f.key==="Escape"&&!v&&y();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let y=()=>{v||(s(""),p(null),d(null),t());},h=async()=>{if(!(!o.trim()||v)){u(true),p(null),d(null);try{let b=await a(o.trim());d(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{u(false);}}},g=()=>{l&&(r(l),y());};return e?jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:y}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:y,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((b,f)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((b,f)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},f)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:m,value:o,onChange:b=>s(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,f)=>jsxRuntime.jsx("button",{onClick:()=>s(b),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:y,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick:g,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!o.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Xs={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var tb={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},rb={generatePlan:{enabled:true,minPlanTier:"hobby",estimatedTokens:2e3},predictRisks:{enabled:true,minPlanTier:"pro",estimatedTokens:1500},suggestAssignee:{enabled:true,minPlanTier:"hobby",estimatedTokens:800},generateReport:{enabled:true,minPlanTier:"enterprise",estimatedTokens:3e3},generateSubtasks:{enabled:true,minPlanTier:"hobby",estimatedTokens:1e3}};function ab(e,t,r){let a=Xs[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,o=r/1e3*a.costPer1kOutput;return n+o}function Qa(e){return `$${e.toFixed(4)}`}var Js=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=ab(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let a=r.length,n=r.reduce((l,d)=>l+d.cost,0),o=r.reduce((l,d)=>l+d.inputTokens,0),s=r.reduce((l,d)=>l+d.outputTokens,0),c=r.filter(l=>l.success),u=r.reduce((l,d)=>l+d.duration,0),i={},p={};return r.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,p[l.feature]=(p[l.feature]||0)+l.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:o,totalOutputTokens:s,operationsByFeature:i,costsByFeature:p,averageDuration:a>0?u/a:0,successRate:a>0?c.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],o=new Date,s=new Date;r==="month"?s.setMonth(o.getMonth()-1):s.setDate(o.getDate()-1);let c=this.operations.filter(p=>p.timestamp>=s).length,u=Math.max(0,n-c),i=c/n*100;return {used:c,limit:n,remaining:u,percentUsed:i,isExceeded:c>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Qr=new Js;function Nd({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=Se.useState(Qr.getStats()),[o,s]=Se.useState(Qr.checkLimit(r));if(Se.useEffect(()=>{if(!e)return;let u=setInterval(()=>{n(Qr.getStats()),s(Qr.checkLimit(r));},1e3);return ()=>clearInterval(u)},[e,r]),Se.useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let c=Qr.getRecentOperations(5);return jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:u=>u.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[o.used," / ",o.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,o.percentUsed)}%`,background:o.percentUsed>90?"#EF4444":o.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[o.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Qa(a.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:a.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([u,i])=>{let p=a.costsByFeature[u]||0,l=a.totalOperations>0?i/a.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:u.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Qa(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},u)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(u=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Qa(u.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Rd({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:o}){let[s,c]=Se.useState(""),[u,i]=Se.useState(""),[p,l]=Se.useState(""),[d,m]=Se.useState(false),[v,y]=Se.useState(null),[h,g]=Se.useState(null),[b,f]=Se.useState(null),k=Se.useRef(null),w=d||n;Se.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),Se.useEffect(()=>{let T=$=>{$.key==="Escape"&&!w&&x();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,w]);let x=()=>{w||(c(""),i(""),l(""),y(null),g(null),f(null),t());},D=async()=>{if(!(!s.trim()||w)){m(true),y(null),g(null),f(null);try{let T=await a({prompt:s.trim(),projectName:o||"Mi Proyecto",startDate:u||void 0,endDate:p||void 0});g(T.tasks.tasks),f({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){y(T instanceof Error?T.message:"Failed to generate tasks");}finally{m(false);}}},C=()=>{h&&(r(h),x());};if(!e)return null;let N=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:w,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",N,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((T,$)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",$+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:k,value:s,onChange:T=>c(T.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:w}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:T=>i(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:w})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:T=>l(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:w})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((T,$)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:w,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:T},$))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:w&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:w,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:D,disabled:!s.trim()||w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:w?"Generating...":"Generate Tasks"})]})]})]})})]})}function co({initialBoard:e,onPersist:t}){let[r,a]=Se.useState(e),n=Se.useCallback(h=>{t&&ln(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(g,b,f)=>{console.warn(`Retry attempt ${b} after ${f}ms: ${g.message}`);}}).then(g=>{g.success||console.error(`Failed to persist board after ${g.attempts} attempts:`,g.error);});},[t]),o=Se.useCallback(async(h,g,b)=>{a(f=>{let k=f.cards.find(T=>T.id===h);if(!k)return f;let w=k.columnId,x={...k,columnId:g,position:b},D=f.cards.map(T=>T.id===h?x:T),C=f.columns.map(T=>{if(T.id===w)return {...T,cardIds:T.cardIds.filter($=>$!==h)};if(T.id===g){let $=D.filter(z=>z.columnId===g).sort((z,R)=>z.position-R.position);return {...T,cardIds:$.map(z=>z.id)}}return T}),N={...f,cards:D,columns:C};return n(N),N});},[n]),s=Se.useCallback(async(h,g)=>{a(b=>{let f=b.cards.map(w=>w.id===h?{...w,...g}:w),k={...b,cards:f};return n(k),k});},[n]),c=Se.useCallback(async h=>{let g=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(b=>{let f={...h,id:g},k=b.columns.map(x=>x.id===h.columnId?{...x,cardIds:[...x.cardIds,g]}:x),w={...b,cards:[...b.cards,f],columns:k};return n(w),w});},[n]),u=Se.useCallback(async h=>{a(g=>{let b=g.cards.find(x=>x.id===h);if(!b)return g;let f=g.cards.filter(x=>x.id!==h),k=g.columns.map(x=>x.id===b.columnId?{...x,cardIds:x.cardIds.filter(D=>D!==h)}:x),w={...g,cards:f,columns:k};return n(w),w});},[n]),i=Se.useCallback(async h=>{let g=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(b=>{let f={...h,id:g,cardIds:[]},k={...b,columns:[...b.columns,f]};return n(k),k});},[n]),p=Se.useCallback(async(h,g)=>{a(b=>{let f=b.columns.map(w=>w.id===h?{...w,...g}:w),k={...b,columns:f};return n(k),k});},[n]),l=Se.useCallback(async h=>{a(g=>{let b=g.cards.filter(w=>w.columnId!==h),f=g.columns.filter(w=>w.id!==h),k={...g,cards:b,columns:f};return n(k),k});},[n]),d=Se.useCallback(h=>{let g=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),g},[c]),m=Se.useCallback(h=>{let g=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),g},[i]),v=Se.useCallback(()=>{a(h=>{let g={...h,cards:[],columns:[]};return n(g),g});},[n]);return {board:r,callbacks:{onCardMove:o,onCardUpdate:s,onCardCreate:c,onCardDelete:u,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:l},setBoard:a,helpers:{addCard:d,addColumn:m,deleteCard:u,deleteColumn:l,clearBoard:v}}}function Id({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:o}=co({initialBoard:e,onPersist:r}),s=Se.useMemo(()=>({addCard:(u,i,p={})=>{o.addCard({title:i,columnId:u,position:a.cards.filter(l=>l.columnId===u).length,...p});},addColumn:(u,i)=>{let p=a.columns.length>0?Math.max(...a.columns.map(l=>l.position)):0;o.addColumn({title:u,position:i??p+1e3});},reset:o.clearBoard}),[a.cards,a.columns,o]);return {props:Se.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:s}}var en={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Ld={by:"none",order:"asc"};function Fd({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=Se.useState({...en,...e}),[o,s]=Se.useState({...Ld,...t}),c=Se.useCallback(y=>{n(h=>({...h,...y}));},[]),u=Se.useCallback(y=>{s(h=>({...h,...y}));},[]),i=Se.useCallback(()=>{n(en),s(Ld);},[]),p=Se.useCallback(()=>{r&&n({...en,assignees:[r]});},[r]),l=Se.useCallback(()=>{n({...en,dateFilter:"overdue"});},[]),d=Se.useCallback(()=>{n({...en,priorities:["HIGH","URGENT"]});},[]),m=Se.useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||o.by!=="none",[a,o]),v=Se.useCallback(y=>{let h=[...y];if(a.search){let g=a.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(g)||b.description?.toLowerCase().includes(g));}if(a.dateFilter!=="all"){let g=new Date,b=g.getFullYear(),f=String(g.getMonth()+1).padStart(2,"0"),k=String(g.getDate()).padStart(2,"0"),w=`${b}-${f}-${k}`;h=h.filter(x=>{if(!x.endDate&&!x.dueDate)return false;let D=x.endDate||x.dueDate;if(!D)return false;let C;if(typeof D=="string")C=D.split("T")[0]||D;else {let N=D.getUTCFullYear(),T=String(D.getUTCMonth()+1).padStart(2,"0"),$=String(D.getUTCDate()).padStart(2,"0");C=`${N}-${T}-${$}`;}switch(a.dateFilter){case "overdue":return C<w;case "today":return C===w;case "this-week":let N=new Date(w+"T00:00:00"),T=new Date(C+"T00:00:00"),$=new Date(N);return $.setDate($.getDate()+7),T>=N&&T<=$;case "custom":if(a.dateRange){let z=typeof D=="string"?new Date(D):D;return z>=a.dateRange.start&&z<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(h=h.filter(g=>g.priority&&a.priorities.includes(g.priority))),a.assignees.length>0&&(h=h.filter(g=>(g.assignedUserIds||(g.assigneeId?[g.assigneeId]:[])).some(f=>a.assignees.includes(f)))),a.labels.length>0&&(h=h.filter(g=>g.labels&&g.labels.some(b=>a.labels.includes(b)))),a.columns.length>0&&(h=h.filter(g=>a.columns.includes(g.columnId))),o.by!=="none"&&h.sort((g,b)=>{let f=0;switch(o.by){case "created":let k=g.createdAt?new Date(g.createdAt).getTime():0,w=b.createdAt?new Date(b.createdAt).getTime():0;f=k-w;break;case "priority":let x={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=x[g.priority||"LOW"],C=x[b.priority||"LOW"];f=D-C;break;case "dueDate":let N=g.endDate||g.dueDate,T=b.endDate||b.dueDate;if(!N)return 1;if(!T)return -1;let $=typeof N=="string"?new Date(N).getTime():N.getTime(),z=typeof T=="string"?new Date(T).getTime():T.getTime();f=$-z;break;case "title":f=g.title.localeCompare(b.title);break;case "estimate":let R=g.estimatedTime||0,W=b.estimatedTime||0;f=R-W;break;default:f=0;}return o.order==="asc"?f:-f}),h},[a,o]);return {filters:a,sort:o,setFilters:c,setSort:u,resetFilters:i,filterMyTasks:p,filterOverdue:l,filterHighPriority:d,applyFilters:v,hasActiveFilters:m}}var Od,zd;if(typeof window<"u")try{let e=nn("ai");Od=e.generateObject,zd=e.generateText;}catch{}function $d(e={}){let[t,r]=Se.useState(false),[a,n]=Se.useState(null),o=!!(Od&&zd&&e.apiKey),s=Se.useCallback(async l=>{if(!o)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let m=d instanceof Error?d:new Error("Failed to generate plan");throw n(m),m}finally{r(false);}},[o]),c=Se.useCallback(async l=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let m=d instanceof Error?d:new Error("Failed to suggest assignee");throw n(m),m}finally{r(false);}},[o]),u=Se.useCallback(async l=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(d){let m=d instanceof Error?d:new Error("Failed to predict risks");throw n(m),m}finally{r(false);}},[o]),i=Se.useCallback(async l=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(d){let m=d instanceof Error?d:new Error("Failed to generate subtasks");throw n(m),m}finally{r(false);}},[o]),p=Se.useCallback(async l=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(d){let m=d instanceof Error?d:new Error("Failed to estimate effort");throw n(m),m}finally{r(false);}},[o]);return {onGeneratePlan:s,onSuggestAssignee:c,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:o,isLoading:t,error:a}}function Qs(){let[e,t]=Se.useState(()=>core.selectionStore.getState());Se.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=Se.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function Wd(e){let{cards:t}=e,[r,a]=Qs(),n=Se.useCallback(l=>r.selectedCardIds.includes(l),[r.selectedCardIds]),o=Se.useCallback((l,d)=>{if(!d){a({selectedCardIds:[l],lastSelectedCardId:l});return}let m=d.ctrlKey||d.metaKey,v=d.shiftKey;if(m)r.selectedCardIds.includes(l)?a({selectedCardIds:r.selectedCardIds.filter(y=>y!==l),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,l],lastSelectedCardId:l});else if(v&&r.lastSelectedCardId){let y=t.find(g=>g.id===l),h=t.find(g=>g.id===r.lastSelectedCardId);if(y&&h&&y.columnId===h.columnId){let g=t.filter(C=>C.columnId===y.columnId).sort((C,N)=>C.position-N.position),b=g.findIndex(C=>C.id===r.lastSelectedCardId),f=g.findIndex(C=>C.id===l),[k,w]=b<f?[b,f]:[f,b],x=g.slice(k,w+1).map(C=>C.id),D=Array.from(new Set([...r.selectedCardIds,...x]));a({selectedCardIds:D,lastSelectedCardId:l});}else a({selectedCardIds:[l],lastSelectedCardId:l});}else a({selectedCardIds:[l],lastSelectedCardId:l});},[t,r,a]),s=Se.useCallback(l=>{a({selectedCardIds:r.selectedCardIds.filter(d=>d!==l),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),c=Se.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),u=Se.useCallback(()=>{a({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=Se.useCallback(l=>{r.selectedCardIds.includes(l)?s(l):a({selectedCardIds:[...r.selectedCardIds,l],lastSelectedCardId:l});},[r,s,a]),p=Se.useCallback(()=>t.filter(l=>r.selectedCardIds.includes(l.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:o,deselectCard:s,clearSelection:c,selectAll:u,toggleCard:i,getSelectedCards:p}}var Ud={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Gd(e){let{cards:t,config:r,aiService:a}=e,n=Se.useMemo(()=>({...Ud,...r}),[r]),[o,s]=Se.useState([]),c=Se.useCallback((y,h,g,b,f)=>{if(h.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:y,cardIds:h,columnId:g,strategy:b,color:f,isExpanded:true,position:o.filter(w=>w.columnId===g).length,createdAt:new Date};s(w=>[...w,k]);},[n.minCardsPerStack,o]),u=Se.useCallback(y=>{s(h=>h.filter(g=>g.id!==y));},[]),i=Se.useCallback(y=>{s(h=>h.map(g=>g.id===y?{...g,isExpanded:!g.isExpanded}:g));},[]),p=Se.useCallback((y,h)=>{s(g=>g.map(b=>b.id===y&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),l=Se.useCallback((y,h)=>{s(g=>g.map(b=>{if(b.id===y){let f=b.cardIds.filter(k=>k!==h);return f.length<n.minCardsPerStack?null:{...b,cardIds:f}}return b}).filter(b=>b!==null));},[n.minCardsPerStack]),d=Se.useCallback(y=>o.filter(h=>h.columnId===y).sort((h,g)=>h.position-g.position),[o]),m=Se.useCallback(async y=>{let h=t.filter(w=>w.columnId===y);if(h.length<n.minCardsPerStack*2)return [];let g=[],b=new Map;h.forEach(w=>{w.labels&&w.labels.length>0&&w.labels.forEach(x=>{b.has(x)||b.set(x,[]),b.get(x).push(w);});}),b.forEach((w,x)=>{w.length>=n.minCardsPerStack&&g.push({stack:{title:`\u{1F4CC} ${x}`,cardIds:w.map(D=>D.id),columnId:y,strategy:"labels",color:"#3b82f6"},reason:`${w.length} cards with label "${x}"`,confidence:.85});});let f=new Map;h.forEach(w=>{w.assignedUserIds&&w.assignedUserIds.length>0&&w.assignedUserIds.forEach(x=>{f.has(x)||f.set(x,[]),f.get(x).push(w);});}),f.forEach((w,x)=>{w.length>=n.minCardsPerStack&&g.push({stack:{title:`\u{1F464} Assigned to user-${x.slice(-4)}`,cardIds:w.map(D=>D.id),columnId:y,strategy:"assignee",color:"#8b5cf6"},reason:`${w.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(h.forEach(w=>{w.priority&&(k.has(w.priority)||k.set(w.priority,[]),k.get(w.priority).push(w));}),k.forEach((w,x)=>{if(w.length>=n.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[x.toLowerCase()]||"\u26AA";g.push({stack:{title:`${D} ${x} Priority`,cardIds:w.map(C=>C.id),columnId:y,strategy:"priority",color:x==="high"||x==="urgent"?"#ef4444":"#10b981"},reason:`${w.length} cards with ${x} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let w of h){let D=(await a.findSimilar(w,h)).filter(C=>C.similarity>=n.autoStackConfidenceThreshold);if(D.length>=n.minCardsPerStack-1){let C=[w.id,...D.map(T=>T.card.id)],N=D.reduce((T,$)=>T+$.similarity,0)/D.length;g.push({stack:{title:`\u2728 Similar to "${w.title.substring(0,30)}${w.title.length>30?"...":""}"`,cardIds:C,columnId:y,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:N});}}return g.filter(w=>w.confidence>=n.autoStackConfidenceThreshold).sort((w,x)=>x.confidence-w.confidence).slice(0,5)},[t,n,a]),v=Se.useCallback(y=>{c(y.stack.title,y.stack.cardIds,y.stack.columnId,y.stack.strategy,y.stack.color);},[c]);return Se.useEffect(()=>{n.enableAutoStacking&&o.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let g=await m(h),b=g[0];g.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:o,createStack:c,deleteStack:u,toggleStack:i,addToStack:p,removeFromStack:l,getStacksForColumn:d,getSuggestions:m,applySuggestion:v,config:n}}var _d=Se.createContext(null);function Hd({children:e,initialData:t,onStateChange:r}){let a=Se.useRef();if(!a.current){let o=new Map,s=new Map;t?.columns?.forEach(u=>{let{Column:i}=nn("@libxai/core");o.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=nn("@libxai/core");s.set(u.id,new i(u));});let c=null;if(t?.board){let{Board:u}=nn("@libxai/core");c=new u(t.board);}a.current=new core.BoardStore({board:c,columns:o,cards:s});}let n=a.current;return Se.useEffect(()=>{if(r)return n.subscribeAll(o=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(_d.Provider,{value:{store:n},children:e})}function uo(){let e=Se.useContext(_d);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function rn(){let e=uo(),[t,r]=Se.useState(e.getBoard()),[a,n]=Se.useState(e.getAllColumns()),[o,s]=Se.useState(e.getAllCards());Se.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),s(e.getAllCards());}),[e]);let c=Se.useCallback(b=>{e.updateBoard(b);},[e]),u=Se.useCallback(b=>{e.addColumn(b);},[e]),i=Se.useCallback((b,f)=>{e.updateColumn(b,f);},[e]),p=Se.useCallback(b=>{e.deleteColumn(b);},[e]),l=Se.useCallback(b=>e.getColumn(b),[e]),d=Se.useCallback(b=>{e.addCard(b);},[e]),m=Se.useCallback((b,f)=>{e.updateCard(b,f);},[e]),v=Se.useCallback(b=>{e.deleteCard(b);},[e]),y=Se.useCallback((b,f,k)=>{e.moveCard(b,f,k);},[e]),h=Se.useCallback(b=>e.getCard(b),[e]),g=Se.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:a,cards:o,updateBoard:c,addColumn:u,updateColumn:i,deleteColumn:p,getColumn:l,addCard:d,updateCard:m,deleteCard:v,moveCard:y,getCard:h,getCardsByColumn:g}}function jd(e){let{cards:t}=rn();return Se.useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),o=r.description?.toLowerCase().includes(a);if(!n&&!o)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function Kd(e="position",t="asc"){let{cards:r}=rn();return Se.useMemo(()=>[...r].sort((n,o)=>{let s=0;switch(e){case "title":s=n.title.localeCompare(o.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=n.priority?c[n.priority]:0,i=o.priority?c[o.priority]:0;s=u-i;break}case "createdAt":s=n.createdAt.getTime()-o.createdAt.getTime();break;case "updatedAt":s=n.updatedAt.getTime()-o.updatedAt.getTime();break;case "position":s=n.position-o.position;break}return t==="asc"?s:-s}),[r,e,t])}var mo=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Pi.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];if(typeof s=="function")try{let c=await Promise.resolve(s.apply(o,r));c!==void 0&&(n=c,r[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,c,{plugin:o.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let o=n[t];typeof o=="function"&&a.push(Promise.resolve(o.apply(n,r)).catch(s=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,s,{plugin:n.id,hook:t});}));}await Promise.all(a);}},xb=new mo;function qd({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:o=5,horizontal:s=false,gap:c=0,getItemKey:u}){let i=Se.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:o,horizontal:s,gap:c}),l=p.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=s?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:d,className:n,children:jsxRuntime.jsx("div",{style:m,children:l.map(v=>{let y=e[v.index];if(!y)return null;let h=u?u(y,v.index):v.index,g={position:"absolute",top:s?0:v.start,left:s?v.start:0,width:s?v.size:"100%",height:s?"100%":v.size};return jsxRuntime.jsx("div",{style:g,"data-index":v.index,children:a(y,v.index)},h)})})})}function Xd(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function Zd({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:o="",overscan:s=3,gap:c=16,getItemKey:u,horizontal:i=true}){let p=Se.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>a,overscan:s,gap:c}),d=l.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},v={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:m,className:o,children:jsxRuntime.jsx("div",{style:v,children:d.map(y=>{let h=e[y.index];if(!h)return null;let g=u?u(h,y.index):y.index,b={position:"absolute",top:0,left:y.start,width:y.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":y.index,children:n(h,y.index)},g)})})})}function Qd(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function eu(e,t=10){return e>t}var ai={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ni={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},oi={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},si={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ii={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},li={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ci={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},di={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},ui={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},mi={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},pi={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},fi={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},po={spacing:ai,borderRadius:ni,fontSize:oi,fontWeight:si,lineHeight:ii,zIndex:li,duration:ci,easing:di,shadows:ui,opacity:mi,kanban:pi,gantt:fi};function tu(e,t,r){return e[t]??r}function gi(e,t="",r={}){for(let[a,n]of Object.entries(e)){let o=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?gi(n,o,r):(typeof n=="string"||typeof n=="number")&&(r[o]=n);}return r}function Cb(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function hi(e="asakaa"){let t=gi(po),r=[];for(let[a,n]of Object.entries(t)){let o=`--${e}-${a}`,s=Cb(n);r.push(` ${o}: ${s};`);}return `:root {
|
|
324
|
-
${
|
|
323
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function rl(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function ca(e,t){let a=rl(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let n=a.find(m=>m.name.toLowerCase().includes(r));if(n)return n;let i=r.split(/\s+/);return a.find(m=>{let c=m.name.toLowerCase();return i.every(s=>c.includes(s))})}function Pn(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let l=new Date(r);return l.setDate(l.getDate()+1),l}if(a==="yesterday"||a==="ayer"){let l=new Date(r);return l.setDate(l.getDate()-1),l}if(a==="next week"||a==="la pr\xF3xima semana"){let l=new Date(r);return l.setDate(l.getDate()+7),l}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let x=new Date(r),y=x.getDay(),b=g-y;return b<=0&&(b+=7),x.setDate(x.getDate()+b),x}}let n=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(n&&n[1]&&n[2]){let l=parseInt(n[1],10),g=n[2].toLowerCase(),x=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?x.setDate(x.getDate()+l):g==="week"||g==="semana"||g==="semanas"?x.setDate(x.getDate()+l*7):(g==="month"||g==="mes"||g==="meses")&&x.setMonth(x.getMonth()+l),x}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let l=parseInt(m[1],10),g=parseInt(m[2],10)-1,x=parseInt(m[3],10);return new Date(x,g,l)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},s=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(s&&s[1]&&s[2]){let l=parseInt(s[1],10),g=c[s[2].toLowerCase()],x=s[3]?parseInt(s[3],10):r.getFullYear();if(g!==void 0)return new Date(x,g,l)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let l=p[d[1].toLowerCase()],g=parseInt(d[2],10),x=d[3]?parseInt(d[3],10):r.getFullYear();if(l!==void 0)return new Date(x,l,g)}return null}function Mn(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function In(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function ol(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function nl(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let s=r[1].trim(),p=r[2].trim(),d=ca(t,s),l=Pn(p);if(!d)return {type:"move_task",taskName:s,message:`Could not find a task named "${s}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!l)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(l);return x.setDate(x.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:l,endDate:x},message:`Moved "${d.name}" to ${l.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let s=o[1].trim(),p=o[2].trim(),d=ca(t,s),l=Mn(p);if(!d)return {type:"resize_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"};if(!l||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+l),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${l} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(n&&n[1]&&n[2]){let s=n[1].trim(),p=n[2].trim(),d=ca(t,s),l=In(p);return d?l===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:l},message:`Set "${d.name}" progress to ${l}%.`,success:true}:{type:"set_progress",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let i=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let s=i[1].trim(),p=i[2].trim(),d=ca(t,s);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let s=m[1].trim(),p=m[2].trim(),d=ca(t,s),l=ca(t,p);return d?l?{type:"link_tasks",taskId:l.id,taskName:l.name,dependencyFrom:d.id,dependencyTo:l.id,message:`Linked "${d.name}" \u2192 "${l.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let s=c[1].trim(),p=ca(t,s);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}return null}function sl(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function vu(e){if(e)switch(e.toUpperCase()){case "TODO":case "BLOCKED":return "todo";case "IN_PROGRESS":case "REVIEW":return "in-progress";case "DONE":return "completed";default:return "todo"}}function yu(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return "TODO"}}function oo(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(l=>l.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>oo(p,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let i=p=>{if(p)return typeof p=="string"?new Date(p):p},m=i(e.startDate),c=i(e.endDate),s=e.metadata?.isMilestone===true||m&&c&&Math.abs(c.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:c,progress:e.progress||0,status:vu(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:n?.length?n:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:s,isCriticalPath:e.metadata?.isCriticalPath===true}}function il(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(n=>n.name===r.name||n.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:yu(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function ll(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>oo(r,e,t))}var Ln={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},An={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},no={en:Ln,es:An};function Fn(e){return no[e]||no.en}function so(e,t){let a=Fn(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function pl(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...pl(r.subtasks,t+1));return a}function Mu({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function ul({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:i}){let{theme:m="dark",locale:c="en",customTranslations:s,showSearch:p=true,showHierarchy:d=true}=t,l=so(c,s),g=m==="dark",[x,y]=react.useState(new Set),[b,f]=react.useState("startDate"),[h,u]=react.useState("asc"),[k,w]=react.useState("");react.useMemo(()=>{let T=new Set;function z(U){for(let L of U)L.subtasks?.length&&(T.add(L.id),z(L.subtasks));}z(e),y(T);},[e]);let v=react.useCallback(T=>{y(z=>{let U=new Set(z);return U.has(T)?U.delete(T):U.add(T),U}),a.onTaskToggleExpand?.(T);},[a]),P=react.useCallback(T=>{b===T?u(z=>z==="asc"?"desc":"asc"):(f(T),u("asc")),a.onSortChange?.({column:T,direction:h==="asc"?"desc":"asc"});},[b,h,a]),C=react.useMemo(()=>{let T=pl(e);if(k.trim()){let U=k.toLowerCase();T=T.filter(L=>L.name.toLowerCase().includes(U));}let z=[];for(let U of T){let L=U.level===0;U.level>0&&(L=true),(L||k.trim())&&z.push(U);}return k.trim()&&z.sort((U,L)=>{let H,S;switch(b){case "name":H=U.name.toLowerCase(),S=L.name.toLowerCase();break;case "startDate":H=U.startDate?.getTime()||0,S=L.startDate?.getTime()||0;break;case "endDate":H=U.endDate?.getTime()||0,S=L.endDate?.getTime()||0;break;case "progress":H=U.progress||0,S=L.progress||0;break;case "status":H=U.status||"todo",S=L.status||"todo";break;default:return 0}return H<S?h==="asc"?-1:1:H>S?h==="asc"?1:-1:0}),z},[e,k,b,h]),E=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",g?"bg-[#0F1117]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:A("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[l.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",g?"bg-[#0F1117]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:A("text-lg font-semibold mb-2",g?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:A("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",g?"bg-[#0F1117]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:A("text-lg font-semibold mb-2",g?"text-white":"text-gray-900"),children:l.empty.noTasks}),jsxRuntime.jsx("p",{className:A("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:A("flex-1 flex flex-col w-full h-full overflow-hidden",g?"bg-[#0F1117]":"bg-white",n),style:i,children:[jsxRuntime.jsx("div",{className:A("flex-shrink-0 px-6 py-4 border-b",g?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:A("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",g?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:k,onChange:T=>w(T.target.value),placeholder:l.toolbar.searchPlaceholder,className:A("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",g?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:A("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[C.length," ",l.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:A("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",g?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>P("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C.map((T,z)=>{let U=x.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:z*.02},className:A("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",g?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:L=>{L.stopPropagation(),v(T.id);},className:A("p-0.5 rounded",g?"hover:bg-white/10":"hover:bg-gray-200"),children:U?jsxRuntime.jsx(lucideReact.ChevronDown,{className:A("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:A("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-400")})}),d&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:L=>{L.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Mu,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:A("truncate",g?"text-white":"text-gray-900",T.progress===100&&(g?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:A("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":g?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?l.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?l.status.inProgress:l.status.todo})}),jsxRuntime.jsxs("div",{className:A("col-span-2 flex items-center gap-1 text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),E(T.startDate)]}),jsxRuntime.jsxs("div",{className:A("col-span-2 flex items-center gap-1 text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),E(T.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:A("flex-1 h-1.5 rounded-full overflow-hidden",g?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:A("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:A("text-xs w-8",g?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),C.length===0&&k&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:A("w-12 h-12 mx-auto mb-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:A(g?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.noResults})]})})]})]})}var Bn={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Rn={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da"},On={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},lo={dark:Bn,light:Rn,neutral:On};function gl(e){return lo[e]||lo.dark}var zn={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Un={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},co={en:zn,es:Un};function vr(e){return co[e]||co.en}function mo(e,t){let a=vr(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function fl(e){let t=vr(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function hl(e,t=0,a=true){let r=vr(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Uu(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function $n(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function Gu({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function yl({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:i,style:m}){let{theme:c="dark",locale:s="en",customTranslations:p}=t,d=mo(s,p),l=c==="dark",[g,x]=react.useState(r||new Date),[y,b]=react.useState(null),f=react.useCallback(()=>{x(new Date(g.getFullYear(),g.getMonth()-1,1));},[g]),h=react.useCallback(()=>{x(new Date(g.getFullYear(),g.getMonth()+1,1));},[g]),u=react.useCallback(()=>{x(new Date);},[]),k=react.useMemo(()=>{let C=g.getFullYear(),E=g.getMonth(),T=new Date(C,E,1),z=new Date(C,E+1,0),U=T.getDay(),L=z.getDate(),H=Uu(e),S=new Date;S.setHours(0,0,0,0);let O=[],Y=U,Q=new Date(C,E,0).getDate();for(let ee=Y-1;ee>=0;ee--){let G=new Date(C,E-1,Q-ee);O.push({date:G,isCurrentMonth:false,isToday:false,isWeekend:G.getDay()===0||G.getDay()===6,events:H.filter(ne=>$n(G,ne)).map(ne=>({id:ne.id,title:ne.name,start:ne.startDate,end:ne.endDate,task:ne}))});}for(let ee=1;ee<=L;ee++){let G=new Date(C,E,ee),ne=G.getTime()===S.getTime();O.push({date:G,isCurrentMonth:true,isToday:ne,isWeekend:G.getDay()===0||G.getDay()===6,events:H.filter(M=>$n(G,M)).map(M=>({id:M.id,title:M.name,start:M.startDate,end:M.endDate,task:M}))});}let R=42-O.length;for(let ee=1;ee<=R;ee++){let G=new Date(C,E+1,ee);O.push({date:G,isCurrentMonth:false,isToday:false,isWeekend:G.getDay()===0||G.getDay()===6,events:H.filter(ne=>$n(G,ne)).map(ne=>({id:ne.id,title:ne.name,start:ne.startDate,end:ne.endDate,task:ne}))});}return O},[g,e]),w=s==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],v=g.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),P=react.useCallback(C=>{let E=C.progress===100?0:100,T=E===100?"completed":"todo";a.onTaskUpdate?.({...C,status:T,progress:E});},[a]);return o?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",i),style:m,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:A("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",i),style:m,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:A("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:A("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",i),style:m,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:A("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsxRuntime.jsx("p",{className:A("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:A("flex-1 flex flex-col w-full h-full overflow-hidden",l?"bg-[#0F1117]":"bg-white",i),style:m,children:[jsxRuntime.jsx("div",{className:A("flex-shrink-0 px-6 py-4 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:A("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:v}),jsxRuntime.jsx("button",{onClick:u,className:A("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:d.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:f,className:A("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:A("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:h,className:A("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:A("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 overflow-auto",children:jsxRuntime.jsxs("div",{className:"h-full flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:w.map(C=>jsxRuntime.jsx("div",{className:A("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:C},C))}),jsxRuntime.jsx("div",{className:A("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",l?"bg-white/5":"bg-gray-200"),children:k.map((C,E)=>jsxRuntime.jsxs("div",{className:A("min-h-[100px] p-2 transition-colors",l?"bg-[#0F1117]":"bg-white",!C.isCurrentMonth&&(l?"bg-[#0F1117]/50":"bg-gray-50"),C.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsx("div",{className:A("text-sm font-medium mb-1",C.isToday?"text-[#3B82F6]":C.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:C.date.getDate()}),jsxRuntime.jsxs("div",{className:"space-y-1 overflow-y-auto max-h-[80px]",children:[C.events.slice(0,3).map(T=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{b(T.task),a.onEventClick?.(T);},whileHover:{scale:1.02},className:A("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",T.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Gu,{task:T.task}),jsxRuntime.jsx("span",{className:"truncate",children:T.title})]},T.id)),C.events.length>3&&jsxRuntime.jsxs("div",{className:A("text-xs px-1.5",l?"text-[#6B7280]":"text-gray-400"),children:["+",C.events.length-3," ",s==="es"?"m\xE1s":"more"]})]})]},E))})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,x:300},animate:{opacity:1,x:0},exit:{opacity:0,x:300},className:A("fixed right-0 top-0 h-full w-80 border-l shadow-xl z-50",l?"bg-[#1A1D25] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:A("p-4 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:A("font-semibold",l?"text-white":"text-gray-900"),children:s==="es"?"Detalle de tarea":"Task Detail"}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:A("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("div",{className:"p-4 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:A("text-xs uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Nombre":"Name"}),jsxRuntime.jsx("p",{className:A("font-medium",l?"text-white":"text-gray-900"),children:y.name})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:A("text-xs uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Inicio":"Start"}),jsxRuntime.jsx("p",{className:A("text-sm",l?"text-white":"text-gray-900"),children:y.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US")||"-"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:A("text-xs uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fin":"End"}),jsxRuntime.jsx("p",{className:A("text-sm",l?"text-white":"text-gray-900"),children:y.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US")||"-"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:A("text-xs uppercase mb-2 block",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:A("flex-1 h-2 rounded-full overflow-hidden",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:A("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:A("text-sm font-medium w-10",l?"text-white":"text-gray-900"),children:[y.progress||0,"%"]})]})]}),jsxRuntime.jsx("button",{onClick:()=>{P(y),b(null);},className:A("w-full py-2 rounded-lg font-medium transition-colors",y.progress===100?"bg-gray-500/10 text-gray-500 hover:bg-gray-500/20":"bg-green-500/10 text-green-500 hover:bg-green-500/20"),children:y.progress===100?s==="es"?"Marcar como pendiente":"Mark as pending":s==="es"?"Marcar como completada":"Mark as complete"})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>b(null),className:"fixed inset-0 bg-black/20 z-40"})})]})}var Wn={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},Hn={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da"},_n={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1"},uo={dark:Wn,light:Hn,neutral:_n};function xl(e){return uo[e]||uo.dark}function Wu({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:i,className:m}){let[c,s]=react.useState(false),p=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=p.length,x=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,y=p.map(f=>f.priority).filter(Boolean),b=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:x,priorities:y,labels:b}},[p]),l=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:A("card-stack",!e.isExpanded&&"card-stack-collapsed",m),onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:l,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:A("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),i?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),n?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var wl={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function yr(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function xr(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function Cl(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Tl({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:i,className:m}){let c=react.useMemo(()=>({...wl,...i}),[i]),[s,p]=react.useState(new Set),d=react.useRef(null),l=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(u=>{let k=u.timestamp.toISOString().split("T")[0],w=h.get(k);w?w.push(u):h.set(k,[u]);}),Array.from(h.entries()).sort((u,k)=>k[0].localeCompare(u[0])).map(([u,k])=>({date:new Date(u),events:k.sort((w,v)=>v.timestamp.getTime()-w.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:x}=react.useMemo(()=>{let h=new Set,u=new Set;return e.forEach(k=>{h.add(k.userId),u.add(k.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(u)}},[e]),y=h=>{p(u=>{let k=new Set(u);return k.has(h)?k.delete(h):k.add(h),k});},b=h=>{let k=new Date().getTime()-h.getTime(),w=Math.floor(k/6e4),v=Math.floor(k/36e5),P=Math.floor(k/864e5);return w<1?"just now":w<60?`${w}m ago`:v<24?`${v}h ago`:P<7?`${P}d ago`:h.toLocaleDateString()},f=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(n&&d.current){let h=d.current.querySelector(`[data-event-id="${n}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:A("history-timeline-empty",m),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:A("history-timeline",c.compact&&"compact",m),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let u=h.target.value;a({...t,types:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),x.map(h=>jsxRuntime.jsxs("option",{value:h,children:[xr(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let u=h.target.value;a({...t,users:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:l.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((u,k)=>{let w=s.has(u.id),v=n===u.id,P=Cl(u.type);return jsxRuntime.jsxs("div",{"data-event-id":u.id,className:A("history-timeline-event",w&&"expanded",v&&"selected"),onClick:()=>o?.(u),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:P},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:xr(u.type)})}),k<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:P}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&u.userAvatar&&jsxRuntime.jsx("img",{src:u.userAvatar,alt:u.userName||u.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:u.userName||u.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:yr(u)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?b(u.timestamp):u.timestamp.toLocaleString()})]}),Object.keys(u.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),y(u.id);},children:[w?"\u25BC":"\u25B6"," Show changes"]}),w&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(u.changes).map(([C,E])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(E.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.to)})]})]},C)),u.metadata&&Object.keys(u.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(u.metadata).map(([C,E])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(E)})]},C))]})]})]})]},u.id)})})]},h.date?.toISOString()||"all"))})]})}function Nl({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:i,onGoToEvent:m,onSpeedChange:c,className:s}){let p=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),l=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:A("history-replay-empty",s),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:A("history-replay",s),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&xr(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&yr(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>m(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${l}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,x)=>jsxRuntime.jsx("div",{className:A("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>m(x),title:yr(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:i,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(g=>jsxRuntime.jsxs("button",{className:A("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:A("history-replay-start",s),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Vn(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function jn(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function Sl(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function El(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Yu(e,t,a,r,o,n=100){let i=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(i.map(c=>[c.id,c]));for(let c=0;c<n;c++){let s=1-c/n;i.forEach(p=>{let d=a/2,l=r/2;p.vx+=(d-p.x)*o.centerForce*s,p.vy+=(l-p.y)*o.centerForce*s,i.forEach(g=>{if(p.id===g.id)return;let x=p.x-g.x,y=p.y-g.y,b=Math.sqrt(x*x+y*y)||1,f=o.chargeStrength*s/(b*b);p.vx+=x/b*f,p.vy+=y/b*f;});}),t.forEach(p=>{let d=m.get(typeof p.source=="string"?p.source:p.source.id),l=m.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!l)return;let g=l.x-d.x,x=l.y-d.y,y=Math.sqrt(g*g+x*x)||1,b=(y-o.linkDistance)/y*o.forceStrength*s;d.vx+=g*b,d.vy+=x*b,l.vx-=g*b,l.vy-=x*b;}),i.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return i}function Pl({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:i,onInteraction:m,className:c}){let s=react.useRef(null),[p,d]=react.useState([]),[l,g]=react.useState(null),[x,y]=react.useState(null),[b,f]=react.useState(null),[h,u]=react.useState(1),[k,w]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let L=Yu(e,t,a.width,a.height,a,150);d(L);},[e,t,a]);let v=react.useCallback((L,H)=>{a.enableDragging&&(H.stopPropagation(),g(L));},[a.enableDragging]),P=react.useCallback(L=>{if(!l||!s.current)return;let S=s.current.getBoundingClientRect(),O=(L.clientX-S.left-k.x)/h,Y=(L.clientY-S.top-k.y)/h;d(Q=>Q.map(R=>R.id===l?{...R,x:O,y:Y,fx:O,fy:Y}:R));},[l,h,k]),C=react.useCallback(()=>{g(null);},[]),E=react.useCallback((L,H)=>{H.stopPropagation(),m?.({type:"node-click",node:L,position:{x:H.clientX,y:H.clientY}});},[m]),T=react.useCallback((L,H)=>{H.stopPropagation(),m?.({type:"edge-click",edge:L,position:{x:H.clientX,y:H.clientY}});},[m]),z=react.useCallback(L=>{let H=p.find(S=>S.id===L);return H?{x:H.x,y:H.y}:{x:0,y:0}},[p]),U=react.useCallback(L=>{if(L.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return L.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=L.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return L.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:A("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:A("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:i.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:i.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),n&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>u(L=>Math.min(L+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>u(L=>Math.max(L-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{u(1),w({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(L=>L.type))).map(L=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Vn(L)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Sl(L)," ",jn(L)]})]},L))}),jsxRuntime.jsxs("svg",{ref:s,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:P,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(L=>{let H=z(typeof L.source=="string"?L.source:L.source.id),S=z(typeof L.target=="string"?L.target:L.target.id),O=El(L.type),Y=b===L.id,Q=L.onCriticalPath;return jsxRuntime.jsxs("g",{className:A("relationships-graph-edge",Y&&"hovered",Q&&"critical"),onMouseEnter:()=>f(L.id),onMouseLeave:()=>f(null),onClick:R=>T(L,R),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:S.x,y2:S.y,stroke:Vn(L.type),strokeWidth:Q?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Y?1:.6,markerEnd:O?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Y&&jsxRuntime.jsx("text",{x:(H.x+S.x)/2,y:(H.y+S.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:jn(L.type)})]},L.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(L=>{let H=x===L.id,S=L.onCriticalPath;return jsxRuntime.jsxs("g",{className:A("relationships-graph-node",H&&"hovered",S&&"critical"),transform:`translate(${L.x}, ${L.y})`,onMouseDown:O=>v(L.id,O),onMouseEnter:()=>y(L.id),onMouseLeave:()=>y(null),onClick:O=>E(L,O),children:[jsxRuntime.jsx("circle",{r:S?a.nodeSize*1.2:a.nodeSize,fill:U(L),stroke:S?"#fbbf24":"#ffffff",strokeWidth:S?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:L.card.title.length>20?L.card.title.substring(0,20)+"...":L.card.title})]},L.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Ll({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,i]=react.useState(""),[m,c]=react.useState(false),[s,p]=react.useState(null),[d,l]=react.useState(null),g=react.useRef(null),x=m||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let h=u=>{u.key==="Escape"&&!x&&y();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,x]);let y=()=>{x||(i(""),p(null),l(null),t());},b=async()=>{if(!(!n.trim()||x)){c(true),p(null),l(null);try{let h=await r(n.trim());l(h);}catch(h){p(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),y());};return e?jsxRuntime.jsxs(Be,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:y}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:y,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,u)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},u))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,u)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},u)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:n,onChange:h=>i(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),s&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:s}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,u)=>jsxRuntime.jsx("button",{onClick:()=>i(h),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},u))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:y,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:b,disabled:!n.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Kn={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var qu={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Ju={generatePlan:{enabled:true,minPlanTier:"hobby",estimatedTokens:2e3},predictRisks:{enabled:true,minPlanTier:"pro",estimatedTokens:1500},suggestAssignee:{enabled:true,minPlanTier:"hobby",estimatedTokens:800},generateReport:{enabled:true,minPlanTier:"enterprise",estimatedTokens:3e3},generateSubtasks:{enabled:true,minPlanTier:"hobby",estimatedTokens:1e3}};function Zu(e,t,a){let r=Kn[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function kr(e){return `$${e.toFixed(4)}`}var Yn=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Zu(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,l)=>d+l.cost,0),n=a.reduce((d,l)=>d+l.inputTokens,0),i=a.reduce((d,l)=>d+l.outputTokens,0),m=a.filter(d=>d.success),c=a.reduce((d,l)=>d+l.duration,0),s={},p={};return a.forEach(d=>{s[d.feature]=(s[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:i,operationsByFeature:s,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?m.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],n=new Date,i=new Date;a==="month"?i.setMonth(n.getMonth()-1):i.setDate(n.getDate()-1);let m=this.operations.filter(p=>p.timestamp>=i).length,c=Math.max(0,o-m),s=m/o*100;return {used:m,limit:o,remaining:c,percentUsed:s,isExceeded:m>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Aa=new Yn;function Bl({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Aa.getStats()),[n,i]=react.useState(Aa.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(Aa.getStats()),i(Aa.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=s=>{s.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let m=Aa.getRecentOperations(5);return jsxRuntime.jsxs(Be,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[n.used," / ",n.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,n.percentUsed)}%`,background:n.percentUsed>90?"#EF4444":n.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[n.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:kr(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,s])=>{let p=r.costsByFeature[c]||0,d=r.totalOperations>0?s/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[s," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:kr(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:m.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:kr(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function zl({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[i,m]=react.useState(""),[c,s]=react.useState(""),[p,d]=react.useState(""),[l,g]=react.useState(false),[x,y]=react.useState(null),[b,f]=react.useState(null),[h,u]=react.useState(null),k=react.useRef(null),w=l||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let T=z=>{z.key==="Escape"&&!w&&v();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,w]);let v=()=>{w||(m(""),s(""),d(""),y(null),f(null),u(null),t());},P=async()=>{if(!(!i.trim()||w)){g(true),y(null),f(null),u(null);try{let T=await r({prompt:i.trim(),projectName:n||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});f(T.tasks.tasks),u({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){y(T instanceof Error?T.message:"Failed to generate tasks");}finally{g(false);}}},C=()=>{b&&(a(b),v());};if(!e)return null;let E=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Be,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:v,disabled:w,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:b?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",E,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[b.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:b.map((T,z)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",z+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:k,value:i,onChange:T=>m(T.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:w}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:T=>s(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:w})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:T=>d(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:w})]})]}),x&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((T,z)=>jsxRuntime.jsx("button",{onClick:()=>m(T),disabled:w,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:T},z))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:w&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:v,disabled:w,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),b?jsxRuntime.jsx("button",{onClick:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:P,disabled:!i.trim()||w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:w?"Generating...":"Generate Tasks"})]})]})]})})]})}function ho({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(b=>{t&&Pr(()=>Promise.resolve(t(b)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,h,u)=>{console.warn(`Retry attempt ${h} after ${u}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),n=react.useCallback(async(b,f,h)=>{r(u=>{let k=u.cards.find(T=>T.id===b);if(!k)return u;let w=k.columnId,v={...k,columnId:f,position:h},P=u.cards.map(T=>T.id===b?v:T),C=u.columns.map(T=>{if(T.id===w)return {...T,cardIds:T.cardIds.filter(z=>z!==b)};if(T.id===f){let z=P.filter(U=>U.columnId===f).sort((U,L)=>U.position-L.position);return {...T,cardIds:z.map(U=>U.id)}}return T}),E={...u,cards:P,columns:C};return o(E),E});},[o]),i=react.useCallback(async(b,f)=>{r(h=>{let u=h.cards.map(w=>w.id===b?{...w,...f}:w),k={...h,cards:u};return o(k),k});},[o]),m=react.useCallback(async b=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let u={...b,id:f},k=h.columns.map(v=>v.id===b.columnId?{...v,cardIds:[...v.cardIds,f]}:v),w={...h,cards:[...h.cards,u],columns:k};return o(w),w});},[o]),c=react.useCallback(async b=>{r(f=>{let h=f.cards.find(v=>v.id===b);if(!h)return f;let u=f.cards.filter(v=>v.id!==b),k=f.columns.map(v=>v.id===h.columnId?{...v,cardIds:v.cardIds.filter(P=>P!==b)}:v),w={...f,cards:u,columns:k};return o(w),w});},[o]),s=react.useCallback(async b=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let u={...b,id:f,cardIds:[]},k={...h,columns:[...h.columns,u]};return o(k),k});},[o]),p=react.useCallback(async(b,f)=>{r(h=>{let u=h.columns.map(w=>w.id===b?{...w,...f}:w),k={...h,columns:u};return o(k),k});},[o]),d=react.useCallback(async b=>{r(f=>{let h=f.cards.filter(w=>w.columnId!==b),u=f.columns.filter(w=>w.id!==b),k={...f,cards:h,columns:u};return o(k),k});},[o]),l=react.useCallback(b=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(b),f},[m]),g=react.useCallback(b=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return s(b),f},[s]),x=react.useCallback(()=>{r(b=>{let f={...b,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:i,onCardCreate:m,onCardDelete:c,onColumnCreate:s,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:l,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:x}}}function Gl({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=ho({initialBoard:e,onPersist:a}),i=react.useMemo(()=>({addCard:(c,s,p={})=>{n.addCard({title:s,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,s)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;n.addColumn({title:c,position:s??p+1e3});},reset:n.clearBoard}),[r.cards,r.columns,n]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:i}}var wr={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Wl={by:"none",order:"asc"};function Hl({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...wr,...e}),[n,i]=react.useState({...Wl,...t}),m=react.useCallback(y=>{o(b=>({...b,...y}));},[]),c=react.useCallback(y=>{i(b=>({...b,...y}));},[]),s=react.useCallback(()=>{o(wr),i(Wl);},[]),p=react.useCallback(()=>{a&&o({...wr,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...wr,dateFilter:"overdue"});},[]),l=react.useCallback(()=>{o({...wr,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||n.by!=="none",[r,n]),x=react.useCallback(y=>{let b=[...y];if(r.search){let f=r.search.toLowerCase();b=b.filter(h=>h.title.toLowerCase().includes(f)||h.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,h=f.getFullYear(),u=String(f.getMonth()+1).padStart(2,"0"),k=String(f.getDate()).padStart(2,"0"),w=`${h}-${u}-${k}`;b=b.filter(v=>{if(!v.endDate&&!v.dueDate)return false;let P=v.endDate||v.dueDate;if(!P)return false;let C;if(typeof P=="string")C=P.split("T")[0]||P;else {let E=P.getUTCFullYear(),T=String(P.getUTCMonth()+1).padStart(2,"0"),z=String(P.getUTCDate()).padStart(2,"0");C=`${E}-${T}-${z}`;}switch(r.dateFilter){case "overdue":return C<w;case "today":return C===w;case "this-week":let E=new Date(w+"T00:00:00"),T=new Date(C+"T00:00:00"),z=new Date(E);return z.setDate(z.getDate()+7),T>=E&&T<=z;case "custom":if(r.dateRange){let U=typeof P=="string"?new Date(P):P;return U>=r.dateRange.start&&U<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(b=b.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(b=b.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(u=>r.assignees.includes(u)))),r.labels.length>0&&(b=b.filter(f=>f.labels&&f.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(b=b.filter(f=>r.columns.includes(f.columnId))),n.by!=="none"&&b.sort((f,h)=>{let u=0;switch(n.by){case "created":let k=f.createdAt?new Date(f.createdAt).getTime():0,w=h.createdAt?new Date(h.createdAt).getTime():0;u=k-w;break;case "priority":let v={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},P=v[f.priority||"LOW"],C=v[h.priority||"LOW"];u=P-C;break;case "dueDate":let E=f.endDate||f.dueDate,T=h.endDate||h.dueDate;if(!E)return 1;if(!T)return -1;let z=typeof E=="string"?new Date(E).getTime():E.getTime(),U=typeof T=="string"?new Date(T).getTime():T.getTime();u=z-U;break;case "title":u=f.title.localeCompare(h.title);break;case "estimate":let L=f.estimatedTime||0,H=h.estimatedTime||0;u=L-H;break;default:u=0;}return n.order==="asc"?u:-u}),b},[r,n]);return {filters:r,sort:n,setFilters:m,setSort:c,resetFilters:s,filterMyTasks:p,filterOverdue:d,filterHighPriority:l,applyFilters:x,hasActiveFilters:g}}var Vl,jl;if(typeof window<"u")try{let e=Nr("ai");Vl=e.generateObject,jl=e.generateText;}catch{}function Kl(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(Vl&&jl&&e.apiKey),i=react.useCallback(async d=>{if(!n)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(l){let g=l instanceof Error?l:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[n]),m=react.useCallback(async d=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(l){let g=l instanceof Error?l:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[n]),c=react.useCallback(async d=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(l){let g=l instanceof Error?l:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[n]),s=react.useCallback(async d=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(l){let g=l instanceof Error?l:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[n]),p=react.useCallback(async d=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(l){let g=l instanceof Error?l:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[n]);return {onGeneratePlan:i,onSuggestAssignee:m,onPredictRisks:c,onGenerateSubtasks:s,onEstimateEffort:p,isAvailable:n,isLoading:t,error:r}}function qn(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function Yl(e){let{cards:t}=e,[a,r]=qn(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),n=react.useCallback((d,l)=>{if(!l){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=l.ctrlKey||l.metaKey,x=l.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(y=>y!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(x&&a.lastSelectedCardId){let y=t.find(f=>f.id===d),b=t.find(f=>f.id===a.lastSelectedCardId);if(y&&b&&y.columnId===b.columnId){let f=t.filter(C=>C.columnId===y.columnId).sort((C,E)=>C.position-E.position),h=f.findIndex(C=>C.id===a.lastSelectedCardId),u=f.findIndex(C=>C.id===d),[k,w]=h<u?[h,u]:[u,h],v=f.slice(k,w+1).map(C=>C.id),P=Array.from(new Set([...a.selectedCardIds,...v]));r({selectedCardIds:P,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),i=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(l=>l!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),s=react.useCallback(d=>{a.selectedCardIds.includes(d)?i(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,i,r]),p=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:n,deselectCard:i,clearSelection:m,selectAll:c,toggleCard:s,getSelectedCards:p}}var Xl={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function ql(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Xl,...a}),[a]),[n,i]=react.useState([]),m=react.useCallback((y,b,f,h,u)=>{if(b.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:y,cardIds:b,columnId:f,strategy:h,color:u,isExpanded:true,position:n.filter(w=>w.columnId===f).length,createdAt:new Date};i(w=>[...w,k]);},[o.minCardsPerStack,n]),c=react.useCallback(y=>{i(b=>b.filter(f=>f.id!==y));},[]),s=react.useCallback(y=>{i(b=>b.map(f=>f.id===y?{...f,isExpanded:!f.isExpanded}:f));},[]),p=react.useCallback((y,b)=>{i(f=>f.map(h=>h.id===y&&!h.cardIds.includes(b)?{...h,cardIds:[...h.cardIds,b]}:h));},[]),d=react.useCallback((y,b)=>{i(f=>f.map(h=>{if(h.id===y){let u=h.cardIds.filter(k=>k!==b);return u.length<o.minCardsPerStack?null:{...h,cardIds:u}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),l=react.useCallback(y=>n.filter(b=>b.columnId===y).sort((b,f)=>b.position-f.position),[n]),g=react.useCallback(async y=>{let b=t.filter(w=>w.columnId===y);if(b.length<o.minCardsPerStack*2)return [];let f=[],h=new Map;b.forEach(w=>{w.labels&&w.labels.length>0&&w.labels.forEach(v=>{h.has(v)||h.set(v,[]),h.get(v).push(w);});}),h.forEach((w,v)=>{w.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${v}`,cardIds:w.map(P=>P.id),columnId:y,strategy:"labels",color:"#3b82f6"},reason:`${w.length} cards with label "${v}"`,confidence:.85});});let u=new Map;b.forEach(w=>{w.assignedUserIds&&w.assignedUserIds.length>0&&w.assignedUserIds.forEach(v=>{u.has(v)||u.set(v,[]),u.get(v).push(w);});}),u.forEach((w,v)=>{w.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${v.slice(-4)}`,cardIds:w.map(P=>P.id),columnId:y,strategy:"assignee",color:"#8b5cf6"},reason:`${w.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(b.forEach(w=>{w.priority&&(k.has(w.priority)||k.set(w.priority,[]),k.get(w.priority).push(w));}),k.forEach((w,v)=>{if(w.length>=o.minCardsPerStack){let P={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[v.toLowerCase()]||"\u26AA";f.push({stack:{title:`${P} ${v} Priority`,cardIds:w.map(C=>C.id),columnId:y,strategy:"priority",color:v==="high"||v==="urgent"?"#ef4444":"#10b981"},reason:`${w.length} cards with ${v} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let w of b){let P=(await r.findSimilar(w,b)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(P.length>=o.minCardsPerStack-1){let C=[w.id,...P.map(T=>T.card.id)],E=P.reduce((T,z)=>T+z.similarity,0)/P.length;f.push({stack:{title:`\u2728 Similar to "${w.title.substring(0,30)}${w.title.length>30?"...":""}"`,cardIds:C,columnId:y,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${P.length+1} similar tasks`,confidence:E});}}return f.filter(w=>w.confidence>=o.autoStackConfidenceThreshold).sort((w,v)=>v.confidence-w.confidence).slice(0,5)},[t,o,r]),x=react.useCallback(y=>{m(y.stack.title,y.stack.cardIds,y.stack.columnId,y.stack.strategy,y.stack.color);},[m]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(b=>b.columnId)).forEach(async b=>{let f=await g(b),h=f[0];f.length>0&&h&&h.confidence>=.9&&x(h);});},[]),{stacks:n,createStack:m,deleteStack:c,toggleStack:s,addToStack:p,removeFromStack:d,getStacksForColumn:l,getSuggestions:g,applySuggestion:x,config:o}}var Jl=react.createContext(null);function Zl({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,i=new Map;t?.columns?.forEach(c=>{let{Column:s}=Nr("@libxai/core");n.set(c.id,new s(c));}),t?.cards?.forEach(c=>{let{Card:s}=Nr("@libxai/core");i.set(c.id,new s(c));});let m=null;if(t?.board){let{Board:c}=Nr("@libxai/core");m=new c(t.board);}r.current=new core.BoardStore({board:m,columns:n,cards:i});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Jl.Provider,{value:{store:o},children:e})}function bo(){let e=react.useContext(Jl);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Tr(){let e=bo(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[n,i]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),i(e.getAllCards());}),[e]);let m=react.useCallback(h=>{e.updateBoard(h);},[e]),c=react.useCallback(h=>{e.addColumn(h);},[e]),s=react.useCallback((h,u)=>{e.updateColumn(h,u);},[e]),p=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),l=react.useCallback(h=>{e.addCard(h);},[e]),g=react.useCallback((h,u)=>{e.updateCard(h,u);},[e]),x=react.useCallback(h=>{e.deleteCard(h);},[e]),y=react.useCallback((h,u,k)=>{e.moveCard(h,u,k);},[e]),b=react.useCallback(h=>e.getCard(h),[e]),f=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:n,updateBoard:m,addColumn:c,updateColumn:s,deleteColumn:p,getColumn:d,addCard:l,updateCard:g,deleteCard:x,moveCard:y,getCard:b,getCardsByColumn:f}}function ed(e){let{cards:t}=Tr();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),n=a.description?.toLowerCase().includes(r);if(!o&&!n)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function td(e="position",t="asc"){let{cards:a}=Tr();return react.useMemo(()=>[...a].sort((o,n)=>{let i=0;switch(e){case "title":i=o.title.localeCompare(n.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?m[o.priority]:0,s=n.priority?m[n.priority]:0;i=c-s;break}case "createdAt":i=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":i=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":i=o.position-n.position;break}return t==="asc"?i:-i}),[a,e,t])}var vo=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ns.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let i=n[t];if(typeof i=="function")try{let m=await Promise.resolve(i.apply(n,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,m,{plugin:n.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let n=o[t];typeof n=="function"&&r.push(Promise.resolve(n.apply(o,a)).catch(i=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,i,{plugin:o.id,hook:t});}));}await Promise.all(r);}},fg=new vo;function rd({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:i=false,gap:m=0,getItemKey:c}){let s=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>s.current,estimateSize:()=>a,overscan:n,horizontal:i,gap:m}),d=p.getVirtualItems(),l={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=i?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:s,style:l,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(x=>{let y=e[x.index];if(!y)return null;let b=c?c(y,x.index):x.index,f={position:"absolute",top:i?0:x.start,left:i?x.start:0,width:i?x.size:"100%",height:i?"100%":x.size};return jsxRuntime.jsx("div",{style:f,"data-index":x.index,children:r(y,x.index)},b)})})})}function od(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function sd({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:i=3,gap:m=16,getItemKey:c,horizontal:s=true}){let p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:s,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:i,gap:m}),l=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:g,className:n,children:jsxRuntime.jsx("div",{style:x,children:l.map(y=>{let b=e[y.index];if(!b)return null;let f=c?c(b,y.index):y.index,h={position:"absolute",top:0,left:y.start,width:y.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":y.index,children:o(b,y.index)},f)})})})}function id(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function ld(e,t=10){return e>t}var es={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ts={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},as={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},rs={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},os={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},ns={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ss={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},is={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},ls={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},ds={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},cs={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},ms={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},yo={spacing:es,borderRadius:ts,fontSize:as,fontWeight:rs,lineHeight:os,zIndex:ns,duration:ss,easing:is,shadows:ls,opacity:ds,kanban:cs,gantt:ms};function dd(e,t,a){return e[t]??a}function ps(e,t="",a={}){for(let[r,o]of Object.entries(e)){let n=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?ps(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function vg(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function us(e="asakaa"){let t=ps(yo),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,i=vg(o);a.push(` ${n}: ${i};`);}return `:root {
|
|
324
|
+
${a.join(`
|
|
325
325
|
`)}
|
|
326
|
-
}`}function
|
|
327
|
-
${
|
|
326
|
+
}`}function Dr(e,t="asakaa"){let a=[],r=ps(e);for(let[o,n]of Object.entries(r)){let i=`--${t}-color-${o}`;a.push(` ${i}: ${n};`);}return `:root {
|
|
327
|
+
${a.join(`
|
|
328
328
|
`)}
|
|
329
|
-
}`}var
|
|
329
|
+
}`}var xo={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"}},gs={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"}},fs={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 hs(e=xo,t="asakaa"){let a=us(t),r=Dr(e,t);return `${a}
|
|
330
330
|
|
|
331
|
-
${
|
|
331
|
+
${r}`}function cd(){return `/**
|
|
332
332
|
* ASAKAA Design Tokens
|
|
333
333
|
* Auto-generated from design-tokens.ts
|
|
334
334
|
* Do not edit this file directly
|
|
335
335
|
*/
|
|
336
336
|
|
|
337
|
-
${
|
|
337
|
+
${hs(xo)}
|
|
338
338
|
|
|
339
339
|
/* Light theme */
|
|
340
340
|
[data-theme="light"] {
|
|
341
|
-
${
|
|
341
|
+
${Dr(gs,"asakaa").split(`
|
|
342
342
|
`).slice(1,-1).join(`
|
|
343
343
|
`)}
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
/* Neutral theme */
|
|
347
347
|
[data-theme="neutral"] {
|
|
348
|
-
${
|
|
348
|
+
${Dr(fs,"asakaa").split(`
|
|
349
349
|
`).slice(1,-1).join(`
|
|
350
350
|
`)}
|
|
351
351
|
}
|
|
352
|
-
`}var
|
|
353
|
-
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=
|
|
352
|
+
`}var yg=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function md({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:n}=ja();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(n).map(([i,m])=>{let c=i,s=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${s?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${m.displayName} theme`,"aria-pressed":s,title:m.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(yg,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:m.displayName})]},c)})})}
|
|
353
|
+
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=Bl;exports.AI_FEATURES=Ju;exports.AI_MODELS=Kn;exports.AttachmentUploader=cr;exports.BoardProvider=Zl;exports.BulkOperationsToolbar=zr;exports.BurnDownChart=Vo;exports.CalendarBoard=yl;exports.Card=sa;exports.CardDetailModal=Go;exports.CardDetailModalV2=Wo;exports.CardHistoryReplay=Nl;exports.CardHistoryTimeline=Tl;exports.CardRelationshipsGraph=Pl;exports.CardStack=Wu;exports.CardTemplateSelector=Zo;exports.CircuitBreaker=Co;exports.Column=Ga;exports.ColumnManager=_r;exports.CommandPalette=zo;exports.ConfigMenu=an;exports.ContextMenu=Xa;exports.DEFAULT_SHORTCUTS=mr;exports.DEFAULT_TEMPLATES=Jo;exports.DateRangePicker=nr;exports.DependenciesSelector=sr;exports.DependencyLine=Xr;exports.DistributionCharts=jo;exports.EditableColumnTitle=Ao;exports.ErrorBoundary=Wa;exports.ExportImportModal=en;exports.FilterBar=tn;exports.GANTT_AI_SYSTEM_PROMPT=tl;exports.GanttAIAssistant=ao;exports.GanttBoard=el;exports.GanttI18nContext=Ya;exports.GanttMilestone=Jr;exports.GanttToolbar=Hr;exports.GenerateGanttTasksDialog=zl;exports.GeneratePlanModal=Ll;exports.GroupBySelector=Xo;exports.KanbanBoard=pa;exports.KanbanViewAdapter=lr;exports.KeyboardShortcutsHelp=qo;exports.ListView=ul;exports.MenuIcons=it;exports.PluginManager=vo;exports.PrioritySelector=or;exports.RATE_LIMITS=qu;exports.SwimlaneBoardView=Ko;exports.TaskBar=Kr;exports.TaskFormModal=to;exports.TaskGrid=jr;exports.ThemeModal=sn;exports.ThemeProvider=mi;exports.ThemeSwitcher=md;exports.Timeline=eo;exports.UserAssignmentSelector=Ta;exports.VelocityChart=_o;exports.VirtualGrid=sd;exports.VirtualList=rd;exports.aiUsageTracker=Aa;exports.borderRadius=ts;exports.calculatePosition=Er;exports.calendarDarkTheme=Wn;exports.calendarEnTranslations=zn;exports.calendarEsTranslations=Un;exports.calendarLightTheme=Hn;exports.calendarNeutralTheme=_n;exports.calendarThemes=uo;exports.calendarTranslations=co;exports.cardToGanttTask=oo;exports.cardsToGanttTasks=ll;exports.cn=A;exports.createKanbanView=Ks;exports.createRetryWrapper=Rd;exports.darkTheme=rn;exports.darkTokenTheme=xo;exports.defaultTheme=Gr;exports.designTokens=yo;exports.duration=ss;exports.easing=is;exports.exportTokensToCSS=cd;exports.findTaskByName=ca;exports.fontSize=as;exports.fontWeight=rs;exports.formatCost=kr;exports.ganttEnTranslations=Wr;exports.ganttEsTranslations=ui;exports.ganttTaskToCardUpdate=il;exports.ganttThemes=Ce;exports.ganttTokens=ms;exports.ganttTranslations=ln;exports.ganttUtils=j;exports.generateCSSVariables=us;exports.generateCompleteCSS=hs;exports.generateInitialPositions=Ld;exports.generateTasksContext=al;exports.generateThemeVariables=Dr;exports.getCalendarTheme=xl;exports.getCalendarTranslations=vr;exports.getListViewTheme=gl;exports.getListViewTranslations=Fn;exports.getMonthNames=fl;exports.getToken=dd;exports.getTranslations=gi;exports.getWeekdayNames=hl;exports.kanbanTokens=cs;exports.lightTheme=on;exports.lightTokenTheme=gs;exports.lineHeight=os;exports.listViewDarkTheme=Bn;exports.listViewEnTranslations=Ln;exports.listViewEsTranslations=An;exports.listViewLightTheme=Rn;exports.listViewNeutralTheme=On;exports.listViewThemes=lo;exports.listViewTranslations=no;exports.mergeCalendarTranslations=mo;exports.mergeListViewTranslations=so;exports.mergeTranslations=dn;exports.neutralTheme=nn;exports.neutralTokenTheme=fs;exports.opacity=ds;exports.parseLocalCommand=nl;exports.parseNaturalDate=Pn;exports.parseNaturalDuration=Mn;exports.parseProgress=In;exports.parseStatus=ol;exports.pluginManager=fg;exports.retrySyncOperation=Bd;exports.retryWithBackoff=Pr;exports.shadows=ls;exports.shouldVirtualizeGrid=ld;exports.spacing=es;exports.themes=Ea;exports.useAI=Kl;exports.useBoard=Gl;exports.useBoardCore=Tr;exports.useBoardStore=bo;exports.useCardStacking=ql;exports.useDragState=Bo;exports.useFilteredCards=ed;exports.useFilters=Hl;exports.useGanttI18n=pr;exports.useKanbanState=ho;exports.useKeyboardShortcuts=li;exports.useMultiSelect=Yl;exports.useSelectionState=qn;exports.useSortedCards=td;exports.useTheme=ja;exports.useVirtualGrid=id;exports.useVirtualList=od;exports.validateAIResponse=sl;exports.withErrorBoundary=Ro;exports.zIndex=ns;//# sourceMappingURL=index.cjs.map
|
|
354
354
|
//# sourceMappingURL=index.cjs.map
|