@libxai/board 0.16.15 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +51 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +575 -3
- package/dist/index.d.ts +575 -3
- package/dist/index.js +51 -51
- package/dist/index.js.map +1 -1
- package/dist/styles.css +362 -0
- package/package.json +140 -136
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=si(t[0]),a=[],n=new Map,o=[];for(let s=1;s<t.length;s++)try{let c=si(t[s]||"");if(c.length>r.length){o.push(`Line ${s+1}: Too many columns`);continue}if(r.length-c.length>3){o.push(`Line ${s+1}: Column count mismatch (expected ${r.length}, got ${c.length})`);continue}for(;c.length<r.length;)c.push("");let i={};r.forEach((m,b)=>{i[m]=c[b]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let l=n.get(u),p={id:i["Card ID"]||`card-${s}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};a.push(p),l.cardIds.push(p.id);}catch(c){o.push(`Line ${s+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...o]}:{success:!0,cardsImported:a.length,columnsImported:n.size,errors:o.length>0?o:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function si(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 ii(e,t){switch(t){case "json":return Yd(e);case "csv":return qd(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function li(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 an(){return typeof window<"u"}function wr(e){return so(e)?(e.nodeName||"").toLowerCase():"#document"}function Ct(e){var t;return (e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Kt(e){var t;return (t=(so(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function so(e){return an()?e instanceof Node||e instanceof Ct(e).Node:false}function dt(e){return an()?e instanceof Element||e instanceof Ct(e).Element:false}function zt(e){return an()?e instanceof HTMLElement||e instanceof Ct(e).HTMLElement:false}function oo(e){return !an()||typeof ShadowRoot>"u"?false:e instanceof ShadowRoot||e instanceof Ct(e).ShadowRoot}var Xd=new Set(["inline","contents"]);function ea(e){let{overflow:t,overflowX:r,overflowY:a,display:n}=Et(e);return /auto|scroll|overlay|hidden|clip/.test(t+a+r)&&!Xd.has(n)}var Jd=new Set(["table","td","th"]);function ci(e){return Jd.has(wr(e))}var Zd=[":popover-open",":modal"];function ka(e){return Zd.some(t=>{try{return e.matches(t)}catch{return false}})}var Qd=["transform","translate","scale","rotate","perspective"],eu=["transform","translate","scale","rotate","perspective","filter"],tu=["paint","layout","strict","content"];function nn(e){let t=wa(),r=dt(e)?Et(e):e;return Qd.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)||eu.some(a=>(r.willChange||"").includes(a))||tu.some(a=>(r.contain||"").includes(a))}function di(e){let t=or(e);for(;zt(t)&&!Cr(t);){if(nn(t))return t;if(ka(t))return null;t=or(t);}return null}function wa(){return typeof CSS>"u"||!CSS.supports?false:CSS.supports("-webkit-backdrop-filter","none")}var ru=new Set(["html","body","#document"]);function Cr(e){return ru.has(wr(e))}function Et(e){return Ct(e).getComputedStyle(e)}function Ca(e){return dt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function or(e){if(wr(e)==="html")return e;let t=e.assignedSlot||e.parentNode||oo(e)&&e.host||Kt(e);return oo(t)?t.host:t}function ui(e){let t=or(e);return Cr(t)?e.ownerDocument?e.ownerDocument.body:e.body:zt(t)&&ea(t)?t:ui(t)}function fr(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=true);let n=ui(e),o=n===((a=e.ownerDocument)==null?void 0:a.body),s=Ct(n);if(o){let c=on(s);return t.concat(s,s.visualViewport||[],ea(n)?n:[],c&&r?fr(c):[])}return t.concat(n,fr(n,[],r))}function on(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var sr=Math.min,Tt=Math.max,Da=Math.round,Sa=Math.floor,jt=e=>({x:e,y:e}),au={left:"right",right:"left",bottom:"top",top:"bottom"},nu={start:"end",end:"start"};function ln(e,t,r){return Tt(e,sr(t,r))}function Or(e,t){return typeof e=="function"?e(t):e}function gr(e){return e.split("-")[0]}function zr(e){return e.split("-")[1]}function io(e){return e==="x"?"y":"x"}function cn(e){return e==="y"?"height":"width"}var ou=new Set(["top","bottom"]);function ir(e){return ou.has(gr(e))?"y":"x"}function dn(e){return io(ir(e))}function fi(e,t,r){r===void 0&&(r=false);let a=zr(e),n=dn(e),o=cn(n),s=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Ta(s)),[s,Ta(s)]}function gi(e){let t=Ta(e);return [sn(e),t,sn(t)]}function sn(e){return e.replace(/start|end/g,t=>nu[t])}var pi=["left","right"],mi=["right","left"],su=["top","bottom"],iu=["bottom","top"];function lu(e,t,r){switch(e){case "top":case "bottom":return r?t?mi:pi:t?pi:mi;case "left":case "right":return t?su:iu;default:return []}}function hi(e,t,r,a){let n=zr(e),o=lu(gr(e),r==="start",a);return n&&(o=o.map(s=>s+"-"+n),t&&(o=o.concat(o.map(sn)))),o}function Ta(e){return e.replace(/left|right|bottom|top/g,t=>au[t])}function cu(e){return {top:0,right:0,bottom:0,left:0,...e}}function lo(e){return typeof e!="number"?cu(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 uu=typeof document<"u",pu=function(){},Ea=uu?Te.useLayoutEffect:pu,mu={...Te__namespace};var fu=mu.useInsertionEffect,gu=fu||(e=>e());function vi(e){let t=Te__namespace.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return gu(()=>{t.current=e;}),Te__namespace.useCallback(function(){for(var r=arguments.length,a=new Array(r),n=0;n<r;n++)a[n]=arguments[n];return t.current==null?void 0:t.current(...a)},[])}function bi(e,t,r){let{reference:a,floating:n}=e,o=ir(t),s=dn(t),c=cn(s),d=gr(t),i=o==="y",u=a.x+a.width/2-n.width/2,l=a.y+a.height/2-n.height/2,p=a[c]/2-n[c]/2,m;switch(d){case "top":m={x:u,y:a.y-n.height};break;case "bottom":m={x:u,y:a.y+a.height};break;case "right":m={x:a.x+a.width,y:l};break;case "left":m={x:a.x-n.width,y:l};break;default:m={x:a.x,y:a.y};}switch(zr(t)){case "start":m[s]-=p*(r&&i?-1:1);break;case "end":m[s]+=p*(r&&i?-1:1);break}return m}var yi=async(e,t,r)=>{let{placement:a="bottom",strategy:n="absolute",middleware:o=[],platform:s}=r,c=o.filter(Boolean),d=await(s.isRTL==null?void 0:s.isRTL(t)),i=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:l}=bi(i,a,d),p=a,m={},b=0;for(let x=0;x<c.length;x++){let{name:h,fn:g}=c[x],{x:v,y:f,data:w,reset:k}=await g({x:u,y:l,initialPlacement:a,placement:p,strategy:n,middlewareData:m,rects:i,platform:s,elements:{reference:e,floating:t}});u=v??u,l=f??l,m={...m,[h]:{...m[h],...w}},k&&b<=50&&(b++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(i=k.rects===true?await s.getElementRects({reference:e,floating:t,strategy:n}):k.rects),{x:u,y:l}=bi(i,p,d)),x=-1);}return {x:u,y:l,placement:p,strategy:n,middlewareData:m}};async function un(e,t){var r;t===void 0&&(t={});let{x:a,y:n,platform:o,rects:s,elements:c,strategy:d}=e,{boundary:i="clippingAncestors",rootBoundary:u="viewport",elementContext:l="floating",altBoundary:p=false,padding:m=0}=Or(t,e),b=lo(m),h=c[p?l==="floating"?"reference":"floating":l],g=$r(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(h)))==null||r?h:h.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:i,rootBoundary:u,strategy:d})),v=l==="floating"?{x:a,y:n,width:s.floating.width,height:s.floating.height}:s.reference,f=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),w=await(o.isElement==null?void 0:o.isElement(f))?await(o.getScale==null?void 0:o.getScale(f))||{x:1,y:1}:{x:1,y:1},k=$r(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:f,strategy:d}):v);return {top:(g.top-k.top+b.top)/w.y,bottom:(k.bottom-g.bottom+b.bottom)/w.y,left:(g.left-k.left+b.left)/w.x,right:(k.right-g.right+b.right)/w.x}}var xi=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:a,placement:n,rects:o,platform:s,elements:c,middlewareData:d}=t,{element:i,padding:u=0}=Or(e,t)||{};if(i==null)return {};let l=lo(u),p={x:r,y:a},m=dn(n),b=cn(m),x=await s.getDimensions(i),h=m==="y",g=h?"top":"left",v=h?"bottom":"right",f=h?"clientHeight":"clientWidth",w=o.reference[b]+o.reference[m]-p[m]-o.floating[b],k=p[m]-o.reference[m],y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i)),C=y?y[f]:0;(!C||!await(s.isElement==null?void 0:s.isElement(y)))&&(C=c.floating[f]||o.floating[b]);let T=w/2-k/2,N=C/2-x[b]/2-1,R=sr(l[g],N),G=sr(l[v],N),W=R,M=C-x[b]-G,z=C/2-x[b]/2+T,E=ln(W,z,M),B=!d.arrow&&zr(n)!=null&&z!==E&&o.reference[b]/2-(z<W?R:G)-x[b]/2<0,$=B?z<W?z-W:z-M:0;return {[m]:p[m]+$,data:{[m]:E,centerOffset:z-E-$,...B&&{alignmentOffset:$}},reset:B}}});var ki=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,a;let{placement:n,middlewareData:o,rects:s,initialPlacement:c,platform:d,elements:i}=t,{mainAxis:u=true,crossAxis:l=true,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:x=true,...h}=Or(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return {};let g=gr(n),v=ir(c),f=gr(c)===c,w=await(d.isRTL==null?void 0:d.isRTL(i.floating)),k=p||(f||!x?[Ta(c)]:gi(c)),y=b!=="none";!p&&y&&k.push(...hi(c,x,b,w));let C=[c,...k],T=await un(t,h),N=[],R=((a=o.flip)==null?void 0:a.overflows)||[];if(u&&N.push(T[g]),l){let z=fi(n,s,w);N.push(T[z[0]],T[z[1]]);}if(R=[...R,{placement:n,overflows:N}],!N.every(z=>z<=0)){var G,W;let z=(((G=o.flip)==null?void 0:G.index)||0)+1,E=C[z];if(E&&(!(l==="alignment"?v!==ir(E):false)||R.every(O=>ir(O.placement)===v?O.overflows[0]>0:true)))return {data:{index:z,overflows:R},reset:{placement:E}};let B=(W=R.filter($=>$.overflows[0]<=0).sort(($,O)=>$.overflows[1]-O.overflows[1])[0])==null?void 0:W.placement;if(!B)switch(m){case "bestFit":{var M;let $=(M=R.filter(O=>{if(y){let F=ir(O.placement);return F===v||F==="y"}return true}).map(O=>[O.placement,O.overflows.filter(F=>F>0).reduce((F,Q)=>F+Q,0)]).sort((O,F)=>O[1]-F[1])[0])==null?void 0:M[0];$&&(B=$);break}case "initialPlacement":B=c;break}if(n!==B)return {reset:{placement:B}}}return {}}}};var hu=new Set(["left","top"]);async function vu(e,t){let{placement:r,platform:a,elements:n}=e,o=await(a.isRTL==null?void 0:a.isRTL(n.floating)),s=gr(r),c=zr(r),d=ir(r)==="y",i=hu.has(s)?-1:1,u=o&&d?-1:1,l=Or(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:b}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return c&&typeof b=="number"&&(m=c==="end"?b*-1:b),d?{x:m*u,y:p*i}:{x:p*i,y:m*u}}var wi=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,a;let{x:n,y:o,placement:s,middlewareData:c}=t,d=await vu(t,e);return s===((r=c.offset)==null?void 0:r.placement)&&(a=c.arrow)!=null&&a.alignmentOffset?{}:{x:n+d.x,y:o+d.y,data:{...d,placement:s}}}}},Ci=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:a,placement:n}=t,{mainAxis:o=true,crossAxis:s=false,limiter:c={fn:h=>{let{x:g,y:v}=h;return {x:g,y:v}}},...d}=Or(e,t),i={x:r,y:a},u=await un(t,d),l=ir(gr(n)),p=io(l),m=i[p],b=i[l];if(o){let h=p==="y"?"top":"left",g=p==="y"?"bottom":"right",v=m+u[h],f=m-u[g];m=ln(v,m,f);}if(s){let h=l==="y"?"top":"left",g=l==="y"?"bottom":"right",v=b+u[h],f=b-u[g];b=ln(v,b,f);}let x=c.fn({...t,[p]:m,[l]:b});return {...x,data:{x:x.x-r,y:x.y-a,enabled:{[p]:o,[l]:s}}}}}};var Ti=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,a;let{placement:n,rects:o,platform:s,elements:c}=t,{apply:d=()=>{},...i}=Or(e,t),u=await un(t,i),l=gr(n),p=zr(n),m=ir(n)==="y",{width:b,height:x}=o.floating,h,g;l==="top"||l==="bottom"?(h=l,g=p===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(g=l,h=p==="end"?"top":"bottom");let v=x-u.top-u.bottom,f=b-u.left-u.right,w=sr(x-u[h],v),k=sr(b-u[g],f),y=!t.middlewareData.shift,C=w,T=k;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(T=f),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(C=v),y&&!p){let R=Tt(u.left,0),G=Tt(u.right,0),W=Tt(u.top,0),M=Tt(u.bottom,0);m?T=b-2*(R!==0||G!==0?R+G:Tt(u.left,u.right)):C=x-2*(W!==0||M!==0?W+M:Tt(u.top,u.bottom));}await d({...t,availableWidth:T,availableHeight:C});let N=await s.getDimensions(c.floating);return b!==N.width||x!==N.height?{reset:{rects:true}}:{}}}};function Ei(e){let t=Et(e),r=parseFloat(t.width)||0,a=parseFloat(t.height)||0,n=zt(e),o=n?e.offsetWidth:r,s=n?e.offsetHeight:a,c=Da(r)!==o||Da(a)!==s;return c&&(r=o,a=s),{width:r,height:a,$:c}}function uo(e){return dt(e)?e:e.contextElement}function ta(e){let t=uo(e);if(!zt(t))return jt(1);let r=t.getBoundingClientRect(),{width:a,height:n,$:o}=Ei(t),s=(o?Da(r.width):r.width)/a,c=(o?Da(r.height):r.height)/n;return (!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}var bu=jt(0);function Ri(e){let t=Ct(e);return !wa()||!t.visualViewport?bu:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function yu(e,t,r){return t===void 0&&(t=false),!r||t&&r!==Ct(e)?false:t}function Gr(e,t,r,a){t===void 0&&(t=false),r===void 0&&(r=false);let n=e.getBoundingClientRect(),o=uo(e),s=jt(1);t&&(a?dt(a)&&(s=ta(a)):s=ta(e));let c=yu(o,r,a)?Ri(o):jt(0),d=(n.left+c.x)/s.x,i=(n.top+c.y)/s.y,u=n.width/s.x,l=n.height/s.y;if(o){let p=Ct(o),m=a&&dt(a)?Ct(a):a,b=p,x=on(b);for(;x&&a&&m!==b;){let h=ta(x),g=x.getBoundingClientRect(),v=Et(x),f=g.left+(x.clientLeft+parseFloat(v.paddingLeft))*h.x,w=g.top+(x.clientTop+parseFloat(v.paddingTop))*h.y;d*=h.x,i*=h.y,u*=h.x,l*=h.y,d+=f,i+=w,b=Ct(x),x=on(b);}}return $r({width:u,height:l,x:d,y:i})}function pn(e,t){let r=Ca(e).scrollLeft;return t?t.left+r:Gr(Kt(e)).left+r}function Pi(e,t){let r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-pn(e,r),n=r.top+t.scrollTop;return {x:a,y:n}}function xu(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e,o=n==="fixed",s=Kt(a),c=t?ka(t.floating):false;if(a===s||c&&o)return r;let d={scrollLeft:0,scrollTop:0},i=jt(1),u=jt(0),l=zt(a);if((l||!l&&!o)&&((wr(a)!=="body"||ea(s))&&(d=Ca(a)),zt(a))){let m=Gr(a);i=ta(a),u.x=m.x+a.clientLeft,u.y=m.y+a.clientTop;}let p=s&&!l&&!o?Pi(s,d):jt(0);return {width:r.width*i.x,height:r.height*i.y,x:r.x*i.x-d.scrollLeft*i.x+u.x+p.x,y:r.y*i.y-d.scrollTop*i.y+u.y+p.y}}function ku(e){return Array.from(e.getClientRects())}function wu(e){let t=Kt(e),r=Ca(e),a=e.ownerDocument.body,n=Tt(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),o=Tt(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),s=-r.scrollLeft+pn(e),c=-r.scrollTop;return Et(a).direction==="rtl"&&(s+=Tt(t.clientWidth,a.clientWidth)-n),{width:n,height:o,x:s,y:c}}var Di=25;function Cu(e,t){let r=Ct(e),a=Kt(e),n=r.visualViewport,o=a.clientWidth,s=a.clientHeight,c=0,d=0;if(n){o=n.width,s=n.height;let u=wa();(!u||u&&t==="fixed")&&(c=n.offsetLeft,d=n.offsetTop);}let i=pn(a);if(i<=0){let u=a.ownerDocument,l=u.body,p=getComputedStyle(l),m=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,b=Math.abs(a.clientWidth-l.clientWidth-m);b<=Di&&(o-=b);}else i<=Di&&(o+=i);return {width:o,height:s,x:c,y:d}}var Tu=new Set(["absolute","fixed"]);function Du(e,t){let r=Gr(e,true,t==="fixed"),a=r.top+e.clientTop,n=r.left+e.clientLeft,o=zt(e)?ta(e):jt(1),s=e.clientWidth*o.x,c=e.clientHeight*o.y,d=n*o.x,i=a*o.y;return {width:s,height:c,x:d,y:i}}function Si(e,t,r){let a;if(t==="viewport")a=Cu(e,r);else if(t==="document")a=wu(Kt(e));else if(dt(t))a=Du(t,r);else {let n=Ri(e);a={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height};}return $r(a)}function Ii(e,t){let r=or(e);return r===t||!dt(r)||Cr(r)?false:Et(r).position==="fixed"||Ii(r,t)}function Su(e,t){let r=t.get(e);if(r)return r;let a=fr(e,[],false).filter(c=>dt(c)&&wr(c)!=="body"),n=null,o=Et(e).position==="fixed",s=o?or(e):e;for(;dt(s)&&!Cr(s);){let c=Et(s),d=nn(s);!d&&c.position==="fixed"&&(n=null),(o?!d&&!n:!d&&c.position==="static"&&!!n&&Tu.has(n.position)||ea(s)&&!d&&Ii(e,s))?a=a.filter(u=>u!==s):n=c,s=or(s);}return t.set(e,a),a}function Nu(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e,s=[...r==="clippingAncestors"?ka(t)?[]:Su(t,this._c):[].concat(r),a],c=s[0],d=s.reduce((i,u)=>{let l=Si(t,u,n);return i.top=Tt(l.top,i.top),i.right=sr(l.right,i.right),i.bottom=sr(l.bottom,i.bottom),i.left=Tt(l.left,i.left),i},Si(t,c,n));return {width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Eu(e){let{width:t,height:r}=Ei(e);return {width:t,height:r}}function Ru(e,t,r){let a=zt(t),n=Kt(t),o=r==="fixed",s=Gr(e,true,o,t),c={scrollLeft:0,scrollTop:0},d=jt(0);function i(){d.x=pn(n);}if(a||!a&&!o)if((wr(t)!=="body"||ea(n))&&(c=Ca(t)),a){let m=Gr(t,true,o,t);d.x=m.x+t.clientLeft,d.y=m.y+t.clientTop;}else n&&i();o&&!a&&n&&i();let u=n&&!a&&!o?Pi(n,c):jt(0),l=s.left+c.scrollLeft-d.x-u.x,p=s.top+c.scrollTop-d.y-u.y;return {x:l,y:p,width:s.width,height:s.height}}function co(e){return Et(e).position==="static"}function Ni(e,t){if(!zt(e)||Et(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Kt(e)===r&&(r=r.ownerDocument.body),r}function Mi(e,t){let r=Ct(e);if(ka(e))return r;if(!zt(e)){let n=or(e);for(;n&&!Cr(n);){if(dt(n)&&!co(n))return n;n=or(n);}return r}let a=Ni(e,t);for(;a&&ci(a)&&co(a);)a=Ni(a,t);return a&&Cr(a)&&co(a)&&!nn(a)?r:a||di(e)||r}var Pu=async function(e){let t=this.getOffsetParent||Mi,r=this.getDimensions,a=await r(e.floating);return {reference:Ru(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function Iu(e){return Et(e).direction==="rtl"}var po={convertOffsetParentRelativeRectToViewportRelativeRect:xu,getDocumentElement:Kt,getClippingRect:Nu,getOffsetParent:Mi,getElementRects:Pu,getClientRects:ku,getDimensions:Eu,getScale:ta,isElement:dt,isRTL:Iu};function Ai(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Mu(e,t){let r=null,a,n=Kt(e);function o(){var c;clearTimeout(a),(c=r)==null||c.disconnect(),r=null;}function s(c,d){c===void 0&&(c=false),d===void 0&&(d=1),o();let i=e.getBoundingClientRect(),{left:u,top:l,width:p,height:m}=i;if(c||t(),!p||!m)return;let b=Sa(l),x=Sa(n.clientWidth-(u+p)),h=Sa(n.clientHeight-(l+m)),g=Sa(u),f={rootMargin:-b+"px "+-x+"px "+-h+"px "+-g+"px",threshold:Tt(0,sr(1,d))||1},w=true;function k(y){let C=y[0].intersectionRatio;if(C!==d){if(!w)return s();C?s(false,C):a=setTimeout(()=>{s(false,1e-7);},1e3);}C===1&&!Ai(i,e.getBoundingClientRect())&&s(),w=false;}try{r=new IntersectionObserver(k,{...f,root:n.ownerDocument});}catch{r=new IntersectionObserver(k,f);}r.observe(e);}return s(true),o}function mn(e,t,r,a){a===void 0&&(a={});let{ancestorScroll:n=true,ancestorResize:o=true,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=false}=a,i=uo(e),u=n||o?[...i?fr(i):[],...fr(t)]:[];u.forEach(g=>{n&&g.addEventListener("scroll",r,{passive:true}),o&&g.addEventListener("resize",r);});let l=i&&c?Mu(i,r):null,p=-1,m=null;s&&(m=new ResizeObserver(g=>{let[v]=g;v&&v.target===i&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var f;(f=m)==null||f.observe(t);})),r();}),i&&!d&&m.observe(i),m.observe(t));let b,x=d?Gr(e):null;d&&h();function h(){let g=Gr(e);x&&!Ai(x,g)&&r(),x=g,b=requestAnimationFrame(h);}return r(),()=>{var g;u.forEach(v=>{n&&v.removeEventListener("scroll",r),o&&v.removeEventListener("resize",r);}),l?.(),(g=m)==null||g.disconnect(),m=null,d&&cancelAnimationFrame(b);}}var Li=wi;var Fi=Ci,Bi=ki,Oi=Ti;var mo=xi;var fn=(e,t,r)=>{let a=new Map,n={platform:po,...r},o={...n.platform,_c:a};return yi(e,t,{...n,platform:o})};var Lu=typeof document<"u",Fu=function(){},gn=Lu?Te.useLayoutEffect:Fu;function hn(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(!hn(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)&&!hn(e[o],t[o]))return false}return true}return e!==e&&t!==t}function Ui(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zi(e,t){let r=Ui(e);return Math.round(t*r)/r}function fo(e){let t=Te__namespace.useRef(e);return gn(()=>{t.current=e;}),t}function _i(e){e===void 0&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:o,floating:s}={},transform:c=true,whileElementsMounted:d,open:i}=e,[u,l]=Te__namespace.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:false}),[p,m]=Te__namespace.useState(a);hn(p,a)||m(a);let[b,x]=Te__namespace.useState(null),[h,g]=Te__namespace.useState(null),v=Te__namespace.useCallback(O=>{O!==y.current&&(y.current=O,x(O));},[]),f=Te__namespace.useCallback(O=>{O!==C.current&&(C.current=O,g(O));},[]),w=o||b,k=s||h,y=Te__namespace.useRef(null),C=Te__namespace.useRef(null),T=Te__namespace.useRef(u),N=d!=null,R=fo(d),G=fo(n),W=fo(i),M=Te__namespace.useCallback(()=>{if(!y.current||!C.current)return;let O={placement:t,strategy:r,middleware:p};G.current&&(O.platform=G.current),fn(y.current,C.current,O).then(F=>{let Q={...F,isPositioned:W.current!==false};z.current&&!hn(T.current,Q)&&(T.current=Q,Gi__namespace.flushSync(()=>{l(Q);}));});},[p,t,r,G,W]);gn(()=>{i===false&&T.current.isPositioned&&(T.current.isPositioned=false,l(O=>({...O,isPositioned:false})));},[i]);let z=Te__namespace.useRef(false);gn(()=>(z.current=true,()=>{z.current=false;}),[]),gn(()=>{if(w&&(y.current=w),k&&(C.current=k),w&&k){if(R.current)return R.current(w,k,M);M();}},[w,k,M,R,N]);let E=Te__namespace.useMemo(()=>({reference:y,floating:C,setReference:v,setFloating:f}),[v,f]),B=Te__namespace.useMemo(()=>({reference:w,floating:k}),[w,k]),$=Te__namespace.useMemo(()=>{let O={position:r,left:0,top:0};if(!B.floating)return O;let F=zi(B.floating,u.x),Q=zi(B.floating,u.y);return c?{...O,transform:"translate("+F+"px, "+Q+"px)",...Ui(B.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:F,top:Q}},[r,c,B.floating,u.x,u.y]);return Te__namespace.useMemo(()=>({...u,update:M,refs:E,elements:B,floatingStyles:$}),[u,M,E,B,$])}var Bu=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?mo({element:a.current,padding:n}).fn(r):{}:a?mo({element:a,padding:n}).fn(r):{}}}},vn=(e,t)=>({...Li(e),options:[e,t]}),go=(e,t)=>({...Fi(e),options:[e,t]});var ho=(e,t)=>({...Bi(e),options:[e,t]}),vo=(e,t)=>({...Oi(e),options:[e,t]});var bo=(e,t)=>({...Bu(e),options:[e,t]});function Ki(e){let t=Te__namespace.useRef(void 0),r=Te__namespace.useCallback(a=>{let n=e.map(o=>{if(o!=null){if(typeof o=="function"){let s=o,c=s(a);return typeof c=="function"?c:()=>{s(null);}}return o.current=a,()=>{o.current=null;}}});return ()=>{n.forEach(o=>o?.());}},e);return Te__namespace.useMemo(()=>e.every(a=>a==null)?null:a=>{t.current&&(t.current(),t.current=void 0),a!=null&&(t.current=r(a));},e)}var Hu={...Te__namespace},Wi=false,Vu=0,Hi=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Vu++;function Ku(){let[e,t]=Te__namespace.useState(()=>Wi?Hi():void 0);return Ea(()=>{e==null&&t(Hi());},[]),Te__namespace.useEffect(()=>{Wi=true;},[]),e}var ju=Hu.useId,ji=ju||Ku,Ra;process.env.NODE_ENV!=="production"&&(Ra=new Set);function Yu(){for(var e,t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];let n="Floating UI: "+r.join(" ");if(!((e=Ra)!=null&&e.has(n))){var o;(o=Ra)==null||o.add(n),console.warn(n);}}function qu(){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=Ra)!=null&&e.has(n))){var o;(o=Ra)==null||o.add(n),console.error(n);}}var Yi=Te__namespace.forwardRef(function(t,r){let{context:{placement:a,elements:{floating:n},middlewareData:{arrow:o,shift:s}},width:c=14,height:d=7,tipRadius:i=0,strokeWidth:u=0,staticOffset:l,stroke:p,d:m,style:{transform:b,...x}={},...h}=t;process.env.NODE_ENV!=="production"&&(r||Yu("The `ref` prop is required for `FloatingArrow`."));let g=ji(),[v,f]=Te__namespace.useState(false);if(Ea(()=>{if(!n)return;Et(n).direction==="rtl"&&f(true);},[n]),!n)return null;let[w,k]=a.split("-"),y=w==="top"||w==="bottom",C=l;(y&&s!=null&&s.x||!y&&s!=null&&s.y)&&(C=null);let T=u*2,N=T/2,R=c/2*(i/-8+1),G=d/2*i/4,W=!!m,M=C&&k==="end"?"bottom":"top",z=C&&k==="end"?"right":"left";C&&v&&(z=k==="end"?"left":"right");let E=o?.x!=null?C||o.x:"",B=o?.y!=null?C||o.y:"",$=m||"M0,0"+(" H"+c)+(" L"+(c-R)+","+(d-G))+(" Q"+c/2+","+d+" "+R+","+(d-G))+" Z",O={top:W?"rotate(180deg)":"",left:W?"rotate(90deg)":"rotate(-90deg)",bottom:W?"":"rotate(180deg)",right:W?"rotate(-90deg)":"rotate(90deg)"}[w];return jsxRuntime.jsxs("svg",{...h,"aria-hidden":true,ref:r,width:W?c:c+T,height:c,viewBox:"0 0 "+c+" "+(d>c?d:c),style:{position:"absolute",pointerEvents:"none",[z]:E,[M]:B,[w]:y||W?"100%":"calc(100% - "+T/2+"px)",transform:[O,b].filter(F=>!!F).join(" "),...x},children:[T>0&&jsxRuntime.jsx("path",{clipPath:"url(#"+g+")",fill:"none",stroke:p,strokeWidth:T+(m?0:1),d:$}),jsxRuntime.jsx("path",{stroke:T&&!m?h.fill:"none",d:$}),jsxRuntime.jsx("clipPath",{id:g,children:jsxRuntime.jsx("rect",{x:-N,y:N*(W?-1:1),width:c+T,height:c})})]})});function Xu(){let e=new Map;return {emit(t,r){var a;(a=e.get(t))==null||a.forEach(n=>n(r));},on(t,r){e.has(t)||e.set(t,new Set),e.get(t).add(r);},off(t,r){var a;(a=e.get(t))==null||a.delete(r);}}}var Ju=Te__namespace.createContext(null),Zu=Te__namespace.createContext(null),Qu=()=>{var e;return ((e=Te__namespace.useContext(Ju))==null?void 0:e.id)||null},ep=()=>Te__namespace.useContext(Zu);function tp(e){let{open:t=false,onOpenChange:r,elements:a}=e,n=ji(),o=Te__namespace.useRef({}),[s]=Te__namespace.useState(()=>Xu()),c=Qu()!=null;if(process.env.NODE_ENV!=="production"){let m=a.reference;m&&!dt(m)&&qu("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.");}let[d,i]=Te__namespace.useState(a.reference),u=vi((m,b,x)=>{o.current.openEvent=m?b:void 0,s.emit("openchange",{open:m,event:b,reason:x,nested:c}),r?.(m,b,x);}),l=Te__namespace.useMemo(()=>({setPositionReference:i}),[]),p=Te__namespace.useMemo(()=>({reference:d||a.reference||null,floating:a.floating||null,domReference:a.reference}),[d,a.reference,a.floating]);return Te__namespace.useMemo(()=>({dataRef:o,open:t,onOpenChange:u,elements:p,events:s,floatingId:n,refs:l}),[t,u,p,s,n,l])}function qi(e){e===void 0&&(e={});let{nodeId:t}=e,r=tp({...e,elements:{reference:null,floating:null,...e.elements}}),a=e.rootContext||r,n=a.elements,[o,s]=Te__namespace.useState(null),[c,d]=Te__namespace.useState(null),u=n?.domReference||o,l=Te__namespace.useRef(null),p=ep();Ea(()=>{u&&(l.current=u);},[u]);let m=_i({...e,elements:{...n,...c&&{reference:c}}}),b=Te__namespace.useCallback(f=>{let w=dt(f)?{getBoundingClientRect:()=>f.getBoundingClientRect(),getClientRects:()=>f.getClientRects(),contextElement:f}:f;d(w),m.refs.setReference(w);},[m.refs]),x=Te__namespace.useCallback(f=>{(dt(f)||f===null)&&(l.current=f,s(f)),(dt(m.refs.reference.current)||m.refs.reference.current===null||f!==null&&!dt(f))&&m.refs.setReference(f);},[m.refs]),h=Te__namespace.useMemo(()=>({...m.refs,setReference:x,setPositionReference:b,domReference:l}),[m.refs,x,b]),g=Te__namespace.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),v=Te__namespace.useMemo(()=>({...m,...a,refs:h,elements:g,nodeId:t}),[m,h,g,t,a]);return Ea(()=>{a.dataRef.current.floatingContext=v;let f=p?.nodesRef.current.find(w=>w.id===t);f&&(f.context=v);}),Te__namespace.useMemo(()=>({...m,context:v,refs:h,elements:g}),[m,h,g,v])}var yo=Te.createContext(null);function Xi(){return Te.useContext(yo)}function Ve({children:e,container:t}){let[r,a]=Te.useState(false),n=Xi();if(Te.useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:s,themeName:c}=n,d={"--asakaa-color-background-primary":s.bgPrimary,"--asakaa-color-background-secondary":s.bgSecondary,"--asakaa-color-background-card":s.bgGrid,"--asakaa-color-background-hover":s.hoverBg,"--asakaa-color-text-primary":s.textPrimary,"--asakaa-color-text-secondary":s.textSecondary,"--asakaa-color-text-tertiary":s.textTertiary,"--asakaa-color-text-inverse":s.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":s.border,"--asakaa-color-border-hover":s.borderLight,"--asakaa-color-border-subtle":s.borderLight,"--asakaa-color-interactive-primary":s.accent,"--asakaa-color-interactive-primaryHover":s.accentHover,"--asakaa-color-interactive-primaryBorder":`${s.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${s.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${s.accent}33`,"--asakaa-color-status-success":s.statusCompleted,"--asakaa-color-status-warning":s.milestone,"--asakaa-color-status-error":s.criticalPath,"--asakaa-color-danger":s.criticalPath,"--asakaa-color-danger-border":`${s.criticalPath}4D`,"--asakaa-color-danger-background":`${s.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${s.criticalPath}26`};return Gi.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:d,children:e}),o)}return Gi.createPortal(e,o)}function Zi(e,t,r=true){Te.useEffect(()=>{if(!r)return;let a=o=>{(Array.isArray(e)?e:[e]).some(d=>{let i=d.current;if(!i)return false;let u=o.target;return i===u||i.contains(u)})||t(o);},n=setTimeout(()=>{document.addEventListener("mousedown",a),document.addEventListener("touchstart",a);},0);return ()=>{clearTimeout(n),document.removeEventListener("mousedown",a),document.removeEventListener("touchstart",a);}},[e,t,r]);}function el({itemCount:e,onSelect:t,onEscape:r,enabled:a=true,loop:n=true,containerRef:o}){let[s,c]=Te.useState(-1);Te.useEffect(()=>{if(!a||s===-1||!o?.current)return;let l=o.current.querySelector(`[data-index="${s}"]`);l&&l.scrollIntoView({block:"nearest",behavior:"smooth"});},[s,a,o]);let d=Te.useCallback(u=>{if(a)switch(u.key){case "ArrowDown":u.preventDefault(),c(l=>l===-1?0:l===e-1?n?0:l:l+1);break;case "ArrowUp":u.preventDefault(),c(l=>l===-1?e-1:l===0?n?e-1:l:l-1);break;case "Enter":case " ":u.preventDefault(),s!==-1&&t&&t(s);break;case "Escape":u.preventDefault(),r&&r();break;case "Home":u.preventDefault(),c(0);break;case "End":u.preventDefault(),c(e-1);break;}},[a,s,e,n,t,r]),i=Te.useCallback(u=>({"data-active":u===s,"data-index":u,role:"option",tabIndex:-1}),[s]);return {activeIndex:s,setActiveIndex:c,handleKeyDown:d,getItemProps:i}}function hr({trigger:e,children:t,isOpen:r,onOpenChange:a,placement:n="bottom-start",offsetDistance:o=8,maxHeight:s=320,minWidth:c="trigger",maxWidth:d,showArrow:i=false,className:u="",triggerClassName:l="",disableClickOutside:p=false,disableKeyboardNav:m=false,itemCount:b=0,onSelectItem:x,onOpen:h,onClose:g,animationDuration:v=200,zIndex:f=1e3}){let[w,k]=Te.useState(false),y=r!==void 0?r:w,C=Te.useCallback(me=>{let I=y;r===void 0&&k(me),a?.(me),me&&!I?h?.():!me&&I&&g?.();},[r,a,h,g,y]),T=Te.useCallback(()=>{C(!y);},[y,C]),N=Te.useCallback(()=>{C(false);},[C]),R=Te.useRef(null),G=Te.useRef(null),W=Te.useRef(null),{refs:M,floatingStyles:z,context:E}=qi({open:y,onOpenChange:C,placement:n,middleware:[vn(o),ho({padding:8}),go({padding:8}),vo({apply({rects:me,elements:I}){Object.assign(I.floating.style,{minWidth:c==="trigger"?`${me.reference.width}px`:c?`${c}px`:void 0,maxWidth:d?`${d}px`:void 0,maxHeight:`${s}px`});},padding:8}),i?bo({element:W}):null].filter(Boolean),whileElementsMounted:mn}),B=Ki([R,M.setReference]);Zi([R,G],N,y&&!p);let{activeIndex:$,setActiveIndex:O,handleKeyDown:F}=el({itemCount:b,onSelect:x,onEscape:N,enabled:y&&!m,loop:true,containerRef:G}),Q=()=>typeof e=="function"?e({isOpen:y,toggle:T}):e,Y=()=>typeof t=="function"?t({activeIndex:$,setActiveIndex:O,close:N}):t;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:B,className:`dropdown-trigger ${l}`,onClick:T,children:Q()}),y&&jsxRuntime.jsx(Ve,{children:jsxRuntime.jsxs("div",{ref:M.setFloating,style:{...z,zIndex:f},className:`dropdown-content ${u}`,role:"menu","aria-orientation":"vertical",onKeyDown:F,children:[jsxRuntime.jsx("div",{ref:G,className:"dropdown-inner",children:Y()}),i&&jsxRuntime.jsx(Yi,{ref:W,context:E,className:"dropdown-arrow"})]})})]})}var rl={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"}},pp="#BDC3C7",mp="#868e96",fp=({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"})]}),al=()=>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 Ia({priority:e,onChange:t,className:r}){let a=e?rl[e]:null,n=document.documentElement.getAttribute("data-theme")==="dark",o=a?n?a.darkColor:a.color:n?mp:pp,s=d=>{t(d);},c=Object.entries(rl);return jsxRuntime.jsx(hr,{trigger:({isOpen:d})=>jsxRuntime.jsx("button",{className:`flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95 ${r||""}`,style:{background:e?`${o}10`:"transparent",boxShadow:e?`0 0 0 2px ${o}30 inset`:"none",transform:d?"scale(1.1)":"scale(1)"},title:a?.label||"Set priority","aria-label":"Select priority","aria-expanded":d,"aria-haspopup":"menu",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:o,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:o,fillOpacity:e?"0.6":"0.4"})})}),placement:"bottom-start",minWidth:180,maxHeight:280,itemCount:c.length+1,onSelectItem:d=>{let i=c[d];s(i?i[0]:void 0);},children:({activeIndex:d,close:i})=>jsxRuntime.jsxs("div",{className:"priority-dropdown",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",children:"Priority"}),jsxRuntime.jsxs("div",{className:"dropdown-section",children:[c.map(([u,l],p)=>{let m=n?l.darkColor:l.color,b=d===p,x=e===u;return jsxRuntime.jsxs("button",{onClick:()=>{s(u),i();},className:"dropdown-item","data-active":b,"data-index":p,role:"option","aria-selected":x,style:{color:b?m:"inherit",fontWeight:x?600:400},children:[jsxRuntime.jsx(fp,{color:m}),jsxRuntime.jsx("span",{children:l.label}),x&&jsxRuntime.jsx(al,{})]},u)}),jsxRuntime.jsx("div",{style:{borderTop:"1px solid var(--asakaa-color-border-default, #e0e0e0)",marginTop:"4px",paddingTop:"4px"},children:jsxRuntime.jsxs("button",{onClick:()=>{s(void 0),i();},className:"dropdown-item","data-active":d===c.length,"data-index":c.length,role:"option","aria-selected":!e,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"var(--asakaa-color-text-tertiary, #9e9e9e)",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{children:"Clear"}),!e&&jsxRuntime.jsx(al,{})]})})]})]})})}var ol=[{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 Ma({startDate:e,endDate:t,onChange:r,className:a}){let[n,o]=Te.useState(e||""),[s,c]=Te.useState(t||""),d=(b,x)=>{let h=new Date,g=new Date(h);g.setDate(g.getDate()+b);let v=h.toISOString().split("T")[0]||"",f=g.toISOString().split("T")[0]||"";o(v),c(f),r(v,f),x();},i=b=>{r(n||void 0,s||void 0),b();},u=()=>{if(!e||!t)return "Set date";let b=v=>{if(v instanceof Date)return v;if(typeof v!="string"||!v.match(/^\d{4}-\d{2}-\d{2}$/))return null;let f=v.split("-").map(Number);if(f.length!==3||f.some(C=>isNaN(C)))return null;let w=f[0],k=f[1],y=f[2];return w===void 0||k===void 0||y===void 0?null:new Date(w,k-1,y)},x=b(e),h=b(t);if(!x||!h||isNaN(x.getTime())||isNaN(h.getTime()))return "Set date";let g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${g[x.getMonth()]} ${x.getDate()} \u2013 ${g[h.getMonth()]} ${h.getDate()}`},l=e&&t,m=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),b<x})();return jsxRuntime.jsx(hr,{trigger:({isOpen:b})=>jsxRuntime.jsxs("button",{className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${m?"asakaa-date-overdue":"asakaa-date"} ${a||""}`,style:{transform:b?"scale(1.05)":"scale(1)"},title:l?`${u()}`:"Set date range","aria-label":"Select date range","aria-expanded":b,"aria-haspopup":"menu",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:u()})]}),placement:"bottom-start",minWidth:320,maxHeight:480,itemCount:ol.length,onOpen:()=>{o(e||""),c(t||"");},children:({activeIndex:b,close:x})=>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:ol.map((h,g)=>jsxRuntime.jsx("button",{onClick:()=>d(h.days,x),className:"dropdown-quick-button","data-active":b===g,"data-index":g,role:"option",children:h.label},h.label))})]}),jsxRuntime.jsxs("div",{className:"dropdown-button-wrapper",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",style:{marginBottom:"12px"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"dropdown-form-actions",children:[jsxRuntime.jsxs("div",{className:"dropdown-form-group",children:[jsxRuntime.jsx("label",{className:"dropdown-label",children:"Start Date"}),jsxRuntime.jsx("input",{type:"date",value:n,onChange:h=>o(h.target.value),className:"dropdown-input"})]}),jsxRuntime.jsxs("div",{className:"dropdown-form-group",children:[jsxRuntime.jsx("label",{className:"dropdown-label",children:"End Date"}),jsxRuntime.jsx("input",{type:"date",value:s,onChange:h=>c(h.target.value),className:"dropdown-input"})]}),jsxRuntime.jsx("button",{onClick:()=>i(x),className:"dropdown-primary-button",children:"Apply"}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{o(""),c(""),r(void 0,void 0),x();},className:"dropdown-danger-button",children:"Clear Dates"})]})]})]})})}function Ur({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[o,s]=Te.useState(""),c=l=>{let p=e.some(m=>m.id===l.id);r(p?e.filter(m=>m.id!==l.id):[...e,l]);},d=t.filter(l=>l.name.toLowerCase().includes(o.toLowerCase())),i=e.slice(0,n),u=e.length-n;return jsxRuntime.jsx(hr,{trigger:({isOpen:l})=>jsxRuntime.jsx("button",{className:`dropdown-avatar-trigger ${a||""}`,style:{transform:l?"scale(1.05)":"scale(1)"},title:e.length>0?`${e.length} assigned`:"Assign users","aria-label":"Assign users","aria-expanded":l,"aria-haspopup":"menu",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[i.map(p=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:p.name,style:{backgroundColor:p.color,color:"#fff"},children:p.avatar?jsxRuntime.jsx("img",{src:p.avatar,alt:p.name,className:"asakaa-avatar-img"}):p.initials},p.id)),u>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar dropdown-avatar-overflow",children:["+",u]})]}):jsxRuntime.jsx("div",{className:"dropdown-avatar-empty-trigger",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),placement:"bottom-start",minWidth:300,maxHeight:350,itemCount:d.length,onSelectItem:l=>{let p=d[l];p&&c(p);},onClose:()=>s(""),children:({activeIndex:l,close:p})=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",children:"Assign Users"}),jsxRuntime.jsx("div",{className:"dropdown-search-wrapper",children:jsxRuntime.jsx("input",{type:"text",value:o,onChange:m=>s(m.target.value),placeholder:"Search users...",className:"dropdown-search-input",autoFocus:true})}),jsxRuntime.jsx("div",{className:"dropdown-list",children:d.length===0?jsxRuntime.jsx("div",{className:"dropdown-empty",children:"No users found"}):d.map((m,b)=>{let x=e.some(h=>h.id===m.id);return jsxRuntime.jsxs("button",{onClick:()=>{c(m);},className:"dropdown-item","data-active":l===b,"data-index":b,role:"option","aria-selected":x,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}),x&&jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 9L7.5 12.5L14 6",stroke:"var(--asakaa-color-interactive-primary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p();},className:"dropdown-danger-button",children:"Clear All"})})]})})}function La({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n}){let[o,s]=Te.useState(""),[c,d]=Te.useState(t.length>0),i=m=>{if(t.includes(m)){let x=t.filter(h=>h!==m);a(x),x.length===0&&d(false);}else a([...t,m]),d(true);},u=()=>{let m=!c;d(m),m||a([]);},l=r.filter(m=>m.id!==e).filter(m=>m.title.toLowerCase().includes(o.toLowerCase())||m.id.toLowerCase().includes(o.toLowerCase())),p=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsx(hr,{trigger:({isOpen:m})=>jsxRuntime.jsxs("button",{className:`flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5 ${n||""}`,style:{transform:m?"scale(1.05)":"scale(1)"},title:t.length>0?`${t.length} dependencies`:"Add dependencies","aria-label":"Select dependencies","aria-expanded":m,"aria-haspopup":"menu",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:p},children:t.length})]}),placement:"bottom-start",minWidth:300,maxHeight:350,itemCount:c?l.length:0,onSelectItem:m=>{let b=l[m];b&&i(b.id);},onClose:()=>s(""),onOpen:()=>d(t.length>0),children:({activeIndex:m,close:b})=>jsxRuntime.jsxs("div",{className:"dependencies-dropdown",children:[jsxRuntime.jsx("div",{className:"dropdown-section-header",children:"Task Dependencies"}),jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",style:{borderBottom:"1px solid var(--asakaa-color-border-subtle)"},children:jsxRuntime.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},onClick:u,children:[jsxRuntime.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s",border:c?"2px solid var(--asakaa-color-interactive-primary)":"2px solid var(--asakaa-color-border-default)",background:c?"var(--asakaa-color-interactive-primary)":"transparent"},children:c&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{fontSize:"13px",fontWeight:600,color:"var(--asakaa-color-text-primary)"},children:"Has dependencies"})]})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"dropdown-search-wrapper",children:jsxRuntime.jsx("input",{type:"text",value:o,onChange:x=>s(x.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((x,h)=>{let g=t.includes(x.id);return jsxRuntime.jsxs("button",{onClick:()=>i(x.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:x.title}),jsxRuntime.jsx("div",{style:{fontSize:"11px",marginTop:"2px",color:"var(--asakaa-color-text-secondary)"},children:x.id})]})]},x.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"dropdown-button-wrapper",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(false),b();},className:"dropdown-danger-button",children:"Clear All Dependencies"})})]})})}var vr=Te.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:o,onUpdate:s,availableUsers:c=[],allCards:d=[]})=>{let{attributes:i,listeners:u,setNodeRef:l,transform:p,transition:m,isDragging:b}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),x={transform:Qa.Transform.toString(p),transition:m};if(t)return jsxRuntime.jsx("div",{ref:l,style:x,...i,...u,onClick:()=>r?.(e),children:t(e)});let h=c.filter(g=>e.assignedUserIds?.includes(g.id));return jsxRuntime.jsxs("div",{ref:l,style:x,className:oe("asakaa-card",b&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",o),...i,...u,onClick:g=>{g.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Ia,{priority:e.priority,onChange:g=>s?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ma,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(g,v)=>s?.(e.id,{startDate:g,endDate:v})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ur,{assignedUsers:h,availableUsers:c,onChange:g=>s?.(e.id,{assignedUserIds:g.map(v=>v.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(La,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:d,onChange:g=>s?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies));vr.displayName="Card";function ll({columnTitle:e,onRename:t,className:r}){let[a,n]=Te.useState(false),[o,s]=Te.useState(false),[c,d]=Te.useState(e),[i,u]=Te.useState({top:0,left:0}),l=Te.useRef(null),p=Te.useRef(null),m=Te.useRef(null);Te.useEffect(()=>{if(a&&p.current){let g=p.current.getBoundingClientRect();u({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[a]),Te.useEffect(()=>{let g=v=>{l.current&&!l.current.contains(v.target)&&!p.current?.contains(v.target)&&(n(false),s(false));};if(a)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[a]),Te.useEffect(()=>{let g=v=>{v.key==="Escape"&&(n(false),s(false),d(e));};if(a)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[a,e]),Te.useEffect(()=>{o&&m.current&&(m.current.focus(),m.current.select());},[o]);let b=()=>{s(true),d(e);},x=()=>{let g=c.trim();g&&g!==e&&t(g),s(false),n(false),d(e);},h=g=>{g.key==="Enter"?x():g.key==="Escape"&&(s(false),d(e));};return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>n(!a),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),a&&jsxRuntime.jsx(Ve,{children:jsxRuntime.jsx("div",{ref:l,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${i.top}px`,left:`${i.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:o?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:m,type:"text",value:c,onChange:g=>d(g.target.value),onKeyDown:h,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:b,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]})})})})]})}var aa=Te.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:o,onCardClick:s,onCardUpdate:c,availableUsers:d,allCards:i,enableVirtualization:u,cardHeight:l=120,isCollapsed:p,onToggleCollapse:m,onColumnRename:b,className:x})=>{let{setNodeRef:h,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),v=Te.useRef(null),f=u??ei(t.length),w=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>v.current,estimateSize:()=>l,enabled:f});if(r)return jsxRuntime.jsx("div",{ref:h,className:x,children:r(e,t)});let y=(()=>{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}})(),C=y.state==="exceeded",T=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:oe("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",C&&"ring-2 ring-asakaa-accent-red",x),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:oe(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&y.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${y.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[y.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),y.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),y.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),y.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),b&&jsxRuntime.jsx(ll,{columnTitle:e.title,onRename:N=>b(e.id,N)}),m&&jsxRuntime.jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsxRuntime.jsx("div",{ref:v,className:"asakaa-column-cards",style:{maxHeight:f?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(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:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(N=>{let R=t[N.index];return R?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(vr,{card:R,render:a,onClick:s,onUpdate:c,availableUsers:d,allCards:i})},R.id):null})}):t.map(N=>jsxRuntime.jsx(vr,{card:N,render:a,onClick:s,onUpdate:c,availableUsers:d,allCards:i},N.id))})})]})});aa.displayName="Column";function Co({title:e,onSave:t,className:r}){let[a,n]=Te.useState(false),[o,s]=Te.useState(e),c=Te.useRef(null);Te.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.select());},[a]);let d=()=>{let u=o.trim();u&&u!==e?t(u):s(e),n(false);},i=u=>{u.key==="Enter"?d():u.key==="Escape"&&(s(e),n(false));};return a?jsxRuntime.jsx("input",{ref:c,type:"text",value:o,onChange:u=>s(u.target.value),onBlur:d,onKeyDown:i,className:oe("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",r),maxLength:50}):jsxRuntime.jsx("h2",{className:oe("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function Do(){let[e,t]=Te.useState(()=>core.dragStore.getState());Te.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let r=Te.useCallback(a=>{core.dragStore.setState(a);},[]);return [e,r]}function Sr({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:o=[],className:s,style:c,isLoading:d,error:i,children:u}){let[l,p]=Do(),m=Te.useCallback((k,y)=>{t.onCardUpdate?.(k,y);},[t]),b=Te.useCallback((k,y)=>{t.onColumnUpdate?.(k,{title:y});},[t]),x=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),h=Te.useMemo(()=>{let k=new Map;return e.columns.forEach(y=>{let C=y.cardIds.map(T=>e.cards.find(N=>N.id===T)).filter(T=>T!==void 0).sort((T,N)=>T.position-N.position);k.set(y.id,C);}),k},[e.cards,e.columns]),g=Te.useCallback(k=>{let{active:y}=k,C=e.cards.find(T=>T.id===y.id);C&&p({isDragging:true,draggedCardId:C.id,sourceColumnId:C.columnId,targetColumnId:C.columnId});},[e.cards,p]),v=Te.useCallback(k=>{let{active:y,over:C}=k;if(!C||!e.cards.find(R=>R.id===y.id))return;let N=null;C.data.current?.type==="column"?N=C.id:C.data.current?.type==="card"&&(N=e.cards.find(G=>G.id===C.id)?.columnId||null),N&&N!==l.targetColumnId&&p({...l,targetColumnId:N});},[e.cards,l,p]),f=Te.useCallback(async k=>{let{active:y,over:C}=k;if(p({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!C)return;let T=e.cards.find(W=>W.id===y.id);if(!T)return;let N,R;if(C.data.current?.type==="column"){N=C.id;let W=h.get(N)||[];R=to(W,0);}else {let W=e.cards.find(E=>E.id===C.id);if(!W)return;N=W.columnId;let M=h.get(N)||[],z=M.findIndex(E=>E.id===C.id);R=to(M,z);}let G=e.columns.find(W=>W.id===N);if(G&&G.wipLimit&&G.wipLimitType==="hard"){let W=h.get(N)||[];if(T.columnId!==N&&W.length>=G.wipLimit){t.onWipLimitExceeded?.(G,T);return}}(T.columnId!==N||T.position!==R)&&await t.onCardMove?.(T.id,N,R);},[e.cards,e.columns,h,t,p]),w=Te.useCallback(k=>{r?.(k);},[r]);return d?jsxRuntime.jsx("div",{className:oe("asakaa-board",s),style:c,children:jsxRuntime.jsx(zp,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:oe("asakaa-board",s),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(core$1.DndContext,{sensors:x,collisionDetection:core$1.closestCorners,onDragStart:g,onDragOver:v,onDragEnd:f,children:[jsxRuntime.jsxs("div",{className:oe("asakaa-board",s),style:c,children:[e.columns.sort((k,y)=>k.position-y.position).map(k=>{let y=h.get(k.id)||[];return jsxRuntime.jsx(aa,{column:k,cards:y,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,onCardClick:w,onCardUpdate:m,onColumnRename:b,availableUsers:o,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight},k.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(vr,{card:e.cards.find(k=>k.id===l.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})}function zp({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 Ba=class extends core.BaseViewAdapter{constructor(r={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=r,this.options={animations:r.viewOptions?.animations??true,virtualScrolling:r.viewOptions?.virtualScrolling??false,theme:r.viewOptions?.theme??"dark",readonly:r.viewOptions?.readonly??false};}mount(r,a){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=r,this.data=a,this.root=client.createRoot(r),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(r){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=r,this.render(),this.emit("view:updated",{viewId:this.id,data:r});}configure(r){this.options={...this.options,...r},this.isMounted()&&this.render();}async export(r){if(!this.data)throw new Error("No data to export");switch(r){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${r}`)}}render(){if(!this.root||!this.data)return;let r={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(Sr,{board:r,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let r=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(a=>{let n=this.data.columns.find(o=>o.id===a.columnId);r.push([a.id,a.title,n?.title||"",a.description||"",a.labels?.join(", ")||"",a.assignedUserIds?.join(", ")||a.assigneeId||"",a.dueDate?.toString()||"",a.position.toString()]);}),r.map(a=>a.map(n=>`"${n}"`).join(",")).join(`
|
|
5
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let a=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,o)=>{a.toBlob(s=>{s?n(s):o(new Error("Failed to create PNG blob"));},"image/png");})}};function pl(e={}){return new Ba(e)}var oa=class extends Te.Component{constructor(r){super(r);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,a){let{onError:n,componentName:o}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${o||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(s){console.error("Error in error handler:",s);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:o,componentName:s}=this.props;return r&&a?o?o(a,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:s?`Error in ${s}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:a.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:a.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function So(e,t){let r=a=>jsxRuntime.jsx(oa,{...t,children:jsxRuntime.jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Eo({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:o,onGeneratePlan:s,onPredictRisks:c,onOpenAIUsage:d,shortcut:i="k",className:u=""}){let[l,p]=Te.useState(false),[m,b]=Te.useState(""),[x,h]=Te.useState("home"),[g,v]=Te.useState(""),[f,w]=Te.useState("");Te.useEffect(()=>{let T=N=>{(N.metaKey||N.ctrlKey)&&N.key===i&&(N.preventDefault(),p(R=>!R)),N.key==="Escape"&&(p(false),h("home"),b(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),Te.useEffect(()=>{l||(h("home"),b(""),v(""),w(""));},[l]);let k=Te.useCallback(()=>{p(false);},[]),y=Te.useCallback(T=>{let[N,R]=T.split(":");switch(N){case "create-card":h("create-card");break;case "create-card-in":v(R||"");break;case "navigate":R?(r?.(R),k()):h("navigate");break;case "search":a?.(m),k();break;case "priority":h("priority");break;case "set-priority":f&&R&&(n?.(f,R),k());break;case "assign":h("assign");break;case "assign-user":f&&R&&(o?.(f,R),k());break;case "ai":h("ai");break;case "ai-generate-plan":s?.(),k();break;case "ai-predict-risks":c?.(),k();break;case "ai-usage":d?.(),k();break;case "back":h("home");break;}},[m,f,t,r,a,n,o,s,c,d,k]),C=Te.useCallback(()=>{g&&m.trim()&&(t?.(g,m.trim()),k());},[g,m,t,k]);return l?jsxRuntime.jsx(Ve,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:m,onValueChange:b,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&g?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&x==="create-card"&&g&&C();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:y,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:N},N))})]},T.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(T=>{let N=e.columns.find(R=>R.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:y,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:N?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},T.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:y,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:y,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:y,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function Vp(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 Kp(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 jp(e){return e.startsWith("image/")}function za({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:o=10}){let[s,c]=Te.useState(false),[d,i]=Te.useState(false),[u,l]=Te.useState(null),p=Te.useRef(null),m=Te.useCallback(y=>{let C=[],T=[];return e.length+y.length>o?(T.push(`Maximum ${o} files allowed`),{valid:C,errors:T}):(y.forEach(N=>{if(N.size/1048576>a){T.push(`${N.name} is too large (max ${a}MB)`);return}if(n&&!n.some(G=>N.type.match(G))){T.push(`${N.name} has invalid file type`);return}C.push(N);}),{valid:C,errors:T})},[e.length,o,a,n]),b=Te.useCallback(async y=>{let{valid:C,errors:T}=m(y);if(T.length>0){l(T.join(", ")),setTimeout(()=>l(null),5e3);return}if(C.length!==0){i(true),l(null);try{await t?.(C);}catch(N){l(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[m,t]),x=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(true);},[]),h=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(false);},[]),g=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation();},[]),v=Te.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(false);let C=Array.from(y.dataTransfer.files);b(C);},[b]),f=Te.useCallback(y=>{let C=y.target.files?Array.from(y.target.files):[];b(C),p.current&&(p.current.value="");},[b]),w=Te.useCallback(()=>{p.current?.click();},[]),k=Te.useCallback(y=>{confirm("Are you sure you want to delete this attachment?")&&r?.(y);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${s?"dragging":""} ${d?"uploading":""}`,onDragEnter:x,onDragLeave:h,onDragOver:g,onDrop:v,onClick:w,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:f,style:{display:"none"},accept:n?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:s?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",a,"MB \u2022 ",e.length,"/",o," files"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(y=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:jp(y.type)&&y.url?jsxRuntime.jsx("img",{src:y.thumbnailUrl||y.url,alt:y.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Kp(y.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:y.name,children:y.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Vp(y.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(y.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(y.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},y.id))})]})}function Po({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:c=[],aiInsights:d=[],attachments:i=[],onAddComment:u,onDeleteComment:l,onUploadAttachments:p,onDeleteAttachment:m,onSuggestAssignee:b,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:g="user-1"}){let[v,f]=Te.useState("details"),[w,k]=Te.useState(false),[y,C]=Te.useState({}),[T,N]=Te.useState(""),[R,G]=Te.useState(false),[W,M]=Te.useState({});if(!t||!e)return null;let z=Te.useCallback(()=>{k(false),C({}),f("details"),N(""),M({}),r();},[r]),E=Te.useCallback(()=>{a&&Object.keys(y).length>0&&(a(e.id,y),C({}),k(false));},[e.id,y,a]),B=Te.useCallback(()=>{n&&window.confirm("Are you sure you want to delete this card?")&&(n(e.id),z());},[e.id,n,z]),$=Te.useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),N(""));},[e.id,T,u]),O=Te.useCallback(async()=>{if(b){G(true);try{let I=await b(e);M(ce=>({...ce,assignees:I}));}catch(I){console.error("Failed to suggest assignee:",I);}finally{G(false);}}},[e,b]),F=Te.useCallback(async()=>{if(x){G(true);try{let I=await x(e);M(ce=>({...ce,subtasks:I}));}catch(I){console.error("Failed to generate subtasks:",I);}finally{G(false);}}},[e,x]),Q=Te.useCallback(async()=>{if(h){G(true);try{let I=await h(e);M(ce=>({...ce,effort:I}));}catch(I){console.error("Failed to estimate effort:",I);}finally{G(false);}}},[e,h]),Y={...e,...y},me=o.filter(I=>Y.assignedUserIds?.includes(I.id));return jsxRuntime.jsx(Ve,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:z,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:I=>I.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:Y.priority==="URGENT"?"#EF4444":Y.priority==="HIGH"?"#F59E0B":Y.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsxRuntime.jsx("input",{type:"text",value:y.title??Y.title,onChange:I=>C({...y,title:I.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:Y.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[w?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:E,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{k(false),C({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>k(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:B,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:z,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>f("details"),className:`card-detail-tab ${v==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>f("comments"),className:`card-detail-tab ${v==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${v==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("attachments"),className:`card-detail-tab ${v==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("ai"),className:`card-detail-tab ${v==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[v==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),w?jsxRuntime.jsx("textarea",{value:y.description??Y.description??"",onChange:I=>C({...y,description:I.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:Y.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsxRuntime.jsx("select",{multiple:true,value:y.assignedUserIds??Y.assignedUserIds??[],onChange:I=>{let ce=Array.from(I.target.selectedOptions,se=>se.value);C({...y,assignedUserIds:ce});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:o.map(I=>jsxRuntime.jsx("option",{value:I.id,children:I.name},I.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:me.length>0?me.map(I=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:I.color},children:I.initials}),jsxRuntime.jsx("span",{children:I.name})]},I.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),w?jsxRuntime.jsxs("select",{value:y.priority??Y.priority??"",onChange:I=>C({...y,priority:I.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:Y.priority==="URGENT"?"#EF4444":Y.priority==="HIGH"?"#F59E0B":Y.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:Y.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:Y.labels&&Y.labels.length>0?Y.labels.map(I=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:I},I)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),w?jsxRuntime.jsx("input",{type:"date",value:y.startDate?new Date(y.startDate).toISOString().split("T")[0]:Y.startDate?new Date(Y.startDate).toISOString().split("T")[0]:"",onChange:I=>C({...y,startDate:I.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:Y.startDate?new Date(Y.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsxRuntime.jsx("input",{type:"date",value:y.endDate?new Date(y.endDate).toISOString().split("T")[0]:Y.endDate?new Date(Y.endDate).toISOString().split("T")[0]:"",onChange:I=>C({...y,endDate:I.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:Y.endDate?new Date(Y.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:y.estimatedTime??Y.estimatedTime??"",onChange:I=>C({...y,estimatedTime:I.target.value?parseFloat(I.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:Y.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:Y.dependencies&&Y.dependencies.length>0?Y.dependencies.map(I=>{let ce=typeof I=="string"?I:I.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:Y.createdAt?new Date(Y.createdAt).toLocaleString():"Unknown"})]})]}),v==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:I=>N(I.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:$,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:s.length>0?s.map(I=>{let ce=o.find(se=>se.id===I.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(I.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(I.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:I.content})]},I.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),v==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(I=>{let ce=o.find(se=>se.id===I.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[I.type.includes("CREATED")&&"\u2795",I.type.includes("UPDATED")&&"\u270F\uFE0F",I.type.includes("MOVED")&&"\u27A1\uFE0F",I.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",I.type.includes("COMMENT")&&"\u{1F4AC}",I.type.includes("ASSIGNED")&&"\u{1F464}",I.type.includes("PRIORITY")&&"\u{1F3AF}",I.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",I.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"})," ",I.type.replace(/_/g," ").toLowerCase(),I.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:I.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(I.timestamp).toLocaleString()})]})]},I.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),v==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(za,{cardId:e.id,attachments:i,onUpload:p?I=>p(e.id,I):void 0,onDelete:m,currentUserId:g,maxSizeMB:10,maxFiles:20})}),v==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:O,disabled:R||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:F,disabled:R||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Q,disabled:R||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),W.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((I,ce)=>{let se=o.find(bt=>bt.id===I.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[se&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:se.color},children:se.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:se?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:I.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(I.confidence*100).toFixed(0),"%"]})]})]},ce)})]}),W.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((I,ce)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:I.title}),I.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:I.description}),I.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",I.estimatedTime,"h"]})]},ce))]}),W.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[W.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),d.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),d.map(I=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${I.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:I.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:I.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:I.description}),I.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",I.suggestedAction]})]},I.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&d.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}var Zp=["LOW","MEDIUM","HIGH","URGENT"],Qp=["todo","in-progress","review","done"];function Mo({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:c=[],onAddComment:d,onDeleteComment:i,currentUser:u,onAIGenerateDescription:l,onAICreateSubtasks:p,onAIFindSimilar:m,availableColumns:b=[],availableLabels:x=[]}){let[h,g]=Te.useState(e),[v,f]=Te.useState(false),[w,k]=Te.useState([]),[y,C]=Te.useState(false),[T,N]=Te.useState(""),[R,G]=Te.useState(""),[W,M]=Te.useState("all"),[z,E]=Te.useState(false),[B,$]=Te.useState(false),[O,F]=Te.useState(false),[Q,Y]=Te.useState(false),[me,I]=Te.useState(false),[ce,se]=Te.useState(false),bt=Te.useRef(null),Ze=Te.useRef(null),ar=Te.useRef(null),Ce=Te.useRef(null),mt=Te.useRef(null),ft=Te.useRef(null),_t=Te.useRef(null),pr=Te.useRef(null);Te.useEffect(()=>{e&&!h?g({...e}):e&&h&&e.id!==h.id&&g({...e});},[e,h]),Te.useEffect(()=>{let D=U=>{let ue=U.target;Ce.current&&!Ce.current.contains(ue)&&E(false),mt.current&&!mt.current.contains(ue)&&$(false),ft.current&&!ft.current.contains(ue)&&F(false),_t.current&&!_t.current.contains(ue)&&Y(false);};if(z||B||O||Q)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[z,B,O,Q]),Te.useEffect(()=>{if(!t)return;let D=U=>{let ue=U.target,he=ue.tagName==="INPUT"||ue.tagName==="TEXTAREA"||ue.isContentEditable;if(U.key==="Escape"){U.preventDefault(),z||B||O||Q||me||ce?(E(false),$(false),F(false),Y(false),I(false),se(false)):he||r();return}if(he&&U.key!=="Escape")return;let Le=U.metaKey||U.ctrlKey;switch(U.key.toLowerCase()){case "s":U.preventDefault(),E(true);break;case "a":U.preventDefault(),F(true);break;case "p":U.preventDefault(),$(true);break;case "l":U.preventDefault(),Y(true);break;case "d":Le||(U.preventDefault(),I(true),setTimeout(()=>pr.current?.focus(),0));break;case "e":Le||(U.preventDefault(),se(true));break;case "i":U.preventDefault(),f(true),setTimeout(()=>Ze.current?.focus(),0);break;case "t":U.preventDefault(),C(true);break;case "c":U.preventDefault(),ar.current?.focus();break}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[t,r,z,B,O,Q,me,ce]);let Lr=Te.useCallback(D=>{let U=D.currentTarget.textContent?.trim()||"";if(h&&U!==h.title){let ue={...h,title:U};g(ue),a?.(h.id,{title:U});}},[h,a]),ge=Te.useCallback(D=>{D.key==="Enter"&&(D.preventDefault(),D.currentTarget.blur()),D.key==="Escape"&&(D.preventDefault(),D.currentTarget.textContent=h?.title||"",D.currentTarget.blur());},[h]),Qe=Te.useCallback(()=>{h&&e&&h.description!==e.description&&a?.(h.id,{description:h.description}),f(false);},[h,e,a]),Wt=Te.useCallback(D=>{if(h){let U={...h,columnId:D};g(U),a?.(h.id,{columnId:D}),E(false);}},[h,a]),Bt=Te.useCallback(D=>{if(h){let U={...h,priority:D};g(U),a?.(h.id,{priority:D}),$(false);}},[h,a]),Fr=Te.useCallback(D=>{if(h){let U=h.assignedUserIds||[],ue=U.includes(D)?U.filter(Le=>Le!==D):[...U,D],he={...h,assignedUserIds:ue};g(he),a?.(h.id,{assignedUserIds:ue});}},[h,a]),ne=Te.useCallback(D=>{if(h){let U=h.labels||[],ue=U.includes(D)?U.filter(Le=>Le!==D):[...U,D],he={...h,labels:ue};g(he),a?.(h.id,{labels:ue});}},[h,a]),de=Te.useCallback(D=>{if(h){let U=D.target.value,ue={...h,endDate:U};g(ue),a?.(h.id,{endDate:U}),I(false);}},[h,a]),j=Te.useCallback(D=>{if(h){let U={...h,estimatedTime:parseFloat(D)||0};g(U),a?.(h.id,{estimatedTime:parseFloat(D)||0});}},[h,a]),H=Te.useCallback(()=>{if(T.trim()){let D={id:`subtask-${Date.now()}`,title:T.trim(),completed:false};k([...w,D]),N(""),C(false);}},[T,w]),we=Te.useCallback(D=>{k(w.map(U=>U.id===D?{...U,completed:!U.completed}:U));},[w]),ze=Te.useCallback(D=>{k(w.filter(U=>U.id!==D));},[w]),te=Te.useCallback(()=>{R.trim()&&h&&d&&(d(h.id,R.trim()),G(""));},[R,h,d]),ie=Te.useCallback(D=>{(D.metaKey||D.ctrlKey)&&D.key==="Enter"&&(D.preventDefault(),te());},[te]),nr=D=>jsxRuntime.jsx(qp__default.default,{remarkPlugins:[Xp__default.default],rehypePlugins:[Jp__default.default],components:{a:({node:U,...ue})=>jsxRuntime.jsx("a",{...ue,target:"_blank",rel:"noopener noreferrer"})},children:D}),Ot=c.filter(D=>W==="comments"?D.type.includes("COMMENT"):W==="history"?!D.type.includes("COMMENT"):true);if(!t||!e)return null;let q=h||e,V=o.filter(D=>q.assignedUserIds?.includes(D.id)),ve=w.filter(D=>D.completed).length;return jsxRuntime.jsx(Ve,{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: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:bt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Lr,onKeyDown:ge,children:q.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"})]})})]}),q.coverImage&&jsxRuntime.jsx("div",{className:"modal-v2-cover",children:jsxRuntime.jsx("img",{src:q.coverImage,alt:`Cover for ${q.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:Ce,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>E(!z),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:q.columnId||"No status"})]}),z&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(b.length>0?b:Qp.map(D=>({id:D,title:D}))).map(D=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${q.columnId===D.id?"active":""}`,onClick:()=>Wt(D.id),children:D.title},D.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ft,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>F(!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:"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"})})]}),O&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:o.map(D=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.assignedUserIds?.includes(D.id)?"active":""}`,onClick:()=>Fr(D.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:D.color},children:D.initials}),D.name,q.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:mt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>$(!B),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:q.priority||"None"})]}),B&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[Zp.map(D=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${D.toLowerCase()} ${q.priority===D?"active":""}`,onClick:()=>Bt(D),children:D},D)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Bt(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:_t,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Y(!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.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:q.labels&&q.labels.length>0?jsxRuntime.jsx("span",{children:q.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),Q&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(D=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${q.labels?.includes(D)?"active":""}`,onClick:()=>ne(D),children:[D,q.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:()=>{I(!me),setTimeout(()=>pr.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:q.endDate?new Date(q.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:pr,type:"date",value:typeof q.endDate=="string"?q.endDate.split("T")[0]:q.endDate?(()=>{let D=new Date(q.endDate),U=D.getUTCFullYear(),ue=String(D.getUTCMonth()+1).padStart(2,"0"),he=String(D.getUTCDate()).padStart(2,"0");return `${U}-${ue}-${he}`})():"",onChange:de,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>se(!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:q.estimatedTime?`${q.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:q.estimatedTime||"",onChange:D=>j(D.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>se(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"}),jsxRuntime.jsxs("button",{className:"modal-v2-ai-button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Assist"]})]}),v?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:q.description||"",onChange:D=>{if(h){let U={...h,description:D.target.value};g(U);}},onBlur:Qe,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>f(true),children:q.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:nr(q.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),w.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ve,"/",w.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>C(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[w.map(D=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${D.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>we(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:()=>ze(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)),y&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:T,onChange:D=>N(D.target.value),onKeyDown:D=>{D.key==="Enter"&&H(),D.key==="Escape"&&(C(false),N(""));},onBlur:H,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${W==="all"?"active":""}`,onClick:()=>M("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${W==="comments"?"active":""}`,onClick:()=>M("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${W==="history"?"active":""}`,onClick:()=>M("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ar,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:R,onChange:D=>G(D.target.value),onKeyDown:ie,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:te,disabled:!R.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Ot.map(D=>{let U=o.find(he=>he.id===D.userId);if(D.type.includes("COMMENT")){let he=s.find(Le=>Le.id===D.metadata?.commentId);return he?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[U&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:U.color},children:U.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:U?.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:he.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:U?.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)}),Ot.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 lm({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 Lo({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let o=e.map(s=>({...s,average:s.average??e.reduce((c,d)=>c+d.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(recharts.LineChart,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(lm,{})}),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 vm({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 Fo({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let o=a??(e[0]?.ideal||e[0]?.remaining||0),s=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,d=o>0?(o-s)/o*100:0,i=s<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(n?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(vm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:d>=50?"#10B981":"#F59E0B"},children:[d.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Sm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},kl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Nm({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:o}){let s=a+(n-a)*.5,c=e+s*Math.cos(-r*(Math.PI/180)),d=t+s*Math.sin(-r*(Math.PI/180));return o<.05?null:jsxRuntime.jsx("text",{x:c,y:d,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(o*100).toFixed(0)}%`})}function wl({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 Bo({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let o=e.reduce((d,i)=>d+i.value,0),s=e.map(d=>({...d,totalValue:o,color:d.color||Sm[d.name]||kl[e.indexOf(d)%kl.length]})),c=s.map(d=>d.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:r==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:s,cx:"50%",cy:"50%",labelLine:false,label:n?Nm:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:s.map((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(wl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(d,i)=>{let u=i.payload,l=o>0?(u.value/o*100).toFixed(0):"0";return `${d} (${u.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(wl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:s.map((d,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:o})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((d,i)=>i.value>d.value?i:d).name})]})]})]})}var Sn=Te.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:o=[]})=>{let[s,c]=Te.useState(false),[d,i]=Te.useState(false),[u,l]=Te.useState(false),[p,m]=Te.useState(false);if(e.length===0)return null;let b=e.map(w=>w.id),x=w=>{a.onBulkUpdate?.(b,{priority:w}),c(false);},h=w=>{a.onBulkMove?.(b,w),i(false),r();},g=w=>{a.onBulkUpdate?.(b,{assignedUserIds:w}),l(false);},v=w=>{let k=new Set;e.forEach(C=>{C.labels?.forEach(T=>k.add(T));});let y=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(b,{labels:y}),m(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(b),r());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!s),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),s&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(w),children:[jsxRuntime.jsx("span",{className:oe("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!d),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(w.id),children:w.title},w.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([w.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Sn.displayName="BulkOperationsToolbar";function Mm(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let o,s,c,d,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let b=r?.find(x=>x.id===m);s=`assignee-${m}`,c=b?.name||`User ${m}`,d=b?.color,i=b?.avatar,a.has(s)||a.set(s,{id:s,title:c,groupValue:m,cardIds:[],color:d,icon:i}),a.get(s).cardIds.push(n.id);}):(s="assignee-unassigned",c="Unassigned",d="#6b7280",i="\u{1F464}",a.has(s)||a.set(s,{id:s,title:c,groupValue:null,cardIds:[],color:d,icon:i}),a.get(s).cardIds.push(n.id));break;case "priority":o=n.priority||"NONE",s=`priority-${o}`;let p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[o];c=p.title,d=p.color,a.has(s)||a.set(s,{id:s,title:c,groupValue:o,cardIds:[],color:d}),a.get(s).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{s=`label-${m}`,c=m,d="#6b7280",a.has(s)||a.set(s,{id:s,title:c,groupValue:m,cardIds:[],color:d}),a.get(s).cardIds.push(n.id);}):(s="label-none",c="No Labels",d="#6b7280",a.has(s)||a.set(s,{id:s,title:c,groupValue:null,cardIds:[],color:d}),a.get(s).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,o)=>n.title.localeCompare(o.title))}function Oo({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n}){let[o,s]=Te.useState(new Set),c=Te.useMemo(()=>Mm(e.cards,t.groupBy,r),[e.cards,t.groupBy,r]),d=Te.useCallback(i=>{s(u=>{let l=new Set(u);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Sr,{board:e,callbacks:a,availableUsers:r,className:n}):jsxRuntime.jsxs("div",{className:oe("asakaa-swimlane-view",n),children:[c.map(i=>{let u=o.has(i.id),l=e.cards.filter(m=>i.cardIds.includes(m.id)),p={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&d(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Sr,{board:p,callbacks:a,availableUsers:r})})]},i.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var 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 $o({value:e,onChange:t,className:r}){let[a,n]=Te.useState(false),o=Te.useRef(null),s=Te.useRef(null),c=zo.find(i=>i.value===e)||zo[0];Te.useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let d=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{className:oe("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:oe("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:()=>d(i.value),className:oe("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 Fm(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},o=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,s=n.shift?e.shiftKey:!e.shiftKey,c=n.alt?e.altKey:!e.altKey,d=n.meta?e.metaKey:true;return o&&s&&c&&d}function Nl(e={}){let{shortcuts:t=$a,enabled:r=true,preventDefault:a=true}=e,n=Te.useRef(t),o=Te.useRef(r);Te.useEffect(()=>{n.current=t,o.current=r;},[t,r]);let s=Te.useCallback(d=>{n.current=[...n.current,d];},[]),c=Te.useCallback(d=>{n.current=n.current.filter(i=>i.action!==d);},[]);return Te.useEffect(()=>{function d(i){if(!o.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of n.current)if(Fm(i,l)){a&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[a]),{registerShortcut:s,unregisterShortcut:c,isEnabled:r}}function Om(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function zm(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 $m(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=zm(e),a=t?Om(t):"";return r?`${r} + ${a}`:a}function Gm(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 Go({shortcuts:e=$a,isOpen:t,onClose:r,className:a}){let[n,o]=Te.useState(false);if(Te.useEffect(()=>{o(true);},[]),Te.useEffect(()=>{function c(d){d.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r]),!n||!t)return null;let s=Gm(e);return jsxRuntime.jsxs("div",{className:oe("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(s).map(([c,d])=>d.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:d.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:$m(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 Uo=[{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'),Se=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'),Hc=require('html2canvas'),jsxRuntime=require('react/jsx-runtime'),pl=require('react-dom'),cmdk=require('cmdk'),Lp=require('react-markdown'),Fp=require('remark-gfm'),Bp=require('rehype-sanitize'),recharts=require('recharts'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Se__namespace=/*#__PURE__*/_interopNamespace(Se);var Hc__default=/*#__PURE__*/_interopDefault(Hc);var pl__namespace=/*#__PURE__*/_interopNamespace(pl);var Lp__default=/*#__PURE__*/_interopDefault(Lp);var Fp__default=/*#__PURE__*/_interopDefault(Fp);var Bp__default=/*#__PURE__*/_interopDefault(Bp);var nn=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var on=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return "scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return [on.Translate.toString(e),on.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}});function L(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function sn(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 Tu(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function ho(e,t){return e.length===0?1e3:t===0?sn(null,e[0].position):t>=e.length?sn(e[e.length-1].position,null):sn(e[t-1].position,e[t].position)}function Ni(e,t=100){return e>t}var Du=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 Su(e,t,r,a){let n=t*Math.pow(r,e-1),o=n*.2*Math.random();return Math.min(n+o,a)}async function ln(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:o=1e4,shouldRetry:s=Du,onRetry:c}=t,u,i=0;for(let m=1;m<=r;m++){i=m;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(u=l,m===r||!s(u,m))return {error:u,attempts:i,success:false};let p=Su(m,a,n,o);if(c)try{c(u,m,p);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,p));}}return {error:u||new Error("Unknown error"),attempts:i,success:false}}function Nu(e,t=3){let r;for(let a=1;a<=t;a++)try{return {data:e(),success:!0}}catch(n){if(r=n,a===t)return {error:r,success:false}}return {error:r||new Error("Unknown error"),success:false}}function Eu(e,t={}){return async(...r)=>ln(()=>e(...r),t)}var bo=class{constructor(t=5,r=6e4){this.threshold=t;this.resetTimeout=r;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let r=await t();return this.onSuccess(),r}catch(r){throw this.onFailure(),r}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var Ei=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARN=2]="WARN",o[o.ERROR=3]="ERROR",o[o.NONE=4]="NONE",o))(Ei||{}),Wr=class Wr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:r,level:a,message:n,component:o,...s}=t,c=`[${r}] [${a}] [${o}]`,u=Object.keys(s).length>0;switch(a){case "DEBUG":console.debug(c,n,u?s:"");break;case "INFO":console.info(c,n,u?s:"");break;case "WARN":console.warn(c,n,u?s:"");break;case "ERROR":console.error(c,n,u?s:""),t.error?.stack&&console.error(t.error.stack);break}};let r=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(r?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Wr.globalOptions};}static configure(t){Wr.globalOptions={...Wr.globalOptions,...t};}child(t){return new Wr({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,r){this.log(0,t,r);}info(t,r){this.log(1,t,r);}warn(t,r){this.log(2,t,r);}error(t,r,a){this.log(3,t,{...a,error:r?{message:r.message,stack:r.stack,name:r.name}:void 0});}startTimer(t){return this.options.enableTiming?new cn((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new cn(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Ei[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};Wr.globalOptions={};var vo=Wr,cn=class{constructor(t,r){this.onEnd=t;this.enabled=r;this.startTime=r?performance.now():0;}end(t){if(!this.enabled)return 0;let r=Math.round(performance.now()-this.startTime);return this.onEnd(r,t),r}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Pi=new vo;function Ru(e,t){let r={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(r,null,2)}function Mu(e,t){let r=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],a=e.cards.map(o=>{let s=e.columns.find(c=>c.id===o.columnId);return [o.id,yo(o.title),yo(o.description||""),yo(s?.title||""),o.priority||"",(o.labels||[]).join(";"),(o.assignedUserIds||[]).join(";"),o.startDate||"",o.endDate||"",o.createdAt||"",o.updatedAt||""]});return [r.join(","),...a.map(o=>o.join(","))].join(`
|
|
2
|
+
`)}async function Iu(e,t,r){let a=t;if(!a){let s=document.querySelector(".asakaa-board");s&&(a=s.parentElement||s);}if(a)try{let s=await Hc__default.default(a,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:a.scrollWidth,windowHeight:a.scrollHeight}),c=s.toDataURL("image/png"),u=297,i=210,m=s.width/s.height,l=u-20,d=l/m;d>i-20&&(d=i-20,l=d*m);let p=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});p.setFontSize(16),p.setTextColor(255,255,255),p.setFillColor(10,10,10),p.rect(0,0,u,15,"F"),p.text(e.title||"Kanban Board",10,10);let v=(u-l)/2;return p.addImage(c,"PNG",v,20,l,d),p}catch(s){console.error("Error capturing board:",s);}let n=new jspdf.jsPDF,o=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,o),o+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,o),o+=15,n.setTextColor(0,0,0),e.columns.forEach(s=>{let c=e.cards.filter(u=>u.columnId===s.id);o>250&&(n.addPage(),o=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(s.title,20,o),o+=8,c.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,o),n.setTextColor(0,0,0),o+=10):c.forEach(u=>{if(o>260&&(n.addPage(),o=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(u.title,25,o),o+=6,u.description){n.setFontSize(9),n.setFont("helvetica","normal");let m=n.splitTextToSize(u.description,160);n.text(m,25,o),o+=m.length*5;}let i=[];if(u.priority&&i.push(`Priority: ${u.priority}`),u.labels&&u.labels.length>0&&i.push(`Labels: ${u.labels.join(", ")}`),u.assignedUserIds&&u.assignedUserIds.length>0&&i.push(`Assigned: ${u.assignedUserIds.length} user(s)`),u.startDate||u.endDate){let m=[];u.startDate&&m.push(`Start: ${u.startDate}`),u.endDate&&m.push(`End: ${u.endDate}`),i.push(m.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,o),n.setTextColor(0,0,0),o+=5),o+=5;}),o+=5;}),n}function yo(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Mi(e,t,r,a){switch(t){case "json":return Ru(e,a);case "csv":return Mu(e);case "pdf":return await Iu(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function Ii(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let m=`${a}.pdf`;e.save(m);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let o=`${a}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,s={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:s[t]}),u=URL.createObjectURL(c),i=document.createElement("a");i.href=u,i.download=o,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(u);}function Au(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let r={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:r.cards.length,columnsImported:r.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Lu(e){try{let t=e.trim().split(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let r=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((p,v)=>{i[p]=c[v]||"";});let m=i.Column||"Unnamed";n.has(m)||n.set(m,{id:`col-${n.size+1}`,title:m,position:n.size+1,cardIds:[]});let l=n.get(m),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",m=a.x+a.width/2-n.width/2,l=a.y+a.height/2-n.height/2,d=a[c]/2-n[c]/2,p;switch(u){case "top":p={x:m,y:a.y-n.height};break;case "bottom":p={x:m,y:a.y+a.height};break;case "right":p={x:a.x+a.width,y:l};break;case "left":p={x:a.x-n.width,y:l};break;default:p={x:a.x,y:a.y};}switch(Gr(t)){case "start":p[s]-=d*(r&&i?-1:1);break;case "end":p[s]+=d*(r&&i?-1:1);break}return p}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:m,y:l}=Vi(i,a,u),d=a,p={},v=0;for(let y=0;y<c.length;y++){let{name:h,fn:g}=c[y],{x:b,y:f,data:w,reset:k}=await g({x:m,y:l,initialPlacement:a,placement:d,strategy:n,middlewareData:p,rects:i,platform:s,elements:{reference:e,floating:t}});m=b??m,l=f??l,p={...p,[h]:{...p[h],...w}},k&&v<=50&&(v++,typeof k=="object"&&(k.placement&&(d=k.placement),k.rects&&(i=k.rects===true?await s.getElementRects({reference:e,floating:t,strategy:n}):k.rects),{x:m,y:l}=Vi(i,d,u)),y=-1);}return {x:m,y:l,placement:d,strategy:n,middlewareData:p}};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:m="viewport",elementContext:l="floating",altBoundary:d=false,padding:p=0}=Ur(t,e),v=Co(p),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:m,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)),w=await(o.isElement==null?void 0:o.isElement(f))?await(o.getScale==null?void 0:o.getScale(f))||{x:1,y:1}:{x:1,y:1},k=_r(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:f,strategy:u}):b);return {top:(g.top-k.top+v.top)/w.y,bottom:(k.bottom-g.bottom+v.bottom)/w.y,left:(g.left-k.left+v.left)/w.x,right:(k.right-g.right+v.right)/w.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:m=0}=Ur(e,t)||{};if(i==null)return {};let l=Co(m),d={x:r,y:a},p=hn(n),v=gn(p),y=await s.getDimensions(i),h=p==="y",g=h?"top":"left",b=h?"bottom":"right",f=h?"clientHeight":"clientWidth",w=o.reference[v]+o.reference[p]-d[p]-o.floating[v],k=d[p]-o.reference[p],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=w/2-k/2,S=D/2-y[v]/2-1,T=dr(l[g],S),$=dr(l[b],S),z=T,R=D-y[v]-$,W=D/2-y[v]/2+C,P=fn(z,W,R),O=!u.arrow&&Gr(n)!=null&&W!==P&&o.reference[v]/2-(W<z?T:$)-y[v]/2<0,G=O?W<z?W-z:W-R:0;return {[p]:d[p]+G,data:{[p]:P,centerOffset:W-P-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:m=true,crossAxis:l=true,fallbackPlacements:d,fallbackStrategy:p="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,w=await(u.isRTL==null?void 0:u.isRTL(i.floating)),k=d||(f||!y?[Ea(c)]:Gi(c)),x=v!=="none";!d&&x&&k.push(..._i(c,y,v,w));let D=[c,...k],C=await bn(t,h),S=[],T=((a=o.flip)==null?void 0:a.overflows)||[];if(m&&S.push(C[g]),l){let W=Ui(n,s,w);S.push(C[W[0]],C[W[1]]);}if(T=[...T,{placement:n,overflows:S}],!S.every(W=>W<=0)){var $,z;let W=((($=o.flip)==null?void 0:$.index)||0)+1,P=D[W];if(P&&(!(l==="alignment"?b!==ur(P):false)||T.every(U=>ur(U.placement)===b?U.overflows[0]>0:true)))return {data:{index:W,overflows:T},reset:{placement:P}};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(p){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,m=o&&u?-1:1,l=Ur(t,e),{mainAxis:d,crossAxis:p,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"&&(p=c==="end"?v*-1:v),u?{x:p*m,y:d*i}:{x:d*i,y:p*m}}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},m=await bn(t,u),l=ur(yr(n)),d=wo(l),p=i[d],v=i[l];if(o){let h=d==="y"?"top":"left",g=d==="y"?"bottom":"right",b=p+m[h],f=p-m[g];p=fn(b,p,f);}if(s){let h=l==="y"?"top":"left",g=l==="y"?"bottom":"right",b=v+m[h],f=v-m[g];v=fn(b,v,f);}let y=c.fn({...t,[d]:p,[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),m=await bn(t,i),l=yr(n),d=Gr(n),p=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-m.top-m.bottom,f=v-m.left-m.right,w=dr(y-m[h],b),k=dr(v-m[g],f),x=!t.middlewareData.shift,D=w,C=k;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(m.left,0),$=Et(m.right,0),z=Et(m.top,0),R=Et(m.bottom,0);p?C=v-2*(T!==0||$!==0?T+$:Et(m.left,m.right)):D=y-2*(z!==0||R!==0?z+R:Et(m.top,m.bottom));}await u({...t,availableWidth:C,availableHeight:D});let S=await s.getDimensions(c.floating);return v!==S.width||y!==S.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,m=n.width/s.x,l=n.height/s.y;if(o){let d=Nt(o),p=a&&ft(a)?Nt(a):a,v=d,y=mn(v);for(;y&&a&&p!==v;){let h=oa(y),g=y.getBoundingClientRect(),b=It(y),f=g.left+(y.clientLeft+parseFloat(b.paddingLeft))*h.x,w=g.top+(y.clientTop+parseFloat(b.paddingTop))*h.y;u*=h.x,i*=h.y,m*=h.x,l*=h.y,u+=f,i+=w,v=Nt(y),y=mn(v);}}return _r({width:m,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),m=Jt(0),l=Gt(a);if((l||!l&&!o)&&((Sr(a)!=="body"||na(s))&&(u=Na(a)),Gt(a))){let p=Hr(a);i=oa(a),m.x=p.x+a.clientLeft,m.y=p.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+m.x+d.x,y:r.y*i.y-u.scrollTop*i.y+m.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 m=Sa();(!m||m&&t==="fixed")&&(c=n.offsetLeft,u=n.offsetTop);}let i=vn(a);if(i<=0){let m=a.ownerDocument,l=m.body,d=getComputedStyle(l),p=m.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,v=Math.abs(a.clientWidth-l.clientWidth-p);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(m=>m!==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,m)=>{let l=Qi(t,m,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 p=Hr(t,true,o,t);u.x=p.x+t.clientLeft,u.y=p.y+t.clientTop;}else n&&i();o&&!a&&n&&i();let m=n&&!a&&!o?al(n,c):Jt(0),l=s.left+c.scrollLeft-u.x-m.x,d=s.top+c.scrollTop-u.y-m.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:m,top:l,width:d,height:p}=i;if(c||t(),!d||!p)return;let v=Ra(l),y=Ra(n.clientWidth-(m+d)),h=Ra(n.clientHeight-(l+p)),g=Ra(m),f={rootMargin:-v+"px "+-y+"px "+-h+"px "+-g+"px",threshold:Et(0,dr(1,u))||1},w=true;function k(x){let D=x[0].intersectionRatio;if(D!==u){if(!w)return s();D?s(false,D):a=setTimeout(()=>{s(false,1e-7);},1e3);}D===1&&!sl(i,e.getBoundingClientRect())&&s(),w=false;}try{r=new IntersectionObserver(k,{...f,root:n.ownerDocument});}catch{r=new IntersectionObserver(k,f);}r.observe(e);}return s(true),o}function 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),m=n||o?[...i?vr(i):[],...vr(t)]:[];m.forEach(g=>{n&&g.addEventListener("scroll",r,{passive:true}),o&&g.addEventListener("resize",r);});let l=i&&c?bm(i,r):null,d=-1,p=null;s&&(p=new ResizeObserver(g=>{let[b]=g;b&&b.target===i&&p&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var f;(f=p)==null||f.observe(t);})),r();}),i&&!u&&p.observe(i),p.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;m.forEach(b=>{n&&b.removeEventListener("scroll",r),o&&b.removeEventListener("resize",r);}),l?.(),(g=p)==null||g.disconnect(),p=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,[m,l]=Se__namespace.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:false}),[d,p]=Se__namespace.useState(a);wn(d,a)||p(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));},[]),w=o||v,k=s||h,x=Se__namespace.useRef(null),D=Se__namespace.useRef(null),C=Se__namespace.useRef(m),S=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(w&&(x.current=w),k&&(D.current=k),w&&k){if(T.current)return T.current(w,k,R);R();}},[w,k,R,T,S]);let P=Se__namespace.useMemo(()=>({reference:x,floating:D,setReference:b,setFloating:f}),[b,f]),O=Se__namespace.useMemo(()=>({reference:w,floating:k}),[w,k]),G=Se__namespace.useMemo(()=>{let U={position:r,left:0,top:0};if(!O.floating)return U;let A=ul(O.floating,m.x),K=ul(O.floating,m.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,m.x,m.y]);return Se__namespace.useMemo(()=>({...m,update:R,refs:P,elements:O,floatingStyles:G}),[m,R,P,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:m=0,staticOffset:l,stroke:d,d:p,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[w,k]=a.split("-"),x=w==="top"||w==="bottom",D=l;(x&&s!=null&&s.x||!x&&s!=null&&s.y)&&(D=null);let C=m*2,S=C/2,T=c/2*(i/-8+1),$=u/2*i/4,z=!!p,R=D&&k==="end"?"bottom":"top",W=D&&k==="end"?"right":"left";D&&b&&(W=k==="end"?"left":"right");let P=o?.x!=null?D||o.x:"",O=o?.y!=null?D||o.y:"",G=p||"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)"}[w];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]:P,[R]:O,[w]: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+(p?0:1),d:G}),jsxRuntime.jsx("path",{stroke:C&&!p?h.fill:"none",d:G}),jsxRuntime.jsx("clipPath",{id:g,children:jsxRuntime.jsx("rect",{x:-S,y:S*(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 p=a.reference;p&&!ft(p)&&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),m=Hi((p,v,y)=>{o.current.openEvent=p?v:void 0,s.emit("openchange",{open:p,event:v,reason:y,nested:c}),r?.(p,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:m,elements:d,events:s,floatingId:n,refs:l}),[t,m,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),m=n?.domReference||o,l=Se__namespace.useRef(null),d=$m();Ia(()=>{m&&(l.current=m);},[m]);let p=gl({...e,elements:{...n,...c&&{reference:c}}}),v=Se__namespace.useCallback(f=>{let w=ft(f)?{getBoundingClientRect:()=>f.getBoundingClientRect(),getClientRects:()=>f.getClientRects(),contextElement:f}:f;u(w),p.refs.setReference(w);},[p.refs]),y=Se__namespace.useCallback(f=>{(ft(f)||f===null)&&(l.current=f,s(f)),(ft(p.refs.reference.current)||p.refs.reference.current===null||f!==null&&!ft(f))&&p.refs.setReference(f);},[p.refs]),h=Se__namespace.useMemo(()=>({...p.refs,setReference:y,setPositionReference:v,domReference:l}),[p.refs,y,v]),g=Se__namespace.useMemo(()=>({...p.elements,domReference:m}),[p.elements,m]),b=Se__namespace.useMemo(()=>({...p,...a,refs:h,elements:g,nodeId:t}),[p,h,g,t,a]);return Ia(()=>{a.dataRef.current.floatingContext=b;let f=d?.nodesRef.current.find(w=>w.id===t);f&&(f.context=b);}),Se__namespace.useMemo(()=>({...p,context:b,refs:h,elements:g}),[p,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 m=o.target;return i===m||i.contains(m)})||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(m=>{if(a)switch(m.key){case "ArrowDown":m.preventDefault(),c(l=>l===-1?0:l===e-1?n?0:l:l+1);break;case "ArrowUp":m.preventDefault(),c(l=>l===-1?e-1:l===0?n?e-1:l:l-1);break;case "Enter":case " ":m.preventDefault(),s!==-1&&t&&t(s);break;case "Escape":m.preventDefault(),r&&r();break;case "Home":m.preventDefault(),c(0);break;case "End":m.preventDefault(),c(e-1);break;}},[a,s,e,n,t,r]),i=Se.useCallback(m=>({"data-active":m===s,"data-index":m,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:m="",triggerClassName:l="",disableClickOutside:d=false,disableKeyboardNav:p=false,itemCount:v=0,onSelectItem:y,onOpen:h,onClose:g,animationDuration:b=200,zIndex:f=1e3}){let[w,k]=Se.useState(false),x=r!==void 0?r:w,D=Se.useCallback(ae=>{let M=x;r===void 0&&k(ae),a?.(ae),ae&&!M?h?.():!ae&&M&&g?.();},[r,a,h,g,x]),C=Se.useCallback(()=>{D(!x);},[x,D]),S=Se.useCallback(()=>{D(false);},[D]),T=Se.useRef(null),$=Se.useRef(null),z=Se.useRef(null),{refs:R,floatingStyles:W,context:P}=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,$],S,x&&!d);let{activeIndex:G,setActiveIndex:U,handleKeyDown:A}=Nl({itemCount:v,onSelect:y,onEscape:S,enabled:x&&!p,loop:true,containerRef:$}),K=()=>typeof e=="function"?e({isOpen:x,toggle:C}):e,_=()=>typeof t=="function"?t({activeIndex:G,setActiveIndex:U,close:S}):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 ${m}`,role:"menu","aria-orientation":"vertical",onKeyDown:A,children:[jsxRuntime.jsx("div",{ref:$,className:"dropdown-inner",children:_()}),i&&jsxRuntime.jsx(kl,{ref:z,context:P,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(([m,l],d)=>{let p=n?l.darkColor:l.color,v=u===d,y=e===m;return jsxRuntime.jsxs("button",{onClick:()=>{s(m),i();},className:"dropdown-item","data-active":v,"data-index":d,role:"option","aria-selected":y,style:{color:v?p:"inherit",fontWeight:y?600:400},children:[jsxRuntime.jsx(Qm,{color:p}),jsxRuntime.jsx("span",{children:l.label}),y&&jsxRuntime.jsx(Rl,{})]},m)}),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();},m=()=>{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 w=f[0],k=f[1],x=f[2];return w===void 0||k===void 0||x===void 0?null:new Date(w,k-1,x)},y=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,p=(()=>{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 ${p?"asakaa-date-overdue":"asakaa-date"} ${a||""}`,style:{transform:v?"scale(1.05)":"scale(1)"},title:l?`${m()}`:"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:m()})]}),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(p=>p.id===l.id);r(d?e.filter(p=>p.id!==l.id):[...e,l]);},u=t.filter(l=>l.name.toLowerCase().includes(o.toLowerCase())),i=e.slice(0,n),m=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)),m>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar dropdown-avatar-overflow",children:["+",m]})]}):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:p=>s(p.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((p,v)=>{let y=e.some(h=>h.id===p.id);return jsxRuntime.jsxs("button",{onClick:()=>{c(p);},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:p.color,color:"#fff",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},children:p.avatar?jsxRuntime.jsx("img",{src:p.avatar,alt:p.name,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}):p.initials}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:600},children:p.name}),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"})})]},p.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=p=>{if(t.includes(p)){let y=t.filter(h=>h!==p);a(y),y.length===0&&u(false);}else a([...t,p]),u(true);},m=()=>{let p=!c;u(p),p||a([]);},l=r.filter(p=>p.id!==e).filter(p=>p.title.toLowerCase().includes(o.toLowerCase())||p.id.toLowerCase().includes(o.toLowerCase())),d=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsx(xr,{trigger:({isOpen:p})=>jsxRuntime.jsxs("button",{className:`flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5 ${n||""}`,style:{transform:p?"scale(1.05)":"scale(1)"},title:t.length>0?`${t.length} dependencies`:"Add dependencies","aria-label":"Select dependencies","aria-expanded":p,"aria-haspopup":"menu",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke: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:p=>{let v=l[p];v&&i(v.id);},onClose:()=>s(""),onOpen:()=>u(t.length>0),children:({activeIndex:p,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:m,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":p===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:m,setNodeRef:l,transform:d,transition:p,isDragging:v}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),y={transform:on.Transform.toString(d),transition:p};if(t)return jsxRuntime.jsx("div",{ref:l,style:y,...i,...m,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,...m,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,m]=Se.useState({top:0,left:0}),l=Se.useRef(null),d=Se.useRef(null),p=Se.useRef(null);Se.useEffect(()=>{if(a&&d.current){let g=d.current.getBoundingClientRect();m({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&&p.current&&(p.current.focus(),p.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:p,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:m,cardHeight:l=120,isCollapsed:d,onToggleCollapse:p,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=m??Ni(t.length),w=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 S=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:S}:S>=80?{state:"warning",percentage:S}:S>=60?{state:"approaching",percentage:S}:{state:"ok",percentage:S}})(),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:S=>v(e.id,S)}),p&&jsxRuntime.jsx("button",{onClick:p,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(S=>S.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?o?o(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):f?jsxRuntime.jsx("div",{style:{height:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(S=>{let T=t[S.index];return T?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${S.start}px)`},children:jsxRuntime.jsx(kr,{card:T,render:a,onClick:s,onUpdate:c,availableUsers:u,allCards:i})},T.id):null})}):t.map(S=>jsxRuntime.jsx(kr,{card:S,render:a,onClick:s,onUpdate:c,availableUsers:u,allCards:i},S.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 m=o.trim();m&&m!==e?t(m):s(e),n(false);},i=m=>{m.key==="Enter"?u():m.key==="Escape"&&(s(e),n(false));};return a?jsxRuntime.jsx("input",{ref:c,type:"text",value:o,onChange:m=>s(m.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:m}){let[l,d]=$o(),p=Se.useCallback((k,x)=>{t.onCardUpdate?.(k,x);},[t]),v=Se.useCallback((k,x)=>{t.onColumnUpdate?.(k,{title:x});},[t]),y=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),h=Se.useMemo(()=>{let k=new Map;return e.columns.forEach(x=>{let D=x.cardIds.map(C=>e.cards.find(S=>S.id===C)).filter(C=>C!==void 0).sort((C,S)=>C.position-S.position);k.set(x.id,D);}),k},[e.cards,e.columns]),g=Se.useCallback(k=>{let{active:x}=k,D=e.cards.find(C=>C.id===x.id);D&&d({isDragging:true,draggedCardId:D.id,sourceColumnId:D.columnId,targetColumnId:D.columnId});},[e.cards,d]),b=Se.useCallback(k=>{let{active:x,over:D}=k;if(!D||!e.cards.find(T=>T.id===x.id))return;let S=null;D.data.current?.type==="column"?S=D.id:D.data.current?.type==="card"&&(S=e.cards.find($=>$.id===D.id)?.columnId||null),S&&S!==l.targetColumnId&&d({...l,targetColumnId:S});},[e.cards,l,d]),f=Se.useCallback(async k=>{let{active:x,over:D}=k;if(d({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!D)return;let C=e.cards.find(z=>z.id===x.id);if(!C)return;let S,T;if(D.data.current?.type==="column"){S=D.id;let z=h.get(S)||[];T=ho(z,0);}else {let z=e.cards.find(P=>P.id===D.id);if(!z)return;S=z.columnId;let R=h.get(S)||[],W=R.findIndex(P=>P.id===D.id);T=ho(R,W);}let $=e.columns.find(z=>z.id===S);if($&&$.wipLimit&&$.wipLimitType==="hard"){let z=h.get(S)||[];if(C.columnId!==S&&z.length>=$.wipLimit){t.onWipLimitExceeded?.($,C);return}}(C.columnId!==S||C.position!==T)&&await t.onCardMove?.(C.id,S,T);},[e.cards,e.columns,h,t,d]),w=Se.useCallback(k=>{r?.(k);},[r]);return u?jsxRuntime.jsx("div",{className:L("asakaa-board",s),style:c,children:jsxRuntime.jsx(Cp,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:L("asakaa-board",s),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(core$1.DndContext,{sensors:y,collisionDetection:core$1.closestCorners,onDragStart:g,onDragOver:b,onDragEnd:f,children:[jsxRuntime.jsxs("div",{className:L("asakaa-board",s),style:c,children:[e.columns.sort((k,x)=>k.position-x.position).map(k=>{let x=h.get(k.id)||[];return jsxRuntime.jsx(ia,{column:k,cards:x,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,onCardClick:w,onCardUpdate:p,onColumnRename:v,availableUsers:o,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight},k.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:l.draggedCardId?jsxRuntime.jsx(kr,{card:e.cards.find(k=>k.id===l.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})}function 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:m=""}){let[l,d]=Se.useState(false),[p,v]=Se.useState(""),[y,h]=Se.useState("home"),[g,b]=Se.useState(""),[f,w]=Se.useState("");Se.useEffect(()=>{let C=S=>{(S.metaKey||S.ctrlKey)&&S.key===i&&(S.preventDefault(),d(T=>!T)),S.key==="Escape"&&(d(false),h("home"),v(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),Se.useEffect(()=>{l||(h("home"),v(""),b(""),w(""));},[l]);let k=Se.useCallback(()=>{d(false);},[]),x=Se.useCallback(C=>{let[S,T]=C.split(":");switch(S){case "create-card":h("create-card");break;case "create-card-in":b(T||"");break;case "navigate":T?(r?.(T),k()):h("navigate");break;case "search":a?.(p),k();break;case "priority":h("priority");break;case "set-priority":f&&T&&(n?.(f,T),k());break;case "assign":h("assign");break;case "assign-user":f&&T&&(o?.(f,T),k());break;case "ai":h("ai");break;case "ai-generate-plan":s?.(),k();break;case "ai-predict-risks":c?.(),k();break;case "ai-usage":u?.(),k();break;case "back":h("home");break;}},[p,f,t,r,a,n,o,s,c,u,k]),D=Se.useCallback(()=>{g&&p.trim()&&(t?.(g,p.trim()),k());},[g,p,t,k]);return l?jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:p,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(S=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:S},S))})]},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 S=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:S?.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),[m,l]=Se.useState(null),d=Se.useRef(null),p=Se.useCallback(x=>{let D=[],C=[];return e.length+x.length>o?(C.push(`Maximum ${o} files allowed`),{valid:D,errors:C}):(x.forEach(S=>{if(S.size/1048576>a){C.push(`${S.name} is too large (max ${a}MB)`);return}if(n&&!n.some($=>S.type.match($))){C.push(`${S.name} has invalid file type`);return}D.push(S);}),{valid:D,errors:C})},[e.length,o,a,n]),v=Se.useCallback(async x=>{let{valid:D,errors:C}=p(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(S){l(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[p,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]),w=Se.useCallback(()=>{d.current?.click();},[]),k=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:w,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"]})]})})]}),m&&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:m})]}),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:()=>k(x.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},x.id))})]})}function Ho({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:c=[],aiInsights:u=[],attachments:i=[],onAddComment:m,onDeleteComment:l,onUploadAttachments:d,onDeleteAttachment:p,onSuggestAssignee:v,onGenerateSubtasks:y,onEstimateEffort:h,currentUserId:g="user-1"}){let[b,f]=Se.useState("details"),[w,k]=Se.useState(false),[x,D]=Se.useState({}),[C,S]=Se.useState(""),[T,$]=Se.useState(false),[z,R]=Se.useState({});if(!t||!e)return null;let W=Se.useCallback(()=>{k(false),D({}),f("details"),S(""),R({}),r();},[r]),P=Se.useCallback(()=>{a&&Object.keys(x).length>0&&(a(e.id,x),D({}),k(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(()=>{m&&C.trim()&&(m(e.id,C.trim()),S(""));},[e.id,C,m]),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"}}),w?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:[w?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:P,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{k(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>k(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick: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"}),w?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"}),w?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"}),w?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"}),w?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"}),w?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"}),w?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=>S(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:p,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(wt=>wt.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:m,onAIGenerateDescription:l,onAICreateSubtasks:d,onAIFindSimilar:p,availableColumns:v=[],availableLabels:y=[]}){let[h,g]=Se.useState(e),[b,f]=Se.useState(false),[w,k]=Se.useState([]),[x,D]=Se.useState(false),[C,S]=Se.useState(""),[T,$]=Se.useState(""),[z,R]=Se.useState("all"),[W,P]=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),wt=Se.useRef(null),rt=Se.useRef(null),ir=Se.useRef(null),De=Se.useRef(null),bt=Se.useRef(null),vt=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 N=H=>{let me=H.target;De.current&&!De.current.contains(me)&&P(false),bt.current&&!bt.current.contains(me)&&G(false),vt.current&&!vt.current.contains(me)&&A(false),jt.current&&!jt.current.contains(me)&&_(false);};if(W||O||U||K)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[W,O,U,K]),Se.useEffect(()=>{if(!t)return;let N=H=>{let me=H.target,be=me.tagName==="INPUT"||me.tagName==="TEXTAREA"||me.isContentEditable;if(H.key==="Escape"){H.preventDefault(),W||O||U||K||ae||de?(P(false),G(false),A(false),_(false),M(false),ie(false)):be||r();return}if(be&&H.key!=="Escape")return;let Be=H.metaKey||H.ctrlKey;switch(H.key.toLowerCase()){case "s":H.preventDefault(),P(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",N),()=>window.removeEventListener("keydown",N)},[t,r,W,O,U,K,ae,de]);let zr=Se.useCallback(N=>{let H=N.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(N=>{N.key==="Enter"&&(N.preventDefault(),N.currentTarget.blur()),N.key==="Escape"&&(N.preventDefault(),N.currentTarget.textContent=h?.title||"",N.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(N=>{if(h){let H={...h,columnId:N};g(H),a?.(h.id,{columnId:N}),P(false);}},[h,a]),Wt=Se.useCallback(N=>{if(h){let H={...h,priority:N};g(H),a?.(h.id,{priority:N}),G(false);}},[h,a]),$r=Se.useCallback(N=>{if(h){let H=h.assignedUserIds||[],me=H.includes(N)?H.filter(Be=>Be!==N):[...H,N],be={...h,assignedUserIds:me};g(be),a?.(h.id,{assignedUserIds:me});}},[h,a]),se=Se.useCallback(N=>{if(h){let H=h.labels||[],me=H.includes(N)?H.filter(Be=>Be!==N):[...H,N],be={...h,labels:me};g(be),a?.(h.id,{labels:me});}},[h,a]),ue=Se.useCallback(N=>{if(h){let H=N.target.value,me={...h,endDate:H};g(me),a?.(h.id,{endDate:H}),M(false);}},[h,a]),X=Se.useCallback(N=>{if(h){let H={...h,estimatedTime:parseFloat(N)||0};g(H),a?.(h.id,{estimatedTime:parseFloat(N)||0});}},[h,a]),j=Se.useCallback(()=>{if(C.trim()){let N={id:`subtask-${Date.now()}`,title:C.trim(),completed:false};k([...w,N]),S(""),D(false);}},[C,w]),Te=Se.useCallback(N=>{k(w.map(H=>H.id===N?{...H,completed:!H.completed}:H));},[w]),We=Se.useCallback(N=>{k(w.filter(H=>H.id!==N));},[w]),re=Se.useCallback(()=>{T.trim()&&h&&u&&(u(h.id,T.trim()),$(""));},[T,h,u]),le=Se.useCallback(N=>{(N.metaKey||N.ctrlKey)&&N.key==="Enter"&&(N.preventDefault(),re());},[re]),lr=N=>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:N}),Ut=c.filter(N=>z==="comments"?N.type.includes("COMMENT"):z==="history"?!N.type.includes("COMMENT"):true);if(!t||!e)return null;let J=h||e,Y=o.filter(N=>J.assignedUserIds?.includes(N.id)),ye=w.filter(N=>N.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:N=>N.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:wt,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:N=>{N.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:()=>P(!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(N=>({id:N,title:N}))).map(N=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${J.columnId===N.id?"active":""}`,onClick:()=>Kt(N.id),children:N.title},N.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:vt,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(N=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:N.color},title:N.name,children:N.initials},N.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),U&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:o.map(N=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${J.assignedUserIds?.includes(N.id)?"active":""}`,onClick:()=>$r(N.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:N.color},children:N.initials}),N.name,J.assignedUserIds?.includes(N.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"})})]},N.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(N=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${N.toLowerCase()} ${J.priority===N?"active":""}`,onClick:()=>Wt(N),children:N},N)),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(N=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${J.labels?.includes(N)?"active":""}`,onClick:()=>se(N),children:[N,J.labels?.includes(N)&&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"})})]},N))})]}),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 N=new Date(J.endDate),H=N.getUTCFullYear(),me=String(N.getUTCMonth()+1).padStart(2,"0"),be=String(N.getUTCDate()).padStart(2,"0");return `${H}-${me}-${be}`})():"",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:N=>X(N.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:N=>{if(h){let H={...h,description:N.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"}),w.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ye,"/",w.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:[w.map(N=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${N.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Te(N.id),children:N.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:N.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>We(N.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"})]})})]},N.id)),x&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:C,onChange:N=>S(N.target.value),onKeyDown:N=>{N.key==="Enter"&&j(),N.key==="Escape"&&(D(false),S(""));},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:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.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:N=>$(N.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(N=>{let H=o.find(be=>be.id===N.userId);if(N.type.includes("COMMENT")){let be=s.find(Be=>Be.id===N.metadata?.commentId);return be?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(N.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:be.content})]})]},N.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[N.type.includes("CREATED")&&"\u2795",N.type.includes("UPDATED")&&"\u270F\uFE0F",N.type.includes("MOVED")&&"\u27A1\uFE0F",N.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",N.type.includes("ASSIGNED")&&"\u{1F464}",N.type.includes("PRIORITY")&&"\u{1F3AF}",N.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"})," ",N.type.replace(/_/g," ").toLowerCase(),N.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:N.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(N.timestamp).toLocaleString()})]})]},N.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 m=i.payload,l=o>0?(m.value/o*100).toFixed(0):"0";return `${u} (${m.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),[m,l]=Se.useState(false),[d,p]=Se.useState(false);if(e.length===0)return null;let v=e.map(w=>w.id),y=w=>{a.onBulkUpdate?.(v,{priority:w}),c(false);},h=w=>{a.onBulkMove?.(v,w),i(false),r();},g=w=>{a.onBulkUpdate?.(v,{assignedUserIds:w}),l(false);},b=w=>{let k=new Set;e.forEach(D=>{D.labels?.forEach(C=>k.add(C));});let x=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(v,{labels:x}),p(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(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w),children:[jsxRuntime.jsx("span",{className:L("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!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(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(w.id),children:w.title},w.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([w.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!d),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});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 m=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);m.length>0?m.forEach(p=>{let v=r?.find(y=>y.id===p);s=`assignee-${p}`,c=v?.name||`User ${p}`,u=v?.color,i=v?.avatar,a.has(s)||a.set(s,{id:s,title:c,groupValue:p,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(p=>{s=`label-${p}`,c=p,u="#6b7280",a.has(s)||a.set(s,{id:s,title:c,groupValue:p,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(m=>{let l=new Set(m);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 m=o.has(i.id),l=e.cards.filter(p=>i.cardIds.includes(p.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":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&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(m){o.current&&!o.current.contains(m.target)&&s.current&&!s.current.contains(m.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 m=i.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.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:**
|
|
6
6
|
1.
|
|
7
7
|
|
|
8
8
|
**Expected behavior:**
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function _o({templates:e,onSelectTemplate:t,className:r}){let[a,n]=Te.useState(false),o=Te.useRef(null),s=Te.useRef(null);Te.useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},d=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxRuntime.jsxs("div",{className:oe("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:oe("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(d).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Ho({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,c]=Te.useState("export"),[d,i]=Te.useState("json"),[u,l]=Te.useState(null),p=Te.useRef(null);if(!t)return null;let m=async()=>{let x=n?.current||void 0,h=await ni(e,d,x);oi(h,d);},b=async x=>{let h=x.target.files?.[0];if(h){try{let g=await li(h),v=h.name.endsWith(".json")?"json":"csv",f=ii(g,v);l(f),f.success&&a&&a(f,g);}catch(g){l({success:false,errors:[`Failed to read file: ${g instanceof Error?g.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:oe("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:oe("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:oe("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(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:oe("p-4 rounded-lg border-2 transition-all text-center",d===x?"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:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:m,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),s==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:b,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:oe("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:oe("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Vm=["URGENT","HIGH","MEDIUM","LOW"],Km=[{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"}],jm=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Vo({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:s,onFilterHighPriority:c,availableUsers:d=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:p=false,groupBy:m="none",onGroupByChange:b}){let[x,h]=Te.useState(true),g=Te.useCallback(y=>{r({search:y.target.value});},[r]),v=Te.useCallback(y=>{r({dateFilter:y.target.value});},[r]),f=Te.useCallback(y=>{a({by:y.target.value});},[a]),w=Te.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:g,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:y=>{let C=y.target.value;r({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Vm.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:y=>{let C=y.target.value;r({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),d.map(y=>jsxRuntime.jsx("option",{value:y.id,children:y.name},y.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:y=>{let C=y.target.value;r({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:f,className:"filter-bar__select filter-bar__select--sm",children:Km.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:m,onChange:y=>b(y.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:jm.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ko({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:s,onExportGanttPNG:c,onExportGanttCSV:d}){let[i,u]=Te.useState(false),l=Te.useRef(null);Te.useEffect(()=>{let m=b=>{l.current&&!l.current.contains(b.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let p=m=>{m(),u(false);};return jsxRuntime.jsxs("div",{className:oe("relative",a),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>p(()=>d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>p(r),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var jo={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"}},Yo={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"}},qo={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Hr={dark:jo,light:Yo,neutral:qo},En="dark";var Rn=Te.createContext(void 0),af="asakaa-theme";function Pl({children:e,defaultTheme:t=En,storageKey:r=af}){let[a,n]=Te.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),o=Te.useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);Te.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,d=Hr[a];Object.entries(d.colors).forEach(([u,l])=>{l&&c.style.setProperty(`--theme-${nf(u)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,l])=>{let p=d.colors[u];p&&c.style.setProperty(l,p);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:Hr};return jsxRuntime.jsx(Rn.Provider,{value:s,children:e})}function ca(){let e=Te.useContext(Rn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function nf(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Xo({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=ca();return e?jsxRuntime.jsxs("div",{className:oe("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Hr).map(([o,s])=>jsxRuntime.jsxs("button",{onClick:()=>{n(o),t();},className:oe("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===o?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===o?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:s.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[o==="dark"&&"Default dark theme with Linear-inspired colors",o==="light"&&"Clean light theme with high contrast",o==="neutral"&&"Monochrome zen theme"]})]}),a===o&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},o))})]})]}):null}var ke={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1C1F24",bgWeekend:"rgba(59, 130, 246, 0.02)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FDFEFE",bgWeekend:"rgba(37, 99, 235, 0.02)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FBFBFA",bgWeekend:"rgba(41, 37, 36, 0.015)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function Il(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ke[e]||ke.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",ke[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ke[e].bgSecondary),bgGrid:a("--theme-bg-card",ke[e].bgGrid),bgWeekend:a("--theme-bg-hover",ke[e].bgWeekend),border:a("--theme-border-primary",ke[e].border),borderLight:a("--theme-border-subtle",ke[e].borderLight),textPrimary:a("--theme-text-primary",ke[e].textPrimary),textSecondary:a("--theme-text-secondary",ke[e].textSecondary),textTertiary:a("--theme-text-tertiary",ke[e].textTertiary),accent:a("--theme-accent-primary",ke[e].accent),accentHover:a("--theme-accent-hover",ke[e].accentHover),accentLight:a("--theme-accent-primary",ke[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ke[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ke[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ke[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ke[e].dependency),dependencyHover:a("--theme-border-secondary",ke[e].dependencyHover),criticalPath:a("--theme-error",ke[e].criticalPath),criticalPathLight:a("--theme-error",ke[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ke[e].today):e==="neutral"?a("--theme-text-primary",ke[e].today):a("--theme-error",ke[e].today),todayLight:e==="light"?a("--theme-accent-primary",ke[e].todayLight):e==="neutral"?a("--theme-text-primary",ke[e].todayLight):a("--theme-error",ke[e].todayLight),milestone:a("--theme-warning",ke[e].milestone),milestoneLight:a("--theme-warning",ke[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ke[e].statusTodo),statusInProgress:a("--theme-accent-primary",ke[e].statusInProgress),statusCompleted:a("--theme-success",ke[e].statusCompleted),hoverBg:a("--theme-bg-hover",ke[e].hoverBg),focusRing:a("--theme-accent-primary",ke[e].focusRing)}}var Pn={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"}},Ml={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"}},Jo={en:Pn,es:Ml};function Al(e){return Jo[e]||Jo.en}function Zo(e,t){let r=Al(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 ua=Te.createContext(Pn);function Ga(){return Te.useContext(ua)}function wf({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:o,onExportMSProject:s}){let[c,d]=Te.useState(false),[i,u]=Te.useState(null),l=Te.useRef(null),p=Ga();if(Te.useEffect(()=>{let h=g=>{l.current&&!l.current.contains(g.target)&&d(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||r||a||n||o||s))return null;let b=[{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),x=async(h,g)=>{if(g){u(h);try{await g();}catch(v){console.error(`Export ${h} failed:`,v);}finally{u(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.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:b.map((h,g)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>x(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<b.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 Cf({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 Tf({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 Df({theme:e,value:t,onChange:r}){let[a,n]=Te.useState(false),o=Te.useRef(null),s=Ga();Te.useEffect(()=>{let i=u=>{o.current&&!o.current.contains(u.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"}],d=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"}: ${d}`,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,u)=>{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:u<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:u*.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 In({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:s,rowDensity:c,onRowDensityChange:d,showThemeSelector:i=true,showCreateTaskButton:u=false,createTaskLabel:l,onCreateTask:p,onExportPNG:m,onExportPDF:b,onExportExcel:x,onExportCSV:h,onExportJSON:g,onExportMSProject:v}){let f=Ga(),w=m||b||x||h||g||v,k=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],y=[{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(Tf,{options:k,value:t,onChange:C=>r(C),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(Df,{theme:e,value:c,onChange:d})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(16, 185, 129, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(16, 185, 129, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||f.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wf,{theme:e,onExportPNG:m,onExportPDF:b,onExportExcel:x,onExportCSV:h,onExportJSON:g,onExportMSProject:v}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Cf,{options:y,value:o,onChange:C=>s(C),theme:e})]})]})}function Mn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=Te.useState(false),[o,s]=Te.useState({x:0,y:0}),c=Te.useRef(null),d=Te.useRef(null);Te.useEffect(()=>{if(!a)return;let u=l=>{c.current&&!c.current.contains(l.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>{if(!a&&d.current){let u=d.current.getBoundingClientRect();s({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(Ve,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${o.x}px`,top:`${o.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function pa({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=Te.useRef(null);return Te.useEffect(()=>{if(!e)return;let c=i=>{s.current&&!s.current.contains(i.target)&&n();},d=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,n]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:s,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg shadow-xl",style:{left:`${t}px`,top:`${r}px`,backgroundColor:o.bgSecondary,border:`1px solid ${o.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:o.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),n());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?o.textTertiary:o.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:o.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:o.textTertiary}})]})]},c.id))})})}):null}var nt={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 Vl({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:c,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:p=true}){let m=Te.useRef(false),b=Te.useCallback(f=>{m.current=f;},[]),x=Te.useCallback(f=>{let w=[],k=y=>{for(let C of y)w.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&k(C.subtasks);};return k(f),w},[]),h=Te.useCallback(()=>{let f=x(e);for(let w of f)if(t.has(w.id))return w;return null},[e,t,x]),g=Te.useCallback((f,w)=>{let k=x(e);if(k.length===0)return;let y=h();if(!y){r(k[0].id,false);return}let C=k.findIndex(R=>R.id===y.id);if(C===-1)return;let T=f==="up"?C-1:C+1;if(T<0||T>=k.length)return;let N=k[T];r(N.id,w);},[e,h,x,r]),v=Te.useCallback(f=>{if(!p)return;let w=f.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){f.key==="Escape"&&(w.blur(),m.current=false);return}let C=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,T=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)&&u(N.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){T.length>0&&(f.preventDefault(),s(T,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){T.length>0&&(f.preventDefault(),c(T));return}if(f.key==="Tab"&&f.shiftKey){T.length>0&&(f.preventDefault(),d(T));return}if(f.key==="Enter"&&!f.shiftKey&&!C){N&&(f.preventDefault(),a(N.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!C){N&&(f.preventDefault(),a(N.id,"above"));return}if(f.key==="Enter"&&C){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"&&C){T.length>0&&(f.preventDefault(),n(T));return}if(f.key==="d"&&C&&!f.shiftKey){T.length>0&&(f.preventDefault(),o(T));return}},[p,t,h,g,a,n,o,s,c,d,i,u,l]);return Te.useEffect(()=>{if(p)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[p,v]),{setIsEditing:b}}function jl(){let[e,t]=Te.useState(new Set),[r,a]=Te.useState(null),n=Te.useCallback(l=>{t(new Set([l])),a(l);},[]),o=Te.useCallback(l=>{t(p=>{let m=new Set(p);return m.has(l)?m.delete(l):m.add(l),m}),a(l);},[]),s=Te.useCallback((l,p)=>{if(!r){n(l);return}let m=p.indexOf(r),b=p.indexOf(l);if(m===-1||b===-1){n(l);return}let x=Math.min(m,b),h=Math.max(m,b),g=p.slice(x,h+1);t(new Set(g)),a(l);},[r,n]),c=Te.useCallback((l,p,m,b)=>{b?s(l,p):m?o(l):n(l);},[n,o,s]),d=Te.useCallback((l,p)=>{p?t(m=>{let b=new Set(m);return b.add(l),b}):n(l);},[n]),i=Te.useCallback(()=>{t(new Set),a(null);},[]),u=Te.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:c,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:u}}function ma(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 ts(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=ts(r.subtasks,t);if(a)return a}return null}function rs(e,t){if(t.length===0)return e;let r=ma(e),a=t[0],n=r.findIndex(l=>l.id===a);if(n<=0)return e;let o=r[n-1],s=(l,p)=>{let m=[];return {tasks:l.filter(x=>{if(p.has(x.id))return m.push(x),false;if(x.subtasks){let h=s(x.subtasks,p);x.subtasks=h.tasks,m.push(...h.removed);}return true}),removed:m}},c=(l,p,m)=>l.map(b=>b.id===p?{...b,subtasks:[...b.subtasks||[],...m],isExpanded:true}:b.subtasks?{...b,subtasks:c(b.subtasks,p,m)}:b),d=new Set(t),{tasks:i,removed:u}=s(e,d);return c(i,o.id,u)}function as(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=ts(r,a);if(!n)continue;let o=ts(r,n.id),s=(i,u,l)=>{for(let p=0;p<i.length;p++){let m=i[p];if(m.id===u&&m.subtasks){let b=m.subtasks.findIndex(x=>x.id===l);if(b!==-1){let[x]=m.subtasks.splice(b,1);return x}}if(m.subtasks){let b=s(m.subtasks,u,l);if(b)return b}}return null},c=(i,u,l)=>{let p=i.findIndex(m=>m.id===u);if(p!==-1)return i.splice(p+1,0,l),i;for(let m of i)m.subtasks&&c(m.subtasks,u,l);return i},d=s(r,n.id,a);d&&(o&&o.subtasks?c(o.subtasks,n.id,d):c(r,n.id,d));}return r}function ns(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,c,d)=>{let i=s.findIndex(l=>l.id===c);if(i===-1){for(let l of s)if(l.subtasks&&o(l.subtasks,c,d))return true;return false}let u=d==="up"?i-1:i+1;return u<0||u>=s.length?false:([s[i],s[u]]=[s[u],s[i]],true)};return o(a,n,r),a}function An(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 os(e,t){let r=[...e];for(let a of t){let n=s=>{let c=s.findIndex(u=>u.id===a);if(c===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let d=s[c],i={...d,id:`${d.id}-copy-${Date.now()}`,name:`${d.name} (Copy)`,subtasks:d.subtasks?o(d.subtasks):void 0};return s.splice(c+1,0,i),true},o=s=>s.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?o(c.subtasks):void 0}));n(r);}return r}function Yl(e,t,r){let a=[...e],n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:o,color:"#6366F1"},c=d=>{let i=d.findIndex(l=>l.id===t);if(i===-1){for(let l of d)if(l.subtasks&&c(l.subtasks))return true;return false}let u=r==="above"?i:i+1;return d.splice(u,0,s),true};return c(a),{tasks:a,newTask:s}}function ss(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:ss(a.subtasks,t,r)}:a)}function is(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:is(r.subtasks,t)}:r)}function ls(e,t){let r=u=>{for(let l of u){if(l.id===t)return l;if(l.subtasks){let p=r(l.subtasks);if(p)return p}}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,d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(s),endDate:new Date(c),color:a?.color||"#3B82F6"},i=u=>u.map(l=>{if(l.id===t){let p=l.subtasks||[];return {...l,subtasks:[...p,d],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:d}}var Jl={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"}},Zl=({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 Ql({status:e="todo",onChange:t,className:r}){let[a,n]=Te.useState(false),[o,s]=Te.useState({top:0,left:0}),c=Te.useRef(null),d=Te.useRef(null);Te.useEffect(()=>{if(a&&d.current){let p=d.current.getBoundingClientRect();s({top:p.bottom+window.scrollY+8,left:p.left+window.scrollX});}},[a]),Te.useEffect(()=>{let p=m=>{c.current&&!c.current.contains(m.target)&&!d.current?.contains(m.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),Te.useEffect(()=>{let p=m=>{m.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let i=p=>{t(p),n(false);},u=Jl[e],l=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:d,onClick:()=>n(!a),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${l}10`,boxShadow:`0 0 0 2px ${l}30 inset`},title:u.label,children:jsxRuntime.jsx(Zl,{icon:u.icon,color:l})}),a&&jsxRuntime.jsx(Ve,{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(Jl).map(([p,m])=>jsxRuntime.jsxs("button",{onClick:()=>i(p),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:m.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Zl,{icon:m.icon,color:m.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:m.label}),e===p&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p))})]})})]})}function Ln({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:s,onTaskContextMenu:c,onTaskToggle:d,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:p,onTaskUpdate:m,onTaskIndent:b,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:g,onTaskDuplicate:v,onTaskCreate:f,onTaskRename:w,onCreateSubtask:k,onOpenTaskModal:y}){let C=Te.useContext(ua),[T,N]=Te.useState(null),[R,G]=Te.useState(false),[W,M]=Te.useState(null),[z,E]=Te.useState(""),B=Te.useRef(null),$=Te.useRef(null),[O,F]=Te.useState(null),[Q,Y]=Te.useState(0),[me,I]=Te.useState(0),[ce,se]=Te.useState({isOpen:false,x:0,y:0,type:"header"});Te.useEffect(()=>{function j(H){B.current&&!B.current.contains(H.target)&&G(false);}if(R)return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[R]),Te.useEffect(()=>{W&&$.current&&($.current.focus(),$.current.select());},[W]),Te.useEffect(()=>{if(!O)return;let j=we=>{let ze=we.clientX-Q,te=me+ze;p?.(O,te);},H=()=>{F(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",j),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[O,Q,me,p]);let{selectedTaskIds:bt,handleTaskClick:Ze,isTaskSelected:ar}=jl(),{setIsEditing:Ce}=Vl({tasks:e,selectedTaskIds:bt,onTaskSelect:(j,H)=>{let ze=ma(e).map(te=>te.id);Ze(j,ze,H||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:j=>{let H=ma(e).find(we=>we.id===j);H&&Lr(H);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:j=>{let H=ma(e).find(we=>we.id===j);H&&y&&y(H);},enableKeyboard:true}),mt=(j,H=0)=>{let we=[];for(let ze of j)we.push({task:ze,level:H}),ze.subtasks&&ze.subtasks.length>0&&ze.isExpanded&&we.push(...mt(ze.subtasks,H+1));return we},ft=mt(e),_t=48,pr=j=>!j.startDate||!j.endDate?"-":`${Math.ceil((j.endDate.getTime()-j.startDate.getTime())/(1e3*60*60*24))}d`,Lr=j=>{M(j.id),E(j.name),Ce(true);},ge=j=>{z.trim()&&z!==e.find(H=>H.id===j)?.name&&w?.(j,z.trim()),M(null),E(""),Ce(false);},Qe=()=>{M(null),E(""),Ce(false);},Wt=(j,H)=>{H.stopPropagation(),k?.(j.id);},Bt=(j,H,we)=>{switch(j.id){case "name":let ze=W===H.id,te=T===H.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${we*20}px`},children:[H.subtasks&&H.subtasks.length>0?jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),d?.(H.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.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:H.color||"#3B82F6",opacity:H.parentId?.6:1,borderColor:H.isMilestone?t.accent:"transparent",borderWidth:H.isMilestone?"2px":"0px"},title:H.isMilestone?"Milestone":H.parentId?"Subtask":"Task"}),ze?jsxRuntime.jsx("input",{ref:$,type:"text",value:z,onChange:q=>E(q.target.value),onKeyDown:q=>{q.key==="Enter"?ge(H.id):q.key==="Escape"&&Qe();},onBlur:()=>ge(H.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:q=>q.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:we===0?"14px":we===1?"13px":"12px",fontWeight:H.isMilestone?600:H.subtasks&&H.subtasks.length>0?500:400,opacity:we===0?1:we===1?.95:.88},title:H.name,children:H.name}),te&&!ze&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:q=>Wt(H,q),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:q=>{q.stopPropagation(),Lr(H);},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 ie=H.startDate?typeof H.startDate=="string"?H.startDate:H.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ie||"",onChange:q=>{m?.(H.id,{startDate:q.target.value?new Date(q.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 nr=H.endDate?typeof H.endDate=="string"?H.endDate:H.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:nr||"",onChange:q=>{m?.(H.id,{endDate:q.target.value?new Date(q.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:pr(H)})});case "assignees":let Ot=a.filter(q=>H.assignees?.some(V=>V.name===q.name||V.initials===q.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Ur,{assignedUsers:Ot,availableUsers:a,onChange:q=>{let V=q.map(ve=>({id:ve.id,name:ve.name,initials:ve.initials,color:ve.color}));m?.(H.id,{assignees:V.length>0?V:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Ql,{status:H.status||"todo",onChange:q=>{m?.(H.id,{status:q,progress:q==="completed"?100:H.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:`${H.progress}%`,backgroundColor:H.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:[H.progress,"%"]})]});default:return null}},Fr=j=>[{id:"hide",label:"Hide Column",icon:nt.Hide,onClick:()=>l(j),disabled:j==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:nt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:nt.SortDesc,onClick:()=>{}}],ne=j=>[{id:"edit",label:C?.contextMenu?.editTask||"Edit Task",icon:nt.Pencil,onClick:()=>{s?.(j);}},{id:"addSubtask",label:C?.contextMenu?.addSubtask||"Add Subtask",icon:nt.Add,onClick:()=>{k?.(j.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:C?.contextMenu?.markIncomplete||"Mark Incomplete",icon:nt.MarkIncomplete,onClick:()=>{m?.(j.id,{status:"todo",progress:0});},disabled:j.status==="todo"},{id:"setInProgress",label:C?.contextMenu?.setInProgress||"Set In Progress",icon:nt.SetInProgress,onClick:()=>{m?.(j.id,{status:"in-progress"});},disabled:j.status==="in-progress"},{id:"markComplete",label:C?.contextMenu?.markComplete||"Mark Complete",icon:nt.MarkComplete,onClick:()=>{m?.(j.id,{status:"completed",progress:100});},disabled:j.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:C?.contextMenu?.splitTask||"Split Task",icon:nt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:C?.contextMenu?.deleteTask||"Delete Task",icon:nt.Delete,onClick:()=>{g?.([j.id]);}}],de=u.filter(j=>j.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:`${_t}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[de.map((j,H)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j.id==="name"?"justify-start":"justify-center"}`,style:{width:`${j.width}px`,minWidth:`${j.width}px`,maxWidth:`${j.width}px`,borderRight:H<de.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box"},onContextMenu:we=>{we.preventDefault(),se({isOpen:true,x:we.clientX,y:we.clientY,type:"header",columnId:j.id});},onMouseEnter:we=>{we.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:we=>{we.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:j.label}),j.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:O===j.id?t.accent:"transparent"},onMouseDown:we=>{we.preventDefault(),we.stopPropagation(),F(j.id),Y(we.clientX),I(j.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}})})]},j.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(Mn,{columns:u,onToggleColumn:l,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>G(!R),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"}),R&&jsxRuntime.jsxs("div",{ref:B,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:j=>j.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:()=>G(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:ft.map(({task:j,level:H},we)=>{let ze=ar(j.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center cursor-pointer group",style:{height:`${r}px`,borderLeft:ze?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ze?t.accentLight:we%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>N(j.id),onMouseLeave:()=>N(null),onClick:te=>{let nr=ma(e).map(V=>V.id),q=navigator.platform.toUpperCase().indexOf("MAC")>=0?te.metaKey:te.ctrlKey;Ze(j.id,nr,q,te.shiftKey),o?.(j);},onDoubleClick:te=>{te.stopPropagation(),s?.(j);},onContextMenu:te=>{te.preventDefault(),se({isOpen:true,x:te.clientX,y:te.clientY,type:"task",task:j}),c?.(j,te);},whileHover:{backgroundColor:ze?t.accentLight:t.hoverBg},children:de.map((te,ie)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${te.id==="name"?"justify-start":"justify-center"} ${ie<de.length-1?"border-r":""}`,style:{width:`${te.width}px`,minWidth:`${te.width}px`,maxWidth:`${te.width}px`,borderColor:T===j.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:Bt(te,j,te.id==="name"?H:0)},`${j.id}-${te.id}`))},j.id)})}),jsxRuntime.jsx(pa,{isOpen:ce.isOpen,x:ce.x,y:ce.y,items:ce.type==="header"&&ce.columnId?Fr(ce.columnId):ce.type==="task"&&ce.task?ne(ce.task):[],onClose:()=>se({...ce,isOpen:false}),theme:t})]})}function tc(e,t){let[r,a]=Te.useState("none"),[n,o]=Te.useState(0),[s,c]=Te.useState(e),[d,i]=Te.useState(t),[u,l]=Te.useState(null),[p,m]=Te.useState(null),[b,x]=Te.useState(null),[h,g]=Te.useState(null),[v,f]=Te.useState(0),[w,k]=Te.useState(0),[y,C]=Te.useState(null),[T,N]=Te.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:c,ghostWidth:d,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:p,setHoveredTaskId:m,activeZone:b,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:g,draggedSegmentStartX:v,setDraggedSegmentStartX:f,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:y,setHoveredSegmentIndex:C,isHovered:T,setIsHovered:N,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(z,E)=>{a("none"),l(null),m(null),c(z),i(E),k(0),g(null),f(0);}}}function Fn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:c,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:p,allTaskPositions:m=[],onDragMove:b}){let x=tc(t,a),h=Te.useRef(null),{dragMode:g,setDragMode:v,dragOffset:f,setDragOffset:w,ghostX:k,setGhostX:y,ghostWidth:C,setGhostWidth:T,connectionLine:N,setConnectionLine:R,hoveredTaskId:G,setHoveredTaskId:W,activeZone:M,setActiveZone:z,draggedSegmentIndex:E,setDraggedSegmentIndex:B,draggedSegmentStartX:$,setDraggedSegmentStartX:O,segmentDragOffsetX:F,setSegmentDragOffsetX:Q,hoveredSegmentIndex:Y,setHoveredSegmentIndex:me,isHovered:I,setIsHovered:ce,isDragging:se,isResizing:bt,isConnecting:Ze,resetDragState:ar}=x,Ce=32,mt=8,ft=e.endDate&&e.endDate<new Date&&e.progress<100,_t=e.isCriticalPath,pr=n.name==="neutral"||n.today==="#1C1917",ge=(V=>V>=80?20:V>=60?15:V>=50?12:10)(a),Qe=a<50,Wt=a<40,Bt=V=>V.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Fr=()=>{let V=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${V} day${V!==1?"s":""}`},ne=V=>Math.round(V/o)*o,de=V=>{let ve=Math.round(V/o),D=new Date(s);return D.setDate(D.getDate()+ve),D},j=(V,ve)=>{for(let D of m){if(D.id===e.id)continue;let U=5;if(V>=D.x-U&&V<=D.x+D.width+U&&ve>=D.y-U&&ve<=D.y+D.height+U)return D.id}return null},H=Te.useCallback((V,ve,D)=>{V.preventDefault(),V.stopPropagation();let U=h.current?.ownerSVGElement;if(!U)return;let ue=U.createSVGPoint();ue.x=V.clientX,ue.y=V.clientY;let he=ue.matrixTransform(U.getScreenCTM()?.inverse()),Le=D!==void 0?D:t,$e=ve;if(!$e){let Nt=he.x-Le;V.shiftKey?($e="connect",R({x:t+a,y:r+Ce/2})):V.ctrlKey||V.metaKey?$e="move":V.altKey?$e=Nt<a/2?"resize-start":"resize-end":Wt?Nt<a/2?$e="move":$e="resize-end":Qe?Nt<=ge/2?$e="resize-start":Nt>=a-ge/2?$e="resize-end":$e="move":Nt<=ge?$e="resize-start":Nt>=a-ge?$e="resize-end":$e="move";}v($e),ce(false),z(null),$e==="move"?w(he.x-Le):$e==="connect"?R({x:t+a,y:r+Ce/2}):w(0),y(Le),T(a);},[t,a,r,Ce]),we=Te.useCallback(V=>{if(g==="none")return;let ve=h.current?.ownerSVGElement;if(!ve)return;let D=ve.createSVGPoint();D.x=V.clientX,D.y=V.clientY;let U=D.matrixTransform(ve.getScreenCTM()?.inverse());if(g==="connect"){R({x:U.x,y:U.y});let ue=j(U.x,U.y);W(ue);}else if(g==="move"){let ue=U.x-f,he=ne(ue);y(he),T(a);let Le=Math.round((he-t)/o);if(b?.(e.id,Le,true),e.segments&&e.segments.length>0&&E!==null){let $e=he-$;Q($e);}}else if(g==="resize-start"){let ue=U.x,he=ne(ue),Le=t+a-he;Le>=o&&(y(he),T(Le));}else if(g==="resize-end"){let ue=U.x,Le=ne(ue)-t;Le>=o&&T(Le);}},[g,t,a,o,f,e,ne,E,$,j,W,R,y,T,Q,b]),ze=Te.useCallback(()=>{if(g!=="none"){if(g==="connect")G&&p&&p(e,G),R(null),W(null);else {let V=e.endDate.getTime()-e.startDate.getTime(),ve,D,U=true;if(g==="move"){if(ve=de(k),D=new Date(ve.getTime()+V),e.segments&&e.segments.length>0&&E!==null){let ue=Math.round(F/o),he=e.segments.map((wt,eo)=>{if(eo===E){let ba=new Date(wt.startDate),ya=new Date(wt.endDate);return ba.setDate(ba.getDate()+ue),ya.setDate(ya.getDate()+ue),{startDate:ba,endDate:ya}}return wt}),Le=he.flatMap(wt=>[wt.startDate,wt.endDate]),$e=new Date(Math.min(...Le.map(wt=>wt.getTime()))),Nt=new Date(Math.max(...Le.map(wt=>wt.getTime())));l?.({...e,segments:he},$e,Nt),ar(t,a);return}}else g==="resize-start"?(ve=de(k),D=e.endDate,ve>=D&&(console.warn("Invalid date range: start date must be before end date"),U=false)):g==="resize-end"?(ve=e.startDate,D=de(k+C),D<=ve&&(console.warn("Invalid date range: end date must be after start date"),U=false)):U=false;U&&ve&&D&&(D.getTime()-ve.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,ve,D));}b?.(e.id,0,false),ar(t,a);}},[g,k,C,e,l,G,p,t,a,o,de,F,E,ar,b]);Te.useEffect(()=>{if(g==="none")return;let V=D=>{we(D);},ve=()=>{ze();};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",ve),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",ve);}},[g,we,ze]);let te=se&&!Ze?k:t,ie=se&&!Ze?C:a,nr=c.taskTooltip(e),Ot=typeof nr=="string"?nr:"",q=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!se&&ce(true),onMouseLeave:()=>{se||(ce(false),z(null));},onClick:()=>!se&&d?.(e),onDoubleClick:V=>{se||(V.stopPropagation(),i?.(e));},onContextMenu:V=>{V.preventDefault(),u?.(e,V);},children:[Ot&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:Ot}}),I&&!se&&!Qe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:ge,height:Ce,fill:M==="resize-start"?n.accent:"transparent",opacity:M==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>z("resize-start"),onMouseDown:V=>H(V,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ge,y:r,width:a-ge*2,height:Ce,fill:M==="move"?n.accent:"transparent",opacity:M==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>z("move"),onMouseDown:V=>H(V,"move")}),jsxRuntime.jsx("rect",{x:t+a-ge,y:r,width:ge,height:Ce,fill:M==="resize-end"?n.accent:"transparent",opacity:M==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>z("resize-end"),onMouseDown:V=>H(V,"resize-end")})]}),I&&!se&&Wt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:Ce,fill:M==="move"?n.accent:"transparent",opacity:M==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>z("move"),onMouseDown:V=>H(V,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:Ce,fill:M==="resize-end"?n.accent:"transparent",opacity:M==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>z("resize-end"),onMouseDown:V=>H(V,"resize-end")}),I&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Ce-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),se&&!Ze&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:r,width:C,height:Ce,rx:mt,fill:n.accent,opacity:.5,stroke:n.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:te,y:r,width:ie,height:Ce,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":q,initial:{opacity:0,scale:.95},animate:{opacity:se&&!Ze?.15:e.parentId?.6:I?.9:.8,scale:I&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V=>H(V),style:{cursor:se?Ze?"crosshair":bt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:te,y:r,width:ie*(e.progress/100),height:Ce,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((V,ve)=>{let D=(V.startDate.getTime()-s.getTime())/864e5*o,ue=(V.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-D+o,he=se&&g==="move"&&E===ve,Le=Y===ve,$e=he?D+F:D;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!se&&me(ve),onMouseLeave:()=>!se&&me(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:$e,y:r,width:ue,height:Ce,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:he||e.parentId?.6:Le?.9:.8,scale:Le&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Nt=>{Nt.stopPropagation(),B(ve),O(D),H(Nt,void 0,D);},style:{cursor:se?Ze?"crosshair":bt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:$e,y:r,width:ue*(e.progress/100),height:Ce,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ve}`)}),pr&&(ft||_t)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[_t&&!ft&&jsxRuntime.jsx("rect",{x:te,y:r,width:ie,height:Ce,rx:mt,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ft&&jsxRuntime.jsx("rect",{x:te,y:r,width:ie,height:Ce,rx:mt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ie>60&&!e.segments&&(()=>{let V=c.taskLabel(e),ve=typeof V=="string"?V:e.name,D=ve.length>Math.floor(ie/8)?`${ve.substring(0,Math.floor(ie/8))}...`:ve;return jsxRuntime.jsx("text",{x:te+12,y:r+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:D})})(),ie>100&&e.progress>0&&e.progress<100&&!se&&!e.segments&&jsxRuntime.jsxs("text",{x:te+ie-12,y:r+Ce/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ie>80&&!se&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:te+ie-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:te+ie-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(I||bt)&&!Ze&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Qe?te-15:te-10,y:r-5,width:Qe?25:20,height:Ce+10,fill:"transparent",onMouseDown:V=>H(V,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe?te-8:te-3,y:r+6,width:Qe?8:6,height:Qe?Ce-12:Ce-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:te+ie-10,y:r-5,width:Qe?25:20,height:Ce+10,fill:"transparent",onMouseDown:V=>H(V,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe?te+ie:te+ie-3,y:r+6,width:Qe?8:6,height:Qe?Ce-12:Ce-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:I&&!se&&!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+Ce/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:V=>{V.stopPropagation(),H(V,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+Ce/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Ze&&N&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+Ce/2,x2:N.x,y2:N.y,stroke:G?n.statusCompleted:n.accent,strokeWidth:G?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:G?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:N.x,cy:N.y,r:G?8:6,fill:G?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),G&&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"})]}),(I||se)&&!Ze&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:te-2,y:r-2,width:ie+4,height:Ce+4,rx:mt+2,fill:"none",stroke:se?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:se?.6:.4,initial:{opacity:0},animate:{opacity:se?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),bt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+C,y1:0,x2:k+C,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&!se&&!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:te+ie/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 ${te+ie/2-6} ${r-13} L ${te+ie/2} ${r-3} L ${te+ie/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:te+ie/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:te+ie/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:te+ie/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Bt(e.startDate)}),jsxRuntime.jsx("text",{x:te+ie/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:te+ie/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Bt(e.endDate)}),jsxRuntime.jsx("text",{x:te+ie/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:te+ie/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fr()}),jsxRuntime.jsx("text",{x:te+ie/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:te+ie/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:te+ie/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:te+ie/2-50,y:r-25,fill:n.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:te+ie/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Wt?"Left: move \u2022 Right: resize":Qe?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})]})}function On({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[s,c]=Te.useState(false),d=r-e,i=a-t,u=e+d/2,l=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,p=6,m=Math.atan2(i,d),b=r-p*Math.cos(m-Math.PI/6),x=a-p*Math.sin(m-Math.PI/6),h=r-p*Math.cos(m+Math.PI/6),g=a-p*Math.sin(m+Math.PI/6),v=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:s?1:.6,strokeWidth:s?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${r} ${a} L ${b} ${x} M ${r} ${a} L ${h} ${g}`,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:s?1:.6,scale:s?1.1:1,strokeWidth:s?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:v,initial:{scale:0},animate:{scale:s?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),s&&o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:f=>{f.stopPropagation(),o();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:u,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:u-4,y1:(t+a)/2-4,x2:u+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:u+4,y1:(t+a)/2-4,x2:u-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function $n({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=Te.useState(false),c=16,d=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:c+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:r+16-c/2,width:c,height:c,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:r+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:d(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var K={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let s=new Set,c=new Set,d=i=>{if(!s.has(i)){s.add(i),c.add(i);let u=a.get(i)||[];for(let l of u){if(!s.has(l)&&d(l))return true;if(c.has(l))return true}}return c.delete(i),false};return d(r)},flattenTasks:e=>{let t=[],r=a=>{a.forEach(n=>{t.push(n),n.subtasks&&n.subtasks.length>0&&r(n.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=K.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=K.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=K.findTaskById(e,n);if(o)r.unshift(o),n=o.parentId;else break}return r},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=K.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
|
|
46
|
-
`)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=
|
|
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(m){o.current&&!o.current.contains(m.target)&&s.current&&!s.current.contains(m.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,m)=>{let l=m.category||"Other";return i[l]||(i[l]=[]),i[l].push(m),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,m])=>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:m.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"),[m,l]=Se.useState(null),d=Se.useRef(null);if(!t)return null;let p=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:p,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),s==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref: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"})]})]}),m&&jsxRuntime.jsxs("div",{className:L("p-4 rounded-lg",m.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",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.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:m=[],showQuickFilters:l=true,compact:d=false,groupBy:p="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]),w=Se.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${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"}),k&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!y&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:g,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange: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:w,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:p,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))})}),k&&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,m]=Se.useState(false),l=Se.useRef(null);Se.useEffect(()=>{let p=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let d=p=>{p(),m(false);};return jsxRuntime.jsxs("div",{className:L("relative",a),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var 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(([m,l])=>{l&&c.style.setProperty(`--theme-${Hf(m)}`,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(([m,l])=>{let d=u.colors[m];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,m]=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){m(h);try{await g();}catch(b){console.error(`Export ${h} failed:`,b);}finally{m(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=m=>{o.current&&!o.current.contains(m.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,m)=>{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:m<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:m*.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:m=false,createTaskLabel:l,onCreateTask:d,onExportPNG:p,onExportPDF:v,onExportExcel:y,onExportCSV:h,onExportJSON:g,onExportMSProject:b}){let f=Ha(),w=p||v||y||h||g||b,k=[{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:k,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:[m&&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})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ig,{theme:e,onExportPNG:p,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 m=l=>{c.current&&!c.current.contains(l.target)&&n(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[a]);let i=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>{if(!a&&u.current){let m=u.current.getBoundingClientRect();s({x:m.left,y:m.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(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.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:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},m.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:m,onOpenTaskModal:l,enableKeyboard:d=true}){let p=Se.useRef(false),v=Se.useCallback(f=>{p.current=f;},[]),y=Se.useCallback(f=>{let w=[],k=x=>{for(let D of x)w.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&k(D.subtasks);};return k(f),w},[]),h=Se.useCallback(()=>{let f=y(e);for(let w of f)if(t.has(w.id))return w;return null},[e,t,y]),g=Se.useCallback((f,w)=>{let k=y(e);if(k.length===0)return;let x=h();if(!x){r(k[0].id,false);return}let D=k.findIndex(T=>T.id===x.id);if(D===-1)return;let C=f==="up"?D-1:D+1;if(C<0||C>=k.length)return;let S=k[C];r(S.id,w);},[e,h,y,r]),b=Se.useCallback(f=>{if(!d)return;let w=f.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){f.key==="Escape"&&(w.blur(),p.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,C=Array.from(t),S=h();if(f.key==="ArrowUp"){f.preventDefault(),g("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),g("down",f.shiftKey);return}if(S&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!S.isExpanded||f.key==="ArrowLeft"&&S.isExpanded)&&m(S.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){S&&(f.preventDefault(),a(S.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!D){S&&(f.preventDefault(),a(S.id,"above"));return}if(f.key==="Enter"&&D){S&&(f.preventDefault(),l(S.id));return}if(f.key==="F2"){S&&(f.preventDefault(),i(S.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,m,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 p=new Set(d);return p.has(l)?p.delete(l):p.add(l),p}),a(l);},[]),s=Se.useCallback((l,d)=>{if(!r){n(l);return}let p=d.indexOf(r),v=d.indexOf(l);if(p===-1||v===-1){n(l);return}let y=Math.min(p,v),h=Math.max(p,v),g=d.slice(y,h+1);t(new Set(g)),a(l);},[r,n]),c=Se.useCallback((l,d,p,v)=>{v?s(l,d):p?o(l):n(l);},[n,o,s]),u=Se.useCallback((l,d)=>{d?t(p=>{let v=new Set(p);return v.add(l),v}):n(l);},[n]),i=Se.useCallback(()=>{t(new Set),a(null);},[]),m=Se.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:c,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:m}}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 p=[];return {tasks:l.filter(y=>{if(d.has(y.id))return p.push(y),false;if(y.subtasks){let h=s(y.subtasks,d);y.subtasks=h.tasks,p.push(...h.removed);}return true}),removed:p}},c=(l,d,p)=>l.map(v=>v.id===d?{...v,subtasks:[...v.subtasks||[],...p],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,d,p)}:v),u=new Set(t),{tasks:i,removed:m}=s(e,u);return c(i,o.id,m)}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,m,l)=>{for(let d=0;d<i.length;d++){let p=i[d];if(p.id===m&&p.subtasks){let v=p.subtasks.findIndex(y=>y.id===l);if(v!==-1){let[y]=p.subtasks.splice(v,1);return y}}if(p.subtasks){let v=s(p.subtasks,m,l);if(v)return v}}return null},c=(i,m,l)=>{let d=i.findIndex(p=>p.id===m);if(d!==-1)return i.splice(d+1,0,l),i;for(let p of i)p.subtasks&&c(p.subtasks,m,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 m=u==="up"?i-1:i+1;return m<0||m>=s.length?false:([s[i],s[m]]=[s[m],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(m=>m.id===a);if(c===-1){for(let m of s)if(m.subtasks&&n(m.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 m=r==="above"?i:i+1;return u.splice(m,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=m=>{for(let l of m){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=m=>m.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=p=>{c.current&&!c.current.contains(p.target)&&!u.current?.contains(p.target)&&n(false);};if(a)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]),Se.useEffect(()=>{let d=p=>{p.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[a]);let i=d=>{t(d),n(false);},m=Tc[e],l=m.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:m.label,children:jsxRuntime.jsx(Dc,{icon:m.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,p])=>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:p.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:p.icon,color:p.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:p.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:m,onToggleColumn:l,onColumnResize:d,onTaskUpdate:p,onTaskIndent:v,onTaskOutdent:y,onTaskMove:h,onMultiTaskDelete:g,onTaskDuplicate:b,onTaskCreate:f,onTaskRename:w,onCreateSubtask:k,onOpenTaskModal:x}){let D=Se.useContext(ga),[C,S]=Se.useState(null),[T,$]=Se.useState(false),[z,R]=Se.useState(null),[W,P]=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:wt,handleTaskClick:rt,isTaskSelected:ir}=xc(),{setIsEditing:De}=vc({tasks:e,selectedTaskIds:wt,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},vt=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),P(X.name),De(true);},he=X=>{W.trim()&&W!==e.find(j=>j.id===X)?.name&&w?.(X,W.trim()),R(null),P(""),De(false);},at=()=>{R(null),P(""),De(false);},Kt=(X,j)=>{j.stopPropagation(),k?.(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=>P(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:"truncate 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=>{p?.(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=>{p?.(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(ye=>({id:ye.id,name:ye.name,initials:ye.initials,color:ye.color}));p?.(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=>{p?.(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:()=>{k?.(X.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:D?.contextMenu?.markIncomplete||"Mark Incomplete",icon:lt.MarkIncomplete,onClick:()=>{p?.(X.id,{status:"todo",progress:0});},disabled:X.status==="todo"},{id:"setInProgress",label:D?.contextMenu?.setInProgress||"Set In Progress",icon:lt.SetInProgress,onClick:()=>{p?.(X.id,{status:"in-progress"});},disabled:X.status==="in-progress"},{id:"markComplete",label:D?.contextMenu?.markComplete||"Mark Complete",icon:lt.MarkComplete,onClick:()=>{p?.(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=m.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:m,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:vt.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:()=>S(X.id),onMouseLeave:()=>S(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),[m,l]=Se.useState(null),[d,p]=Se.useState(null),[v,y]=Se.useState(null),[h,g]=Se.useState(null),[b,f]=Se.useState(0),[w,k]=Se.useState(0),[x,D]=Se.useState(null),[C,S]=Se.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:c,ghostWidth:u,setGhostWidth:i,connectionLine:m,setConnectionLine:l,hoveredTaskId:d,setHoveredTaskId:p,activeZone:v,setActiveZone:y,draggedSegmentIndex:h,setDraggedSegmentIndex:g,draggedSegmentStartX:b,setDraggedSegmentStartX:f,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:x,setHoveredSegmentIndex:D,isHovered:C,setIsHovered:S,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(W,P)=>{a("none"),l(null),p(null),c(W),i(P),k(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:m,onDateChange:l,onDependencyCreate:d,allTaskPositions:p=[],onDragMove:v}){let y=Ec(t,a),h=Se.useRef(null),{dragMode:g,setDragMode:b,dragOffset:f,setDragOffset:w,ghostX:k,setGhostX:x,ghostWidth:D,setGhostWidth:C,connectionLine:S,setConnectionLine:T,hoveredTaskId:$,setHoveredTaskId:z,activeZone:R,setActiveZone:W,draggedSegmentIndex:P,setDraggedSegmentIndex:O,draggedSegmentStartX:G,setDraggedSegmentStartX:U,segmentDragOffsetX:A,setSegmentDragOffsetX:K,hoveredSegmentIndex:_,setHoveredSegmentIndex:ae,isHovered:M,setIsHovered:de,isDragging:ie,isResizing:wt,isConnecting:rt,resetDragState:ir}=y,De=32,bt=8,vt=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 ye=Math.round(Y/o),N=new Date(s);return N.setDate(N.getDate()+ye),N},X=(Y,ye)=>{for(let N of p){if(N.id===e.id)continue;let H=5;if(Y>=N.x-H&&Y<=N.x+N.width+H&&ye>=N.y-H&&ye<=N.y+N.height+H)return N.id}return null},j=Se.useCallback((Y,ye,N)=>{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 be=me.matrixTransform(H.getScreenCTM()?.inverse()),Be=N!==void 0?N:t,Ue=ye;if(!Ue){let Mt=be.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"?w(be.x-Be):Ue==="connect"?T({x:t+a,y:r+De/2}):w(0),x(Be),C(a);},[t,a,r,De]),Te=Se.useCallback(Y=>{if(g==="none")return;let ye=h.current?.ownerSVGElement;if(!ye)return;let N=ye.createSVGPoint();N.x=Y.clientX,N.y=Y.clientY;let H=N.matrixTransform(ye.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,be=se(me);x(be),C(a);let Be=Math.round((be-t)/o);if(v?.(e.id,Be,true),e.segments&&e.segments.length>0&&P!==null){let Ue=be-G;K(Ue);}}else if(g==="resize-start"){let me=H.x,be=se(me),Be=t+a-be;Be>=o&&(x(be),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,P,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(),ye,N,H=true;if(g==="move"){if(ye=ue(k),N=new Date(ye.getTime()+Y),e.segments&&e.segments.length>0&&P!==null){let me=Math.round(A/o),be=e.segments.map((St,go)=>{if(go===P){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=be.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:be},Ue,Mt),ir(t,a);return}}else g==="resize-start"?(ye=ue(k),N=e.endDate,ye>=N&&(console.warn("Invalid date range: start date must be before end date"),H=false)):g==="resize-end"?(ye=e.startDate,N=ue(k+D),N<=ye&&(console.warn("Invalid date range: end date must be after start date"),H=false)):H=false;H&&ye&&N&&(N.getTime()-ye.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,ye,N));}v?.(e.id,0,false),ir(t,a);}},[g,k,D,e,l,$,d,t,a,o,ue,A,P,ir,v]);Se.useEffect(()=>{if(g==="none")return;let Y=N=>{Te(N);},ye=()=>{We();};return window.addEventListener("mousemove",Y),window.addEventListener("mouseup",ye),()=>{window.removeEventListener("mousemove",Y),window.removeEventListener("mouseup",ye);}},[g,Te,We]);let re=ie&&!rt?k: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(),m?.(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:k,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||vt?"#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":wt?"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||vt?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((Y,ye)=>{let N=(Y.startDate.getTime()-s.getTime())/864e5*o,me=(Y.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-N+o,be=ie&&g==="move"&&P===ye,Be=_===ye,Ue=be?N+A:N;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ie&&ae(ye),onMouseLeave:()=>!ie&&ae(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Ue,y:r,width:me,height:De,rx:bt,fill:e.isCriticalPath||vt?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:be||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(ye),U(N),j(Mt,void 0,N);},style:{cursor:ie?rt?"crosshair":wt?"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||vt?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ye}`)}),hr&&(vt||jt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jt&&!vt&&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"}}),vt&&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),ye=typeof Y=="string"?Y:e.name,N=ye.length>Math.floor(le/8)?`${ye.substring(0,Math.floor(le/8))}...`:ye;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:N})})(),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||wt)&&!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&&S&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+De/2,x2:S.x,y2:S.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:S.x,cy:S.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:S.x+15,y:S.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:S.x+10},animate:{opacity:1,x:S.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"}}),wt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+D,y1:0,x2:k+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,m=e+u/2,l=`M ${e} ${t} C ${m} ${t}, ${m} ${a}, ${r} ${a}`,d=6,p=Math.atan2(i,u),v=r-d*Math.cos(p-Math.PI/6),y=a-d*Math.sin(p-Math.PI/6),h=r-d*Math.cos(p+Math.PI/6),g=a-d*Math.sin(p+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:m,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:m-4,y1:(t+a)/2-4,x2:m+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:m+4,y1:(t+a)/2-4,x2:m-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(m=>{m.dependencies&&a.set(m.id,m.dependencies),m.subtasks&&n(m.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 m=a.get(i)||[];for(let l of m){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(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=q.flattenTasks(e).filter(a=>a.startDate);return r.length===0?null:new Date(Math.min(...r.map(a=>a.startDate.getTime())))},getLatestEndDate:e=>{let r=q.flattenTasks(e).filter(a=>a.endDate);return r.length===0?null:new Date(Math.max(...r.map(a=>a.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>q.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=q.findTaskById(e,t);return !r||!r.dependencies?[]:q.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>q.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>q.flattenTasks(e).filter(a=>!a.startDate||!a.endDate?false:a.startDate<=r&&a.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.startDate||!a.startDate)return 0;let n=r.startDate.getTime()-a.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.endDate||!a.endDate)return 0;let n=r.endDate.getTime()-a.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((r,a)=>{let n=r.progress-a.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=q.flattenTasks(e);if(t.length===0)return 0;let r=t.reduce((a,n)=>a+n.progress,0);return Math.round(r/t.length)},getTaskByPath:(e,t)=>{let r=e,a;for(let n=0;n<t.length;n++){let o=t[n];if(!r||o===void 0||o>=r.length||(a=r[o],!a))return;n<t.length-1&&(r=a.subtasks||[]);}return a},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(r=>q.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable'),n=new r,o=q.flattenTasks(e);if(o.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let s=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=o.map(u=>{let i=u.startDate&&u.endDate?q.calculateDuration(u.startDate,u.endDate):0;return [u.name,u.startDate?q.formatDate(u.startDate):"N/A",u.endDate?q.formatDate(u.endDate):"N/A",i>0?`${i} days`:"N/A",`${u.progress}%`,u.status||"N/A"]});a(n,{head:s,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(r){throw r}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let r=await import('xlsx'),n=q.flattenTasks(e).map(u=>{let i=u.startDate&&u.endDate?q.calculateDuration(u.startDate,u.endDate):0;return {"Task ID":u.id,"Task Name":u.name,"Start Date":u.startDate?q.formatDate(u.startDate):"","End Date":u.endDate?q.formatDate(u.endDate):"","Duration (days)":i>0?i:"","Progress (%)":u.progress,Status:u.status||"",Assignees:u.assignees?.map(m=>m.name).join(", ")||"",Dependencies:u.dependencies?.join(", ")||"","Is Milestone":u.isMilestone?"Yes":"No","Parent ID":u.parentId||"",Level:u.level||0}}),o=r.utils.json_to_sheet(n),s=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];o["!cols"]=s;let c=r.utils.book_new();r.utils.book_append_sheet(c,o,"Gantt Tasks"),r.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=q.flattenTasks(e),n=new Map;a.forEach((d,p)=>{n.set(d.id,p+1);});let o=d=>d.toISOString().replace("Z",""),s=q.getEarliestStartDate(e)||new Date,c=q.getLatestEndDate(e)||new Date,u=a.map((d,p)=>{let v=n.get(d.id),y=d.startDate&&d.endDate?q.calculateDuration(d.startDate,d.endDate):0,h=(d.dependencies||[]).filter(g=>n.has(g)).map(g=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
48
|
<PredecessorUID>${n.get(g)}</PredecessorUID>
|
|
49
49
|
<Type>1</Type>
|
|
@@ -52,38 +52,38 @@
|
|
|
52
52
|
<LagFormat>7</LagFormat>
|
|
53
53
|
</PredecessorLink>`).join("");return `
|
|
54
54
|
<Task>
|
|
55
|
-
<UID>${
|
|
56
|
-
<ID>${
|
|
57
|
-
<Name>${
|
|
55
|
+
<UID>${v}</UID>
|
|
56
|
+
<ID>${p+1}</ID>
|
|
57
|
+
<Name>${d.name.replace(/[<>&'"]/g,g=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[g]||g)}</Name>
|
|
58
58
|
<Type>0</Type>
|
|
59
59
|
<IsNull>0</IsNull>
|
|
60
60
|
<CreateDate>${o(new Date)}</CreateDate>
|
|
61
|
-
<WBS>${
|
|
62
|
-
<OutlineNumber>${
|
|
63
|
-
<OutlineLevel>${
|
|
61
|
+
<WBS>${p+1}</WBS>
|
|
62
|
+
<OutlineNumber>${p+1}</OutlineNumber>
|
|
63
|
+
<OutlineLevel>${d.level||0}</OutlineLevel>
|
|
64
64
|
<Priority>500</Priority>
|
|
65
|
-
<Start>${
|
|
66
|
-
<Finish>${
|
|
67
|
-
<Duration>PT${
|
|
65
|
+
<Start>${d.startDate?o(d.startDate):""}</Start>
|
|
66
|
+
<Finish>${d.endDate?o(d.endDate):""}</Finish>
|
|
67
|
+
<Duration>PT${y*8}H0M0S</Duration>
|
|
68
68
|
<DurationFormat>7</DurationFormat>
|
|
69
|
-
<Work>PT${
|
|
70
|
-
<Stop>${
|
|
71
|
-
<Resume>${
|
|
69
|
+
<Work>PT${y*8}H0M0S</Work>
|
|
70
|
+
<Stop>${d.endDate?o(d.endDate):""}</Stop>
|
|
71
|
+
<Resume>${d.startDate?o(d.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>${d.isMilestone?"1":"0"}</Milestone>
|
|
78
|
+
<Summary>${d.subtasks&&d.subtasks.length>0?"1":"0"}</Summary>
|
|
79
|
+
<Critical>${d.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>${d.startDate?o(d.startDate):""}</EarlyStart>
|
|
84
|
+
<EarlyFinish>${d.endDate?o(d.endDate):""}</EarlyFinish>
|
|
85
|
+
<LateStart>${d.startDate?o(d.startDate):""}</LateStart>
|
|
86
|
+
<LateFinish>${d.endDate?o(d.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>${d.progress}</PercentComplete>
|
|
95
|
+
<PercentWorkComplete>${d.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(
|
|
99
|
+
<ActualStart>${d.progress>0&&d.startDate?o(d.startDate):""}</ActualStart>
|
|
100
|
+
<ActualFinish>${d.progress===100&&d.endDate?o(d.endDate):""}</ActualFinish>
|
|
101
|
+
<ActualDuration>PT${Math.round(y*d.progress/100)*8}H0M0S</ActualDuration>
|
|
102
102
|
<ActualCost>0</ActualCost>
|
|
103
103
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
104
|
-
<ActualWork>PT${Math.round(
|
|
104
|
+
<ActualWork>PT${Math.round(y*d.progress/100)*8}H0M0S</ActualWork>
|
|
105
105
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
106
|
-
<RegularWork>PT${
|
|
107
|
-
<RemainingDuration>PT${Math.round(
|
|
106
|
+
<RegularWork>PT${y*8}H0M0S</RegularWork>
|
|
107
|
+
<RemainingDuration>PT${Math.round(y*(100-d.progress)/100)*8}H0M0S</RemainingDuration>
|
|
108
108
|
<RemainingCost>0</RemainingCost>
|
|
109
|
-
<RemainingWork>PT${Math.round(
|
|
109
|
+
<RemainingWork>PT${Math.round(y*(100-d.progress)/100)*8}H0M0S</RemainingWork>
|
|
110
110
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
111
111
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
112
112
|
<ACWP>0</ACWP>
|
|
@@ -129,8 +129,8 @@
|
|
|
129
129
|
</Task>`}).join(""),i=`<?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,
|
|
132
|
+
<Name>${t.replace(/[<>&'"]/g,d=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[d]||d)}</Name>
|
|
133
|
+
<Title>${t.replace(/[<>&'"]/g,d=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[d]||d)}</Title>
|
|
134
134
|
<CreationDate>${o(new Date)}</CreationDate>
|
|
135
135
|
<LastSaved>${o(new Date)}</LastSaved>
|
|
136
136
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
@@ -271,11 +271,11 @@
|
|
|
271
271
|
</WeekDays>
|
|
272
272
|
</Calendar>
|
|
273
273
|
</Calendars>
|
|
274
|
-
<Tasks>${
|
|
274
|
+
<Tasks>${u}
|
|
275
275
|
</Tasks>
|
|
276
|
-
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(u),l.download=r,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=K.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let u=i.startDate&&i.endDate?K.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let b=t.find(x=>x.id===m);if(b){n(b);let x=a.get(m)?.ef||0;l=Math.max(l,x);}}let p=l+u;a.set(i.id,{es:l,ef:p});};r.forEach(n);let o=Math.max(...Array.from(a.values()).map(i=>i.ef)),s=new Map,c=i=>{if(s.has(i.id))return;let u=i.startDate&&i.endDate?K.calculateDuration(i.startDate,i.endDate):0,l=t.filter(b=>b.dependencies&&b.dependencies.includes(i.id)),p=o;if(l.length>0)for(let b of l){c(b);let x=s.get(b.id)?.ls||0;p=Math.min(p,x);}let m=p-u;s.set(i.id,{ls:m,lf:p});};r.forEach(c);let d=[];for(let i of r){let u=a.get(i.id),l=s.get(i.id);if(u&&l){let p=l.ls-u.es;Math.abs(p)<.01&&d.push(i.id);}}return d},calculateSlack:(e,t)=>{let r=K.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(K.calculateCriticalPath(e).includes(t))return 0;let n=K.getDependentTasks(e,t);if(n.length===0){let c=K.getLatestEndDate(e);if(!c)return null;let d=K.calculateDuration(r.endDate,c);return Math.max(0,d)}let o=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,d)=>c-d)[0];if(!o)return null;let s=K.calculateDuration(r.endDate,new Date(o));return Math.max(0,s)},isOnCriticalPath:(e,t)=>K.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r)=>{let a=K.findTaskById(e,t);if(!a||!a.endDate)return e;let n=K.getDependentTasks(e,t);if(n.length===0)return e;let o=[...e];for(let s of n){if(!s.startDate||!s.endDate)continue;let c=K.calculateDuration(s.startDate,s.endDate),d;r!==void 0?(d=new Date(s.startDate),d.setDate(d.getDate()+r)):(d=new Date(a.endDate),d.setDate(d.getDate()+1));let i=K.calculateEndDate(d,c),u=l=>l.map(p=>p.id===s.id?{...p,startDate:d,endDate:i}:p.subtasks?{...p,subtasks:u(p.subtasks)}:p);o=u(o),o=K.autoScheduleDependents(o,s.id,r);}return o},calculateCascadePreview:(e,t,r,a,n,o,s,c)=>{if(r===0)return [];let d=[],i=n.getTime(),u=1e3*60*60*24,l=K.findTaskById(e,t);if(!l||!l.endDate)return [];let p=(m,b,x=new Set)=>{if(x.has(m))return;x.add(m);let h=K.getDependentTasks(e,m);for(let g of h){if(!g.startDate||!g.endDate)continue;let v=a.findIndex(G=>G.id===g.id);if(v===-1)continue;let f=g.startDate.getTime(),k=(g.endDate.getTime()-f)/u,C=(f-i)/u*o,T=C+b*o,N=Math.max(k*o,o),R=c+v*s+12;d.push({taskId:g.id,taskName:g.name,originalX:C,previewX:T,width:N,y:R,rowIndex:v,daysDelta:b,color:g.color}),p(g.id,b,x);}};return p(t,r),d},splitTask:(e,t,r,a=3)=>{let n=K.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let o=new Date(r);o.setDate(o.getDate()-1);let s=new Date(r);s.setDate(s.getDate()+a);let c=new Date(n.endDate);c.setDate(c.getDate()+a);let d=[{startDate:new Date(n.startDate),endDate:o},{startDate:s,endDate:c}],i=u=>u.map(l=>l.id===n.id?{...l,endDate:c,segments:d}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function _n({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:s,templates:c,onTaskClick:d,onTaskDblClick:i,onTaskContextMenu:u,onTaskDateChange:l,onDependencyCreate:p,onDependencyDelete:m}){let[x,h]=Te.useState([]),g=Math.ceil((o.getTime()-n.getTime())/(1e3*60*60*24)),v=a==="day"?60:a==="week"?20:8,f=g*v*s,w=E=>{let B=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),$=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-$);let O=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-O.getTime())/864e5+1)/7)},k=E=>{let B=E.getDay();return B===0||B===6},y=Te.useCallback(E=>{let B=Math.round(E/(v*s)),$=new Date(n);return $.setDate($.getDate()+B),$},[n,v,s]),C=Te.useCallback((E,B)=>{if(B.startDate&&B.endDate)return;let $=E.currentTarget.ownerSVGElement;if(!$)return;let O=$.createSVGPoint();O.x=E.clientX,O.y=E.clientY;let F=O.matrixTransform($.getScreenCTM()?.inverse()),Q=y(F.x),Y=new Date(Q);Y.setDate(Y.getDate()+1),l?.(B,Q,Y);},[y,l]),T=Te.useMemo(()=>{let E=F=>F.map(Q=>{if(Q.subtasks&&Q.subtasks.length>0){let Y=E(Q.subtasks),me=Y.filter(I=>I.startDate&&I.endDate);if(me.length>0){let I=me.map(Ze=>Ze.startDate.getTime()),ce=me.map(Ze=>Ze.endDate.getTime()),se=new Date(Math.min(...I)),bt=new Date(Math.max(...ce));return {...Q,subtasks:Y,startDate:Q.startDate||se,endDate:Q.endDate||bt}}return {...Q,subtasks:Y}}return Q}),B=(F,Q=[])=>{for(let Y of F)Q.push(Y),Y.subtasks&&Y.subtasks.length>0&&(Y.isExpanded===void 0||Y.isExpanded)&&B(Y.subtasks,Q);return Q},$=E(e);return B($)},[e]),N=Te.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let B=E.startDate.getTime(),$=E.endDate.getTime(),O=n.getTime(),F=(B-O)/(1e3*60*60*24),Q=($-B)/(1e3*60*60*24),Y=F*v*s,me=Math.max(v*s,40),I=Math.max(Q*v*s,me);return {x:Y,width:I}},[n,v,s]),R=Te.useMemo(()=>T.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:B,width:$}=N(E),F=T.findIndex(Q=>Q.id===E.id)*r+12;return {id:E.id,x:B,y:F,width:$,height:32}}),[T,N]),G=Te.useCallback((E,B,$)=>{if(!$||B===0){h([]);return}let O=K.calculateCascadePreview(e,E,B,T,n,v*s,r,48);h(O);},[e,T,n,v,s,r,48]),W=Te.useMemo(()=>{let E=[],B=new Date(n);for(;B<=o;){let F=(B.getTime()-n.getTime())/864e5*v*s;if(a==="day")E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:F}),B.setDate(B.getDate()+1);else if(a==="week"){let Q=w(B);E.push({date:new Date(B),label:`Week ${Q}`,x:F}),B.setDate(B.getDate()+7);}else E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:F}),B.setMonth(B.getMonth()+1);}return E},[n,o,a,v,s]),M=Te.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*v*s,[n,v,s]),z=Math.max(T.length*r,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,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}),W.map((E,B)=>jsxRuntime.jsxs("g",{children:[B>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-${B}`)),M>=0&&M<=f&&jsxRuntime.jsx("circle",{cx:M,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(f,1e3),height:z,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:z,fill:t.bgPrimary}),W.map((E,B)=>{let $=W[B+1]?.x||f,O=k(E.date);return jsxRuntime.jsxs("g",{children:[O&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:$-E.x,height:T.length*r,fill:t.bgWeekend,opacity:1}),B>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:T.length*r,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),M>=0&&M<=f&&jsxRuntime.jsx("line",{x1:M,y1:0,x2:M,y2:T.length*r,stroke:t.today,strokeWidth:2,opacity:1}),T.map((E,B)=>{let $=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:B*r,width:f,height:r,fill:B%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:B*r,width:f,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:O=>C(O,E),onMouseEnter:O=>{O.currentTarget.setAttribute("fill",t.accentLight),O.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:O=>{O.currentTarget.setAttribute("fill","transparent"),O.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:M>0?M:100,y:B*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${E.id}`)]})]},`row-group-${E.id}`)}),T.map((E,B)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map($=>{let O=T.find(me=>me.id===$);if(!O||!O.startDate||!O.endDate)return null;let F=T.findIndex(me=>me.id===$),Q=N(O),Y=N(E);return jsxRuntime.jsx(On,{x1:Q.x+Q.width,y1:F*r+r/2,x2:Y.x,y2:B*r+r/2,theme:t,onDelete:()=>m?.(E.id,$)},`dep-${$}-${E.id}`)})),T.map((E,B)=>{if(!E.startDate||!E.endDate)return null;let{x:$,width:O}=N(E),F=B*r+12,Q=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx($n,{task:E,x:$+O/2,y:F+16,theme:t,onClick:d},E.id):Q?jsxRuntime.jsxs("g",{onClick:()=>d?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:$,y:F,width:O,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:$,y1:F,x2:$+O,y2:F,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$,y1:F,x2:$,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$+O,y1:F,x2:$+O,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$,y1:F+32,x2:$+O,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),O>60&&jsxRuntime.jsx("text",{x:$+12,y:F+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(Fn,{task:E,x:$,y:F,width:O,theme:t,dayWidth:v*s,startDate:n,templates:c,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:p,allTaskPositions:R,onDragMove:G},E.id)}),x.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 oc=[{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 sc({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:oc.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:oc.find(a=>a.value===e)?.name||"Personalizado"})]})}function Wn({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:s=false,mode:c=r?"edit":"create",theme:d="dark"}){let i=ke[d]||ke.dark,u={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},l={color:i.textSecondary},[p,m]=Te.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[b,x]=Te.useState({});Te.useEffect(()=>{m(r?{name:r.name,startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",isMilestone:r.isMilestone||false,color:r.color||"#6366F1",assignees:r.assignees||[],dependencies:r.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[r,e]);let h=()=>{let f={};return p.name.trim()||(f.name="El nombre es requerido"),p.startDate&&p.endDate&&p.startDate>p.endDate&&(f.endDate="La fecha de fin debe ser posterior a la de inicio"),x(f),Object.keys(f).length===0},g=async f=>{if(f.preventDefault(),!!h())try{await o(p),t();}catch(w){console.error("Error submitting task:",w);}},v=(f,w)=>{m(k=>{let y={...k,[f]:w};if(f==="progress"){let C=typeof w=="number"?w:parseInt(w,10);C===100&&k.status!=="completed"?y.status="completed":C>0&&C<100&&k.status==="todo"?y.status="in-progress":C===0&&k.status==="in-progress"&&(y.status="todo");}return y}),b[f]&&x(k=>{let y={...k};return delete y[f],y});};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:c==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:f=>f.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:f=>f.currentTarget.style.backgroundColor="transparent",disabled:s,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:g,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:l,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:p.name,onChange:f=>v("name",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,onFocus:f=>f.currentTarget.style.borderColor=i.accent,onBlur:f=>f.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:s}),b.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),b.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsxRuntime.jsx("input",{type:"date",value:p.startDate?p.startDate.toISOString().split("T")[0]:"",onChange:f=>v("startDate",f.target.value?new Date(f.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||p.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsxRuntime.jsx("input",{type:"date",value:p.endDate?p.endDate.toISOString().split("T")[0]:"",onChange:f=>v("endDate",f.target.value?new Date(f.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||p.isMilestone}),b.endDate&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),b.endDate]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:p.status,onChange:f=>v("status",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s,children:[jsxRuntime.jsx("option",{value:"todo",children:"Por Hacer"}),jsxRuntime.jsx("option",{value:"in-progress",children:"En Progreso"}),jsxRuntime.jsx("option",{value:"completed",children:"Completada"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-3 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(sc,{value:p.color,onChange:f=>v("color",f),disabled:s}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:i.textTertiary},children:r?.parentId?"Esta subtarea hereda el color de su tarea padre":r?.subtasks&&r.subtasks.length>0?"Las subtareas heredar\xE1n este color con menor opacidad":"Elige un color para organizar visualmente tus tareas"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:l,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-2 py-0.5 rounded text-sm",style:{color:p.progress<30?"#EF4444":p.progress<70?"#F59E0B":"#10B981",backgroundColor:p.progress<30?"rgba(239, 68, 68, 0.1)":p.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[p.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:p.progress,onChange:f=>v("progress",parseInt(f.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:p.progress<30?"#EF4444":p.progress<70?"#F59E0B":"#10B981"},disabled:s}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${p.progress}%`,backgroundColor:p.progress<30?"rgba(239, 68, 68, 0.3)":p.progress<70?"rgba(245, 158, 11, 0.3)":"rgba(16, 185, 129, 0.3)"}})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-3 gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:i.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(f=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>v("progress",f),disabled:s,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:p.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.bgSecondary,color:p.progress===f?"#FFFFFF":i.textSecondary,border:`1px solid ${p.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.borderLight}`},children:[f,"%"]},f))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:i.textTertiary},children:[jsxRuntime.jsx("span",{children:"0%"}),jsxRuntime.jsx("span",{children:"25%"}),jsxRuntime.jsx("span",{children:"50%"}),jsxRuntime.jsx("span",{children:"75%"}),jsxRuntime.jsx("span",{children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:p.isMilestone,onChange:f=>v("isMilestone",f.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),n.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:n.map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.assignees?.some(w=>w.name===f.name),onChange:w=>{let k=w.target.checked?[...p.assignees||[],{name:f.name,avatar:f.avatar,initials:f.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(p.assignees||[]).filter(y=>y.name!==f.name);v("assignees",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:i.accent},children:f.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:f.name})]})]},f.id))})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:a.filter(f=>f.id!==r?.id).map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.dependencies?.includes(f.id),onChange:w=>{let k=w.target.checked?[...p.dependencies||[],f.id]:(p.dependencies||[]).filter(y=>y!==f.id);v("dependencies",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:f.name})]},f.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:f=>{f.currentTarget.style.color=i.textPrimary,f.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:f=>{f.currentTarget.style.color=i.textSecondary,f.currentTarget.style.backgroundColor="transparent";},disabled:s,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:g,disabled:s,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:f=>!s&&(f.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:f=>!s&&(f.currentTarget.style.backgroundColor=i.accent),children:s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Dg=['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"'],mc=()=>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"})]}),Sg=()=>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"})}),Ng=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),Eg=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),Rg=()=>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 Hn({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:o,onTaskDelete:s,onDependencyCreate:c,onDependencyDelete:d}){let[i,u]=Te.useState(false),[l,p]=Te.useState(false),[m,b]=Te.useState([]),[x,h]=Te.useState(""),[g,v]=Te.useState(false),[f,w]=Te.useState(true),k=Te.useRef(null),y=Te.useRef(null),C=Te.useRef(null),{enabled:T=true,placeholder:N='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:G,suggestions:W=Dg,maxHistory:M=50}=r;Te.useEffect(()=>{y.current&&y.current.scrollIntoView({behavior:"smooth"});},[m]),Te.useEffect(()=>{i&&!l&&k.current&&setTimeout(()=>k.current?.focus(),100);},[i,l]);let z=Te.useCallback(F=>{if(F.success)switch(F.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":F.taskId&&F.updates&&n?.(F.taskId,F.updates);break;case "create_task":F.newTask&&o?.(F.newTask);break;case "delete_task":F.taskId&&s?.(F.taskId);break;case "link_tasks":F.dependencyFrom&&F.dependencyTo&&c?.(F.dependencyFrom,F.dependencyTo);break;case "unlink_tasks":F.taskId&&F.dependencyFrom&&d?.(F.taskId,F.dependencyFrom);break}},[n,o,s,c,d]),E=Te.useCallback(async F=>{if(!F.trim()||g)return;let Q={id:`user-${Date.now()}`,role:"user",content:F,timestamp:new Date};b(me=>[...me.slice(-(M-1)),Q]),h(""),w(false),v(true);let Y={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(me=>[...me,Y]);try{if(G){let me=await G(F,e);b(I=>{let ce=I.filter(bt=>!bt.isLoading),se={id:`assistant-${Date.now()}`,role:"assistant",content:me.message,timestamp:new Date,command:me};return [...ce,se]}),z(me);}else b(me=>[...me.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(me){b(I=>[...I.filter(se=>!se.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${me instanceof Error?me.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[g,M,G,e,z]),B=F=>{F.preventDefault(),E(x);},$=F=>{h(F),k.current?.focus();};if(Te.useEffect(()=>{let F=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.key==="k"&&(Q.preventDefault(),u(Y=>!Y),i||p(false)),Q.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[i]),!T)return null;let O={"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(Ve,{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 ${O[R]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(mc,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:C,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${O[R]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(mc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(F=>!F),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Eg,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Ng,{})})]})]}),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:W.slice(0,4).map((F,Q)=>jsxRuntime.jsx("button",{onClick:()=>$(F),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:F.length>30?F.slice(0,30)+"...":F},Q))})]}),m.map(F=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${F.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:F.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:F.role==="user"?"white":t.textPrimary},children:[F.isLoading?jsxRuntime.jsx(Rg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:F.content}),F.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:F.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:F.command.success?"#10B981":"#EF4444"},children:[F.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:F.command.type.replace(/_/g," ")})]})]})},F.id)),jsxRuntime.jsx("div",{ref:y})]}),jsxRuntime.jsxs("form",{onSubmit:B,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:k,type:"text",value:x,onChange:F=>h(F.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:!x.trim()||g,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:x.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:x.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Sg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function fc(e,t=50){let[r,a]=Te.useState({past:[],present:e,future:[]}),n=Te.useRef(false),o=Te.useCallback((i,u=true)=>{a(l=>{let p=typeof i=="function"?i(l.present):i;if(n.current)return {...l,present:p};if(!u)return {...l,present:p};let m=[...l.past,l.present];return m.length>t&&m.shift(),{past:m,present:p,future:[]}});},[t]),s=Te.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:l,present:u,future:[i.present,...i.future]}});},[]),c=Te.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],l=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:l}});},[]),d=Te.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:o,undo:s,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:d}}function gc({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){Te.useEffect(()=>{if(!n)return;let o=s=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=c?s.metaKey:s.ctrlKey;if(d&&s.key==="z"&&!s.shiftKey&&r){s.preventDefault(),e();return}if(a){if(!c&&d&&s.key==="y"){s.preventDefault(),t();return}if(c&&d&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var Ag={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${K.formatDate(e.startDate)} - ${K.formatDate(e.endDate)}`);let r=K.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>K.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function hc(e){return {...Ag,...e}}var Og=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},yc=Te.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:o,timeScale:s="week",rowDensity:c="comfortable",showThemeSelector:d=true,showExportButton:i=true,availableUsers:u=[],templates:l,enableAutoCriticalPath:p=true,aiAssistant:m,locale:b="en",customTranslations:x,showCreateTaskButton:h=false,createTaskLabel:g,onCreateTask:v,onThemeChange:f,onTaskClick:w,onTaskDblClick:k,onTaskContextMenu:y,onTaskUpdate:C,onProgressChange:T,onTaskEdit:N,onTaskAddSubtask:R,onTaskMarkIncomplete:G,onTaskSetInProgress:W,onDependencyCreate:M,onDependencyDelete:z,onBeforeTaskAdd:E,onAfterTaskAdd:B,onBeforeTaskUpdate:$,onAfterTaskUpdate:O}=r,Q=Te.useContext(Rn)?.theme,[Y,me]=Te.useState(Q||o||"dark"),[I,ce]=Te.useState(s),[se,bt]=Te.useState(c),[Ze,ar]=Te.useState(1),[Ce,mt]=Te.useState(0),[ft,_t]=Te.useState(false),[pr,Lr]=Te.useState(null),[ge,Qe]=Te.useState({isOpen:false,x:0,y:0,task:null}),[Wt,Bt]=Te.useState(null);Te.useEffect(()=>{Q&&Q!==Y&&me(Q);},[Q]),Te.useEffect(()=>{o&&o!==Y&&me(o);},[o]);let Fr=Te.useCallback(S=>{me(S),f?.(S);},[f]),{state:ne,setState:de,undo:j,redo:H,canUndo:we,canRedo:ze,clearHistory:te}=fc(t,50);Te.useEffect(()=>{de(t);},[t,de]),Te.useEffect(()=>{a&&a(ne);},[ne,a]);let ie=Te.useMemo(()=>Zo(b,x),[b,x]),nr=Te.useCallback(S=>[{id:"name",label:S.columns.taskName,width:320,minWidth:180,maxWidth:800,visible:true,sortable:true,resizable:true},{id:"startDate",label:S.columns.startDate,width:110,visible:false,sortable:true},{id:"endDate",label:S.columns.endDate,width:110,visible:false,sortable:true},{id:"duration",label:S.columns.duration,width:80,visible:false,sortable:true},{id:"assignees",label:S.columns.assignees,width:120,visible:false,sortable:false},{id:"status",label:S.columns.status,width:80,visible:false,sortable:true},{id:"progress",label:S.columns.progress,width:120,visible:false,sortable:true}],[]),[Ot,q]=Te.useState(()=>nr(ie));Te.useEffect(()=>{q(S=>S.map(P=>({...P,label:ie.columns[P.id==="name"?"taskName":P.id]||P.label})));},[ie]);let V=Te.useMemo(()=>Ot.filter(S=>S.visible).reduce((S,P)=>S+P.width,0)+60,[Ot]),ve=pr||V,D=Te.useRef(null),U=Te.useRef(null),ue=Te.useRef(null),he=Te.useMemo(()=>Il(Y),[Y]),Le=Te.useMemo(()=>({theme:he,themeName:Y}),[he,Y]),$e=Te.useMemo(()=>hc(l),[l]),Nt=Te.useMemo(()=>{if(!p)return ne;let S=K.calculateCriticalPath(ne),P=_=>_.map(Z=>({...Z,isCriticalPath:S.includes(Z.id),subtasks:Z.subtasks?P(Z.subtasks):void 0}));return P(ne)},[ne,p]),wt=Og(se);gc({undo:j,redo:H,canUndo:we,canRedo:ze,enabled:true}),Te.useImperativeHandle(n,()=>({getTask:S=>K.findTaskById(ne,S),addTask:(S,P)=>{de(_=>{if(!P)return [..._,{...S,level:0}];let Z=ae=>ae.map(le=>le.id===P?{...le,subtasks:[...le.subtasks||[],{...S,parentId:P,level:(le.level||0)+1}],isExpanded:true}:le.subtasks?{...le,subtasks:Z(le.subtasks)}:le);return Z(_)});},updateTask:(S,P)=>{de(_=>{let Z=ae=>ae.map(le=>le.id===S?{...le,...P}:le.subtasks?{...le,subtasks:Z(le.subtasks)}:le);return Z(_)});},deleteTask:S=>{de(P=>{let _=Z=>Z.filter(ae=>ae.id===S?false:(ae.subtasks&&(ae.subtasks=_(ae.subtasks)),true));return _(P)});},deleteTasks:S=>{de(P=>An(P,S));},duplicateTask:S=>{de(P=>os(P,[S]));},splitTask:(S,P,_=3)=>{de(Z=>K.splitTask(Z,S,P,_));},calculateEndDate:K.calculateEndDate,calculateDuration:K.calculateDuration,validateDependency:(S,P)=>!K.validateDependencies(ne,S,P),getAllTasks:()=>K.flattenTasks(ne),getTasksByStatus:S=>K.flattenTasks(ne).filter(P=>P.status===S),getTasksByParent:S=>S?K.findTaskById(ne,S)?.subtasks||[]:ne.filter(_=>!_.parentId),getCriticalPath:()=>K.flattenTasks(ne).filter(S=>S.isCriticalPath),indentTask:S=>{de(P=>rs(P,[S]));},outdentTask:S=>{de(P=>as(P,[S]));},moveTask:(S,P)=>{de(_=>ns(_,[S],P));},createSubtask:async S=>{let{tasks:P,newTask:_}=ls(ne,S);if(E){let Z=E({..._,parentId:S});if((Z instanceof Promise?await Z:Z)===false)return}de(P),B&&B({..._,parentId:S});},scrollToTask:S=>{let _=K.flattenTasks(ne).findIndex(Z=>Z.id===S);if(_!==-1&&D.current){let Z=_*wt;D.current.scrollTo({top:Z,behavior:"smooth"}),U.current&&U.current.scrollTo({top:Z,behavior:"smooth"});}},highlightTask:(S,P=2e3)=>{},expandTask:S=>{de(P=>{let _=Z=>Z.map(ae=>ae.id===S?{...ae,isExpanded:true}:ae.subtasks?{...ae,subtasks:_(ae.subtasks)}:ae);return _(P)});},collapseTask:S=>{de(P=>{let _=Z=>Z.map(ae=>ae.id===S?{...ae,isExpanded:false}:ae.subtasks?{...ae,subtasks:_(ae.subtasks)}:ae);return _(P)});},expandAll:()=>{de(S=>{let P=_=>_.map(Z=>({...Z,isExpanded:true,subtasks:Z.subtasks?P(Z.subtasks):void 0}));return P(S)});},collapseAll:()=>{de(S=>{let P=_=>_.map(Z=>({...Z,isExpanded:false,subtasks:Z.subtasks?P(Z.subtasks):void 0}));return P(S)});},undo:j,redo:H,canUndo:()=>we,canRedo:()=>ze,clearHistory:te,exportToPNG:async()=>{if(!ue.current)throw new Error("Gantt container not found");let S=await vc__default.default(ue.current,{backgroundColor:he.bgPrimary,scale:2});return new Promise((P,_)=>{S.toBlob(Z=>{Z?P(Z):_(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async S=>{await K.exportToPDF(ne,S);},exportToExcel:async S=>{await K.exportToExcel(ne,S);},exportToJSON:()=>K.exportToJSON(ne),exportToCSV:()=>K.exportToCSV(ne),importFromJSON:S=>{let P=K.importFromJSON(S);de(P);},getTasks:()=>ne,refresh:()=>{de(S=>[...S]);},clearAll:()=>{de([]);}}),[ne,j,H,we,ze,te,he,wt]);let eo=Te.useCallback(S=>{q(P=>P.map(_=>_.id===S?{..._,visible:!_.visible}:_));},[]),ba=Te.useCallback((S,P)=>{q(_=>_.map(Z=>{if(Z.id!==S)return Z;let ae=Z.minWidth??100,le=Z.maxWidth??800,et=Math.max(ae,Math.min(le,P));return {...Z,width:et}}));},[]),ya=Te.useCallback(S=>{de(P=>is(P,S)),r.onTaskToggleExpand?.(S);},[r]),Qr=Te.useCallback((S,P)=>{if($&&$(S,P)===false)return;let Z=K.findTaskById(ne,S)?.progress,ae=et=>et.map(gt=>gt.id===S?{...gt,...P}:gt.subtasks?{...gt,subtasks:ae(gt.subtasks)}:gt);de(ae(ne));let le=K.findTaskById(ae(ne),S);le&&(C?.(le),O?.(le),P.progress!==void 0&&Z!==void 0&&P.progress!==Z&&T?.(S,Z,P.progress));},[ne,C,$,O,T]),yd=Te.useCallback(S=>{S.length!==0&&(de(P=>rs(P,S)),r.onTaskIndent?.(S[0]));},[r]),xd=Te.useCallback(S=>{S.length!==0&&(de(P=>as(P,S)),r.onTaskOutdent?.(S[0]));},[r]),kd=Te.useCallback((S,P)=>{S.length!==0&&(de(_=>ns(_,S,P)),r.onTaskMove?.(S[0],P));},[r]),Ys=Te.useCallback(S=>{r.onMultiTaskDelete?r.onMultiTaskDelete(S):(de(P=>An(P,S)),S.forEach(P=>r.onTaskDelete?.(P)));},[r]),wd=Te.useCallback(S=>{de(P=>os(P,S)),S.forEach(P=>r.onTaskDuplicate?.(P));},[r]),Cd=Te.useCallback((S,P)=>{de(_=>{let{tasks:Z,newTask:ae}=Yl(_,S,P);return E&&E(ae)===false?_:(r.onTaskCreate?.(ae.parentId,ae.position||0),B?.(ae),Z)});},[r,E,B]),Td=Te.useCallback((S,P)=>{de(_=>ss(_,S,P)),r.onTaskRename?.(S,P);},[r]),qs=Te.useCallback(S=>{de(P=>{let{tasks:_}=ls(P,S);return r.onTaskCreate?.(S,0),_});},[r]),Dd=Te.useCallback((S,P,_)=>{let Z=S.startDate?Math.round((P.getTime()-S.startDate.getTime())/864e5):0,ae=gt=>gt.map(Ht=>Ht.id===S.id?{...Ht,startDate:P,endDate:_,...S.segments&&{segments:S.segments}}:Ht.subtasks?{...Ht,subtasks:ae(Ht.subtasks)}:Ht),le=ae(ne);le=K.autoScheduleDependents(le,S.id,Z),de(le);let et={...S,startDate:P,endDate:_};C?.(et);},[ne,C]),Sd=Te.useCallback((S,P)=>{y?.(S,P),Qe({isOpen:true,x:P.clientX,y:P.clientY,task:S});},[y]),Nd=Te.useCallback((S,P)=>{let _=K.splitTask(ne,S.id,P);de(_),Qe({isOpen:false,x:0,y:0,task:null});},[ne]),Xs=Te.useCallback(S=>{k?.(S),N||Bt(S);},[k,N]),Js=Te.useCallback((S,P,_)=>{let Z=new Map,ae=Vt=>{Vt.forEach(mr=>{mr.dependencies&&Z.set(mr.id,mr.dependencies),mr.subtasks&&ae(mr.subtasks);});};ae(_);let le=Z.get(P)||[];Z.set(P,[...le,S]);let et=new Set,gt=new Set,Ht=Vt=>{if(!et.has(Vt)){et.add(Vt),gt.add(Vt);let mr=Z.get(Vt)||[];for(let xa of mr){if(!et.has(xa)&&Ht(xa))return true;if(gt.has(xa))return true}}return gt.delete(Vt),false};return Ht(P)},[]),Zs=Te.useCallback((S,P)=>{if(Js(S.id,P,ne)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
276
|
+
</Project>`,m=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(m),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 m=i.startDate&&i.endDate?q.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let p of i.dependencies){let v=t.find(y=>y.id===p);if(v){n(v);let y=a.get(p)?.ef||0;l=Math.max(l,y);}}let d=l+m;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 m=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 p=d-m;s.set(i.id,{ls:p,lf:d});};r.forEach(c);let u=[];for(let i of r){let m=a.get(i.id),l=s.get(i.id);if(m&&l){let d=l.ls-m.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),m=l=>l.map(d=>d.id===s.id?{...d,startDate:u,endDate:i}:d.subtasks?{...d,subtasks:m(d.subtasks)}:d);o=m(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(),m=1e3*60*60*24,l=q.findTaskById(e,t);if(!l||!l.endDate)return [];let d=(p,v,y=new Set)=>{if(y.has(p))return;y.add(p);let h=q.getDependentTasks(e,p);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(),k=(g.endDate.getTime()-f)/m,D=(f-i)/m*o,C=D+v*o,S=Math.max(k*o,o),T=c+b*s+12;u.push({taskId:g.id,taskName:g.name,originalX:D,previewX:C,width:S,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=m=>m.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:m,onTaskDateChange:l,onDependencyCreate:d,onDependencyDelete:p}){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,w=P=>{let O=new Date(Date.UTC(P.getFullYear(),P.getMonth(),P.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)},k=P=>{let O=P.getDay();return O===0||O===6},x=Se.useCallback(P=>{let O=Math.round(P/(b*s)),G=new Date(n);return G.setDate(G.getDate()+O),G},[n,b,s]),D=Se.useCallback((P,O)=>{if(O.startDate&&O.endDate)return;let G=P.currentTarget.ownerSVGElement;if(!G)return;let U=G.createSVGPoint();U.x=P.clientX,U.y=P.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 P=A=>A.map(K=>{if(K.subtasks&&K.subtasks.length>0){let _=P(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)),wt=new Date(Math.max(...de));return {...K,subtasks:_,startDate:K.startDate||ie,endDate:K.endDate||wt}}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=P(e);return O(G)},[e]),S=Se.useCallback(P=>{if(!P.startDate||!P.endDate)return {x:0,width:0};let O=P.startDate.getTime(),G=P.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(P=>P.startDate&&P.endDate).map(P=>{let{x:O,width:G}=S(P),A=C.findIndex(K=>K.id===P.id)*r+12;return {id:P.id,x:O,y:A,width:G,height:32}}),[C,S]),$=Se.useCallback((P,O,G)=>{if(!G||O===0){h([]);return}let U=q.calculateCascadePreview(e,P,O,C,n,b*s,r,48);h(U);},[e,C,n,b,s,r,48]),z=Se.useMemo(()=>{let P=[],O=new Date(n);for(;O<=o;){let A=(O.getTime()-n.getTime())/864e5*b*s;if(a==="day")P.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=w(O);P.push({date:new Date(O),label:`Week ${K}`,x:A}),O.setDate(O.getDate()+7);}else P.push({date:new Date(O),label:O.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:A}),O.setMonth(O.getMonth()+1);}return P},[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((P,O)=>jsxRuntime.jsxs("g",{children:[O>0&&jsxRuntime.jsx("line",{x1:P.x,y1:0,x2:P.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:P.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:P.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((P,O)=>{let G=z[O+1]?.x||f,U=k(P.date);return jsxRuntime.jsxs("g",{children:[U&&jsxRuntime.jsx("rect",{x:P.x,y:0,width:G-P.x,height:C.length*r,fill:t.bgWeekend,opacity:1}),O>0&&jsxRuntime.jsx("line",{x1:P.x,y1:0,x2:P.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((P,O)=>{let G=P.startDate&&P.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-${P.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,P),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-${P.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-${P.id}`)]})]},`row-group-${P.id}`)}),C.map((P,O)=>!P.dependencies||P.dependencies.length===0||!P.startDate||!P.endDate?null:P.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=S(U),_=S(P);return jsxRuntime.jsx(_n,{x1:K.x+K.width,y1:A*r+r/2,x2:_.x,y2:O*r+r/2,theme:t,onDelete:()=>p?.(P.id,G)},`dep-${G}-${P.id}`)})),C.map((P,O)=>{if(!P.startDate||!P.endDate)return null;let{x:G,width:U}=S(P),A=O*r+12,K=P.subtasks&&P.subtasks.length>0&&!P.isMilestone;return P.isMilestone?jsxRuntime.jsx(Vn,{task:P,x:G+U/2,y:A+16,theme:t,onClick:u},P.id):K?jsxRuntime.jsxs("g",{onClick:()=>u?.(P),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:P.name})]},P.id):jsxRuntime.jsx(Un,{task:P,x:G,y:A,width:U,theme:t,dayWidth:b*s,startDate:n,templates:c,onClick:u,onDoubleClick:i,onContextMenu:m,onDateChange:l,onDependencyCreate:d,allTaskPositions:T,onDragMove:$},P.id)}),y.map(P=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:P.previewX,y:P.y-48,width:P.width,height:32,rx:8,fill:P.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(P.daysDelta)>0&&jsxRuntime.jsx("text",{x:P.previewX+P.width/2,y:P.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:P.daysDelta>0?`+${P.daysDelta}d`:`${P.daysDelta}d`})]},`cascade-preview-${P.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,m={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},l={color:i.textSecondary},[d,p]=Se.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[v,y]=Se.useState({});Se.useEffect(()=>{p(r?{name:r.name,startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",isMilestone:r.isMilestone||false,color:r.color||"#6366F1",assignees:r.assignees||[],dependencies:r.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[r,e]);let 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(w){console.error("Error submitting task:",w);}},b=(f,w)=>{p(k=>{let x={...k,[f]:w};if(f==="progress"){let D=typeof w=="number"?w:parseInt(w,10);D===100&&k.status!=="completed"?x.status="completed":D>0&&D<100&&k.status==="todo"?x.status="in-progress":D===0&&k.status==="in-progress"&&(x.status="todo");}return x}),v[f]&&y(k=>{let x={...k};return delete x[f],x});};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:c==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:f=>f.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:f=>f.currentTarget.style.backgroundColor="transparent",disabled:s,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:g,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:l,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value: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:m,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:m,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:m,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:m,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:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:d.assignees?.some(w=>w.name===f.name),onChange:w=>{let k=w.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",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:i.accent},children:f.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:f.name})]})]},f.id))})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:a.filter(f=>f.id!==r?.id).map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:d.dependencies?.includes(f.id),onChange:w=>{let k=w.target.checked?[...d.dependencies||[],f.id]:(d.dependencies||[]).filter(x=>x!==f.id);b("dependencies",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:f.name})]},f.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:f=>{f.currentTarget.style.color=i.textPrimary,f.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:f=>{f.currentTarget.style.color=i.textSecondary,f.currentTarget.style.backgroundColor="transparent";},disabled:s,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:g,disabled:s,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:f=>!s&&(f.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:f=>!s&&(f.currentTarget.style.backgroundColor=i.accent),children:s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var 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,m]=Se.useState(false),[l,d]=Se.useState(false),[p,v]=Se.useState([]),[y,h]=Se.useState(""),[g,b]=Se.useState(false),[f,w]=Se.useState(true),k=Se.useRef(null),x=Se.useRef(null),D=Se.useRef(null),{enabled:C=true,placeholder:S='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"});},[p]),Se.useEffect(()=>{i&&!l&&k.current&&setTimeout(()=>k.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]),P=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(""),w(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(wt=>!wt.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(),P(y);},G=A=>{h(A),k.current?.focus();};if(Se.useEffect(()=>{let A=K=>{(K.metaKey||K.ctrlKey)&&K.key==="k"&&(K.preventDefault(),m(_=>!_),i||d(false)),K.key==="Escape"&&i&&m(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:()=>m(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:()=>m(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:[p.length===0&&f&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children: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))})]}),p.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:k,type:"text",value:y,onChange:A=>h(A.target.value),placeholder:S,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,m=true)=>{a(l=>{let d=typeof i=="function"?i(l.present):i;if(n.current)return {...l,present:d};if(!m)return {...l,present:d};let p=[...l.past,l.present];return p.length>t&&p.shift(),{past:p,present:d,future:[]}});},[t]),s=Se.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let m=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:m,future:[i.present,...i.future]}});},[]),c=Se.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let m=i.future[0],l=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:m,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:m=[],templates:l,enableAutoCriticalPath:d=true,aiAssistant:p,locale:v="en",customTranslations:y,showCreateTaskButton:h=false,createTaskLabel:g,onCreateTask:b,onThemeChange:f,onTaskClick:w,onTaskDblClick:k,onTaskContextMenu:x,onTaskUpdate:D,onProgressChange:C,onTaskEdit:S,onTaskAddSubtask:T,onTaskMarkIncomplete:$,onTaskSetInProgress:z,onDependencyCreate:R,onDependencyDelete:W,onBeforeTaskAdd:P,onAfterTaskAdd:O,onBeforeTaskUpdate:G,onAfterTaskUpdate:U}=r,K=Se.useContext(Fn)?.theme,[_,ae]=Se.useState(K||o||"dark"),[M,de]=Se.useState(s),[ie,wt]=Se.useState(c),[rt,ir]=Se.useState(1),[De,bt]=Se.useState(0),[vt,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(E=>{ae(E),f?.(E);},[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(E=>[{id:"name",label:E.columns.taskName,width:320,minWidth:180,maxWidth:800,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,visible:false,sortable:true},{id:"endDate",label:E.columns.endDate,width:110,visible:false,sortable:true},{id:"duration",label:E.columns.duration,width:80,visible:false,sortable:true},{id:"assignees",label:E.columns.assignees,width:120,visible:false,sortable:false},{id:"status",label:E.columns.status,width:80,visible:false,sortable:true},{id:"progress",label:E.columns.progress,width:120,visible:false,sortable:true}],[]),[Ut,J]=Se.useState(()=>lr(le));Se.useEffect(()=>{J(E=>E.map(I=>({...I,label:le.columns[I.id==="name"?"taskName":I.id]||I.label})));},[le]);let Y=Se.useMemo(()=>Ut.filter(E=>E.visible).reduce((E,I)=>E+I.width,0)+60,[Ut]),ye=hr||Y,N=Se.useRef(null),H=Se.useRef(null),me=Se.useRef(null),be=Se.useMemo(()=>nc(_),[_]),Be=Se.useMemo(()=>({theme:be,themeName:_}),[be,_]),Ue=Se.useMemo(()=>_c(l),[l]),Mt=Se.useMemo(()=>{if(!d)return se;let E=q.calculateCriticalPath(se),I=V=>V.map(ee=>({...ee,isCriticalPath:E.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:E=>q.findTaskById(se,E),addTask:(E,I)=>{ue(V=>{if(!I)return [...V,{...E,level:0}];let ee=oe=>oe.map(ce=>ce.id===I?{...ce,subtasks:[...ce.subtasks||[],{...E,parentId:I,level:(ce.level||0)+1}],isExpanded:true}:ce.subtasks?{...ce,subtasks:ee(ce.subtasks)}:ce);return ee(V)});},updateTask:(E,I)=>{ue(V=>{let ee=oe=>oe.map(ce=>ce.id===E?{...ce,...I}:ce.subtasks?{...ce,subtasks:ee(ce.subtasks)}:ce);return ee(V)});},deleteTask:E=>{ue(I=>{let V=ee=>ee.filter(oe=>oe.id===E?false:(oe.subtasks&&(oe.subtasks=V(oe.subtasks)),true));return V(I)});},deleteTasks:E=>{ue(I=>$n(I,E));},duplicateTask:E=>{ue(I=>ys(I,[E]));},splitTask:(E,I,V=3)=>{ue(ee=>q.splitTask(ee,E,I,V));},calculateEndDate:q.calculateEndDate,calculateDuration:q.calculateDuration,validateDependency:(E,I)=>!q.validateDependencies(se,E,I),getAllTasks:()=>q.flattenTasks(se),getTasksByStatus:E=>q.flattenTasks(se).filter(I=>I.status===E),getTasksByParent:E=>E?q.findTaskById(se,E)?.subtasks||[]:se.filter(V=>!V.parentId),getCriticalPath:()=>q.flattenTasks(se).filter(E=>E.isCriticalPath),indentTask:E=>{ue(I=>hs(I,[E]));},outdentTask:E=>{ue(I=>bs(I,[E]));},moveTask:(E,I)=>{ue(V=>vs(V,[E],I));},createSubtask:async E=>{let{tasks:I,newTask:V}=ws(se,E);if(P){let ee=P({...V,parentId:E});if((ee instanceof Promise?await ee:ee)===false)return}ue(I),O&&O({...V,parentId:E});},scrollToTask:E=>{let V=q.flattenTasks(se).findIndex(ee=>ee.id===E);if(V!==-1&&N.current){let ee=V*St;N.current.scrollTo({top:ee,behavior:"smooth"}),H.current&&H.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(E,I=2e3)=>{},expandTask:E=>{ue(I=>{let V=ee=>ee.map(oe=>oe.id===E?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:V(oe.subtasks)}:oe);return V(I)});},collapseTask:E=>{ue(I=>{let V=ee=>ee.map(oe=>oe.id===E?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:V(oe.subtasks)}:oe);return V(I)});},expandAll:()=>{ue(E=>{let I=V=>V.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?I(ee.subtasks):void 0}));return I(E)});},collapseAll:()=>{ue(E=>{let I=V=>V.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?I(ee.subtasks):void 0}));return I(E)});},undo:X,redo:j,canUndo:()=>Te,canRedo:()=>We,clearHistory:re,exportToPNG:async()=>{if(!me.current)throw new Error("Gantt container not found");let E=await Hc__default.default(me.current,{backgroundColor:be.bgPrimary,scale:2});return new Promise((I,V)=>{E.toBlob(ee=>{ee?I(ee):V(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async E=>{await q.exportToPDF(se,E);},exportToExcel:async E=>{await q.exportToExcel(se,E);},exportToJSON:()=>q.exportToJSON(se),exportToCSV:()=>q.exportToCSV(se),importFromJSON:E=>{let I=q.importFromJSON(E);ue(I);},getTasks:()=>se,refresh:()=>{ue(E=>[...E]);},clearAll:()=>{ue([]);}}),[se,X,j,Te,We,re,be,St]);let go=Se.useCallback(E=>{J(I=>I.map(V=>V.id===E?{...V,visible:!V.visible}:V));},[]),wa=Se.useCallback((E,I)=>{J(V=>V.map(ee=>{if(ee.id!==E)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(E=>{ue(I=>ks(I,E)),r.onTaskToggleExpand?.(E);},[r]),aa=Se.useCallback((E,I)=>{if(G&&G(E,I)===false)return;let ee=q.findTaskById(se,E)?.progress,oe=nt=>nt.map(yt=>yt.id===E?{...yt,...I}:yt.subtasks?{...yt,subtasks:oe(yt.subtasks)}:yt);ue(oe(se));let ce=q.findTaskById(oe(se),E);ce&&(D?.(ce),U?.(ce),I.progress!==void 0&&ee!==void 0&&I.progress!==ee&&C?.(E,ee,I.progress));},[se,D,G,U,C]),nu=Se.useCallback(E=>{E.length!==0&&(ue(I=>hs(I,E)),r.onTaskIndent?.(E[0]));},[r]),ou=Se.useCallback(E=>{E.length!==0&&(ue(I=>bs(I,E)),r.onTaskOutdent?.(E[0]));},[r]),su=Se.useCallback((E,I)=>{E.length!==0&&(ue(V=>vs(V,E,I)),r.onTaskMove?.(E[0],I));},[r]),ki=Se.useCallback(E=>{r.onMultiTaskDelete?r.onMultiTaskDelete(E):(ue(I=>$n(I,E)),E.forEach(I=>r.onTaskDelete?.(I)));},[r]),iu=Se.useCallback(E=>{ue(I=>ys(I,E)),E.forEach(I=>r.onTaskDuplicate?.(I));},[r]),lu=Se.useCallback((E,I)=>{ue(V=>{let{tasks:ee,newTask:oe}=kc(V,E,I);return P&&P(oe)===false?V:(r.onTaskCreate?.(oe.parentId,oe.position||0),O?.(oe),ee)});},[r,P,O]),cu=Se.useCallback((E,I)=>{ue(V=>xs(V,E,I)),r.onTaskRename?.(E,I);},[r]),wi=Se.useCallback(E=>{ue(I=>{let{tasks:V}=ws(I,E);return r.onTaskCreate?.(E,0),V});},[r]),du=Se.useCallback((E,I,V)=>{let ee=E.startDate?Math.round((I.getTime()-E.startDate.getTime())/864e5):0,oe=yt=>yt.map(Yt=>Yt.id===E.id?{...Yt,startDate:I,endDate:V,...E.segments&&{segments:E.segments}}:Yt.subtasks?{...Yt,subtasks:oe(Yt.subtasks)}:Yt),ce=oe(se);ce=q.autoScheduleDependents(ce,E.id,ee),ue(ce);let nt={...E,startDate:I,endDate:V};D?.(nt);},[se,D]),uu=Se.useCallback((E,I)=>{x?.(E,I),at({isOpen:true,x:I.clientX,y:I.clientY,task:E});},[x]),mu=Se.useCallback((E,I)=>{let V=q.splitTask(se,E.id,I);ue(V),at({isOpen:false,x:0,y:0,task:null});},[se]),Ci=Se.useCallback(E=>{k?.(E),S||Wt(E);},[k,S]),Ti=Se.useCallback((E,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,E]);let nt=new Set,yt=new Set,Yt=qt=>{if(!nt.has(qt)){nt.add(qt),yt.add(qt);let br=ee.get(qt)||[];for(let Ta of br){if(!nt.has(Ta)&&Yt(Ta))return true;if(yt.has(Ta))return true}}return yt.delete(qt),false};return Yt(I)},[]),Di=Se.useCallback((E,I)=>{if(Ti(E.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 V=ee=>ee.map(oe=>{if(oe.id===I){let ce=oe.dependencies||[];if(!ce.includes(E.id))return {...oe,dependencies:[...ce,E.id]}}return oe.subtasks?{...oe,subtasks:V(oe.subtasks)}:oe});ue(V(se)),R?.(E.id,I);},[se,R,Ti]),Si=Se.useCallback((E,I)=>{let V=ee=>ee.map(oe=>{if(oe.id===E&&oe.dependencies){let ce=oe.dependencies.filter(nt=>nt!==I);return {...oe,dependencies:ce}}return oe.subtasks?{...oe,subtasks:V(oe.subtasks)}:oe});ue(V(se)),W?.(E,I);},[se,W]),{startDate:pu,endDate:fu}=Se.useMemo(()=>{let E=se.filter(ce=>ce.startDate&&ce.endDate);if(E.length===0){let ce=new Date,nt=new Date(ce);nt.setDate(nt.getDate()-30);let yt=new Date(ce);return yt.setDate(yt.getDate()+60),{startDate:nt,endDate:yt}}let I=E.flatMap(ce=>[ce.startDate,ce.endDate]).filter(ce=>ce!==void 0),V=new Date(Math.min(...I.map(ce=>ce.getTime()))),ee=new Date(Math.max(...I.map(ce=>ce.getTime()))),oe=M==="day"?7:M==="week"?14:30;return V.setDate(V.getDate()-oe),ee.setDate(ee.getDate()+oe),{startDate:V,endDate:ee}},[se,M]),gu=Se.useCallback(async()=>{if(!me.current)return;let E=await Hc__default.default(me.current,{backgroundColor:be.bgPrimary,scale:2}),I=document.createElement("a");I.download="gantt-chart.png",I.href=E.toDataURL("image/png"),I.click();},[be]),hu=Se.useCallback(async()=>{await q.exportToPDF(se);},[se]),bu=Se.useCallback(async()=>{await q.exportToExcel(se);},[se]),vu=Se.useCallback(()=>{let E=q.exportToCSV(se),I=new Blob([E],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(I),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[se]),yu=Se.useCallback(()=>{let E=q.exportToJSON(se),I=new Blob([E],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(I),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[se]),xu=Se.useCallback(()=>{q.exportToMSProject(se,"Gantt Project","project.xml");},[se]),ku=E=>{E.preventDefault(),jt(true);};return Se.useEffect(()=>{let E=H.current,I=N.current;if(!E||!I)return;let V=I.querySelector(".gantt-taskgrid-content"),ee=()=>{let nt=E.scrollTop;bt(nt),V&&(V.style.transform=`translateY(-${nt}px)`);},oe=nt=>{if(vt&&I){let Yt=I.parentElement?.getBoundingClientRect()?.left||0,qt=nt.clientX-Yt,br=200,Ta=Math.min(window.innerWidth-300,800);qt>=br&&qt<=Ta&&zr(qt);}},ce=()=>{jt(false);};return E.addEventListener("scroll",ee),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",ce),()=>{E.removeEventListener("scroll",ee),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",ce);}},[vt]),jsxRuntime.jsx(ga.Provider,{value:le,children:jsxRuntime.jsx(Ao.Provider,{value:Be,children:jsxRuntime.jsxs("div",{ref:me,className:"flex flex-col h-full w-full",style:{backgroundColor:be.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(On,{theme:be,timeScale:M,onTimeScaleChange:de,zoom:rt,onZoomChange:ir,currentTheme:_,onThemeChange:$r,rowDensity:ie,onRowDensityChange:wt,showThemeSelector:u,showCreateTaskButton:h,createTaskLabel:g,onCreateTask:b,onExportPNG:i?gu:void 0,onExportPDF:i?hu:void 0,onExportExcel:i?bu:void 0,onExportCSV:i?vu:void 0,onExportJSON:i?yu:void 0,onExportMSProject:i?xu:void 0}),jsxRuntime.jsxs("div",{ref:N,className:"flex-1 flex min-h-0",style:{overflow:"hidden"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:ye,overflow:"hidden",borderRight:`1px solid ${vt?be.accent:be.border}`},children:jsxRuntime.jsx(Wn,{tasks:Mt,theme:be,rowHeight:St,availableUsers:m,templates:Ue,onTaskClick:w,onTaskDblClick:Ci,onTaskContextMenu:x,onTaskToggle:Ca,scrollTop:De,columns:Ut,onToggleColumn:go,onColumnResize:wa,onTaskUpdate:aa,onTaskIndent:nu,onTaskOutdent:ou,onTaskMove:su,onMultiTaskDelete:ki,onTaskDuplicate:iu,onTaskCreate:lu,onTaskRename:cu,onCreateSubtask:wi,onOpenTaskModal:w?E=>w(E):void 0})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:ku}),jsxRuntime.jsx("div",{ref:H,className:"gantt-timeline-scroll flex-1 overflow-auto",style:{minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Yn,{tasks:Mt,theme:be,rowHeight:St,timeScale:M,startDate:pu,endDate:fu,zoom:rt,templates:Ue,onTaskClick:w,onTaskDblClick:Ci,onTaskContextMenu:uu,onTaskDateChange:du,onDependencyCreate:Di,onDependencyDelete:Si})})]}),he.task&&jsxRuntime.jsx(ha,{isOpen:he.isOpen,x:he.x,y:he.y,theme:be,onClose:()=>at({isOpen:false,x:0,y:0,task:null}),items:[{id:"edit",label:le.contextMenu?.editTask||"Edit Task",icon:lt.Pencil,onClick:()=>{he.task&&(S?S(he.task):Wt(he.task));}},{id:"addSubtask",label:le.contextMenu?.addSubtask||"Add Subtask",icon:lt.Add,onClick:()=>{he.task&&(T?T(he.task):wi(he.task.id));}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:le.contextMenu?.markIncomplete||"Mark Incomplete",icon:lt.MarkIncomplete,onClick:()=>{he.task&&($?$(he.task):aa(he.task.id,{status:"todo",progress:0}));},disabled:he.task?.status==="todo"},{id:"setInProgress",label:le.contextMenu?.setInProgress||"Set In Progress",icon:lt.SetInProgress,onClick:()=>{he.task&&(z?z(he.task):aa(he.task.id,{status:"in-progress"}));},disabled:he.task?.status==="in-progress"},{id:"markComplete",label:le.contextMenu?.markComplete||"Mark Complete",icon:lt.MarkComplete,onClick:()=>{he.task&&aa(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:lt.Split,onClick:()=>{if(!he.task?.startDate||!he.task?.endDate){console.warn("Cannot split task without dates");return}let E=he.task.startDate.getTime(),I=he.task.endDate.getTime(),V=E+(I-E)/2,ee=new Date(V);mu(he.task,ee);},disabled:!he.task?.startDate||!he.task?.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:le.contextMenu?.deleteTask||"Delete Task",icon:lt.Delete,onClick:()=>{he.task&&ki([he.task.id]);}}]}),Kt&&jsxRuntime.jsx(qn,{isOpen:true,onClose:()=>Wt(null),task:Kt,onSubmit:E=>{aa(Kt.id,E),Wt(null);},mode:"edit",theme:_}),p?.enabled&&jsxRuntime.jsx(Xn,{tasks:se,theme:be,config:p,onTasksUpdate:ue,onTaskUpdate:aa,onTaskCreate:E=>{ue(I=>[...I,E]);},onTaskDelete:E=>{ue(I=>$n(I,[E]));},onDependencyCreate:(E,I)=>{let V=q.findTaskById(se,E);V&&Di(V,I);},onDependencyDelete:Si})]})})})});var Kc=`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 Yc(e){return `CURRENT TASKS:
|
|
320
|
+
${qc(e).map(a=>{let n=a.startDate?a.startDate.toISOString().split("T")[0]:"no date",o=a.endDate?a.endDate.toISOString().split("T")[0]:"no date",s=a.dependencies?.length?`deps: [${a.dependencies.join(", ")}]`:"";return `- ${a.id}: "${a.name}" (${n} to ${o}, ${a.progress}%, ${a.status||"todo"}) ${s}`}).join(`
|
|
321
321
|
`)}
|
|
322
322
|
|
|
323
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function wc(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function kr(e,t){let r=wc(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 d=c.name.toLowerCase();return s.every(i=>d.includes(i))})}function bs(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 p=new Date(a);return p.setDate(p.getDate()+1),p}if(r==="yesterday"||r==="ayer"){let p=new Date(a);return p.setDate(p.getDate()-1),p}if(r==="next week"||r==="la pr\xF3xima semana"){let p=new Date(a);return p.setDate(p.getDate()+7),p}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 b=new Date(a),x=b.getDay(),h=m-x;return h<=0&&(h+=7),b.setDate(b.getDate()+h),b}}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 p=parseInt(o[1],10),m=o[2].toLowerCase(),b=new Date(a);return m==="day"||m==="d\xEDa"||m==="dias"?b.setDate(b.getDate()+p):m==="week"||m==="semana"||m==="semanas"?b.setDate(b.getDate()+p*7):(m==="month"||m==="mes"||m==="meses")&&b.setMonth(b.getMonth()+p),b}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 p=parseInt(c[1],10),m=parseInt(c[2],10)-1,b=parseInt(c[3],10);return new Date(b,m,p)}let d={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 p=parseInt(i[1],10),m=d[i[2].toLowerCase()],b=i[3]?parseInt(i[3],10):a.getFullYear();if(m!==void 0)return new Date(b,m,p)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},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 p=u[l[1].toLowerCase()],m=parseInt(l[2],10),b=l[3]?parseInt(l[3],10):a.getFullYear();if(p!==void 0)return new Date(b,p,m)}return null}function ys(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 xs(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 Cc(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 Tc(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(),u=a[2].trim(),l=kr(t,i),p=bs(u);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,b=new Date(p);return b.setDate(b.getDate()+m),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:p,endDate:b},message:`Moved "${l.name}" to ${p.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),l=kr(t,i),p=ys(u);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let m=new Date(l.endDate);return m.setDate(m.getDate()+p),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:m},message:`Extended "${l.name}" by ${p} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let o=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),l=kr(t,i),p=xs(u);return l?p===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:p},message:`Set "${l.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let 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(),u=s[2].trim(),l=kr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:u},message:`Renamed "${l.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let c=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),u=c[2].trim(),l=kr(t,i),p=kr(t,u);return l?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:l.id,dependencyTo:p.id,message:`Linked "${l.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let d=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]){let i=d[1].trim(),u=kr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Dc(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 zg(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 $g(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return "TODO"}}function Kn(e,t=[],r=[]){let a=e.assignedUserIds?.map(u=>{let l=r.find(p=>p.id===u);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Kn(u,t,r)),o;e.dependencies&&(typeof e.dependencies[0]=="string"?o=e.dependencies:o=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let s=u=>{if(u)return typeof u=="string"?new Date(u):u},c=s(e.startDate),d=s(e.endDate),i=e.metadata?.isMilestone===true||c&&d&&Math.abs(d.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:d,progress:e.progress||0,status:zg(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 Sc(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:$g(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Nc(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>Kn(a,e,t))}function Ug({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:o,onDeleteStack:s,className:c}){let[d,i]=Te.useState(false),u=Te.useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),l=Te.useMemo(()=>{let m=u.length,b=new Set(u.flatMap(g=>g.assignedUserIds||[])).size,x=u.map(g=>g.priority).filter(Boolean),h=new Set(u.flatMap(g=>g.labels||[])).size;return {totalCards:m,uniqueAssignees:b,priorities:x,labels:h}},[u]),p=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:oe("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:p,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:oe("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"]})]}),d&&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:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(m=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(m),children:r(m)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(m),children:[jsxRuntime.jsx("h4",{children:m.title}),m.description&&jsxRuntime.jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:b=>{b.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 Rc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Va(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 Ka(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 Pc(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 Ic({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:o,config:s,className:c}){let d=Te.useMemo(()=>({...Rc,...s}),[s]),[i,u]=Te.useState(new Set),l=Te.useRef(null),p=Te.useMemo(()=>{if(!d.groupByDay)return [{date:null,events:e}];let v=new Map;return e.forEach(f=>{let w=f.timestamp.toISOString().split("T")[0],k=v.get(w);k?k.push(f):v.set(w,[f]);}),Array.from(v.entries()).sort((f,w)=>w[0].localeCompare(f[0])).map(([f,w])=>({date:new Date(f),events:w.sort((k,y)=>y.timestamp.getTime()-k.timestamp.getTime())}))},[e,d.groupByDay]),{uniqueUsers:m,uniqueTypes:b}=Te.useMemo(()=>{let v=new Set,f=new Set;return e.forEach(w=>{v.add(w.userId),f.add(w.type);}),{uniqueUsers:Array.from(v),uniqueTypes:Array.from(f)}},[e]),x=v=>{u(f=>{let w=new Set(f);return w.has(v)?w.delete(v):w.add(v),w});},h=v=>{let w=new Date().getTime()-v.getTime(),k=Math.floor(w/6e4),y=Math.floor(w/36e5),C=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:y<24?`${y}h ago`:C<7?`${C}d ago`:v.toLocaleDateString()},g=Te.useMemo(()=>{let v=0;return t.types&&t.types.length>0&&v++,t.users&&t.users.length>0&&v++,t.dateRange&&v++,t.searchTerm&&v++,v},[t]);return Te.useEffect(()=>{if(o&&l.current){let v=l.current.querySelector(`[data-event-id="${o}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"center"});}},[o]),e.length===0?jsxRuntime.jsxs("div",{className:oe("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:oe("history-timeline",d.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:v=>{let f=v.target.value;r({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),b.map(v=>jsxRuntime.jsxs("option",{value:v,children:[Ka(v)," ",v.replace("_"," ")]},v))]}),m.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:v=>{let f=v.target.value;r({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),m.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:v=>r({...t,searchTerm:v.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:p.map(v=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[d.groupByDay&&v.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:v.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[v.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:v.events.map((f,w)=>{let k=i.has(f.id),y=o===f.id,C=Pc(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:oe("history-timeline-event",k&&"expanded",y&&"selected"),onClick:()=>n?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:C},children:d.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Ka(f.type)})}),w<v.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:C}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[d.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:Va(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:d.useRelativeTime?h(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),x(f.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([T,N])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(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)})]})]},T)),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(([T,N])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(N)})]},T))]})]})]})]},f.id)})})]},v.date?.toISOString()||"all"))})]})}function Ac({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:o,onNext:s,onGoToEvent:c,onSpeedChange:d,className:i}){let u=[.5,1,1.5,2,3],l=Te.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=Te.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:oe("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:oe("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&Ka(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&Va(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:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((m,b)=>jsxRuntime.jsx("div",{className:oe("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>c(b),title:Va(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:u.map(m=>jsxRuntime.jsxs("button",{className:oe("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>d(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:oe("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 ks(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 ws(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 Lc(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 Fc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function jg(e,t,r,a,n,o=100){let s=e.map(d=>({...d,x:d.x??r/2+Math.random()*100-50,y:d.y??a/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(s.map(d=>[d.id,d]));for(let d=0;d<o;d++){let i=1-d/o;s.forEach(u=>{let l=r/2,p=a/2;u.vx+=(l-u.x)*n.centerForce*i,u.vy+=(p-u.y)*n.centerForce*i,s.forEach(m=>{if(u.id===m.id)return;let b=u.x-m.x,x=u.y-m.y,h=Math.sqrt(b*b+x*x)||1,g=n.chargeStrength*i/(h*h);u.vx+=b/h*g,u.vy+=x/h*g;});}),t.forEach(u=>{let l=c.get(typeof u.source=="string"?u.source:u.source.id),p=c.get(typeof u.target=="string"?u.target:u.target.id);if(!l||!p)return;let m=p.x-l.x,b=p.y-l.y,x=Math.sqrt(m*m+b*b)||1,h=(x-n.linkDistance)/x*n.forceStrength*i;l.vx+=m*h,l.vy+=b*h,p.vx-=m*h,p.vy-=b*h;}),s.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return s}function Bc({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:o,stats:s,onInteraction:c,className:d}){let i=Te.useRef(null),[u,l]=Te.useState([]),[p,m]=Te.useState(null),[b,x]=Te.useState(null),[h,g]=Te.useState(null),[v,f]=Te.useState(1),[w,k]=Te.useState({x:0,y:0});Te.useEffect(()=>{if(e.length===0)return;let M=jg(e,t,r.width,r.height,r,150);l(M);},[e,t,r]);let y=Te.useCallback((M,z)=>{r.enableDragging&&(z.stopPropagation(),m(M));},[r.enableDragging]),C=Te.useCallback(M=>{if(!p||!i.current)return;let E=i.current.getBoundingClientRect(),B=(M.clientX-E.left-w.x)/v,$=(M.clientY-E.top-w.y)/v;l(O=>O.map(F=>F.id===p?{...F,x:B,y:$,fx:B,fy:$}:F));},[p,v,w]),T=Te.useCallback(()=>{m(null);},[]),N=Te.useCallback((M,z)=>{z.stopPropagation(),c?.({type:"node-click",node:M,position:{x:z.clientX,y:z.clientY}});},[c]),R=Te.useCallback((M,z)=>{z.stopPropagation(),c?.({type:"edge-click",edge:M,position:{x:z.clientX,y:z.clientY}});},[c]),G=Te.useCallback(M=>{let z=u.find(E=>E.id===M);return z?{x:z.x,y:z.y}:{x:0,y:0}},[u]),W=Te.useCallback(M=>{if(M.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return M.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let z=M.card.priority;return z==="URGENT"?"#ef4444":z==="HIGH"?"#f59e0b":z==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return M.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[r.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:oe("relationships-graph-empty",d),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:oe("relationships-graph",d),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(M=>Math.min(M+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(v*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(M=>Math.max(M-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(M=>M.type))).map(M=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:ks(M)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Lc(M)," ",ws(M)]})]},M))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:C,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${v})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(M=>{let z=G(typeof M.source=="string"?M.source:M.source.id),E=G(typeof M.target=="string"?M.target:M.target.id),B=Fc(M.type),$=h===M.id,O=M.onCriticalPath;return jsxRuntime.jsxs("g",{className:oe("relationships-graph-edge",$&&"hovered",O&&"critical"),onMouseEnter:()=>g(M.id),onMouseLeave:()=>g(null),onClick:F=>R(M,F),children:[jsxRuntime.jsx("line",{x1:z.x,y1:z.y,x2:E.x,y2:E.y,stroke:ks(M.type),strokeWidth:O?r.edgeWidth*2:r.edgeWidth,strokeOpacity:$?1:.6,markerEnd:B?"url(#arrowhead)":void 0}),r.showEdgeLabels&&$&&jsxRuntime.jsx("text",{x:(z.x+E.x)/2,y:(z.y+E.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ws(M.type)})]},M.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(M=>{let z=b===M.id,E=M.onCriticalPath;return jsxRuntime.jsxs("g",{className:oe("relationships-graph-node",z&&"hovered",E&&"critical"),transform:`translate(${M.x}, ${M.y})`,onMouseDown:B=>y(M.id,B),onMouseEnter:()=>x(M.id),onMouseLeave:()=>x(null),onClick:B=>N(M,B),children:[jsxRuntime.jsx("circle",{r:E?r.nodeSize*1.2:r.nodeSize,fill:W(M),stroke:E?"#fbbf24":"#ffffff",strokeWidth:E?3:2,opacity:z?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:M.card.title.length>20?M.card.title.substring(0,20)+"...":M.card.title})]},M.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 $c({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[o,s]=Te.useState(""),[c,d]=Te.useState(false),[i,u]=Te.useState(null),[l,p]=Te.useState(null),m=Te.useRef(null),b=c||n;Te.useEffect(()=>{e&&m.current&&m.current.focus();},[e]),Te.useEffect(()=>{let v=f=>{f.key==="Escape"&&!b&&x();};if(e)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,b]);let x=()=>{b||(s(""),u(null),p(null),t());},h=async()=>{if(!(!o.trim()||b)){d(true),u(null),p(null);try{let v=await a(o.trim());p(v);}catch(v){u(v instanceof Error?v.message:"Failed to generate plan");}finally{d(false);}}},g=()=>{l&&(r(l),x());};return e?jsxRuntime.jsxs(Ve,{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-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:v=>v.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:x,disabled:b,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((v,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:v.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((v,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:v.title}),v.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:v.description})]}),v.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${v.priority==="URGENT"?"bg-red-500/20 text-red-400":v.priority==="HIGH"?"bg-orange-500/20 text-orange-400":v.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:v.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:v=>s(v.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:b}),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((v,f)=>jsxRuntime.jsx("button",{onClick:()=>s(v),disabled:b,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:v},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:b&&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:b,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()||b,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:b?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Cs={"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 qg={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Xg={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 Jg(e,t,r){let a=Cs[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,o=r/1e3*a.costPer1kOutput;return n+o}function ja(e){return `$${e.toFixed(4)}`}var Ts=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=Jg(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,p)=>l+p.cost,0),o=r.reduce((l,p)=>l+p.inputTokens,0),s=r.reduce((l,p)=>l+p.outputTokens,0),c=r.filter(l=>l.success),d=r.reduce((l,p)=>l+p.duration,0),i={},u={};return r.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,u[l.feature]=(u[l.feature]||0)+l.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:o,totalOutputTokens:s,operationsByFeature:i,costsByFeature:u,averageDuration:a>0?d/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(u=>u.timestamp>=s).length,d=Math.max(0,n-c),i=c/n*100;return {used:c,limit:n,remaining:d,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 Ts;function _c({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=Te.useState(qr.getStats()),[o,s]=Te.useState(qr.checkLimit(r));if(Te.useEffect(()=>{if(!e)return;let d=setInterval(()=>{n(qr.getStats()),s(qr.checkLimit(r));},1e3);return ()=>clearInterval(d)},[e,r]),Te.useEffect(()=>{let d=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,t]),!e)return null;let c=qr.getRecentOperations(5);return jsxRuntime.jsxs(Ve,{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:d=>d.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:ja(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(([d,i])=>{let u=a.costsByFeature[d]||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:d.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:ja(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},d)})})]}),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(d=>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:d.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(d.timestamp).toLocaleTimeString()," \u2022"," ",d.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[d.inputTokens+d.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ja(d.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${d.success?"bg-green-400":"bg-red-400"}`})]})]},d.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 Vc({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:o}){let[s,c]=Te.useState(""),[d,i]=Te.useState(""),[u,l]=Te.useState(""),[p,m]=Te.useState(false),[b,x]=Te.useState(null),[h,g]=Te.useState(null),[v,f]=Te.useState(null),w=Te.useRef(null),k=p||n;Te.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),Te.useEffect(()=>{let R=G=>{G.key==="Escape"&&!k&&y();};if(e)return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[e,k]);let y=()=>{k||(c(""),i(""),l(""),x(null),g(null),f(null),t());},C=async()=>{if(!(!s.trim()||k)){m(true),x(null),g(null),f(null);try{let R=await a({prompt:s.trim(),projectName:o||"Mi Proyecto",startDate:d||void 0,endDate:u||void 0});g(R.tasks.tasks),f({from_cache:R.from_cache,tokens_used:R.tokens_used,mock_mode:R.mock_mode,similarity:R.similarity,tokens_saved:R.tokens_saved});}catch(R){x(R instanceof Error?R.message:"Failed to generate tasks");}finally{m(false);}}},T=()=>{h&&(r(h),y());};if(!e)return null;let N=v?.similarity?((v.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ve,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:y}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:R=>R.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:y,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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:[v?.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"}),v?.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:[v?.tokens_used||0," tokens"]}),v?.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:[v.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((R,G)=>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:["#",G+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:R.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),R.start," \u2192 ",R.end]}),jsxRuntime.jsxs("span",{children:[R.duration," days"]}),R.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",R.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${R.priority==="high"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:R.priority})]})},R.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:w,value:s,onChange:R=>c(R.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:d,onChange:R=>i(R.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:k})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:R=>l(R.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:k})]})]}),b&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((R,G)=>jsxRuntime.jsx("button",{onClick:()=>c(R),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:R},G))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:y,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:C,disabled:!s.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function qn({initialBoard:e,onPersist:t}){let[r,a]=Te.useState(e),n=Te.useCallback(h=>{t&&tn(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(g,v,f)=>{console.warn(`Retry attempt ${v} after ${f}ms: ${g.message}`);}}).then(g=>{g.success||console.error(`Failed to persist board after ${g.attempts} attempts:`,g.error);});},[t]),o=Te.useCallback(async(h,g,v)=>{a(f=>{let w=f.cards.find(R=>R.id===h);if(!w)return f;let k=w.columnId,y={...w,columnId:g,position:v},C=f.cards.map(R=>R.id===h?y:R),T=f.columns.map(R=>{if(R.id===k)return {...R,cardIds:R.cardIds.filter(G=>G!==h)};if(R.id===g){let G=C.filter(W=>W.columnId===g).sort((W,M)=>W.position-M.position);return {...R,cardIds:G.map(W=>W.id)}}return R}),N={...f,cards:C,columns:T};return n(N),N});},[n]),s=Te.useCallback(async(h,g)=>{a(v=>{let f=v.cards.map(k=>k.id===h?{...k,...g}:k),w={...v,cards:f};return n(w),w});},[n]),c=Te.useCallback(async h=>{let g=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(v=>{let f={...h,id:g},w=v.columns.map(y=>y.id===h.columnId?{...y,cardIds:[...y.cardIds,g]}:y),k={...v,cards:[...v.cards,f],columns:w};return n(k),k});},[n]),d=Te.useCallback(async h=>{a(g=>{let v=g.cards.find(y=>y.id===h);if(!v)return g;let f=g.cards.filter(y=>y.id!==h),w=g.columns.map(y=>y.id===v.columnId?{...y,cardIds:y.cardIds.filter(C=>C!==h)}:y),k={...g,cards:f,columns:w};return n(k),k});},[n]),i=Te.useCallback(async h=>{let g=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(v=>{let f={...h,id:g,cardIds:[]},w={...v,columns:[...v.columns,f]};return n(w),w});},[n]),u=Te.useCallback(async(h,g)=>{a(v=>{let f=v.columns.map(k=>k.id===h?{...k,...g}:k),w={...v,columns:f};return n(w),w});},[n]),l=Te.useCallback(async h=>{a(g=>{let v=g.cards.filter(k=>k.columnId!==h),f=g.columns.filter(k=>k.id!==h),w={...g,cards:v,columns:f};return n(w),w});},[n]),p=Te.useCallback(h=>{let g=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),g},[c]),m=Te.useCallback(h=>{let g=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),g},[i]),b=Te.useCallback(()=>{a(h=>{let g={...h,cards:[],columns:[]};return n(g),g});},[n]);return {board:r,callbacks:{onCardMove:o,onCardUpdate:s,onCardCreate:c,onCardDelete:d,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:l},setBoard:a,helpers:{addCard:p,addColumn:m,deleteCard:d,deleteColumn:l,clearBoard:b}}}function jc({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:o}=qn({initialBoard:e,onPersist:r}),s=Te.useMemo(()=>({addCard:(d,i,u={})=>{o.addCard({title:i,columnId:d,position:a.cards.filter(l=>l.columnId===d).length,...u});},addColumn:(d,i)=>{let u=a.columns.length>0?Math.max(...a.columns.map(l=>l.position)):0;o.addColumn({title:d,position:i??u+1e3});},reset:o.clearBoard}),[a.cards,a.columns,o]);return {props:Te.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:s}}var Ya={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},qc={by:"none",order:"asc"};function Xc({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=Te.useState({...Ya,...e}),[o,s]=Te.useState({...qc,...t}),c=Te.useCallback(x=>{n(h=>({...h,...x}));},[]),d=Te.useCallback(x=>{s(h=>({...h,...x}));},[]),i=Te.useCallback(()=>{n(Ya),s(qc);},[]),u=Te.useCallback(()=>{r&&n({...Ya,assignees:[r]});},[r]),l=Te.useCallback(()=>{n({...Ya,dateFilter:"overdue"});},[]),p=Te.useCallback(()=>{n({...Ya,priorities:["HIGH","URGENT"]});},[]),m=Te.useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||o.by!=="none",[a,o]),b=Te.useCallback(x=>{let h=[...x];if(a.search){let g=a.search.toLowerCase();h=h.filter(v=>v.title.toLowerCase().includes(g)||v.description?.toLowerCase().includes(g));}if(a.dateFilter!=="all"){let g=new Date,v=g.getFullYear(),f=String(g.getMonth()+1).padStart(2,"0"),w=String(g.getDate()).padStart(2,"0"),k=`${v}-${f}-${w}`;h=h.filter(y=>{if(!y.endDate&&!y.dueDate)return false;let C=y.endDate||y.dueDate;if(!C)return false;let T;if(typeof C=="string")T=C.split("T")[0]||C;else {let N=C.getUTCFullYear(),R=String(C.getUTCMonth()+1).padStart(2,"0"),G=String(C.getUTCDate()).padStart(2,"0");T=`${N}-${R}-${G}`;}switch(a.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let N=new Date(k+"T00:00:00"),R=new Date(T+"T00:00:00"),G=new Date(N);return G.setDate(G.getDate()+7),R>=N&&R<=G;case "custom":if(a.dateRange){let W=typeof C=="string"?new Date(C):C;return W>=a.dateRange.start&&W<=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(v=>a.labels.includes(v)))),a.columns.length>0&&(h=h.filter(g=>a.columns.includes(g.columnId))),o.by!=="none"&&h.sort((g,v)=>{let f=0;switch(o.by){case "created":let w=g.createdAt?new Date(g.createdAt).getTime():0,k=v.createdAt?new Date(v.createdAt).getTime():0;f=w-k;break;case "priority":let y={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},C=y[g.priority||"LOW"],T=y[v.priority||"LOW"];f=C-T;break;case "dueDate":let N=g.endDate||g.dueDate,R=v.endDate||v.dueDate;if(!N)return 1;if(!R)return -1;let G=typeof N=="string"?new Date(N).getTime():N.getTime(),W=typeof R=="string"?new Date(R).getTime():R.getTime();f=G-W;break;case "title":f=g.title.localeCompare(v.title);break;case "estimate":let M=g.estimatedTime||0,z=v.estimatedTime||0;f=M-z;break;default:f=0;}return o.order==="asc"?f:-f}),h},[a,o]);return {filters:a,sort:o,setFilters:c,setSort:d,resetFilters:i,filterMyTasks:u,filterOverdue:l,filterHighPriority:p,applyFilters:b,hasActiveFilters:m}}var Zc,Qc;if(typeof window<"u")try{let e=Za("ai");Zc=e.generateObject,Qc=e.generateText;}catch{}function ed(e={}){let[t,r]=Te.useState(false),[a,n]=Te.useState(null),o=!!(Zc&&Qc&&e.apiKey),s=Te.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(p){let m=p instanceof Error?p:new Error("Failed to generate plan");throw n(m),m}finally{r(false);}},[o]),c=Te.useCallback(async 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(p){let m=p instanceof Error?p:new Error("Failed to suggest assignee");throw n(m),m}finally{r(false);}},[o]),d=Te.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(p){let m=p instanceof Error?p:new Error("Failed to predict risks");throw n(m),m}finally{r(false);}},[o]),i=Te.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(p){let m=p instanceof Error?p:new Error("Failed to generate subtasks");throw n(m),m}finally{r(false);}},[o]),u=Te.useCallback(async 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(p){let m=p instanceof Error?p:new Error("Failed to estimate effort");throw n(m),m}finally{r(false);}},[o]);return {onGeneratePlan:s,onSuggestAssignee:c,onPredictRisks:d,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:o,isLoading:t,error:a}}function Ss(){let[e,t]=Te.useState(()=>core.selectionStore.getState());Te.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=Te.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function td(e){let{cards:t}=e,[r,a]=Ss(),n=Te.useCallback(l=>r.selectedCardIds.includes(l),[r.selectedCardIds]),o=Te.useCallback((l,p)=>{if(!p){a({selectedCardIds:[l],lastSelectedCardId:l});return}let m=p.ctrlKey||p.metaKey,b=p.shiftKey;if(m)r.selectedCardIds.includes(l)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==l),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,l],lastSelectedCardId:l});else if(b&&r.lastSelectedCardId){let x=t.find(g=>g.id===l),h=t.find(g=>g.id===r.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let g=t.filter(T=>T.columnId===x.columnId).sort((T,N)=>T.position-N.position),v=g.findIndex(T=>T.id===r.lastSelectedCardId),f=g.findIndex(T=>T.id===l),[w,k]=v<f?[v,f]:[f,v],y=g.slice(w,k+1).map(T=>T.id),C=Array.from(new Set([...r.selectedCardIds,...y]));a({selectedCardIds:C,lastSelectedCardId:l});}else a({selectedCardIds:[l],lastSelectedCardId:l});}else a({selectedCardIds:[l],lastSelectedCardId:l});},[t,r,a]),s=Te.useCallback(l=>{a({selectedCardIds:r.selectedCardIds.filter(p=>p!==l),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),c=Te.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),d=Te.useCallback(()=>{a({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=Te.useCallback(l=>{r.selectedCardIds.includes(l)?s(l):a({selectedCardIds:[...r.selectedCardIds,l],lastSelectedCardId:l});},[r,s,a]),u=Te.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:d,toggleCard:i,getSelectedCards:u}}var rd={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function ad(e){let{cards:t,config:r,aiService:a}=e,n=Te.useMemo(()=>({...rd,...r}),[r]),[o,s]=Te.useState([]),c=Te.useCallback((x,h,g,v,f)=>{if(h.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:g,strategy:v,color:f,isExpanded:true,position:o.filter(k=>k.columnId===g).length,createdAt:new Date};s(k=>[...k,w]);},[n.minCardsPerStack,o]),d=Te.useCallback(x=>{s(h=>h.filter(g=>g.id!==x));},[]),i=Te.useCallback(x=>{s(h=>h.map(g=>g.id===x?{...g,isExpanded:!g.isExpanded}:g));},[]),u=Te.useCallback((x,h)=>{s(g=>g.map(v=>v.id===x&&!v.cardIds.includes(h)?{...v,cardIds:[...v.cardIds,h]}:v));},[]),l=Te.useCallback((x,h)=>{s(g=>g.map(v=>{if(v.id===x){let f=v.cardIds.filter(w=>w!==h);return f.length<n.minCardsPerStack?null:{...v,cardIds:f}}return v}).filter(v=>v!==null));},[n.minCardsPerStack]),p=Te.useCallback(x=>o.filter(h=>h.columnId===x).sort((h,g)=>h.position-g.position),[o]),m=Te.useCallback(async x=>{let h=t.filter(k=>k.columnId===x);if(h.length<n.minCardsPerStack*2)return [];let g=[],v=new Map;h.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(y=>{v.has(y)||v.set(y,[]),v.get(y).push(k);});}),v.forEach((k,y)=>{k.length>=n.minCardsPerStack&&g.push({stack:{title:`\u{1F4CC} ${y}`,cardIds:k.map(C=>C.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${y}"`,confidence:.85});});let f=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(y=>{f.has(y)||f.set(y,[]),f.get(y).push(k);});}),f.forEach((k,y)=>{k.length>=n.minCardsPerStack&&g.push({stack:{title:`\u{1F464} Assigned to user-${y.slice(-4)}`,cardIds:k.map(C=>C.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,y)=>{if(k.length>=n.minCardsPerStack){let C={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[y.toLowerCase()]||"\u26AA";g.push({stack:{title:`${C} ${y} Priority`,cardIds:k.map(T=>T.id),columnId:x,strategy:"priority",color:y==="high"||y==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${y} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let k of h){let C=(await a.findSimilar(k,h)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(C.length>=n.minCardsPerStack-1){let T=[k.id,...C.map(R=>R.card.id)],N=C.reduce((R,G)=>R+G.similarity,0)/C.length;g.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${C.length+1} similar tasks`,confidence:N});}}return g.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,y)=>y.confidence-k.confidence).slice(0,5)},[t,n,a]),b=Te.useCallback(x=>{c(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[c]);return Te.useEffect(()=>{n.enableAutoStacking&&o.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let g=await m(h),v=g[0];g.length>0&&v&&v.confidence>=.9&&b(v);});},[]),{stacks:o,createStack:c,deleteStack:d,toggleStack:i,addToStack:u,removeFromStack:l,getStacksForColumn:p,getSuggestions:m,applySuggestion:b,config:n}}var nd=Te.createContext(null);function od({children:e,initialData:t,onStateChange:r}){let a=Te.useRef();if(!a.current){let o=new Map,s=new Map;t?.columns?.forEach(d=>{let{Column:i}=Za("@libxai/core");o.set(d.id,new i(d));}),t?.cards?.forEach(d=>{let{Card:i}=Za("@libxai/core");s.set(d.id,new i(d));});let c=null;if(t?.board){let{Board:d}=Za("@libxai/core");c=new d(t.board);}a.current=new core.BoardStore({board:c,columns:o,cards:s});}let n=a.current;return Te.useEffect(()=>{if(r)return n.subscribeAll(o=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(nd.Provider,{value:{store:n},children:e})}function Xn(){let e=Te.useContext(nd);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Xa(){let e=Xn(),[t,r]=Te.useState(e.getBoard()),[a,n]=Te.useState(e.getAllColumns()),[o,s]=Te.useState(e.getAllCards());Te.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),s(e.getAllCards());}),[e]);let c=Te.useCallback(v=>{e.updateBoard(v);},[e]),d=Te.useCallback(v=>{e.addColumn(v);},[e]),i=Te.useCallback((v,f)=>{e.updateColumn(v,f);},[e]),u=Te.useCallback(v=>{e.deleteColumn(v);},[e]),l=Te.useCallback(v=>e.getColumn(v),[e]),p=Te.useCallback(v=>{e.addCard(v);},[e]),m=Te.useCallback((v,f)=>{e.updateCard(v,f);},[e]),b=Te.useCallback(v=>{e.deleteCard(v);},[e]),x=Te.useCallback((v,f,w)=>{e.moveCard(v,f,w);},[e]),h=Te.useCallback(v=>e.getCard(v),[e]),g=Te.useCallback(v=>e.getCardsByColumn(v),[e]);return {board:t,columns:a,cards:o,updateBoard:c,addColumn:d,updateColumn:i,deleteColumn:u,getColumn:l,addCard:p,updateCard:m,deleteCard:b,moveCard:x,getCard:h,getCardsByColumn:g}}function id(e){let{cards:t}=Xa();return Te.useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),o=r.description?.toLowerCase().includes(a);if(!n&&!o)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function ld(e="position",t="asc"){let{cards:r}=Xa();return Te.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},d=n.priority?c[n.priority]:0,i=o.priority?c[o.priority]:0;s=d-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 Jn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=ri.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);}},fh=new Jn;function dd({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:o=5,horizontal:s=false,gap:c=0,getItemKey:d}){let i=Te.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:o,horizontal:s,gap:c}),l=u.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=s?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:p,className:n,children:jsxRuntime.jsx("div",{style:m,children:l.map(b=>{let x=e[b.index];if(!x)return null;let h=d?d(x,b.index):b.index,g={position:"absolute",top:s?0:b.start,left:s?b.start:0,width:s?b.size:"100%",height:s?"100%":b.size};return jsxRuntime.jsx("div",{style:g,"data-index":b.index,children:a(x,b.index)},h)})})})}function ud(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 md({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:o="",overscan:s=3,gap:c=16,getItemKey:d,horizontal:i=true}){let u=Te.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>a,overscan:s,gap:c}),p=l.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},b={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:m,className:o,children:jsxRuntime.jsx("div",{style:b,children:p.map(x=>{let h=e[x.index];if(!h)return null;let g=d?d(h,x.index):x.index,v={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:v,"data-index":x.index,children:n(h,x.index)},g)})})})}function fd(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 gd(e,t=10){return e>t}var Ps={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Is={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ms={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},As={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ls={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Fs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Bs={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Os={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)"},zs={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)"},$s={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Gs={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}},Us={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}},Zn={spacing:Ps,borderRadius:Is,fontSize:Ms,fontWeight:As,lineHeight:Ls,zIndex:Fs,duration:Bs,easing:Os,shadows:zs,opacity:$s,kanban:Gs,gantt:Us};function hd(e,t,r){return e[t]??r}function _s(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)?_s(n,o,r):(typeof n=="string"||typeof n=="number")&&(r[o]=n);}return r}function vh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ws(e="asakaa"){let t=_s(Zn),r=[];for(let[a,n]of Object.entries(t)){let o=`--${e}-${a}`,s=vh(n);r.push(` ${o}: ${s};`);}return `:root {
|
|
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 p={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(p!==void 0){let v=new Date(a),y=v.getDay(),h=p-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),p=o[2].toLowerCase(),v=new Date(a);return p==="day"||p==="d\xEDa"||p==="dias"?v.setDate(v.getDate()+d):p==="week"||p==="semana"||p==="semanas"?v.setDate(v.getDate()+d*7):(p==="month"||p==="mes"||p==="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),p=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,p,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),p=u[i[2].toLowerCase()],v=i[3]?parseInt(i[3],10):a.getFullYear();if(p!==void 0)return new Date(v,p,d)}let m={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=m[l[1].toLowerCase()],p=parseInt(l[2],10),v=l[3]?parseInt(l[3],10):a.getFullYear();if(d!==void 0)return new Date(v,d,p)}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(),m=a[2].trim(),l=Dr(t,i),d=Is(m);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 "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let p=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()+p),{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(),m=n[2].trim(),l=Dr(t,i),d=As(m);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 "${m}".`,success:false,error:"Invalid duration"};let p=new Date(l.endDate);return p.setDate(p.getDate()+d),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:p},message:`Extended "${l.name}" by ${d} days. New end date: ${p.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(),m=o[2].trim(),l=Dr(t,i),d=Ls(m);return l?d===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${m}".`,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(),m=s[2].trim(),l=Dr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:m},message:`Renamed "${l.name}" to "${m}".`,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(),m=c[2].trim(),l=Dr(t,i),d=Dr(t,m);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:m,message:`Could not find a task named "${m}".`,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(),m=Dr(t,i);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.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(m=>{let l=r.find(d=>d.id===m);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(m=>m!==null),n=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Zn(m,t,r)),o;e.dependencies&&(typeof e.dependencies[0]=="string"?o=e.dependencies:o=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let s=m=>{if(m)return typeof m=="string"?new Date(m):m},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:m=true,showHierarchy:l=true}=t,d=eo(u,i),p=c==="dark",[v,y]=Se.useState(new Set),[h,g]=Se.useState("startDate"),[b,f]=Se.useState("asc"),[w,k]=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(w.trim()){let z=w.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||w.trim())&&$.push(z);}return w.trim()&&$.sort((z,R)=>{let W,P;switch(h){case "name":W=z.name.toLowerCase(),P=R.name.toLowerCase();break;case "startDate":W=z.startDate?.getTime()||0,P=R.startDate?.getTime()||0;break;case "endDate":W=z.endDate?.getTime()||0,P=R.endDate?.getTime()||0;break;case "progress":W=z.progress||0,P=R.progress||0;break;case "status":W=z.status||"todo",P=R.status||"todo";break;default:return 0}return W<P?b==="asc"?-1:1:W>P?b==="asc"?1:-1:0}),$},[e,w,h,b]),S=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",p?"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",p?"text-[#9CA3AF]":"text-gray-600"),children:[d.empty.noTasks,"..."]})]})}):n?jsxRuntime.jsx("div",{className:L("flex-1 flex items-center justify-center",p?"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",p?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:L("text-sm",p?"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",p?"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",p?"text-white":"text-gray-900"),children:d.empty.noTasks}),jsxRuntime.jsx("p",{className:L("text-sm",p?"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",p?"bg-[#0F1117]":"bg-white",o),style:s,children:[jsxRuntime.jsx("div",{className:L("flex-shrink-0 px-6 py-4 border-b",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[m&&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",p?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:w,onChange:T=>k(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",p?"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",p?"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",p?"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",p?"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",p?"hover:bg-white/10":"hover:bg-gray-200"),children:z?jsxRuntime.jsx(lucideReact.ChevronDown,{className:L("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:L("w-4 h-4",p?"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",p?"text-white":"text-gray-900",T.progress===100&&(p?"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":p?"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",p?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),S(T.startDate)]}),jsxRuntime.jsxs("div",{className:L("col-span-2 flex items-center gap-1 text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),S(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",p?"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",p?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),C.length===0&&w&&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",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:L(p?"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:m}=t,l=no(i,m),d=u==="dark",[p,v]=Se.useState(a||new Date),[y,h]=Se.useState(null),g=Se.useCallback(()=>{v(new Date(p.getFullYear(),p.getMonth()-1,1));},[p]),b=Se.useCallback(()=>{v(new Date(p.getFullYear(),p.getMonth()+1,1));},[p]),f=Se.useCallback(()=>{v(new Date);},[]),w=Se.useMemo(()=>{let C=p.getFullYear(),S=p.getMonth(),T=new Date(C,S,1),$=new Date(C,S+1,0),z=T.getDay(),R=$.getDate(),W=Hh(e),P=new Date;P.setHours(0,0,0,0);let O=[],G=z,U=new Date(C,S,0).getDate();for(let K=G-1;K>=0;K--){let _=new Date(C,S-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,S,K),ae=_.getTime()===P.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,S+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},[p,e]),k=i==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],x=p.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),D=Se.useCallback(C=>{let S=C.progress===100?0:100,T=S===100?"completed":"todo";r.onTaskUpdate?.({...C,status:T,progress:S});},[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:k.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:w.map((C,S)=>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"]})]})]},S))})]})}),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),m=Se.useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),l=Se.useMemo(()=>{let p=m.length,v=new Set(m.flatMap(g=>g.assignedUserIds||[])).size,y=m.map(g=>g.priority).filter(Boolean),h=new Set(m.flatMap(g=>g.labels||[])).size;return {totalCards:p,uniqueAssignees:v,priorities:y,labels:h}},[m]),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:p=>{p.stopPropagation(),s?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[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:m.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:m.map(p=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsxRuntime.jsx("h4",{children:p.title}),p.description&&jsxRuntime.jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),o?.(e.id,p.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},p.id))})})]})}var 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,m]=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 w=f.timestamp.toISOString().split("T")[0],k=b.get(w);k?k.push(f):b.set(w,[f]);}),Array.from(b.entries()).sort((f,w)=>w[0].localeCompare(f[0])).map(([f,w])=>({date:new Date(f),events:w.sort((k,x)=>x.timestamp.getTime()-k.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:p,uniqueTypes:v}=Se.useMemo(()=>{let b=new Set,f=new Set;return e.forEach(w=>{b.add(w.userId),f.add(w.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(f)}},[e]),y=b=>{m(f=>{let w=new Set(f);return w.has(b)?w.delete(b):w.add(b),w});},h=b=>{let w=new Date().getTime()-b.getTime(),k=Math.floor(w/6e4),x=Math.floor(w/36e5),D=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}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))]}),p.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"}),p.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,w)=>{let k=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",k&&"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)})}),w<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:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([C,S])=>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(S.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(S.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,S])=>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(S)})]},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 m=[.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:p=>c(parseInt(p.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((p,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(p)},p.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(p=>jsxRuntime.jsxs("button",{className:L("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>u(p),children:[p,"x"]},p))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children: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(p=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):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(m=>{let l=r/2,d=a/2;m.vx+=(l-m.x)*n.centerForce*i,m.vy+=(d-m.y)*n.centerForce*i,s.forEach(p=>{if(m.id===p.id)return;let v=m.x-p.x,y=m.y-p.y,h=Math.sqrt(v*v+y*y)||1,g=n.chargeStrength*i/(h*h);m.vx+=v/h*g,m.vy+=y/h*g;});}),t.forEach(m=>{let l=c.get(typeof m.source=="string"?m.source:m.source.id),d=c.get(typeof m.target=="string"?m.target:m.target.id);if(!l||!d)return;let p=d.x-l.x,v=d.y-l.y,y=Math.sqrt(p*p+v*v)||1,h=(y-n.linkDistance)/y*n.forceStrength*i;l.vx+=p*h,l.vy+=v*h,d.vx-=p*h,d.vy-=v*h;}),s.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,m.x)),m.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,m.y)),m.vx*=.9,m.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),[m,l]=Se.useState([]),[d,p]=Se.useState(null),[v,y]=Se.useState(null),[h,g]=Se.useState(null),[b,f]=Se.useState(1),[w,k]=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(),p(R));},[r.enableDragging]),D=Se.useCallback(R=>{if(!d||!i.current)return;let P=i.current.getBoundingClientRect(),O=(R.clientX-P.left-w.x)/b,G=(R.clientY-P.top-w.y)/b;l(U=>U.map(A=>A.id===d?{...A,x:O,y:G,fx:O,fy:G}:A));},[d,b,w]),C=Se.useCallback(()=>{p(null);},[]),S=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=m.find(P=>P.id===R);return W?{x:W.x,y:W.y}:{x:0,y:0}},[m]),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),k({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(${w.x}, ${w.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),P=$(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:P.x,y2:P.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+P.x)/2,y:(W.y+P.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:qs(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(R=>{let W=v===R.id,P=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:L("relationships-graph-node",W&&"hovered",P&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:O=>x(R.id,O),onMouseEnter:()=>y(R.id),onMouseLeave:()=>y(null),onClick:O=>S(R,O),children:[jsxRuntime.jsx("circle",{r:P?r.nodeSize*1.2:r.nodeSize,fill:z(R),stroke:P?"#fbbf24":"#ffffff",strokeWidth:P?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,m]=Se.useState(null),[l,d]=Se.useState(null),p=Se.useRef(null),v=c||n;Se.useEffect(()=>{e&&p.current&&p.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(""),m(null),d(null),t());},h=async()=>{if(!(!o.trim()||v)){u(true),m(null),d(null);try{let b=await a(o.trim());d(b);}catch(b){m(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:p,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={},m={};return r.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,m[l.feature]=(m[l.feature]||0)+l.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:o,totalOutputTokens:s,operationsByFeature:i,costsByFeature:m,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(m=>m.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 m=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(m)})]})]}),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(""),[m,l]=Se.useState(""),[d,p]=Se.useState(false),[v,y]=Se.useState(null),[h,g]=Se.useState(null),[b,f]=Se.useState(null),w=Se.useRef(null),k=d||n;Se.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),Se.useEffect(()=>{let T=$=>{$.key==="Escape"&&!k&&x();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,k]);let x=()=>{k||(c(""),i(""),l(""),y(null),g(null),f(null),t());},D=async()=>{if(!(!s.trim()||k)){p(true),y(null),g(null),f(null);try{let T=await a({prompt:s.trim(),projectName:o||"Mi Proyecto",startDate:u||void 0,endDate:m||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{p(false);}}},C=()=>{h&&(r(h),x());};if(!e)return null;let S=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:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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 (",S,"% 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:w,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:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value: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:k})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,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:k})]})]}),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:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:T},$))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),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()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function 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 w=f.cards.find(T=>T.id===h);if(!w)return f;let k=w.columnId,x={...w,columnId:g,position:b},D=f.cards.map(T=>T.id===h?x:T),C=f.columns.map(T=>{if(T.id===k)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}),S={...f,cards:D,columns:C};return n(S),S});},[n]),s=Se.useCallback(async(h,g)=>{a(b=>{let f=b.cards.map(k=>k.id===h?{...k,...g}:k),w={...b,cards:f};return n(w),w});},[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},w=b.columns.map(x=>x.id===h.columnId?{...x,cardIds:[...x.cardIds,g]}:x),k={...b,cards:[...b.cards,f],columns:w};return n(k),k});},[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),w=g.columns.map(x=>x.id===b.columnId?{...x,cardIds:x.cardIds.filter(D=>D!==h)}:x),k={...g,cards:f,columns:w};return n(k),k});},[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:[]},w={...b,columns:[...b.columns,f]};return n(w),w});},[n]),m=Se.useCallback(async(h,g)=>{a(b=>{let f=b.columns.map(k=>k.id===h?{...k,...g}:k),w={...b,columns:f};return n(w),w});},[n]),l=Se.useCallback(async h=>{a(g=>{let b=g.cards.filter(k=>k.columnId!==h),f=g.columns.filter(k=>k.id!==h),w={...g,cards:b,columns:f};return n(w),w});},[n]),d=Se.useCallback(h=>{let g=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),g},[c]),p=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:m,onColumnDelete:l},setBoard:a,helpers:{addCard:d,addColumn:p,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,m={})=>{o.addCard({title:i,columnId:u,position:a.cards.filter(l=>l.columnId===u).length,...m});},addColumn:(u,i)=>{let m=a.columns.length>0?Math.max(...a.columns.map(l=>l.position)):0;o.addColumn({title:u,position:i??m+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);},[]),m=Se.useCallback(()=>{r&&n({...en,assignees:[r]});},[r]),l=Se.useCallback(()=>{n({...en,dateFilter:"overdue"});},[]),d=Se.useCallback(()=>{n({...en,priorities:["HIGH","URGENT"]});},[]),p=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"),w=String(g.getDate()).padStart(2,"0"),k=`${b}-${f}-${w}`;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 S=D.getUTCFullYear(),T=String(D.getUTCMonth()+1).padStart(2,"0"),$=String(D.getUTCDate()).padStart(2,"0");C=`${S}-${T}-${$}`;}switch(a.dateFilter){case "overdue":return C<k;case "today":return C===k;case "this-week":let S=new Date(k+"T00:00:00"),T=new Date(C+"T00:00:00"),$=new Date(S);return $.setDate($.getDate()+7),T>=S&&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 w=g.createdAt?new Date(g.createdAt).getTime():0,k=b.createdAt?new Date(b.createdAt).getTime():0;f=w-k;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 S=g.endDate||g.dueDate,T=b.endDate||b.dueDate;if(!S)return 1;if(!T)return -1;let $=typeof S=="string"?new Date(S).getTime():S.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:m,filterOverdue:l,filterHighPriority:d,applyFilters:v,hasActiveFilters:p}}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 p=d instanceof Error?d:new Error("Failed to generate plan");throw n(p),p}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 p=d instanceof Error?d:new Error("Failed to suggest assignee");throw n(p),p}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 p=d instanceof Error?d:new Error("Failed to predict risks");throw n(p),p}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 p=d instanceof Error?d:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[o]),m=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 p=d instanceof Error?d:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[o]);return {onGeneratePlan:s,onSuggestAssignee:c,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:m,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 p=d.ctrlKey||d.metaKey,v=d.shiftKey;if(p)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,S)=>C.position-S.position),b=g.findIndex(C=>C.id===r.lastSelectedCardId),f=g.findIndex(C=>C.id===l),[w,k]=b<f?[b,f]:[f,b],x=g.slice(w,k+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]),m=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:m}}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 w={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(k=>k.columnId===g).length,createdAt:new Date};s(k=>[...k,w]);},[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));},[]),m=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(w=>w!==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]),p=Se.useCallback(async y=>{let h=t.filter(k=>k.columnId===y);if(h.length<n.minCardsPerStack*2)return [];let g=[],b=new Map;h.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(x=>{b.has(x)||b.set(x,[]),b.get(x).push(k);});}),b.forEach((k,x)=>{k.length>=n.minCardsPerStack&&g.push({stack:{title:`\u{1F4CC} ${x}`,cardIds:k.map(D=>D.id),columnId:y,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${x}"`,confidence:.85});});let f=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(x=>{f.has(x)||f.set(x,[]),f.get(x).push(k);});}),f.forEach((k,x)=>{k.length>=n.minCardsPerStack&&g.push({stack:{title:`\u{1F464} Assigned to user-${x.slice(-4)}`,cardIds:k.map(D=>D.id),columnId:y,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,x)=>{if(k.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:k.map(C=>C.id),columnId:y,strategy:"priority",color:x==="high"||x==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${x} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let k of h){let D=(await a.findSimilar(k,h)).filter(C=>C.similarity>=n.autoStackConfidenceThreshold);if(D.length>=n.minCardsPerStack-1){let C=[k.id,...D.map(T=>T.card.id)],S=D.reduce((T,$)=>T+$.similarity,0)/D.length;g.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:C,columnId:y,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:S});}}return g.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,x)=>x.confidence-k.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 p(h),b=g[0];g.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:o,createStack:c,deleteStack:u,toggleStack:i,addToStack:m,removeFromStack:l,getStacksForColumn:d,getSuggestions:p,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]),m=Se.useCallback(b=>{e.deleteColumn(b);},[e]),l=Se.useCallback(b=>e.getColumn(b),[e]),d=Se.useCallback(b=>{e.addCard(b);},[e]),p=Se.useCallback((b,f)=>{e.updateCard(b,f);},[e]),v=Se.useCallback(b=>{e.deleteCard(b);},[e]),y=Se.useCallback((b,f,w)=>{e.moveCard(b,f,w);},[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:m,getColumn:l,addCard:d,updateCard:p,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),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:o,horizontal:s,gap:c}),l=m.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=s?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:d,className:n,children:jsxRuntime.jsx("div",{style:p,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 m=Se.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>a,overscan:s,gap:c}),d=l.getVirtualItems(),p={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:m,style:p,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
324
|
${r.join(`
|
|
325
325
|
`)}
|
|
326
|
-
}`}function
|
|
326
|
+
}`}function an(e,t="asakaa"){let r=[],a=gi(e);for(let[n,o]of Object.entries(a)){let s=`--${t}-color-${n}`;r.push(` ${s}: ${o};`);}return `:root {
|
|
327
327
|
${r.join(`
|
|
328
328
|
`)}
|
|
329
|
-
}`}var
|
|
329
|
+
}`}var fo={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"}},bi={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"}},vi={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 yi(e=fo,t="asakaa"){let r=hi(t),a=an(e,t);return `${r}
|
|
330
330
|
|
|
331
|
-
${a}`}function
|
|
331
|
+
${a}`}function ru(){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
|
+
${yi(fo)}
|
|
338
338
|
|
|
339
339
|
/* Light theme */
|
|
340
340
|
[data-theme="light"] {
|
|
341
|
-
${
|
|
341
|
+
${an(bi,"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
|
+
${an(vi,"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 Tb=({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 au({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:o}=pa();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${r}`,children:Object.entries(o).map(([s,c])=>{let u=s,i=u===a;return jsxRuntime.jsxs("button",{onClick:()=>n(u),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":i,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Tb,{theme:u})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},u)})})}
|
|
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=Nd;exports.AI_FEATURES=rb;exports.AI_MODELS=Xs;exports.AttachmentUploader=Ga;exports.BoardProvider=Hd;exports.BulkOperationsToolbar=In;exports.BurnDownChart=qo;exports.CalendarBoard=ud;exports.Card=kr;exports.CardDetailModal=Ho;exports.CardDetailModalV2=jo;exports.CardHistoryReplay=vd;exports.CardHistoryTimeline=hd;exports.CardRelationshipsGraph=kd;exports.CardStack=Kh;exports.CardTemplateSelector=rs;exports.CircuitBreaker=bo;exports.Column=ia;exports.ColumnManager=zn;exports.CommandPalette=Go;exports.ConfigMenu=ss;exports.ContextMenu=ha;exports.DEFAULT_SHORTCUTS=_a;exports.DEFAULT_TEMPLATES=ts;exports.DateRangePicker=Ba;exports.DependenciesSelector=za;exports.DependencyLine=_n;exports.DistributionCharts=Xo;exports.EditableColumnTitle=Oo;exports.ErrorBoundary=ca;exports.ExportImportModal=ns;exports.FilterBar=os;exports.GANTT_AI_SYSTEM_PROMPT=Kc;exports.GanttAIAssistant=Xn;exports.GanttBoard=jc;exports.GanttI18nContext=ga;exports.GanttMilestone=Vn;exports.GanttToolbar=On;exports.GenerateGanttTasksDialog=Rd;exports.GeneratePlanModal=Td;exports.GroupBySelector=Qo;exports.KanbanBoard=Rr;exports.KanbanViewAdapter=Wa;exports.KeyboardShortcutsHelp=es;exports.ListView=od;exports.MenuIcons=lt;exports.PluginManager=mo;exports.PrioritySelector=Fa;exports.RATE_LIMITS=tb;exports.SwimlaneBoardView=Jo;exports.TaskBar=Un;exports.TaskFormModal=qn;exports.TaskGrid=Wn;exports.ThemeModal=ds;exports.ThemeProvider=ac;exports.ThemeSwitcher=au;exports.Timeline=Yn;exports.UserAssignmentSelector=Vr;exports.VelocityChart=Yo;exports.VirtualGrid=Zd;exports.VirtualList=qd;exports.aiUsageTracker=Qr;exports.borderRadius=ni;exports.calculatePosition=sn;exports.calendarDarkTheme=Vs;exports.calendarEnTranslations=Us;exports.calendarEsTranslations=Gs;exports.calendarLightTheme=js;exports.calendarNeutralTheme=Ks;exports.calendarThemes=so;exports.calendarTranslations=ao;exports.cardToGanttTask=Zn;exports.cardsToGanttTasks=ed;exports.cn=L;exports.createKanbanView=$l;exports.createRetryWrapper=Eu;exports.darkTheme=is;exports.darkTokenTheme=fo;exports.defaultTheme=Ln;exports.designTokens=po;exports.duration=ci;exports.easing=di;exports.exportTokensToCSS=ru;exports.findTaskByName=Dr;exports.fontSize=oi;exports.fontWeight=si;exports.formatCost=Qa;exports.ganttEnTranslations=Bn;exports.ganttEsTranslations=oc;exports.ganttTaskToCardUpdate=Qc;exports.ganttThemes=Ce;exports.ganttTokens=fi;exports.ganttTranslations=us;exports.ganttUtils=q;exports.generateCSSVariables=hi;exports.generateCompleteCSS=yi;exports.generateInitialPositions=Tu;exports.generateTasksContext=Yc;exports.generateThemeVariables=an;exports.getCalendarTheme=md;exports.getCalendarTranslations=Xa;exports.getListViewTheme=sd;exports.getListViewTranslations=Os;exports.getMonthNames=id;exports.getToken=tu;exports.getTranslations=sc;exports.getWeekdayNames=ld;exports.kanbanTokens=pi;exports.lightTheme=ls;exports.lightTokenTheme=bi;exports.lineHeight=ii;exports.listViewDarkTheme=zs;exports.listViewEnTranslations=Fs;exports.listViewEsTranslations=Bs;exports.listViewLightTheme=$s;exports.listViewNeutralTheme=Ws;exports.listViewThemes=ro;exports.listViewTranslations=Qn;exports.mergeCalendarTranslations=no;exports.mergeListViewTranslations=eo;exports.mergeTranslations=ms;exports.neutralTheme=cs;exports.neutralTokenTheme=vi;exports.opacity=mi;exports.parseLocalCommand=Jc;exports.parseNaturalDate=Is;exports.parseNaturalDuration=As;exports.parseProgress=Ls;exports.parseStatus=Xc;exports.pluginManager=xb;exports.retrySyncOperation=Nu;exports.retryWithBackoff=ln;exports.shadows=ui;exports.shouldVirtualizeGrid=eu;exports.spacing=ai;exports.themes=Yr;exports.useAI=$d;exports.useBoard=Id;exports.useBoardCore=rn;exports.useBoardStore=uo;exports.useCardStacking=Gd;exports.useDragState=$o;exports.useFilteredCards=jd;exports.useFilters=Fd;exports.useGanttI18n=Ha;exports.useKanbanState=co;exports.useKeyboardShortcuts=ec;exports.useMultiSelect=Wd;exports.useSelectionState=Qs;exports.useSortedCards=Kd;exports.useTheme=pa;exports.useVirtualGrid=Qd;exports.useVirtualList=Xd;exports.validateAIResponse=Zc;exports.withErrorBoundary=Wo;exports.zIndex=li;//# sourceMappingURL=index.cjs.map
|
|
354
354
|
//# sourceMappingURL=index.cjs.map
|