knowns 0.8.1 → 0.8.2
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/README.md +3 -2
- package/dist/index.js +94 -26
- package/dist/mcp/server.js +59 -1
- package/dist/ui/assets/{index-CgrPuyyK.js → index-D3_NArD-.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +1 -2
- package/CLAUDE.md +0 -999
|
@@ -307,7 +307,7 @@ Defaulting to \`null\`.`}var Jce=Kce,Xot=Zce;const eue=v.forwardRef(({className:
|
|
|
307
307
|
To pick up a draggable item, press the space bar.
|
|
308
308
|
While dragging, use the arrow keys to move the item.
|
|
309
309
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
310
|
-
`},Xat={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Zat(e){let{announcements:t=Xat,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Kat}=e;const{announce:o,announcement:s}=qat(),a=Ly("DndLiveRegion"),[l,c]=v.useState(!1);if(v.useEffect(()=>{c(!0)},[]),Wat(v.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const u=be.createElement(be.Fragment,null,be.createElement(Vat,{id:r,value:i.draggable}),be.createElement(Gat,{id:a,announcement:s}));return n?Yr.createPortal(u,n):u}var Gr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Gr||(Gr={}));function qS(){}function e_(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Qat(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ha=Object.freeze({x:0,y:0});function vF(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jat(e,t){const n=GS(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function xF(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function elt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function KD(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function tlt(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function bW(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const nlt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=bW(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=vF(bW(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(xF)},yW=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=KD(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=KD(l),u=i.reduce((h,g,y)=>h+vF(c[y],g),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(xF)};function rlt(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const wue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=rlt(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(elt)};function ilt(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const olt=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:s}=o,a=n.get(s);if(a&&ilt(r,a)){const c=KD(a).reduce((f,h)=>f+vF(r,h),0),u=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:u}})}}return i.sort(xF)};function slt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Cue(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ha}function alt(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const llt=alt(1);function Tue(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function clt(e,t,n){const r=Tue(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const ult={ignoreTransform:!1};function vm(e,t){t===void 0&&(t=ult);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=ro(e).getComputedStyle(e);c&&(n=clt(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function vW(e){return vm(e,{ignoreTransform:!0})}function dlt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function flt(e,t){return t===void 0&&(t=ro(e).getComputedStyle(e)),t.position==="fixed"}function plt(e,t){t===void 0&&(t=ro(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function EF(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(yF(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Oy(i)||xue(i)||n.includes(i))return n;const o=ro(e).getComputedStyle(i);return i!==e&&plt(i,o)&&n.push(i),flt(i,o)?n:r(i.parentNode)}return e?r(e):n}function kue(e){const[t]=EF(e,1);return t??null}function t_(e){return!tT||!e?null:bm(e)?e:bF(e)?yF(e)||e===ym(e).scrollingElement?window:Oy(e)?e:null:null}function Aue(e){return bm(e)?e.scrollX:e.scrollLeft}function Nue(e){return bm(e)?e.scrollY:e.scrollTop}function XD(e){return{x:Aue(e),y:Nue(e)}}var ii;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ii||(ii={}));function _ue(e){return!tT||!e?!1:e===document.scrollingElement}function Rue(e){const t={x:0,y:0},n=_ue(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const hlt={x:.2,y:.2};function mlt(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=hlt);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=Rue(e),g={x:0,y:0},y={x:0,y:0},E={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+E.height?(g.y=ii.Backward,y.y=r*Math.abs((t.top+E.height-o)/E.height)):!u&&l>=t.bottom-E.height&&(g.y=ii.Forward,y.y=r*Math.abs((t.bottom-E.height-l)/E.height)),!h&&a>=t.right-E.width?(g.x=ii.Forward,y.x=r*Math.abs((t.right-E.width-a)/E.width)):!f&&s<=t.left+E.width&&(g.x=ii.Backward,y.x=r*Math.abs((t.left+E.width-s)/E.width)),{direction:g,speed:y}}function glt(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Due(e){return e.reduce((t,n)=>ih(t,XD(n)),ha)}function blt(e){return e.reduce((t,n)=>t+Aue(n),0)}function ylt(e){return e.reduce((t,n)=>t+Nue(n),0)}function Iue(e,t){if(t===void 0&&(t=vm),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);kue(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const vlt=[["x",["left","right"],blt],["y",["top","bottom"],ylt]];class SF{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=EF(n),i=Due(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of vlt)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Sb{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function xlt(e){const{EventTarget:t}=ro(e);return e instanceof t?e:ym(e)}function n_(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var gs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(gs||(gs={}));function xW(e){e.preventDefault()}function Elt(e){e.stopPropagation()}var Cn;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Cn||(Cn={}));const Oue={start:[Cn.Space,Cn.Enter],cancel:[Cn.Esc],end:[Cn.Space,Cn.Enter,Cn.Tab]},Slt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Cn.Right:return{...n,x:n.x+25};case Cn.Left:return{...n,x:n.x-25};case Cn.Down:return{...n,y:n.y+25};case Cn.Up:return{...n,y:n.y-25}}};class wF{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Sb(ym(n)),this.windowListeners=new Sb(ro(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(gs.Resize,this.handleCancel),this.windowListeners.add(gs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(gs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Iue(r),n(ha)}handleKeyDown(t){if(rT(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Oue,coordinateGetter:s=Slt,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:ha;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const h=VS(f,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const E of y){const S=t.code,{isTop:w,isRight:T,isLeft:A,isBottom:R,maxScroll:_,minScroll:D}=Rue(E),I=glt(E),M={x:Math.min(S===Cn.Right?I.right-I.width/2:I.right,Math.max(S===Cn.Right?I.left:I.left+I.width/2,f.x)),y:Math.min(S===Cn.Down?I.bottom-I.height/2:I.bottom,Math.max(S===Cn.Down?I.top:I.top+I.height/2,f.y))},H=S===Cn.Right&&!T||S===Cn.Left&&!A,F=S===Cn.Down&&!R||S===Cn.Up&&!w;if(H&&M.x!==f.x){const B=E.scrollLeft+h.x,z=S===Cn.Right&&B<=_.x||S===Cn.Left&&B>=D.x;if(z&&!h.y){E.scrollTo({left:B,behavior:a});return}z?g.x=E.scrollLeft-B:g.x=S===Cn.Right?E.scrollLeft-_.x:E.scrollLeft-D.x,g.x&&E.scrollBy({left:-g.x,behavior:a});break}else if(F&&M.y!==f.y){const B=E.scrollTop+h.y,z=S===Cn.Down&&B<=_.y||S===Cn.Up&&B>=D.y;if(z&&!h.x){E.scrollTo({top:B,behavior:a});return}z?g.y=E.scrollTop-B:g.y=S===Cn.Down?E.scrollTop-_.y:E.scrollTop-D.y,g.y&&E.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,ih(VS(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}wF.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Oue,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function EW(e){return!!(e&&"distance"in e)}function SW(e){return!!(e&&"delay"in e)}class CF{constructor(t,n,r){var i;r===void 0&&(r=xlt(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=ym(s),this.documentListeners=new Sb(this.document),this.listeners=new Sb(r),this.windowListeners=new Sb(ro(s)),this.initialCoordinates=(i=GS(o))!=null?i:ha,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(gs.Resize,this.handleCancel),this.windowListeners.add(gs.DragStart,xW),this.windowListeners.add(gs.VisibilityChange,this.handleCancel),this.windowListeners.add(gs.ContextMenu,xW),this.documentListeners.add(gs.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(SW(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(EW(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(gs.Click,Elt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(gs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=GS(t))!=null?n:ha,c=VS(i,l);if(!r&&a){if(EW(a)){if(a.tolerance!=null&&n_(c,a.tolerance))return this.handleCancel();if(n_(c,a.distance))return this.handleStart()}if(SW(a)&&n_(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Cn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const wlt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Mue extends CF{constructor(t){const{event:n}=t,r=ym(n.target);super(t,wlt,r)}}Mue.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Clt={move:{name:"mousemove"},end:{name:"mouseup"}};var ZD;(function(e){e[e.RightClick=2]="RightClick"})(ZD||(ZD={}));class Lue extends CF{constructor(t){super(t,Clt,ym(t.event.target))}}Lue.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ZD.RightClick?!1:(r?.({event:n}),!0)}}];const r_={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Pue extends CF{constructor(t){super(t,r_)}static setup(){return window.addEventListener(r_.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(r_.move.name,t)};function t(){}}}Pue.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var wb;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(wb||(wb={}));var WS;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(WS||(WS={}));function Tlt(e){let{acceleration:t,activator:n=wb.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=WS.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=e;const g=Alt({delta:f,disabled:!o}),[y,E]=jat(),S=v.useRef({x:0,y:0}),w=v.useRef({x:0,y:0}),T=v.useMemo(()=>{switch(n){case wb.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case wb.DraggableRect:return i}},[n,i,l]),A=v.useRef(null),R=v.useCallback(()=>{const D=A.current;if(!D)return;const I=S.current.x*w.current.x,M=S.current.y*w.current.y;D.scrollBy(I,M)},[]),_=v.useMemo(()=>a===WS.TreeOrder?[...c].reverse():c,[a,c]);v.useEffect(()=>{if(!o||!c.length||!T){E();return}for(const D of _){if(r?.(D)===!1)continue;const I=c.indexOf(D),M=u[I];if(!M)continue;const{direction:H,speed:F}=mlt(D,M,T,t,h);for(const B of["x","y"])g[B][H[B]]||(F[B]=0,H[B]=0);if(F.x>0||F.y>0){E(),A.current=D,y(R,s),S.current=F,w.current=H;return}}S.current={x:0,y:0},w.current={x:0,y:0},E()},[t,R,r,E,o,s,JSON.stringify(T),JSON.stringify(g),y,c,_,u,JSON.stringify(h)])}const klt={x:{[ii.Backward]:!1,[ii.Forward]:!1},y:{[ii.Backward]:!1,[ii.Forward]:!1}};function Alt(e){let{delta:t,disabled:n}=e;const r=zS(t);return My(i=>{if(n||!r||!i)return klt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ii.Backward]:i.x[ii.Backward]||o.x===-1,[ii.Forward]:i.x[ii.Forward]||o.x===1},y:{[ii.Backward]:i.y[ii.Backward]||o.y===-1,[ii.Forward]:i.y[ii.Forward]||o.y===1}}},[n,t,r])}function Nlt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return My(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function _lt(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var N0;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(N0||(N0={}));var QD;(function(e){e.Optimized="optimized"})(QD||(QD={}));const wW=new Map;function Rlt(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=v.useState(null),{frequency:a,measure:l,strategy:c}=i,u=v.useRef(e),f=S(),h=A0(f),g=v.useCallback(function(w){w===void 0&&(w=[]),!h.current&&s(T=>T===null?w:T.concat(w.filter(A=>!T.includes(A))))},[h]),y=v.useRef(null),E=My(w=>{if(f&&!n)return wW;if(!w||w===wW||u.current!==e||o!=null){const T=new Map;for(let A of e){if(!A)continue;if(o&&o.length>0&&!o.includes(A.id)&&A.rect.current){T.set(A.id,A.rect.current);continue}const R=A.node.current,_=R?new SF(l(R),R):null;A.rect.current=_,_&&T.set(A.id,_)}return T}return w},[e,o,n,f,l]);return v.useEffect(()=>{u.current=e},[e]),v.useEffect(()=>{f||g()},[n,f]),v.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),v.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,f,g,...r]),{droppableRects:E,measureDroppableContainers:g,measuringScheduled:o!=null};function S(){switch(c){case N0.Always:return!1;case N0.BeforeDragging:return n;default:return!n}}}function TF(e,t){return My(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Dlt(e,t){return TF(e,t)}function Ilt(e){let{callback:t,disabled:n}=e;const r=nT(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>i?.disconnect(),[i]),i}function iT(e){let{callback:t,disabled:n}=e;const r=nT(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>i?.disconnect(),[i]),i}function Olt(e){return new SF(vm(e),e)}function CW(e,t,n){t===void 0&&(t=Olt);const[r,i]=v.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=Ilt({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=iT({callback:o});return pa(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function Mlt(e){const t=TF(e);return Cue(e,t)}const TW=[];function Llt(e){const t=v.useRef(e),n=My(r=>e?r&&r!==TW&&e&&t.current&&e.parentNode===t.current.parentNode?r:EF(e):TW,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function Plt(e){const[t,n]=v.useState(null),r=v.useRef(e),i=v.useCallback(o=>{const s=t_(o.target);s&&n(a=>a?(a.set(s,XD(s)),new Map(a)):null)},[]);return v.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=t_(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,XD(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=t_(l);c?.removeEventListener("scroll",i)})}},[i,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>ih(o,s),ha):Due(e):ha,[e,t])}function kW(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==ha;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?VS(e,n.current):ha}function Flt(e){v.useEffect(()=>{if(!tT)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Blt(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function Fue(e){return v.useMemo(()=>e?dlt(e):null,[e])}const AW=[];function jlt(e,t){t===void 0&&(t=vm);const[n]=e,r=Fue(n?ro(n):null),[i,o]=v.useState(AW);function s(){o(()=>e.length?e.map(l=>_ue(l)?r:new SF(t(l),l)):AW)}const a=iT({callback:s});return pa(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function Bue(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Oy(t)?t:e}function $lt(e){let{measure:t}=e;const[n,r]=v.useState(null),i=v.useCallback(c=>{for(const{target:u}of c)if(Oy(u)){r(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=iT({callback:i}),s=v.useCallback(c=>{const u=Bue(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=HS(s);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Ult=[{sensor:Mue,options:{}},{sensor:wF,options:{}}],Hlt={current:{}},Mx={draggable:{measure:vW},droppable:{measure:vW,strategy:N0.WhileDragging,frequency:QD.Optimized},dragOverlay:{measure:vm}};class Cb extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const zlt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Cb,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:qS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mx,measureDroppableContainers:qS,windowRect:null,measuringScheduled:!1},jue={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:qS,draggableNodes:new Map,over:null,measureDroppableContainers:qS},Py=v.createContext(jue),$ue=v.createContext(zlt);function Vlt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Cb}}}function Glt(e,t){switch(t.type){case Gr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Gr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Gr.DragEnd:case Gr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Gr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Cb(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Gr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Cb(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Gr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Cb(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function qlt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=v.useContext(Py),o=zS(r),s=zS(n?.id);return v.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!rT(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=Hat(u);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function Uue(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function Wlt(e){return v.useMemo(()=>({draggable:{...Mx.draggable,...e?.draggable},droppable:{...Mx.droppable,...e?.droppable},dragOverlay:{...Mx.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ylt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=v.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;pa(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=Cue(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=kue(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const oT=v.createContext({...ha,scaleX:1,scaleY:1});var Uc;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Uc||(Uc={}));const Klt=v.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Ult,collisionDetection:f=wue,measuring:h,modifiers:g,...y}=t;const E=v.useReducer(Glt,void 0,Vlt),[S,w]=E,[T,A]=Yat(),[R,_]=v.useState(Uc.Uninitialized),D=R===Uc.Initialized,{draggable:{active:I,nodes:M,translate:H},droppable:{containers:F}}=S,B=I!=null?M.get(I):null,z=v.useRef({initial:null,translated:null}),X=v.useMemo(()=>{var Nt;return I!=null?{id:I,data:(Nt=B?.data)!=null?Nt:Hlt,rect:z}:null},[I,B]),U=v.useRef(null),[K,G]=v.useState(null),[Q,J]=v.useState(null),re=A0(y,Object.values(y)),j=Ly("DndDescribedBy",s),Z=v.useMemo(()=>F.getEnabled(),[F]),V=Wlt(h),{droppableRects:P,measureDroppableContainers:se,measuringScheduled:ae}=Rlt(Z,{dragging:D,dependencies:[H.x,H.y],config:V.droppable}),W=Nlt(M,I),ie=v.useMemo(()=>Q?GS(Q):null,[Q]),te=bt(),fe=Dlt(W,V.draggable.measure);Ylt({activeNode:I!=null?M.get(I):null,config:te.layoutShiftCompensation,initialRect:fe,measure:V.draggable.measure});const Ce=CW(W,V.draggable.measure,fe),Oe=CW(W?W.parentElement:null),ve=v.useRef({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:M,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),tt=F.getNodeFor((n=ve.current.over)==null?void 0:n.id),nt=$lt({measure:V.dragOverlay.measure}),Fe=(r=nt.nodeRef.current)!=null?r:W,wt=D?(i=nt.rect)!=null?i:Ce:null,Ge=!!(nt.nodeRef.current&&nt.rect),Ct=Mlt(Ge?null:Ce),Ot=Fue(Fe?ro(Fe):null),it=Llt(D?tt??W:null),le=jlt(it),he=Uue(g,{transform:{x:H.x-Ct.x,y:H.y-Ct.y,scaleX:1,scaleY:1},activatorEvent:Q,active:X,activeNodeRect:Ce,containerNodeRect:Oe,draggingNodeRect:wt,over:ve.current.over,overlayNodeRect:nt.rect,scrollableAncestors:it,scrollableAncestorRects:le,windowRect:Ot}),ge=ie?ih(ie,H):null,Ae=Plt(it),Le=kW(Ae),O=kW(Ae,[Ce]),$=ih(he,Le),ne=wt?llt(wt,he):null,de=X&&ne?f({active:X,collisionRect:ne,droppableRects:P,droppableContainers:Z,pointerCoordinates:ge}):null,Te=tlt(de,"id"),[ke,Be]=v.useState(null),$e=Ge?he:ih(he,O),He=slt($e,(o=ke?.rect)!=null?o:null,Ce),Ke=v.useRef(null),xe=v.useCallback((Nt,_t)=>{let{sensor:Ze,options:Tt}=_t;if(U.current==null)return;const rt=M.get(U.current);if(!rt)return;const Rt=Nt.nativeEvent,Xt=new Ze({active:U.current,activeNode:rt,event:Rt,options:Tt,context:ve,onAbort(Mt){if(!M.get(Mt))return;const{onDragAbort:nn}=re.current,An={id:Mt};nn?.(An),T({type:"onDragAbort",event:An})},onPending(Mt,pn,nn,An){if(!M.get(Mt))return;const{onDragPending:or}=re.current,kr={id:Mt,constraint:pn,initialCoordinates:nn,offset:An};or?.(kr),T({type:"onDragPending",event:kr})},onStart(Mt){const pn=U.current;if(pn==null)return;const nn=M.get(pn);if(!nn)return;const{onDragStart:An}=re.current,Ai={activatorEvent:Rt,active:{id:pn,data:nn.data,rect:z}};Yr.unstable_batchedUpdates(()=>{An?.(Ai),_(Uc.Initializing),w({type:Gr.DragStart,initialCoordinates:Mt,active:pn}),T({type:"onDragStart",event:Ai}),G(Ke.current),J(Rt)})},onMove(Mt){w({type:Gr.DragMove,coordinates:Mt})},onEnd:It(Gr.DragEnd),onCancel:It(Gr.DragCancel)});Ke.current=Xt;function It(Mt){return async function(){const{active:nn,collisions:An,over:Ai,scrollAdjustedTranslate:or}=ve.current;let kr=null;if(nn&&or){const{cancelDrop:Jo}=re.current;kr={activatorEvent:Rt,active:nn,collisions:An,delta:or,over:Ai},Mt===Gr.DragEnd&&typeof Jo=="function"&&await Promise.resolve(Jo(kr))&&(Mt=Gr.DragCancel)}U.current=null,Yr.unstable_batchedUpdates(()=>{w({type:Mt}),_(Uc.Uninitialized),Be(null),G(null),J(null),Ke.current=null;const Jo=Mt===Gr.DragEnd?"onDragEnd":"onDragCancel";if(kr){const Zr=re.current[Jo];Zr?.(kr),T({type:Jo,event:kr})}})}}},[M]),Ue=v.useCallback((Nt,_t)=>(Ze,Tt)=>{const rt=Ze.nativeEvent,Rt=M.get(Tt);if(U.current!==null||!Rt||rt.dndKit||rt.defaultPrevented)return;const Xt={active:Rt};Nt(Ze,_t.options,Xt)===!0&&(rt.dndKit={capturedBy:_t.sensor},U.current=Tt,xe(Ze,_t))},[M,xe]),Xe=_lt(u,Ue);Flt(u),pa(()=>{Ce&&R===Uc.Initializing&&_(Uc.Initialized)},[Ce,R]),v.useEffect(()=>{const{onDragMove:Nt}=re.current,{active:_t,activatorEvent:Ze,collisions:Tt,over:rt}=ve.current;if(!_t||!Ze)return;const Rt={active:_t,activatorEvent:Ze,collisions:Tt,delta:{x:$.x,y:$.y},over:rt};Yr.unstable_batchedUpdates(()=>{Nt?.(Rt),T({type:"onDragMove",event:Rt})})},[$.x,$.y]),v.useEffect(()=>{const{active:Nt,activatorEvent:_t,collisions:Ze,droppableContainers:Tt,scrollAdjustedTranslate:rt}=ve.current;if(!Nt||U.current==null||!_t||!rt)return;const{onDragOver:Rt}=re.current,Xt=Tt.get(Te),It=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,Mt={active:Nt,activatorEvent:_t,collisions:Ze,delta:{x:rt.x,y:rt.y},over:It};Yr.unstable_batchedUpdates(()=>{Be(It),Rt?.(Mt),T({type:"onDragOver",event:Mt})})},[Te]),pa(()=>{ve.current={activatorEvent:Q,active:X,activeNode:W,collisionRect:ne,collisions:de,droppableRects:P,draggableNodes:M,draggingNode:Fe,draggingNodeRect:wt,droppableContainers:F,over:ke,scrollableAncestors:it,scrollAdjustedTranslate:$},z.current={initial:wt,translated:ne}},[X,W,de,ne,M,Fe,wt,P,F,ke,it,$]),Tlt({...te,delta:H,draggingRect:ne,pointerCoordinates:ge,scrollableAncestors:it,scrollableAncestorRects:le});const et=v.useMemo(()=>({active:X,activeNode:W,activeNodeRect:Ce,activatorEvent:Q,collisions:de,containerNodeRect:Oe,dragOverlay:nt,draggableNodes:M,droppableContainers:F,droppableRects:P,over:ke,measureDroppableContainers:se,scrollableAncestors:it,scrollableAncestorRects:le,measuringConfiguration:V,measuringScheduled:ae,windowRect:Ot}),[X,W,Ce,Q,de,Oe,nt,M,F,P,ke,se,it,le,V,ae,Ot]),Bt=v.useMemo(()=>({activatorEvent:Q,activators:Xe,active:X,activeNodeRect:Ce,ariaDescribedById:{draggable:j},dispatch:w,draggableNodes:M,over:ke,measureDroppableContainers:se}),[Q,Xe,X,Ce,w,j,M,ke,se]);return be.createElement(Sue.Provider,{value:A},be.createElement(Py.Provider,{value:Bt},be.createElement($ue.Provider,{value:et},be.createElement(oT.Provider,{value:He},c)),be.createElement(qlt,{disabled:a?.restoreFocus===!1})),be.createElement(Zat,{...a,hiddenTextDescribedById:j}));function bt(){const Nt=K?.autoScrollEnabled===!1,_t=typeof l=="object"?l.enabled===!1:l===!1,Ze=D&&!Nt&&!_t;return typeof l=="object"?{...l,enabled:Ze}:{enabled:Ze}}}),Xlt=v.createContext(null),NW="button",Zlt="Draggable";function Qlt(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Ly(Zlt),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=v.useContext(Py),{role:g=NW,roleDescription:y="draggable",tabIndex:E=0}=i??{},S=l?.id===t,w=v.useContext(S?oT:Xlt),[T,A]=HS(),[R,_]=HS(),D=Blt(s,t),I=A0(n);pa(()=>(f.set(t,{id:t,key:o,node:T,activatorNode:R,data:I}),()=>{const H=f.get(t);H&&H.key===o&&f.delete(t)}),[f,t]);const M=v.useMemo(()=>({role:g,tabIndex:E,"aria-disabled":r,"aria-pressed":S&&g===NW?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,E,S,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:M,isDragging:S,listeners:r?void 0:D,node:T,over:h,setNodeRef:A,setActivatorNodeRef:_,transform:w}}function Hue(){return v.useContext($ue)}const Jlt="Droppable",ect={timeout:25};function zue(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Ly(Jlt),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=v.useContext(Py),u=v.useRef({disabled:n}),f=v.useRef(!1),h=v.useRef(null),g=v.useRef(null),{disabled:y,updateMeasurementsFor:E,timeout:S}={...ect,...i},w=A0(E??r),T=v.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(w.current)?w.current:[w.current]),g.current=null},S)},[S]),A=iT({callback:T,disabled:y||!s}),R=v.useCallback((M,H)=>{A&&(H&&(A.unobserve(H),f.current=!1),M&&A.observe(M))},[A]),[_,D]=HS(R),I=A0(t);return v.useEffect(()=>{!A||!_.current||(A.disconnect(),f.current=!1,A.observe(_.current))},[_,A]),v.useEffect(()=>(a({type:Gr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:_,rect:h,data:I}}),()=>a({type:Gr.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==u.current.disabled&&(a({type:Gr.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:_,over:l,setNodeRef:D}}function tct(e){let{animation:t,children:n}=e;const[r,i]=v.useState(null),[o,s]=v.useState(null),a=zS(n);return!n&&!r&&a&&i(a),pa(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){i(null);return}Promise.resolve(t(c,o)).then(()=>{i(null)})},[t,r,o]),be.createElement(be.Fragment,null,n,r?v.cloneElement(r,{ref:s}):null)}const nct={x:0,y:0,scaleX:1,scaleY:1};function rct(e){let{children:t}=e;return be.createElement(Py.Provider,{value:jue},be.createElement(oT.Provider,{value:nct},t))}const ict={position:"fixed",touchAction:"none"},oct=e=>rT(e)?"transform 250ms ease":void 0,sct=v.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:c,transition:u=oct}=e;if(!a)return null;const f=i?c:{...c,scaleX:1,scaleY:1},h={...ict,width:a.width,height:a.height,top:a.top,left:a.left,transform:Nu.Transform.toString(f),transformOrigin:i&&r?Jat(r,a):void 0,transition:typeof u=="function"?u(r):u,...l};return be.createElement(n,{className:s,style:h,ref:t},o)}),act=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:s}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[l,c]of Object.entries(i))n.node.style.setProperty(l,c);s!=null&&s.active&&n.node.classList.remove(s.active)}},lct=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Nu.Transform.toString(t)},{transform:Nu.Transform.toString(n)}]},cct={duration:250,easing:"ease",keyframes:lct,sideEffects:act({styles:{active:{opacity:"0"}}})};function uct(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return nT((o,s)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=Bue(s);if(!c)return;const{transform:u}=ro(s).getComputedStyle(s),f=Tue(u);if(!f)return;const h=typeof t=="function"?t:dct(t);return Iue(l,i.draggable.measure),h({active:{id:o,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:s,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function dct(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...cct,...e};return o=>{let{active:s,dragOverlay:a,transform:l,...c}=o;if(!t)return;const u={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},f={scaleX:l.scaleX!==1?s.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?s.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-u.x,y:l.y-u.y,...f},g=i({...c,active:s,dragOverlay:a,transform:{initial:l,final:h}}),[y]=g,E=g[g.length-1];if(JSON.stringify(y)===JSON.stringify(E))return;const S=r?.({active:s,dragOverlay:a,...c}),w=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(T=>{w.onfinish=()=>{S?.(),T()}})}}let _W=0;function fct(e){return v.useMemo(()=>{if(e!=null)return _W++,_W},[e])}const pct=be.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:s,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:g,draggableNodes:y,droppableContainers:E,dragOverlay:S,over:w,measuringConfiguration:T,scrollableAncestors:A,scrollableAncestorRects:R,windowRect:_}=Hue(),D=v.useContext(oT),I=fct(f?.id),M=Uue(s,{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:g,draggingNodeRect:S.rect,over:w,overlayNodeRect:S.rect,scrollableAncestors:A,scrollableAncestorRects:R,transform:D,windowRect:_}),H=TF(h),F=uct({config:r,draggableNodes:y,droppableContainers:E,measuringConfiguration:T}),B=H?S.setRef:void 0;return be.createElement(rct,null,be.createElement(tct,{animation:F},f&&I?be.createElement(sct,{key:I,id:f.id,ref:B,as:a,activatorEvent:u,adjustScale:t,className:l,transition:o,rect:H,style:{zIndex:c,...i},transform:M},n):null))});function YS(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function hct(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function Zv(e){return e!==null&&e>=0}function mct(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function gct(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Vue=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=YS(t,r,n),s=t[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},Gue="Sortable",que=be.createContext({activeIndex:-1,containerId:Gue,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Vue,disabled:{draggable:!1,droppable:!1}});function bct(e){let{children:t,id:n,items:r,strategy:i=Vue,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Hue(),f=Ly(Gue,n),h=a.rect!==null,g=v.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),y=s!=null,E=s?g.indexOf(s.id):-1,S=c?g.indexOf(c.id):-1,w=v.useRef(g),T=!mct(g,w.current),A=S!==-1&&E===-1||T,R=gct(o);pa(()=>{T&&y&&u(g)},[T,g,y,u]),v.useEffect(()=>{w.current=g},[g]);const _=v.useMemo(()=>({activeIndex:E,containerId:f,disabled:R,disableTransforms:A,items:g,overIndex:S,useDragOverlay:h,sortedRects:hct(g,l),strategy:i}),[E,f,R.draggable,R.droppable,A,g,S,l,h,i]);return be.createElement(que.Provider,{value:_},t)}const yct=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return YS(n,r,i).indexOf(t)},vct=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},xct={duration:200,easing:"ease"},Wue="transform",Ect=Nu.Transition.toString({property:Wue,duration:0,easing:"linear"}),Sct={roleDescription:"sortable"};function wct(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=v.useState(null),a=v.useRef(n);return pa(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=vm(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),v.useEffect(()=>{o&&s(null)},[o]),o}function Cct(e){let{animateLayoutChanges:t=vct,attributes:n,disabled:r,data:i,getNewIndex:o=yct,id:s,strategy:a,resizeObserverConfig:l,transition:c=xct}=e;const{items:u,containerId:f,activeIndex:h,disabled:g,disableTransforms:y,sortedRects:E,overIndex:S,useDragOverlay:w,strategy:T}=v.useContext(que),A=Tct(r,g),R=u.indexOf(s),_=v.useMemo(()=>({sortable:{containerId:f,index:R,items:u},...i}),[f,i,R,u]),D=v.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:I,node:M,isOver:H,setNodeRef:F}=zue({id:s,data:_,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...l}}),{active:B,activatorEvent:z,activeNodeRect:X,attributes:U,setNodeRef:K,listeners:G,isDragging:Q,over:J,setActivatorNodeRef:re,transform:j}=Qlt({id:s,data:_,attributes:{...Sct,...n},disabled:A.draggable}),Z=Bat(F,K),V=!!B,P=V&&!y&&Zv(h)&&Zv(S),se=!w&&Q,ae=se&&P?j:null,ie=P?ae??(a??T)({rects:E,activeNodeRect:X,activeIndex:h,overIndex:S,index:R}):null,te=Zv(h)&&Zv(S)?o({id:s,items:u,activeIndex:h,overIndex:S}):R,fe=B?.id,Ce=v.useRef({activeId:fe,items:u,newIndex:te,containerId:f}),Oe=u!==Ce.current.items,ve=t({active:B,containerId:f,isDragging:Q,isSorting:V,id:s,index:R,items:u,newIndex:Ce.current.newIndex,previousItems:Ce.current.items,previousContainerId:Ce.current.containerId,transition:c,wasDragging:Ce.current.activeId!=null}),tt=wct({disabled:!ve,index:R,node:M,rect:I});return v.useEffect(()=>{V&&Ce.current.newIndex!==te&&(Ce.current.newIndex=te),f!==Ce.current.containerId&&(Ce.current.containerId=f),u!==Ce.current.items&&(Ce.current.items=u)},[V,te,f,u]),v.useEffect(()=>{if(fe===Ce.current.activeId)return;if(fe!=null&&Ce.current.activeId==null){Ce.current.activeId=fe;return}const Fe=setTimeout(()=>{Ce.current.activeId=fe},50);return()=>clearTimeout(Fe)},[fe]),{active:B,activeIndex:h,attributes:U,data:_,rect:I,index:R,newIndex:te,items:u,isOver:H,isSorting:V,isDragging:Q,listeners:G,node:M,overIndex:S,over:J,setNodeRef:Z,setActivatorNodeRef:re,setDroppableNodeRef:F,setDraggableNodeRef:K,transform:tt??ie,transition:nt()};function nt(){if(tt||Oe&&Ce.current.newIndex===R)return Ect;if(!(se&&!rT(z)||!c)&&(V||ve))return Nu.Transition.toString({...c,property:Wue})}}function Tct(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}Cn.Down,Cn.Right,Cn.Up,Cn.Left;const kct={},RW=e=>{let t;const n=new Set,r=(u,f)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(y=>y(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(kct?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,i,l);return l},Act=e=>e?RW(e):RW,Yue={},{useDebugValue:Nct}=be,{useSyncExternalStoreWithSelector:_ct}=cYe;let DW=!1;const Rct=e=>e;function Dct(e,t=Rct,n){(Yue?"production":void 0)!=="production"&&n&&!DW&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),DW=!0);const r=_ct(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Nct(r),r}const IW=e=>{(Yue?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Act(e):e,n=(r,i)=>Dct(t,r,i);return Object.assign(n,t),n},Ict=e=>e?IW(e):IW;var OW,MW;const LW=typeof window<"u"&&((OW=window.document)!=null&&OW.createElement||((MW=window.navigator)==null?void 0:MW.product)==="ReactNative")?be.useLayoutEffect:be.useEffect;function Oct(){const e=Ict(t=>({current:new Array,version:0,set:t}));return{In:({children:t})=>{const n=e(i=>i.set),r=e(i=>i.version);return LW(()=>{n(i=>({version:i.version+1}))},[]),LW(()=>(n(({current:i})=>({current:[...i,t]})),()=>n(({current:i})=>({current:i.filter(o=>o!==t)}))),[t,r]),null},Out:()=>{const t=e(n=>n.current);return be.createElement(be.Fragment,null,t)}}}const i_=768;function sT(){const[e,t]=v.useState(void 0);return v.useEffect(()=>{const n=window.matchMedia(`(max-width: ${i_-1}px)`),r=()=>{t(window.innerWidth<i_)};return n.addEventListener("change",r),t(window.innerWidth<i_),()=>n.removeEventListener("change",r)},[]),!!e}const Kue=Oct(),kF=v.createContext({columns:[],data:[],activeCardId:null}),Mct=({id:e,children:t,className:n})=>{const{isOver:r,setNodeRef:i}=zue({id:e});return m.jsx("div",{className:Re("flex min-h-40 flex-col divide-y overflow-hidden rounded-md border bg-secondary text-xs shadow-sm ring-2 transition-all shrink-0",r?"ring-primary":"ring-transparent",n),ref:i,children:t})},Lct=({id:e,name:t,children:n,className:r})=>{const{attributes:i,listeners:o,setNodeRef:s,transition:a,transform:l,isDragging:c}=Cct({id:e}),{activeCardId:u}=v.useContext(kF),f={transition:a,transform:Nu.Transform.toString(l)};return m.jsxs(m.Fragment,{children:[m.jsx("div",{style:f,...o,...i,ref:s,children:m.jsx(Bd,{className:Re("cursor-grab gap-4 rounded-md p-3 shadow-sm",c&&"pointer-events-none cursor-grabbing opacity-30",r),children:n??m.jsx("p",{className:"m-0 font-medium text-sm",children:t})})}),u===e&&m.jsx(Kue.In,{children:m.jsx(Bd,{className:Re("cursor-grab gap-4 rounded-md p-3 shadow-sm ring-2 ring-primary",c&&"cursor-grabbing",r),children:n??m.jsx("p",{className:"m-0 font-medium text-sm",children:t})})})]})},Pct=({children:e,className:t,...n})=>{const{data:r}=v.useContext(kF),i=r.filter(s=>s.column===n.id),o=i.map(s=>s.id);return m.jsxs(Yi,{className:"overflow-hidden flex-1",children:[m.jsx(bct,{items:o,children:m.jsx("div",{className:Re("flex flex-grow flex-col gap-2 p-2",t),...n,children:i.map(e)})}),m.jsx(uw,{orientation:"vertical"})]})},Fct=({className:e,...t})=>m.jsx("div",{className:Re("m-0 p-2 font-semibold text-sm",e),...t}),Bct=e=>t=>{const{droppableRects:n,droppableContainers:r,pointerCoordinates:i}=t,o=y=>!e.includes(y),s=y=>e.includes(y),a=olt(t),l=a.filter(y=>o(y.id)),c=a.filter(y=>s(y.id));if(l.length>0){const E=yW(t).filter(S=>o(S.id));return E.length>0?[E[0]]:[l[0]]}if(c.length>0)return[c[0]];const u=wue(t),f=u.filter(y=>o(y.id)),h=u.filter(y=>s(y.id));if(f.length>0){const E=nlt(t).filter(S=>o(S.id));return E.length>0?[E[0]]:[f[0]]}if(h.length>0)return[h[0]];if(i){let y=null;for(const E of e){const S=n.get(E);if(!S)continue;const w=S.left+S.width/2,T=S.top+S.height/2,A=Math.sqrt(Math.pow(i.x-w,2)+Math.pow(i.y-T,2)),R={left:S.left-150,right:S.right+150,top:S.top-50,bottom:S.bottom+50};i.x>=R.left&&i.x<=R.right&&i.y>=R.top&&i.y<=R.bottom&&(!y||A<y.distance)&&(y={id:E,distance:A})}if(y)return[{id:y.id}]}const g=yW(t);if(g.length>0){const y=g.find(E=>s(E.id));return y?[y]:[g[0]]}return[]},jct=({children:e,onDragStart:t,onDragEnd:n,onDragOver:r,className:i,columns:o,data:s,onDataChange:a,...l})=>{const[c,u]=v.useState(null),f=sT(),h=v.useMemo(()=>o.map(A=>A.id),[o]),g=v.useMemo(()=>Bct(h),[h]),y=Qat(e_(Lue,{activationConstraint:{distance:8}}),e_(Pue,{activationConstraint:{delay:150,tolerance:8}}),e_(wF)),E=A=>{s.find(_=>_.id===A.active.id)&&u(A.active.id),t?.(A)},S=A=>{const{active:R,over:_}=A;if(!_)return;const D=s.find(B=>B.id===R.id),I=s.find(B=>B.id===_.id);if(!D)return;const M=D.column,F=o.some(B=>B.id===_.id)?_.id:I?.column||M;if(M!==F){let B=[...s];const z=B.findIndex(X=>X.id===R.id);if(B[z]={...B[z],column:F},I){const X=B.findIndex(U=>U.id===_.id);B=YS(B,z,X)}a?.(B)}r?.(A)},w=A=>{u(null),n?.(A);const{active:R,over:_}=A;if(!_||R.id===_.id)return;if(o.some(F=>F.id===_.id)){const F=s.find(B=>B.id===R.id);if(F&&F.column!==_.id){let B=[...s];const z=B.findIndex(X=>X.id===R.id);B[z]={...B[z],column:_.id},a?.(B)}return}let I=[...s];const M=I.findIndex(F=>F.id===R.id),H=I.findIndex(F=>F.id===_.id);M!==-1&&H!==-1&&(I=YS(I,M,H),a?.(I))},T={onDragStart({active:A}){const{name:R,column:_}=s.find(D=>D.id===A.id)??{};return`Picked up the card "${R}" from the "${_}" column`},onDragOver({active:A,over:R}){const{name:_}=s.find(I=>I.id===A.id)??{},D=o.find(I=>I.id===R?.id)?.name;return`Dragged the card "${_}" over the "${D}" column`},onDragEnd({active:A,over:R}){const{name:_}=s.find(I=>I.id===A.id)??{},D=o.find(I=>I.id===R?.id)?.name;return`Dropped the card "${_}" into the "${D}" column`},onDragCancel({active:A}){const{name:R}=s.find(_=>_.id===A.id)??{};return`Cancelled dragging the card "${R}"`}};return m.jsx(kF.Provider,{value:{columns:o,data:s,activeCardId:c},children:m.jsxs(Klt,{accessibility:{announcements:T},collisionDetection:g,onDragEnd:w,onDragOver:S,onDragStart:E,sensors:y,...l,children:[m.jsx("div",{className:Re("flex gap-4",f&&"flex-col",i),children:o.map(A=>e(A))}),typeof window<"u"&&Yr.createPortal(m.jsx(pct,{children:m.jsx(Kue.Out,{})}),document.body)]})})},PW={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold"};function qg(e){return PW[e]?PW[e]:e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function $ct({tasks:e,loading:t,onTasksUpdate:n}){const{config:r,updateConfig:i}=sf(),[o,s]=v.useState(new Set),[a,l]=v.useState(!1),c=sT(),u=r?.statuses||["todo","in-progress","in-review","done","blocked"],f=r?.statusColors||oO,h=v.useMemo(()=>u.filter(F=>o.has(F)).map(F=>({id:F,name:qg(F),color:f[F]||"gray"})),[u,o,f]),g={high:0,medium:1,low:2},y=v.useMemo(()=>[...e].sort((B,z)=>{const X=g[B.priority]??2,U=g[z.priority]??2;return X!==U?X-U:new Date(z.updatedAt).getTime()-new Date(B.updatedAt).getTime()}).map(B=>({id:B.id,name:B.title,column:B.status,task:B})),[e]),E=()=>{const B=window.location.hash.slice(1).match(/^\/kanban\/([^?]+)/);if(!B)return null;const z=B[1];return e.find(X=>X.id===z)||null},[S,w]=v.useState(E());v.useEffect(()=>{const F=()=>{w(E())};return w(E()),window.addEventListener("hashchange",F),()=>window.removeEventListener("hashchange",F)},[e]),v.useEffect(()=>{r?.visibleColumns?s(new Set(r.visibleColumns)):s(new Set(u))},[r?.visibleColumns,u.join(",")]);const T=async F=>{try{await i({visibleColumns:[...F]})}catch(B){console.error("Failed to save config:",B)}},A=F=>{s(B=>{const z=new Set(B);return z.has(F)?z.delete(F):z.add(F),T(z),z})},R=async F=>{const B=F.filter(X=>{const U=e.find(K=>K.id===X.id);return U&&U.status!==X.column}),z=e.map(X=>{const U=F.find(K=>K.id===X.id);return U&&U.column!==X.status?{...X,status:U.column}:X});n(z);for(const X of B)try{await ta.updateTask(X.id,{status:X.column}),jl.success("Status updated",{description:`#${X.id} moved to ${qg(X.column)}`})}catch(U){console.error("Failed to update task:",U),jl.error("Failed to update status",{description:U instanceof Error?U.message:"Unknown error"}),ta.getTasks().then(n).catch(console.error);break}};if(t)return m.jsx("div",{className:"flex items-center justify-center h-64",children:m.jsxs("div",{className:"text-center",children:[m.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary"}),m.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading tasks..."})]})});const _=F=>{window.location.hash=`/kanban/${F.id}`},D=()=>{window.location.hash="/"},I=F=>{n(e.map(B=>B.id===F.id?F:B))},M=F=>{window.location.hash=`/kanban/${F}`},H=async F=>{try{await ta.archiveTask(F),n(e.filter(B=>B.id!==F)),D()}catch(B){console.error("Failed to archive task:",B)}};return m.jsxs("div",{className:"flex flex-col h-full",children:[c?m.jsxs(hue,{open:a,onOpenChange:l,className:"shrink-0 bg-card rounded-lg mb-4 border border-border",children:[m.jsxs(mue,{className:"flex items-center justify-between w-full p-3",children:[m.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Show Columns (",o.size,"/",u.length,")"]}),a?m.jsx(eY,{className:"w-4 h-4 text-muted-foreground"}):m.jsx(uu,{className:"w-4 h-4 text-muted-foreground"})]}),m.jsx(gue,{children:m.jsx("div",{className:"flex flex-wrap gap-2 px-3 pb-3",children:u.map(F=>{const B=o.has(F),z=e.filter(X=>X.status===F).length;return m.jsxs("button",{type:"button",onClick:()=>A(F),className:Re("flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-colors text-xs",B?"bg-primary/10 text-primary dark:bg-primary/20":"bg-muted text-muted-foreground"),children:[B?m.jsx(g_,{className:"w-3.5 h-3.5"}):m.jsx(m_,{className:"w-3.5 h-3.5"}),m.jsxs("span",{className:"font-medium",children:[qg(F)," (",z,")"]})]},F)})})})]}):m.jsx("div",{className:"shrink-0 bg-card rounded-lg p-4 mb-4 border border-border",children:m.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[m.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Show Columns:"}),u.map(F=>{const B=o.has(F),z=e.filter(X=>X.status===F).length;return m.jsxs("button",{type:"button",onClick:()=>A(F),className:Re("flex items-center gap-2 px-3 py-1.5 rounded-lg transition-colors",B?"bg-primary/10 text-primary dark:bg-primary/20":"bg-muted text-muted-foreground"),children:[B?m.jsx(g_,{className:"w-4 h-4"}):m.jsx(m_,{className:"w-4 h-4"}),m.jsxs("span",{className:"text-sm font-medium",children:[qg(F)," (",z,")"]})]},F)})]})}),m.jsxs(Yi,{className:"flex-1",children:[o.size>0?m.jsx(jct,{columns:h,data:y,onDataChange:R,className:"min-h-full pb-4",children:F=>{const B=ASe(F.id,f),z=y.filter(X=>X.column===F.id).length;return m.jsxs(Mct,{id:F.id,className:Re("min-w-[320px] max-w-[380px]",c&&"min-w-0 max-w-none w-full",B.bg,B.border),children:[m.jsxs(Fct,{className:"flex items-center justify-between",children:[m.jsx("span",{className:"font-bold text-sm uppercase tracking-wide text-foreground",children:F.name}),m.jsx("span",{className:"text-xs rounded-full px-2 py-1 font-medium text-muted-foreground bg-background",children:z})]}),m.jsx(Pct,{id:F.id,children:X=>m.jsx(Uct,{item:X,statusColors:f,onClick:()=>_(X.task)},X.id)})]},F.id)}}):m.jsx("div",{className:"text-center py-12",children:m.jsx("p",{className:"text-lg text-muted-foreground",children:"No columns visible. Please select at least one column to display."})}),m.jsx(uw,{orientation:"horizontal"})]}),m.jsx(vue,{task:S,allTasks:e,onClose:D,onUpdate:I,onArchive:H,onNavigateToTask:M})]})}function Uct({item:e,statusColors:t,onClick:n}){const{task:r}=e,i=uh(r.status,t),o=r.acceptanceCriteria.filter(a=>a.completed).length,s=r.acceptanceCriteria.length;return m.jsx(Lct,{id:e.id,name:e.name,column:e.column,className:"w-full",children:m.jsxs("div",{onClick:n,onKeyDown:a=>a.key==="Enter"&&n(),role:"button",tabIndex:0,className:"cursor-pointer",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[m.jsxs("span",{className:"text-xs font-mono shrink-0 text-muted-foreground",children:["#",r.id]}),m.jsxs("div",{className:"flex items-center gap-1 flex-wrap justify-end",children:[m.jsx("span",{className:Re("text-xs px-1.5 py-0.5 rounded font-medium",i),children:qg(r.status)}),r.priority==="high"&&m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-destructive/10 text-destructive dark:bg-destructive/20",children:"HIGH"}),r.priority==="medium"&&m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",children:"MED"})]})]}),m.jsx("h3",{className:"font-medium text-sm mb-2 line-clamp-2 text-foreground",children:r.title}),s>0&&m.jsxs("div",{className:"flex items-center gap-2 text-xs mb-2 text-muted-foreground",children:[m.jsx(nY,{className:"w-3 h-3","aria-hidden":"true"}),m.jsxs("span",{children:[o,"/",s]})]}),r.labels.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:r.labels.map(a=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-secondary text-secondary-foreground",children:a},a))}),r.assignee&&m.jsxs("div",{className:"flex items-center gap-1.5 text-xs mt-2 text-muted-foreground",children:[m.jsx(k0,{name:r.assignee,size:"sm"}),m.jsx("span",{children:r.assignee})]})]})})}const FW=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],BW={low:"bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-400",medium:"bg-amber-100 dark:bg-amber-900 text-amber-700 dark:text-amber-300",high:"bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300"};function Hct({isOpen:e,allTasks:t,onClose:n,onCreated:r}){const{currentUser:i}=QX(),{config:o}=sf(),s=v.useRef(null),a=v.useRef(null),l=v.useMemo(()=>{const O=o.statuses||["todo","in-progress","in-review","done","blocked"];return rZ(O)},[o.statuses]),c=o.statusColors||{},[u,f]=v.useState(""),[h,g]=v.useState(""),[y,E]=v.useState("todo"),[S,w]=v.useState("medium"),[T,A]=v.useState(""),[R,_]=v.useState([]),[D,I]=v.useState(""),[M,H]=v.useState([]),[F,B]=v.useState(""),[z,X]=v.useState(""),[U,K]=v.useState(!1),[G,Q]=v.useState(null),[J,re]=v.useState(!1),[j,Z]=v.useState(""),[V,P]=v.useState(!1),[se,ae]=v.useState(""),[W,ie]=v.useState(!1),[te,fe]=v.useState(!1),{preferences:Ce,toggleTaskCreateLayout:Oe}=tZ(),ve=Ce.taskCreateLayout==="maximized",tt=v.useRef(null),nt={hidden:{opacity:0,y:20,scale:.98},visible:{opacity:1,y:0,scale:1,transition:{duration:.2,ease:"easeOut"}},exit:{opacity:0,y:10,scale:.98,transition:{duration:.15,ease:"easeIn"}}};v.useEffect(()=>{e||(f(""),g(""),E("todo"),w("medium"),A(""),_([]),I(""),H([]),B(""),X(""),Q(null),re(!1),Z(""),P(!1),ae(""),ie(!1),fe(!1))},[e]),v.useEffect(()=>{e&&setTimeout(()=>s.current?.focus(),100)},[e,ve]),v.useEffect(()=>{V&&tt.current&&tt.current.focus()},[V]);const Fe=v.useCallback(()=>{j.trim()&&(H(O=>[...O,{id:crypto.randomUUID(),text:j.trim()}]),Z(""),P(!1))},[j]),wt=v.useCallback(O=>{H($=>$.filter(ne=>ne.id!==O))},[]),Ge=v.useCallback(()=>{se.trim()&&(R.includes(se.trim())||_(O=>[...O,se.trim()]),ae(""),ie(!1))},[se,R]),Ct=v.useCallback(O=>{_($=>$.filter(ne=>ne!==O))},[]),Ot=async O=>{if(O.preventDefault(),Q(null),!u.trim()){Q("Title is required");return}K(!0);try{const $={title:u.trim(),description:h.trim()||void 0,status:y,priority:S,labels:R,assignee:T.trim()||void 0,parent:D||void 0,acceptanceCriteria:M.map(ne=>({text:ne.text,completed:!1})),implementationPlan:F.trim()||void 0,implementationNotes:z.trim()||void 0};await Xpe($),re(!0),jl.success("Task created successfully",{description:u.trim()}),setTimeout(()=>{r(),n()},800)}catch($){const ne=$ instanceof Error?$.message:"Failed to create task";Q(ne),jl.error("Failed to create task",{description:ne})}finally{K(!1)}},it=D?t.find(O=>O.id===D):null,le=m.jsxs("div",{className:"flex items-center justify-between gap-2 p-4 border-b bg-green-700",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"text-green-100 text-xs font-medium uppercase tracking-wide",children:"New Task"}),m.jsx("input",{ref:s,type:"text",value:u,onChange:O=>f(O.target.value),placeholder:"Enter task title...",className:"w-full text-lg font-semibold bg-white/20 text-white placeholder-white/60 border-0 rounded px-2 py-1 mt-1 focus:outline-none focus:ring-2 focus:ring-white/50",disabled:U})]}),m.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[m.jsx(Qe,{variant:"ghost",size:"icon",onClick:Oe,className:"h-8 w-8 text-foreground hover:text-foreground",title:ve?"Minimize":"Maximize",children:ve?m.jsx(lY,{className:"w-4 h-4"}):m.jsx(aY,{className:"w-4 h-4"})}),m.jsx(Qe,{variant:"ghost",size:"icon",onClick:n,className:"h-8 w-8 text-foreground hover:text-foreground",title:"Close",children:m.jsx(Ho,{className:"w-4 h-4"})})]})]}),he=(J||G)&&m.jsxs("div",{className:"px-4 pt-4",children:[J&&m.jsx("div",{className:"bg-green-50 dark:bg-green-900/50 border border-green-200 dark:border-green-700 text-green-700 dark:text-green-300 px-4 py-2 rounded-lg text-sm",children:"Task created successfully!"}),G&&m.jsx("div",{className:"bg-red-50 dark:bg-red-900/50 border border-red-200 dark:border-red-700 text-red-700 dark:text-red-300 px-4 py-2 rounded-lg text-sm",children:G})]}),ge=m.jsxs("div",{className:"p-6 space-y-6",children:[m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(uY,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Description"})]}),m.jsx(au,{markdown:h,onChange:g,placeholder:"Add a more detailed description...",readOnly:U})]}),m.jsxs("section",{children:[m.jsx("div",{className:"flex items-center justify-between mb-3",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(of,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Acceptance Criteria"}),M.length>0&&m.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",M.length,")"]})]})}),m.jsx("div",{className:"space-y-2",children:M.map(O=>m.jsxs("div",{className:"flex items-start gap-2 bg-muted/50 rounded-lg px-3 py-2 group hover:shadow-sm transition-shadow",children:[m.jsx("input",{type:"checkbox",checked:!1,disabled:!0,className:"mt-1 w-4 h-4 rounded cursor-not-allowed opacity-50"}),m.jsx("span",{className:"flex-1 text-sm",children:O.text}),m.jsx("button",{type:"button",onClick:()=>wt(O.id),className:"opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-red-500 p-1 transition-all",title:"Delete",children:m.jsx(Pd,{className:"w-4 h-4"})})]},O.id))}),V?m.jsxs("div",{className:"mt-2 bg-muted/50 rounded-lg px-3 py-2",children:[m.jsx("input",{ref:tt,type:"text",value:j,onChange:O=>Z(O.target.value),onKeyDown:O=>{O.key==="Enter"&&j.trim()&&(O.preventDefault(),Fe()),O.key==="Escape"&&(Z(""),P(!1))},placeholder:"Add an item...",className:"w-full border border-input rounded px-2 py-1.5 text-sm bg-background focus:outline-none focus:ring-2 focus:ring-green-500",disabled:U}),m.jsxs("div",{className:"flex gap-2 mt-2",children:[m.jsx(Qe,{type:"button",size:"sm",onClick:Fe,disabled:!j.trim()||U,className:"bg-green-700 hover:bg-green-800 text-white",children:"Add"}),m.jsx(Qe,{type:"button",variant:"ghost",size:"sm",onClick:()=>{Z(""),P(!1)},children:"Cancel"})]})]}):m.jsxs("button",{type:"button",onClick:()=>P(!0),className:"mt-2 flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground hover:bg-muted px-3 py-2 rounded-lg transition-colors w-full",disabled:U,children:[m.jsx(Cs,{className:"w-4 h-4"}),m.jsx("span",{children:"Add an item"})]})]}),m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Vo,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Implementation Plan"}),m.jsx("span",{className:"text-xs text-muted-foreground",children:"(optional)"})]}),m.jsx(au,{markdown:F,onChange:B,placeholder:"Describe how you plan to implement this task...",readOnly:U})]}),m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Fme,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Implementation Notes"}),m.jsx("span",{className:"text-xs text-muted-foreground",children:"(optional)"})]}),m.jsx(au,{markdown:z,onChange:X,placeholder:"Add notes, observations, or any other relevant information...",readOnly:U})]})]}),Ae=m.jsxs("div",{className:"p-4 space-y-6",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Status"}),m.jsxs(qi,{value:y,onValueChange:O=>E(O),disabled:U,children:[m.jsx(Mi,{className:Re("w-full",uh(y,c)),children:m.jsx(Wi,{})}),m.jsx(Li,{children:l.map(O=>m.jsx(Tn,{value:O.value,children:O.label},O.value))})]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Priority"}),m.jsxs(qi,{value:S,onValueChange:O=>w(O),disabled:U,children:[m.jsx(Mi,{className:Re("w-full",BW[S]),children:m.jsx(Wi,{})}),m.jsx(Li,{children:FW.map(O=>m.jsx(Tn,{value:O.value,children:O.label},O.value))})]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Assignee"}),m.jsx(jS,{value:T,onChange:A,showGrabButton:!1,currentUser:i,container:a.current})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Labels"}),m.jsx("div",{className:"flex flex-wrap gap-1",children:R.map(O=>m.jsxs(Yl,{variant:"secondary",className:"gap-1 pr-1",children:[O,m.jsx("button",{type:"button",onClick:()=>Ct(O),className:"ml-1 hover:text-destructive",children:m.jsx(Ho,{className:"w-3 h-3"})})]},O))}),W?m.jsxs("div",{className:"space-y-2",children:[m.jsx(Wr,{value:se,onChange:O=>ae(O.target.value),onKeyDown:O=>{O.key==="Enter"&&se.trim()&&(O.preventDefault(),Ge()),O.key==="Escape"&&(ae(""),ie(!1))},placeholder:"Label name",disabled:U,autoFocus:!0}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(Qe,{size:"sm",onClick:Ge,disabled:!se.trim()||U,children:"Add"}),m.jsx(Qe,{size:"sm",variant:"ghost",onClick:()=>{ae(""),ie(!1)},children:"Cancel"})]})]}):m.jsxs(Qe,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground",onClick:()=>ie(!0),disabled:U,children:[m.jsx(Cs,{className:"w-4 h-4 mr-2"}),"Add label"]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Parent Task"}),m.jsxs(E0,{open:te,onOpenChange:fe,children:[m.jsx(S0,{asChild:!0,children:m.jsxs(Qe,{variant:"outline",role:"combobox","aria-expanded":te,className:"w-full justify-between h-auto min-h-10 py-2",disabled:U,title:it?`#${it.id} - ${it.title}`:void 0,children:[it?m.jsxs("div",{className:"flex items-center gap-2 text-left overflow-hidden min-w-0 flex-1",children:[m.jsx(oh,{className:"w-4 h-4 shrink-0 text-muted-foreground"}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",it.id]}),m.jsx("p",{className:"truncate text-sm",children:it.title})]})]}):m.jsx("span",{className:"text-muted-foreground",children:"Select parent task..."}),m.jsx(jx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(Dh,{className:"w-[400px] p-0",align:"start",children:m.jsxs(Ih,{children:[m.jsx(Oh,{placeholder:"Search tasks..."}),m.jsxs(Mh,{children:[m.jsx(Lh,{children:"No task found."}),m.jsxs(Va,{children:[m.jsxs(zo,{value:"none",onSelect:()=>{I(""),fe(!1)},children:[m.jsx(Ss,{className:Re("mr-2 h-4 w-4 shrink-0",D?"opacity-0":"opacity-100")}),m.jsx("span",{className:"text-muted-foreground",children:"None"})]}),t.map(O=>m.jsxs(zo,{value:`${O.id} ${O.title}`,onSelect:()=>{I(O.id),fe(!1)},title:`#${O.id} - ${O.title}`,children:[m.jsx(Ss,{className:Re("mr-2 h-4 w-4 shrink-0",D===O.id?"opacity-100":"opacity-0")}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",O.id]}),m.jsx("p",{className:"truncate text-sm",children:O.title})]})]},O.id))]})]})]})})]})]})]}),Le=m.jsxs("div",{className:"border-t px-6 py-4 bg-muted/30 flex justify-end gap-3",children:[m.jsx(Qe,{type:"button",variant:"ghost",onClick:n,disabled:U,children:"Cancel"}),m.jsx(Qe,{type:"button",onClick:Ot,className:"bg-green-700 hover:bg-green-800 text-white",disabled:U||J||!u.trim(),children:U?"Creating...":"Create Task"})]});return ve?m.jsx(Gx,{children:e&&m.jsx(JI,{open:e,onOpenChange:O=>!O&&n(),children:m.jsxs(aw,{className:"max-w-6xl w-[95vw] h-[90vh] p-0 gap-0 overflow-hidden flex flex-col",hideCloseButton:!0,children:[m.jsx(eO,{className:"sr-only",children:"Create New Task"}),m.jsxs(Kx.div,{ref:a,className:"flex flex-col h-full overflow-hidden",variants:nt,initial:"hidden",animate:"visible",exit:"exit",children:[le,he,m.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[m.jsx(Yi,{className:"flex-1",children:ge}),m.jsx("div",{className:"shrink-0 w-72 border-l bg-muted/20",children:m.jsx(Yi,{className:"h-full",children:Ae})})]}),Le]})]})})}):m.jsx(Gx,{children:e&&m.jsx(XI,{open:e,onOpenChange:O=>!O&&n(),children:m.jsx(sw,{side:"right",className:"w-full sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl p-0 flex flex-col gap-0",hideCloseButton:!0,children:m.jsxs(Kx.div,{ref:a,className:"flex flex-col h-full overflow-hidden",variants:nt,initial:"hidden",animate:"visible",exit:"exit",children:[le,he,m.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m.jsx("div",{className:"shrink-0 border-b bg-muted/20",children:m.jsxs("div",{className:"p-4 space-y-3",children:[m.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Status"}),m.jsxs(qi,{value:y,onValueChange:O=>E(O),disabled:U,children:[m.jsx(Mi,{className:Re("w-full h-9",uh(y,c)),children:m.jsx(Wi,{})}),m.jsx(Li,{children:l.map(O=>m.jsx(Tn,{value:O.value,children:O.label},O.value))})]})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Priority"}),m.jsxs(qi,{value:S,onValueChange:O=>w(O),disabled:U,children:[m.jsx(Mi,{className:Re("w-full h-9",BW[S]),children:m.jsx(Wi,{})}),m.jsx(Li,{children:FW.map(O=>m.jsx(Tn,{value:O.value,children:O.label},O.value))})]})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Assignee"}),m.jsx(jS,{value:T,onChange:A,showGrabButton:!1,currentUser:i,container:a.current})]})]}),m.jsxs("div",{className:"flex items-start gap-4 flex-wrap",children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground shrink-0",children:"Labels:"}),m.jsxs("div",{className:"flex flex-wrap gap-1 flex-1",children:[R.map(O=>m.jsxs(Yl,{variant:"secondary",className:"gap-1 pr-1 text-xs",children:[O,m.jsx("button",{type:"button",onClick:()=>Ct(O),className:"ml-0.5 hover:text-destructive",children:m.jsx(Ho,{className:"w-3 h-3"})})]},O)),!W&&m.jsxs(Qe,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs text-muted-foreground",onClick:()=>ie(!0),children:[m.jsx(Cs,{className:"w-3 h-3 mr-1"}),"Add"]})]}),W&&m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Wr,{value:se,onChange:O=>ae(O.target.value),onKeyDown:O=>{O.key==="Enter"&&se.trim()&&Ge(),O.key==="Escape"&&(ae(""),ie(!1))},placeholder:"Label",className:"h-7 w-24 text-xs",autoFocus:!0}),m.jsx(Qe,{size:"sm",className:"h-7 px-2",onClick:Ge,disabled:!se.trim(),children:"Add"}),m.jsx(Qe,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:()=>{ae(""),ie(!1)},children:m.jsx(Ho,{className:"w-3 h-3"})})]})]}),m.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground shrink-0",children:"Parent:"}),m.jsxs(E0,{open:te,onOpenChange:fe,children:[m.jsx(S0,{asChild:!0,children:m.jsxs(Qe,{variant:"outline",role:"combobox",size:"sm",className:"h-7 justify-between min-w-[120px] max-w-[250px]",disabled:U,title:it?`#${it.id} - ${it.title}`:void 0,children:[it?m.jsxs("span",{className:"truncate text-xs",children:["#",it.id," - ",it.title]}):m.jsx("span",{className:"text-muted-foreground text-xs",children:"None"}),m.jsx(jx,{className:"ml-1 h-3 w-3 shrink-0 opacity-50"})]})}),m.jsx(Dh,{className:"w-[400px] p-0",align:"end",children:m.jsxs(Ih,{children:[m.jsx(Oh,{placeholder:"Search tasks..."}),m.jsxs(Mh,{children:[m.jsx(Lh,{children:"No task found."}),m.jsxs(Va,{children:[m.jsxs(zo,{value:"none",onSelect:()=>{I(""),fe(!1)},children:[m.jsx(Ss,{className:Re("mr-2 h-4 w-4 shrink-0",D?"opacity-0":"opacity-100")}),m.jsx("span",{className:"text-muted-foreground",children:"None"})]}),t.map(O=>m.jsxs(zo,{value:`${O.id} ${O.title}`,onSelect:()=>{I(O.id),fe(!1)},title:`#${O.id} - ${O.title}`,children:[m.jsx(Ss,{className:Re("mr-2 h-4 w-4 shrink-0",D===O.id?"opacity-100":"opacity-0")}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",O.id]}),m.jsx("p",{className:"truncate text-sm",children:O.title})]})]},O.id))]})]})]})})]})]})]})]})}),m.jsx(Yi,{className:"flex-1",children:ge})]}),Le]})})})})}const zct=Ece,Vct=Sce,Gct=wce,Xue=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(art,{children:m.jsx(nF,{ref:r,sideOffset:t,className:Re("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));Xue.displayName=nF.displayName;const qct="sidebar_state",Wct=3600*24*7,Yct="16rem",Kct="18rem",Xct="3rem",Zct="b",Zue=v.createContext(null);function Fy(){const e=v.useContext(Zue);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Que=v.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:o,...s},a)=>{const l=sT(),[c,u]=v.useState(!1),[f,h]=v.useState(e),g=t??f,y=v.useCallback(T=>{const A=typeof T=="function"?T(g):T;n?n(A):h(A),document.cookie=`${qct}=${A}; path=/; max-age=${Wct}`},[n,g]),E=v.useCallback(()=>l?u(T=>!T):y(T=>!T),[l,y,u]);v.useEffect(()=>{const T=A=>{A.key===Zct&&(A.metaKey||A.ctrlKey)&&(A.preventDefault(),E())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[E]);const S=g?"expanded":"collapsed",w=v.useMemo(()=>({state:S,open:g,setOpen:y,isMobile:l,openMobile:c,setOpenMobile:u,toggleSidebar:E}),[S,g,y,l,c,u,E]);return m.jsx(Zue.Provider,{value:w,children:m.jsx(zct,{delayDuration:0,children:m.jsx("div",{style:{"--sidebar-width":Yct,"--sidebar-width-icon":Xct,...i},className:Re("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",r),ref:a,...s,children:o})})})});Que.displayName="SidebarProvider";const Jue=v.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:i,...o},s)=>{const{isMobile:a,state:l,openMobile:c,setOpenMobile:u}=Fy();return n==="none"?m.jsx("div",{className:Re("flex h-full w-[var(--sidebar-width)] flex-col bg-sidebar text-sidebar-foreground",r),ref:s,...o,children:i}):a?m.jsx(XI,{open:c,onOpenChange:u,...o,children:m.jsxs(sw,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[var(--sidebar-width)] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":Kct},side:e,children:[m.jsxs(ZI,{className:"sr-only",children:[m.jsx(QI,{children:"Sidebar"}),m.jsx(MX,{children:"Displays the mobile sidebar."})]}),m.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):m.jsxs("div",{ref:s,className:"group peer hidden text-sidebar-foreground md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":t,"data-side":e,children:[m.jsx("div",{className:Re("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),m.jsx("div",{className:Re("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...o,children:m.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:i})})]})});Jue.displayName="Sidebar";const ede=v.forwardRef(({className:e,onClick:t,...n},r)=>{const{toggleSidebar:i}=Fy();return m.jsxs(Qe,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Re("h-7 w-7",e),onClick:o=>{t?.(o),i()},...n,children:[m.jsx(Sme,{}),m.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});ede.displayName="SidebarTrigger";const tde=v.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:r}=Fy();return m.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:Re("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});tde.displayName="SidebarRail";const Qct=v.forwardRef(({className:e,...t},n)=>m.jsx("main",{ref:n,className:Re("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));Qct.displayName="SidebarInset";const Jct=v.forwardRef(({className:e,...t},n)=>m.jsx(Wr,{ref:n,"data-sidebar":"input",className:Re("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));Jct.displayName="SidebarInput";const nde=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"header",className:Re("flex flex-col gap-2 p-2",e),...t}));nde.displayName="SidebarHeader";const rde=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"footer",className:Re("flex flex-col gap-2 p-2",e),...t}));rde.displayName="SidebarFooter";const eut=v.forwardRef(({className:e,...t},n)=>m.jsx(T0,{ref:n,"data-sidebar":"separator",className:Re("mx-2 w-auto bg-sidebar-border",e),...t}));eut.displayName="SidebarSeparator";const ide=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"content",className:Re("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));ide.displayName="SidebarContent";const ode=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"group",className:Re("relative flex w-full min-w-0 flex-col p-2",e),...t}));ode.displayName="SidebarGroup";const sde=v.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const i=t?Du:"div";return m.jsx(i,{ref:r,"data-sidebar":"group-label",className:Re("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...n})});sde.displayName="SidebarGroupLabel";const tut=v.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const i=t?Du:"button";return m.jsx(i,{ref:r,"data-sidebar":"group-action",className:Re("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...n})});tut.displayName="SidebarGroupAction";const ade=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"group-content",className:Re("w-full text-sm",e),...t}));ade.displayName="SidebarGroupContent";const Lx=v.forwardRef(({className:e,...t},n)=>m.jsx("ul",{ref:n,"data-sidebar":"menu",className:Re("flex w-full min-w-0 flex-col gap-1",e),...t}));Lx.displayName="SidebarMenu";const Px=v.forwardRef(({className:e,...t},n)=>m.jsx("li",{ref:n,"data-sidebar":"menu-item",className:Re("group/menu-item relative",e),...t}));Px.displayName="SidebarMenuItem";const nut=Ql("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),Fx=v.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n="default",size:r="default",tooltip:i,className:o,...s},a)=>{const l=e?Du:"button",{isMobile:c,state:u}=Fy(),f=m.jsx(l,{ref:a,"data-sidebar":"menu-button","data-size":r,"data-active":t,className:Re(nut({variant:n,size:r}),o),...s});return i?(typeof i=="string"&&(i={children:i}),m.jsxs(Vct,{children:[m.jsx(Gct,{asChild:!0,children:f}),m.jsx(Xue,{side:"right",align:"center",hidden:u!=="collapsed"||c,...i})]})):f});Fx.displayName="SidebarMenuButton";const rut=v.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>{const o=t?Du:"button";return m.jsx(o,{ref:i,"data-sidebar":"menu-action",className:Re("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...r})});rut.displayName="SidebarMenuAction";const iut=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:Re("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));iut.displayName="SidebarMenuBadge";const out=v.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{const i=v.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return m.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:Re("flex h-8 items-center gap-2 rounded-md px-2",e),...n,children:[t&&m.jsx(Kq,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),m.jsx(Kq,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":i}})]})});out.displayName="SidebarMenuSkeleton";const sut=v.forwardRef(({className:e,...t},n)=>m.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:Re("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));sut.displayName="SidebarMenuSub";const aut=v.forwardRef(({...e},t)=>m.jsx("li",{ref:t,...e}));aut.displayName="SidebarMenuSubItem";const lut=v.forwardRef(({asChild:e=!1,size:t="md",isActive:n,className:r,...i},o)=>{const s=e?Du:"a";return m.jsx(s,{ref:o,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:Re("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",r),...i})});lut.displayName="SidebarMenuSubButton";const cut=[{id:"kanban",label:"Kanban",icon:lme,href:"#/"},{id:"tasks",label:"Tasks",icon:oY,href:"#/tasks"},{id:"docs",label:"Docs",icon:Vo,href:"#/docs"}];function uut({currentPage:e,onSearchClick:t}){const{state:n}=Fy(),r=sT(),i=n==="expanded";return m.jsxs(Jue,{collapsible:"icon",variant:r?"floating":"sidebar",children:[m.jsxs(nde,{children:[m.jsx(Lx,{children:m.jsx(Px,{children:m.jsx(Fx,{size:"lg",asChild:!0,children:m.jsxs("a",{href:"#/",children:[m.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:m.jsx("span",{className:"text-lg font-bold",children:"◆"})}),m.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[m.jsx("span",{className:"truncate font-semibold",children:"Knowns.dev"}),m.jsx("span",{className:"truncate text-xs",children:"Task Management"})]})]})})})}),i&&m.jsx("div",{className:"px-2 pb-2",children:m.jsxs("button",{type:"button",onClick:t,className:"flex w-full items-center gap-2 rounded-lg border bg-background px-3 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[m.jsx(KS,{className:"h-4 w-4"}),m.jsx("span",{children:"Search..."}),m.jsxs("kbd",{className:"ml-auto pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100",children:[m.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]})})]}),m.jsx(ide,{children:m.jsxs(ode,{children:[m.jsx(sde,{children:"Navigation"}),m.jsx(ade,{children:m.jsx(Lx,{children:cut.map(o=>{const s=e===o.id;return m.jsx(Px,{children:m.jsx(Fx,{asChild:!0,isActive:s,tooltip:o.label,children:m.jsxs("a",{href:o.href,children:[m.jsx(o.icon,{}),m.jsx("span",{children:o.label})]})})},o.id)})})})]})}),m.jsxs(rde,{children:[m.jsx(Lx,{children:m.jsx(Px,{children:m.jsx(Fx,{asChild:!0,isActive:e==="config",tooltip:"Settings",children:m.jsxs("a",{href:"#/config",children:[m.jsx(lI,{}),m.jsx("span",{children:"Settings"})]})})})}),i&&m.jsx("div",{className:"px-3 py-2 text-xs text-sidebar-foreground/50",children:m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("a",{href:"https://github.com/knowns-dev/knowns",target:"_blank",rel:"noopener noreferrer",className:"hover:text-sidebar-foreground transition-colors",children:"Knowns"}),m.jsx("span",{className:"font-mono",children:"0.8.1"})]})})]}),m.jsx(tde,{})]})}const dut=[{value:"all",label:"All"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"content",label:"Content"}];function fut(e){const t=e.changes;if(t.length===0)return"Updated";const n=t.find(s=>s.field==="status");if(n){const s=String(n.newValue);return s==="done"?"Completed":s==="in-progress"?"Started working on":s==="in-review"?"Submitted for review":s==="blocked"?"Blocked":`Changed status to ${s}`}const r=t.find(s=>s.field==="assignee");if(r){const s=r.newValue;return s?`Assigned to ${s}`:"Unassigned"}if(t.find(s=>s.field==="title"))return"Updated title";const o=t.find(s=>s.field==="priority");return o?`Set priority to ${o.newValue}`:t.some(s=>s.field==="description")?"Updated description":t.some(s=>s.field==="acceptanceCriteria")?"Updated acceptance criteria":t.some(s=>s.field==="implementationPlan")?"Updated plan":t.some(s=>s.field==="implementationNotes")?"Updated notes":t.some(s=>s.field==="labels")?"Updated labels":`Updated ${t.length} field(s)`}function put(e){const n=new Date().getTime()-e.getTime(),r=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return r<1?"just now":r<60?`${r}m ago`:i<24?`${i}h ago`:o<7?`${o}d ago`:e.toLocaleDateString()}function hut(e){return e.some(t=>t.field==="status"&&t.newValue==="done")?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":e.some(t=>t.field==="status"&&t.newValue==="in-progress")?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400":e.some(t=>t.field==="status"&&t.newValue==="blocked")?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":e.some(t=>t.field==="assignee")?"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400":"bg-muted text-muted-foreground"}function mut({limit:e=20,showFilter:t=!0,onTaskClick:n}){const[r,i]=v.useState([]),[o,s]=v.useState(!0),[a,l]=v.useState("all"),[c,u]=v.useState(!1),f=v.useCallback(async()=>{try{const y=a==="all"?void 0:a,E=await ta.getActivities({limit:e,type:y});i(E)}catch(y){console.error("Failed to load activities:",y)}finally{s(!1),u(!1)}},[e,a]);v.useEffect(()=>{f()},[f]),cu("tasks:updated",()=>{f()},[f]);const h=()=>{u(!0),f()},g=y=>{n?n(y):window.location.hash=`/kanban/${y}`};return m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(O7,{className:"w-5 h-5"}),m.jsx("h3",{className:"font-semibold",children:"Recent Activity"})]}),m.jsx(Qe,{variant:"ghost",size:"icon",onClick:h,disabled:c,className:"h-8 w-8",children:m.jsx(aI,{className:`w-4 h-4 ${c?"animate-spin":""}`})})]}),t&&m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(sI,{className:"w-4 h-4 text-muted-foreground"}),m.jsx("select",{value:a,onChange:y=>l(y.target.value),className:"text-sm rounded px-2 py-1 bg-card border flex-1",children:dut.map(y=>m.jsx("option",{value:y.value,children:y.label},y.value))})]}),m.jsx(Yi,{className:"flex-1",children:m.jsx("div",{className:"space-y-1.5 pr-3",children:o?m.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"Loading activities..."}):r.length===0?m.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"No recent activity"}):r.map((y,E)=>m.jsx("div",{role:"button",tabIndex:0,onClick:S=>{S.preventDefault(),S.stopPropagation(),g(y.taskId)},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),g(y.taskId))},className:"w-full bg-card rounded p-2 text-left hover:bg-accent transition-colors border cursor-pointer select-none",children:m.jsxs("div",{className:"flex items-center gap-2",children:[y.author?m.jsx(k0,{name:y.author,size:"xs"}):m.jsx("div",{className:`w-5 h-5 rounded-full flex items-center justify-center shrink-0 ${hut(y.changes)}`,children:m.jsx(O7,{className:"w-2.5 h-2.5"})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-xs font-medium truncate",children:fut(y)}),m.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:put(y.timestamp)})]}),m.jsxs("div",{className:"text-[11px] text-muted-foreground truncate",children:[m.jsxs("span",{className:"font-medium",children:["#",y.taskId]})," ",y.taskTitle]})]})]})},`${y.taskId}-${y.version}-${E}`))})})]})}function gut(){const[e,t]=v.useState(!1),[n,r]=v.useState(!1),[i,o]=v.useState(()=>{const l=localStorage.getItem("knowns-last-activity-check");return l?new Date(l):new Date}),s=v.useCallback(async()=>{try{const l=await ta.getActivities({limit:1});l.length>0&&new Date(l[0].timestamp)>i&&t(!0)}catch(l){console.error("Failed to check activities:",l)}},[i]);v.useEffect(()=>{s()},[s]),cu("tasks:updated",()=>{n||t(!0)},[n]);const a=l=>{if(r(l),l){t(!1);const c=new Date;o(c),localStorage.setItem("knowns-last-activity-check",c.toISOString())}};return m.jsxs(E0,{open:n,onOpenChange:a,children:[m.jsx(S0,{asChild:!0,children:m.jsxs(Qe,{variant:"ghost",size:"icon",className:"relative h-8 w-8","aria-label":"Notifications",children:[m.jsx(yhe,{className:"h-4 w-4"}),e&&m.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-blue-500 animate-pulse"})]})}),m.jsx(Dh,{className:"w-80 p-0",align:"end",sideOffset:8,children:m.jsxs("div",{className:"flex flex-col h-[400px]",children:[m.jsx("div",{className:"px-4 py-3 border-b",children:m.jsx("h3",{className:"font-semibold text-sm",children:"Recent Activity"})}),m.jsx("div",{className:"flex-1 overflow-hidden p-2",children:m.jsx(mut,{limit:20,showFilter:!1,onTaskClick:l=>{r(!1),window.location.hash=`/kanban/${l}`}})})]})})]})}const jW={todo:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300","in-progress":"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300","in-review":"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",done:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",blocked:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300","on-hold":"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300"},but={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold"};function yut({open:e,onOpenChange:t,onTaskSelect:n,onDocSelect:r}){const[i,o]=v.useState(""),[s,a]=v.useState({tasks:[],docs:[]}),[l,c]=v.useState(!1);v.useEffect(()=>{if(!e){o(""),a({tasks:[],docs:[]});return}if(!i.trim()){a({tasks:[],docs:[]});return}c(!0);const h=setTimeout(()=>{fetch(`/api/search?q=${encodeURIComponent(i)}`).then(g=>g.json()).then(g=>{a({tasks:g.tasks||[],docs:g.docs||[]})}).catch(g=>{console.error("Search failed:",g),a({tasks:[],docs:[]})}).finally(()=>{c(!1)})},300);return()=>clearTimeout(h)},[i,e]);const u=h=>{n(h),t(!1),o("")},f=h=>{r(h),t(!1),o("")};return m.jsx(JI,{open:e,onOpenChange:t,children:m.jsx(aw,{className:"overflow-hidden p-0 max-w-2xl",hideClose:!0,children:m.jsxs(Ih,{shouldFilter:!1,children:[m.jsx(Oh,{placeholder:"Search tasks and docs...",value:i,onValueChange:o}),m.jsxs(Mh,{children:[m.jsx(Lh,{children:l?"Searching...":i?"No results found.":"Type to search..."}),s.tasks.length>0&&m.jsx(Va,{heading:"Tasks",children:s.tasks.slice(0,8).map(h=>{const g=jW[h.status]||jW.todo,y=but[h.status]||h.status;return m.jsxs(zo,{value:`task-${h.id}`,onSelect:()=>u(h),children:[m.jsx(oY,{className:"mr-2 h-4 w-4 shrink-0"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:["#",h.id]}),m.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${g}`,children:y})]}),m.jsx("div",{className:"font-medium truncate",children:h.title})]})]},h.id)})}),s.tasks.length>0&&s.docs.length>0&&m.jsx(PS,{}),s.docs.length>0&&m.jsx(Va,{heading:"Documentation",children:s.docs.slice(0,8).map(h=>{const g=h.metadata?.title||h.filename;return m.jsxs(zo,{value:`doc-${h.path}`,onSelect:()=>f(h),children:[m.jsx(Vo,{className:"mr-2 h-4 w-4 shrink-0"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"font-medium truncate mb-1",children:g}),m.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:m.jsx("span",{className:"truncate",children:h.path})})]})]},h.path)})})]})]})})})}const lde={description:{begin:"<!-- SECTION:DESCRIPTION:BEGIN -->",end:"<!-- SECTION:DESCRIPTION:END -->"},plan:{begin:"<!-- SECTION:PLAN:BEGIN -->",end:"<!-- SECTION:PLAN:END -->"},notes:{begin:"<!-- SECTION:NOTES:BEGIN -->",end:"<!-- SECTION:NOTES:END -->"},ac:{begin:"<!-- AC:BEGIN -->",end:"<!-- AC:END -->"}};function vut(e,t){const n=lde[t];if(!n)return e;const r=e.indexOf(n.begin),i=e.indexOf(n.end);return r===-1||i===-1?e:e.substring(r+n.begin.length,i).trim()}function xut(e,t){const n=lde[t];return n?e.includes(n.begin)&&e.includes(n.end):!1}function Eut(e){return e.replace(/<!--[\s\S]*?-->/g,"")}function Sut(e,t){return e?t&&xut(e,t)?vut(e,t):e:""}const wut="inline-flex items-center gap-1 px-1 py-1 rounded-md text-sm font-medium transition-all hover:scale-105 bg-green-100/50 border border-green-500/30 text-green-700 hover:bg-green-100 hover:border-green-500/50 dark:bg-green-900/20 dark:text-green-300 dark:hover:bg-green-900/30",Cut="inline-flex items-center gap-1 px-1 py-1 rounded-md text-sm font-medium transition-all hover:scale-105 bg-blue-100/50 border border-blue-500/30 text-blue-700 hover:bg-blue-100 hover:border-blue-500/50 dark:bg-blue-900/20 dark:text-blue-300 dark:hover:bg-blue-900/30",Tut=v.forwardRef(({markdown:e,className:t="",sectionType:n,enableGFM:r=!0,onDocLinkClick:i},o)=>{if(!e)return null;const s=Eut(Sut(e,n)),a=({href:l,children:c})=>{if(l&&/^(task-)?\d+(\.\d+)?(\.md)?$/.test(l)){const u=l.replace(/^task-/,"").replace(/\.md$/,""),f=`#/tasks/${u}`;return m.jsxs("a",{href:f,className:wut,"data-task-id":u,children:[m.jsx(of,{className:"w-4 h-4 shrink-0"}),c]})}if(l&&(l.endsWith(".md")||l.includes(".md#"))){const u=l.replace(/^\.\//,""),f=`#/docs/${u}`;return m.jsxs("a",{href:f,className:Cut,"data-doc-path":u,onClick:h=>{i&&(h.preventDefault(),i(u))},children:[m.jsx(Vo,{className:"w-4 h-4 shrink-0"}),c]})}return m.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-600 underline",children:c})};return m.jsx("div",{ref:o,className:`prose prose-sm max-w-none dark:prose-invert ${t}`,children:m.jsx(iJ,{remarkPlugins:r?[Vw]:[],components:{a,code:({className:l,children:c,...u})=>l?m.jsx("code",{className:l,...u,children:c}):m.jsx("code",{className:"px-1.5 py-0.5 rounded text-sm bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200",...u,children:c}),pre:({children:l})=>m.jsx("pre",{className:"overflow-x-auto rounded-lg p-4 text-sm bg-gray-100 dark:bg-gray-900",children:l}),table:({children:l})=>m.jsx("div",{className:"overflow-x-auto my-4",children:m.jsx("table",{className:"min-w-full border-collapse",children:l})}),th:({children:l})=>m.jsx("th",{className:"px-4 py-2 text-left font-semibold border bg-gray-100 text-gray-900 border-gray-200 dark:bg-gray-700 dark:text-gray-100 dark:border-gray-600",children:l}),td:({children:l})=>m.jsx("td",{className:"px-4 py-2 border border-gray-200 text-gray-700 dark:border-gray-600 dark:text-gray-200",children:l}),input:({type:l,checked:c,...u})=>l==="checkbox"?m.jsx("input",{type:"checkbox",checked:c,readOnly:!0,className:"mr-2 accent-blue-600",...u}):m.jsx("input",{type:l,...u})},children:s})})});Tut.displayName="MarkdownRenderer";function nu(e,t){return typeof e=="function"?e(t):e}function Xo(e,t){return n=>{t.setState(r=>({...r,[e]:nu(n,r[e])}))}}function aT(e){return e instanceof Function}function kut(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Aut(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const s=t(o);s!=null&&s.length&&r(s)})};return r(e),n}function vt(e,t,n){let r=[],i;return o=>{let s;n.key&&n.debug&&(s=Date.now());const a=e(o);if(!(a.length!==r.length||a.some((u,f)=>r[f]!==u)))return i;r=a;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...a),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const u=Math.round((Date.now()-s)*100)/100,f=Math.round((Date.now()-c)*100)/100,h=f/16,g=(y,E)=>{for(y=String(y);y.length<E;)y=" "+y;return y};console.info(`%c⏱ ${g(f,5)} /${g(u,5)} ms`,`
|
|
310
|
+
`},Xat={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Zat(e){let{announcements:t=Xat,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Kat}=e;const{announce:o,announcement:s}=qat(),a=Ly("DndLiveRegion"),[l,c]=v.useState(!1);if(v.useEffect(()=>{c(!0)},[]),Wat(v.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const u=be.createElement(be.Fragment,null,be.createElement(Vat,{id:r,value:i.draggable}),be.createElement(Gat,{id:a,announcement:s}));return n?Yr.createPortal(u,n):u}var Gr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Gr||(Gr={}));function qS(){}function e_(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Qat(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ha=Object.freeze({x:0,y:0});function vF(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jat(e,t){const n=GS(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function xF(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function elt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function KD(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function tlt(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function bW(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const nlt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=bW(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=vF(bW(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(xF)},yW=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=KD(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=KD(l),u=i.reduce((h,g,y)=>h+vF(c[y],g),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(xF)};function rlt(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const wue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=rlt(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(elt)};function ilt(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const olt=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:s}=o,a=n.get(s);if(a&&ilt(r,a)){const c=KD(a).reduce((f,h)=>f+vF(r,h),0),u=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:u}})}}return i.sort(xF)};function slt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Cue(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ha}function alt(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const llt=alt(1);function Tue(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function clt(e,t,n){const r=Tue(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const ult={ignoreTransform:!1};function vm(e,t){t===void 0&&(t=ult);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=ro(e).getComputedStyle(e);c&&(n=clt(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function vW(e){return vm(e,{ignoreTransform:!0})}function dlt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function flt(e,t){return t===void 0&&(t=ro(e).getComputedStyle(e)),t.position==="fixed"}function plt(e,t){t===void 0&&(t=ro(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function EF(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(yF(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Oy(i)||xue(i)||n.includes(i))return n;const o=ro(e).getComputedStyle(i);return i!==e&&plt(i,o)&&n.push(i),flt(i,o)?n:r(i.parentNode)}return e?r(e):n}function kue(e){const[t]=EF(e,1);return t??null}function t_(e){return!tT||!e?null:bm(e)?e:bF(e)?yF(e)||e===ym(e).scrollingElement?window:Oy(e)?e:null:null}function Aue(e){return bm(e)?e.scrollX:e.scrollLeft}function Nue(e){return bm(e)?e.scrollY:e.scrollTop}function XD(e){return{x:Aue(e),y:Nue(e)}}var ii;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ii||(ii={}));function _ue(e){return!tT||!e?!1:e===document.scrollingElement}function Rue(e){const t={x:0,y:0},n=_ue(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const hlt={x:.2,y:.2};function mlt(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=hlt);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=Rue(e),g={x:0,y:0},y={x:0,y:0},E={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+E.height?(g.y=ii.Backward,y.y=r*Math.abs((t.top+E.height-o)/E.height)):!u&&l>=t.bottom-E.height&&(g.y=ii.Forward,y.y=r*Math.abs((t.bottom-E.height-l)/E.height)),!h&&a>=t.right-E.width?(g.x=ii.Forward,y.x=r*Math.abs((t.right-E.width-a)/E.width)):!f&&s<=t.left+E.width&&(g.x=ii.Backward,y.x=r*Math.abs((t.left+E.width-s)/E.width)),{direction:g,speed:y}}function glt(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Due(e){return e.reduce((t,n)=>ih(t,XD(n)),ha)}function blt(e){return e.reduce((t,n)=>t+Aue(n),0)}function ylt(e){return e.reduce((t,n)=>t+Nue(n),0)}function Iue(e,t){if(t===void 0&&(t=vm),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);kue(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const vlt=[["x",["left","right"],blt],["y",["top","bottom"],ylt]];class SF{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=EF(n),i=Due(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of vlt)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Sb{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function xlt(e){const{EventTarget:t}=ro(e);return e instanceof t?e:ym(e)}function n_(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var gs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(gs||(gs={}));function xW(e){e.preventDefault()}function Elt(e){e.stopPropagation()}var Cn;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Cn||(Cn={}));const Oue={start:[Cn.Space,Cn.Enter],cancel:[Cn.Esc],end:[Cn.Space,Cn.Enter,Cn.Tab]},Slt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Cn.Right:return{...n,x:n.x+25};case Cn.Left:return{...n,x:n.x-25};case Cn.Down:return{...n,y:n.y+25};case Cn.Up:return{...n,y:n.y-25}}};class wF{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Sb(ym(n)),this.windowListeners=new Sb(ro(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(gs.Resize,this.handleCancel),this.windowListeners.add(gs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(gs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Iue(r),n(ha)}handleKeyDown(t){if(rT(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Oue,coordinateGetter:s=Slt,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:ha;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const h=VS(f,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const E of y){const S=t.code,{isTop:w,isRight:T,isLeft:A,isBottom:R,maxScroll:_,minScroll:D}=Rue(E),I=glt(E),M={x:Math.min(S===Cn.Right?I.right-I.width/2:I.right,Math.max(S===Cn.Right?I.left:I.left+I.width/2,f.x)),y:Math.min(S===Cn.Down?I.bottom-I.height/2:I.bottom,Math.max(S===Cn.Down?I.top:I.top+I.height/2,f.y))},H=S===Cn.Right&&!T||S===Cn.Left&&!A,F=S===Cn.Down&&!R||S===Cn.Up&&!w;if(H&&M.x!==f.x){const B=E.scrollLeft+h.x,z=S===Cn.Right&&B<=_.x||S===Cn.Left&&B>=D.x;if(z&&!h.y){E.scrollTo({left:B,behavior:a});return}z?g.x=E.scrollLeft-B:g.x=S===Cn.Right?E.scrollLeft-_.x:E.scrollLeft-D.x,g.x&&E.scrollBy({left:-g.x,behavior:a});break}else if(F&&M.y!==f.y){const B=E.scrollTop+h.y,z=S===Cn.Down&&B<=_.y||S===Cn.Up&&B>=D.y;if(z&&!h.x){E.scrollTo({top:B,behavior:a});return}z?g.y=E.scrollTop-B:g.y=S===Cn.Down?E.scrollTop-_.y:E.scrollTop-D.y,g.y&&E.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,ih(VS(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}wF.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Oue,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function EW(e){return!!(e&&"distance"in e)}function SW(e){return!!(e&&"delay"in e)}class CF{constructor(t,n,r){var i;r===void 0&&(r=xlt(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=ym(s),this.documentListeners=new Sb(this.document),this.listeners=new Sb(r),this.windowListeners=new Sb(ro(s)),this.initialCoordinates=(i=GS(o))!=null?i:ha,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(gs.Resize,this.handleCancel),this.windowListeners.add(gs.DragStart,xW),this.windowListeners.add(gs.VisibilityChange,this.handleCancel),this.windowListeners.add(gs.ContextMenu,xW),this.documentListeners.add(gs.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(SW(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(EW(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(gs.Click,Elt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(gs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=GS(t))!=null?n:ha,c=VS(i,l);if(!r&&a){if(EW(a)){if(a.tolerance!=null&&n_(c,a.tolerance))return this.handleCancel();if(n_(c,a.distance))return this.handleStart()}if(SW(a)&&n_(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Cn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const wlt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Mue extends CF{constructor(t){const{event:n}=t,r=ym(n.target);super(t,wlt,r)}}Mue.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Clt={move:{name:"mousemove"},end:{name:"mouseup"}};var ZD;(function(e){e[e.RightClick=2]="RightClick"})(ZD||(ZD={}));class Lue extends CF{constructor(t){super(t,Clt,ym(t.event.target))}}Lue.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ZD.RightClick?!1:(r?.({event:n}),!0)}}];const r_={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Pue extends CF{constructor(t){super(t,r_)}static setup(){return window.addEventListener(r_.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(r_.move.name,t)};function t(){}}}Pue.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var wb;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(wb||(wb={}));var WS;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(WS||(WS={}));function Tlt(e){let{acceleration:t,activator:n=wb.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=WS.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=e;const g=Alt({delta:f,disabled:!o}),[y,E]=jat(),S=v.useRef({x:0,y:0}),w=v.useRef({x:0,y:0}),T=v.useMemo(()=>{switch(n){case wb.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case wb.DraggableRect:return i}},[n,i,l]),A=v.useRef(null),R=v.useCallback(()=>{const D=A.current;if(!D)return;const I=S.current.x*w.current.x,M=S.current.y*w.current.y;D.scrollBy(I,M)},[]),_=v.useMemo(()=>a===WS.TreeOrder?[...c].reverse():c,[a,c]);v.useEffect(()=>{if(!o||!c.length||!T){E();return}for(const D of _){if(r?.(D)===!1)continue;const I=c.indexOf(D),M=u[I];if(!M)continue;const{direction:H,speed:F}=mlt(D,M,T,t,h);for(const B of["x","y"])g[B][H[B]]||(F[B]=0,H[B]=0);if(F.x>0||F.y>0){E(),A.current=D,y(R,s),S.current=F,w.current=H;return}}S.current={x:0,y:0},w.current={x:0,y:0},E()},[t,R,r,E,o,s,JSON.stringify(T),JSON.stringify(g),y,c,_,u,JSON.stringify(h)])}const klt={x:{[ii.Backward]:!1,[ii.Forward]:!1},y:{[ii.Backward]:!1,[ii.Forward]:!1}};function Alt(e){let{delta:t,disabled:n}=e;const r=zS(t);return My(i=>{if(n||!r||!i)return klt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ii.Backward]:i.x[ii.Backward]||o.x===-1,[ii.Forward]:i.x[ii.Forward]||o.x===1},y:{[ii.Backward]:i.y[ii.Backward]||o.y===-1,[ii.Forward]:i.y[ii.Forward]||o.y===1}}},[n,t,r])}function Nlt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return My(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function _lt(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var N0;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(N0||(N0={}));var QD;(function(e){e.Optimized="optimized"})(QD||(QD={}));const wW=new Map;function Rlt(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=v.useState(null),{frequency:a,measure:l,strategy:c}=i,u=v.useRef(e),f=S(),h=A0(f),g=v.useCallback(function(w){w===void 0&&(w=[]),!h.current&&s(T=>T===null?w:T.concat(w.filter(A=>!T.includes(A))))},[h]),y=v.useRef(null),E=My(w=>{if(f&&!n)return wW;if(!w||w===wW||u.current!==e||o!=null){const T=new Map;for(let A of e){if(!A)continue;if(o&&o.length>0&&!o.includes(A.id)&&A.rect.current){T.set(A.id,A.rect.current);continue}const R=A.node.current,_=R?new SF(l(R),R):null;A.rect.current=_,_&&T.set(A.id,_)}return T}return w},[e,o,n,f,l]);return v.useEffect(()=>{u.current=e},[e]),v.useEffect(()=>{f||g()},[n,f]),v.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),v.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,f,g,...r]),{droppableRects:E,measureDroppableContainers:g,measuringScheduled:o!=null};function S(){switch(c){case N0.Always:return!1;case N0.BeforeDragging:return n;default:return!n}}}function TF(e,t){return My(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Dlt(e,t){return TF(e,t)}function Ilt(e){let{callback:t,disabled:n}=e;const r=nT(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>i?.disconnect(),[i]),i}function iT(e){let{callback:t,disabled:n}=e;const r=nT(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>i?.disconnect(),[i]),i}function Olt(e){return new SF(vm(e),e)}function CW(e,t,n){t===void 0&&(t=Olt);const[r,i]=v.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=Ilt({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=iT({callback:o});return pa(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function Mlt(e){const t=TF(e);return Cue(e,t)}const TW=[];function Llt(e){const t=v.useRef(e),n=My(r=>e?r&&r!==TW&&e&&t.current&&e.parentNode===t.current.parentNode?r:EF(e):TW,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function Plt(e){const[t,n]=v.useState(null),r=v.useRef(e),i=v.useCallback(o=>{const s=t_(o.target);s&&n(a=>a?(a.set(s,XD(s)),new Map(a)):null)},[]);return v.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=t_(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,XD(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=t_(l);c?.removeEventListener("scroll",i)})}},[i,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>ih(o,s),ha):Due(e):ha,[e,t])}function kW(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==ha;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?VS(e,n.current):ha}function Flt(e){v.useEffect(()=>{if(!tT)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Blt(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function Fue(e){return v.useMemo(()=>e?dlt(e):null,[e])}const AW=[];function jlt(e,t){t===void 0&&(t=vm);const[n]=e,r=Fue(n?ro(n):null),[i,o]=v.useState(AW);function s(){o(()=>e.length?e.map(l=>_ue(l)?r:new SF(t(l),l)):AW)}const a=iT({callback:s});return pa(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function Bue(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Oy(t)?t:e}function $lt(e){let{measure:t}=e;const[n,r]=v.useState(null),i=v.useCallback(c=>{for(const{target:u}of c)if(Oy(u)){r(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=iT({callback:i}),s=v.useCallback(c=>{const u=Bue(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=HS(s);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Ult=[{sensor:Mue,options:{}},{sensor:wF,options:{}}],Hlt={current:{}},Mx={draggable:{measure:vW},droppable:{measure:vW,strategy:N0.WhileDragging,frequency:QD.Optimized},dragOverlay:{measure:vm}};class Cb extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const zlt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Cb,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:qS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mx,measureDroppableContainers:qS,windowRect:null,measuringScheduled:!1},jue={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:qS,draggableNodes:new Map,over:null,measureDroppableContainers:qS},Py=v.createContext(jue),$ue=v.createContext(zlt);function Vlt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Cb}}}function Glt(e,t){switch(t.type){case Gr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Gr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Gr.DragEnd:case Gr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Gr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Cb(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Gr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Cb(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Gr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Cb(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function qlt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=v.useContext(Py),o=zS(r),s=zS(n?.id);return v.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!rT(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=Hat(u);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function Uue(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function Wlt(e){return v.useMemo(()=>({draggable:{...Mx.draggable,...e?.draggable},droppable:{...Mx.droppable,...e?.droppable},dragOverlay:{...Mx.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ylt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=v.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;pa(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=Cue(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=kue(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const oT=v.createContext({...ha,scaleX:1,scaleY:1});var Uc;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Uc||(Uc={}));const Klt=v.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Ult,collisionDetection:f=wue,measuring:h,modifiers:g,...y}=t;const E=v.useReducer(Glt,void 0,Vlt),[S,w]=E,[T,A]=Yat(),[R,_]=v.useState(Uc.Uninitialized),D=R===Uc.Initialized,{draggable:{active:I,nodes:M,translate:H},droppable:{containers:F}}=S,B=I!=null?M.get(I):null,z=v.useRef({initial:null,translated:null}),X=v.useMemo(()=>{var Nt;return I!=null?{id:I,data:(Nt=B?.data)!=null?Nt:Hlt,rect:z}:null},[I,B]),U=v.useRef(null),[K,G]=v.useState(null),[Q,J]=v.useState(null),re=A0(y,Object.values(y)),j=Ly("DndDescribedBy",s),Z=v.useMemo(()=>F.getEnabled(),[F]),V=Wlt(h),{droppableRects:P,measureDroppableContainers:se,measuringScheduled:ae}=Rlt(Z,{dragging:D,dependencies:[H.x,H.y],config:V.droppable}),W=Nlt(M,I),ie=v.useMemo(()=>Q?GS(Q):null,[Q]),te=bt(),fe=Dlt(W,V.draggable.measure);Ylt({activeNode:I!=null?M.get(I):null,config:te.layoutShiftCompensation,initialRect:fe,measure:V.draggable.measure});const Ce=CW(W,V.draggable.measure,fe),Oe=CW(W?W.parentElement:null),ve=v.useRef({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:M,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),tt=F.getNodeFor((n=ve.current.over)==null?void 0:n.id),nt=$lt({measure:V.dragOverlay.measure}),Fe=(r=nt.nodeRef.current)!=null?r:W,wt=D?(i=nt.rect)!=null?i:Ce:null,Ge=!!(nt.nodeRef.current&&nt.rect),Ct=Mlt(Ge?null:Ce),Ot=Fue(Fe?ro(Fe):null),it=Llt(D?tt??W:null),le=jlt(it),he=Uue(g,{transform:{x:H.x-Ct.x,y:H.y-Ct.y,scaleX:1,scaleY:1},activatorEvent:Q,active:X,activeNodeRect:Ce,containerNodeRect:Oe,draggingNodeRect:wt,over:ve.current.over,overlayNodeRect:nt.rect,scrollableAncestors:it,scrollableAncestorRects:le,windowRect:Ot}),ge=ie?ih(ie,H):null,Ae=Plt(it),Le=kW(Ae),O=kW(Ae,[Ce]),$=ih(he,Le),ne=wt?llt(wt,he):null,de=X&&ne?f({active:X,collisionRect:ne,droppableRects:P,droppableContainers:Z,pointerCoordinates:ge}):null,Te=tlt(de,"id"),[ke,Be]=v.useState(null),$e=Ge?he:ih(he,O),He=slt($e,(o=ke?.rect)!=null?o:null,Ce),Ke=v.useRef(null),xe=v.useCallback((Nt,_t)=>{let{sensor:Ze,options:Tt}=_t;if(U.current==null)return;const rt=M.get(U.current);if(!rt)return;const Rt=Nt.nativeEvent,Xt=new Ze({active:U.current,activeNode:rt,event:Rt,options:Tt,context:ve,onAbort(Mt){if(!M.get(Mt))return;const{onDragAbort:nn}=re.current,An={id:Mt};nn?.(An),T({type:"onDragAbort",event:An})},onPending(Mt,pn,nn,An){if(!M.get(Mt))return;const{onDragPending:or}=re.current,kr={id:Mt,constraint:pn,initialCoordinates:nn,offset:An};or?.(kr),T({type:"onDragPending",event:kr})},onStart(Mt){const pn=U.current;if(pn==null)return;const nn=M.get(pn);if(!nn)return;const{onDragStart:An}=re.current,Ai={activatorEvent:Rt,active:{id:pn,data:nn.data,rect:z}};Yr.unstable_batchedUpdates(()=>{An?.(Ai),_(Uc.Initializing),w({type:Gr.DragStart,initialCoordinates:Mt,active:pn}),T({type:"onDragStart",event:Ai}),G(Ke.current),J(Rt)})},onMove(Mt){w({type:Gr.DragMove,coordinates:Mt})},onEnd:It(Gr.DragEnd),onCancel:It(Gr.DragCancel)});Ke.current=Xt;function It(Mt){return async function(){const{active:nn,collisions:An,over:Ai,scrollAdjustedTranslate:or}=ve.current;let kr=null;if(nn&&or){const{cancelDrop:Jo}=re.current;kr={activatorEvent:Rt,active:nn,collisions:An,delta:or,over:Ai},Mt===Gr.DragEnd&&typeof Jo=="function"&&await Promise.resolve(Jo(kr))&&(Mt=Gr.DragCancel)}U.current=null,Yr.unstable_batchedUpdates(()=>{w({type:Mt}),_(Uc.Uninitialized),Be(null),G(null),J(null),Ke.current=null;const Jo=Mt===Gr.DragEnd?"onDragEnd":"onDragCancel";if(kr){const Zr=re.current[Jo];Zr?.(kr),T({type:Jo,event:kr})}})}}},[M]),Ue=v.useCallback((Nt,_t)=>(Ze,Tt)=>{const rt=Ze.nativeEvent,Rt=M.get(Tt);if(U.current!==null||!Rt||rt.dndKit||rt.defaultPrevented)return;const Xt={active:Rt};Nt(Ze,_t.options,Xt)===!0&&(rt.dndKit={capturedBy:_t.sensor},U.current=Tt,xe(Ze,_t))},[M,xe]),Xe=_lt(u,Ue);Flt(u),pa(()=>{Ce&&R===Uc.Initializing&&_(Uc.Initialized)},[Ce,R]),v.useEffect(()=>{const{onDragMove:Nt}=re.current,{active:_t,activatorEvent:Ze,collisions:Tt,over:rt}=ve.current;if(!_t||!Ze)return;const Rt={active:_t,activatorEvent:Ze,collisions:Tt,delta:{x:$.x,y:$.y},over:rt};Yr.unstable_batchedUpdates(()=>{Nt?.(Rt),T({type:"onDragMove",event:Rt})})},[$.x,$.y]),v.useEffect(()=>{const{active:Nt,activatorEvent:_t,collisions:Ze,droppableContainers:Tt,scrollAdjustedTranslate:rt}=ve.current;if(!Nt||U.current==null||!_t||!rt)return;const{onDragOver:Rt}=re.current,Xt=Tt.get(Te),It=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,Mt={active:Nt,activatorEvent:_t,collisions:Ze,delta:{x:rt.x,y:rt.y},over:It};Yr.unstable_batchedUpdates(()=>{Be(It),Rt?.(Mt),T({type:"onDragOver",event:Mt})})},[Te]),pa(()=>{ve.current={activatorEvent:Q,active:X,activeNode:W,collisionRect:ne,collisions:de,droppableRects:P,draggableNodes:M,draggingNode:Fe,draggingNodeRect:wt,droppableContainers:F,over:ke,scrollableAncestors:it,scrollAdjustedTranslate:$},z.current={initial:wt,translated:ne}},[X,W,de,ne,M,Fe,wt,P,F,ke,it,$]),Tlt({...te,delta:H,draggingRect:ne,pointerCoordinates:ge,scrollableAncestors:it,scrollableAncestorRects:le});const et=v.useMemo(()=>({active:X,activeNode:W,activeNodeRect:Ce,activatorEvent:Q,collisions:de,containerNodeRect:Oe,dragOverlay:nt,draggableNodes:M,droppableContainers:F,droppableRects:P,over:ke,measureDroppableContainers:se,scrollableAncestors:it,scrollableAncestorRects:le,measuringConfiguration:V,measuringScheduled:ae,windowRect:Ot}),[X,W,Ce,Q,de,Oe,nt,M,F,P,ke,se,it,le,V,ae,Ot]),Bt=v.useMemo(()=>({activatorEvent:Q,activators:Xe,active:X,activeNodeRect:Ce,ariaDescribedById:{draggable:j},dispatch:w,draggableNodes:M,over:ke,measureDroppableContainers:se}),[Q,Xe,X,Ce,w,j,M,ke,se]);return be.createElement(Sue.Provider,{value:A},be.createElement(Py.Provider,{value:Bt},be.createElement($ue.Provider,{value:et},be.createElement(oT.Provider,{value:He},c)),be.createElement(qlt,{disabled:a?.restoreFocus===!1})),be.createElement(Zat,{...a,hiddenTextDescribedById:j}));function bt(){const Nt=K?.autoScrollEnabled===!1,_t=typeof l=="object"?l.enabled===!1:l===!1,Ze=D&&!Nt&&!_t;return typeof l=="object"?{...l,enabled:Ze}:{enabled:Ze}}}),Xlt=v.createContext(null),NW="button",Zlt="Draggable";function Qlt(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Ly(Zlt),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=v.useContext(Py),{role:g=NW,roleDescription:y="draggable",tabIndex:E=0}=i??{},S=l?.id===t,w=v.useContext(S?oT:Xlt),[T,A]=HS(),[R,_]=HS(),D=Blt(s,t),I=A0(n);pa(()=>(f.set(t,{id:t,key:o,node:T,activatorNode:R,data:I}),()=>{const H=f.get(t);H&&H.key===o&&f.delete(t)}),[f,t]);const M=v.useMemo(()=>({role:g,tabIndex:E,"aria-disabled":r,"aria-pressed":S&&g===NW?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,E,S,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:M,isDragging:S,listeners:r?void 0:D,node:T,over:h,setNodeRef:A,setActivatorNodeRef:_,transform:w}}function Hue(){return v.useContext($ue)}const Jlt="Droppable",ect={timeout:25};function zue(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Ly(Jlt),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=v.useContext(Py),u=v.useRef({disabled:n}),f=v.useRef(!1),h=v.useRef(null),g=v.useRef(null),{disabled:y,updateMeasurementsFor:E,timeout:S}={...ect,...i},w=A0(E??r),T=v.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(w.current)?w.current:[w.current]),g.current=null},S)},[S]),A=iT({callback:T,disabled:y||!s}),R=v.useCallback((M,H)=>{A&&(H&&(A.unobserve(H),f.current=!1),M&&A.observe(M))},[A]),[_,D]=HS(R),I=A0(t);return v.useEffect(()=>{!A||!_.current||(A.disconnect(),f.current=!1,A.observe(_.current))},[_,A]),v.useEffect(()=>(a({type:Gr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:_,rect:h,data:I}}),()=>a({type:Gr.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==u.current.disabled&&(a({type:Gr.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:_,over:l,setNodeRef:D}}function tct(e){let{animation:t,children:n}=e;const[r,i]=v.useState(null),[o,s]=v.useState(null),a=zS(n);return!n&&!r&&a&&i(a),pa(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){i(null);return}Promise.resolve(t(c,o)).then(()=>{i(null)})},[t,r,o]),be.createElement(be.Fragment,null,n,r?v.cloneElement(r,{ref:s}):null)}const nct={x:0,y:0,scaleX:1,scaleY:1};function rct(e){let{children:t}=e;return be.createElement(Py.Provider,{value:jue},be.createElement(oT.Provider,{value:nct},t))}const ict={position:"fixed",touchAction:"none"},oct=e=>rT(e)?"transform 250ms ease":void 0,sct=v.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:c,transition:u=oct}=e;if(!a)return null;const f=i?c:{...c,scaleX:1,scaleY:1},h={...ict,width:a.width,height:a.height,top:a.top,left:a.left,transform:Nu.Transform.toString(f),transformOrigin:i&&r?Jat(r,a):void 0,transition:typeof u=="function"?u(r):u,...l};return be.createElement(n,{className:s,style:h,ref:t},o)}),act=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:s}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[l,c]of Object.entries(i))n.node.style.setProperty(l,c);s!=null&&s.active&&n.node.classList.remove(s.active)}},lct=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Nu.Transform.toString(t)},{transform:Nu.Transform.toString(n)}]},cct={duration:250,easing:"ease",keyframes:lct,sideEffects:act({styles:{active:{opacity:"0"}}})};function uct(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return nT((o,s)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=Bue(s);if(!c)return;const{transform:u}=ro(s).getComputedStyle(s),f=Tue(u);if(!f)return;const h=typeof t=="function"?t:dct(t);return Iue(l,i.draggable.measure),h({active:{id:o,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:s,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function dct(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...cct,...e};return o=>{let{active:s,dragOverlay:a,transform:l,...c}=o;if(!t)return;const u={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},f={scaleX:l.scaleX!==1?s.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?s.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-u.x,y:l.y-u.y,...f},g=i({...c,active:s,dragOverlay:a,transform:{initial:l,final:h}}),[y]=g,E=g[g.length-1];if(JSON.stringify(y)===JSON.stringify(E))return;const S=r?.({active:s,dragOverlay:a,...c}),w=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(T=>{w.onfinish=()=>{S?.(),T()}})}}let _W=0;function fct(e){return v.useMemo(()=>{if(e!=null)return _W++,_W},[e])}const pct=be.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:s,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:g,draggableNodes:y,droppableContainers:E,dragOverlay:S,over:w,measuringConfiguration:T,scrollableAncestors:A,scrollableAncestorRects:R,windowRect:_}=Hue(),D=v.useContext(oT),I=fct(f?.id),M=Uue(s,{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:g,draggingNodeRect:S.rect,over:w,overlayNodeRect:S.rect,scrollableAncestors:A,scrollableAncestorRects:R,transform:D,windowRect:_}),H=TF(h),F=uct({config:r,draggableNodes:y,droppableContainers:E,measuringConfiguration:T}),B=H?S.setRef:void 0;return be.createElement(rct,null,be.createElement(tct,{animation:F},f&&I?be.createElement(sct,{key:I,id:f.id,ref:B,as:a,activatorEvent:u,adjustScale:t,className:l,transition:o,rect:H,style:{zIndex:c,...i},transform:M},n):null))});function YS(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function hct(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function Zv(e){return e!==null&&e>=0}function mct(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function gct(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Vue=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=YS(t,r,n),s=t[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},Gue="Sortable",que=be.createContext({activeIndex:-1,containerId:Gue,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Vue,disabled:{draggable:!1,droppable:!1}});function bct(e){let{children:t,id:n,items:r,strategy:i=Vue,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Hue(),f=Ly(Gue,n),h=a.rect!==null,g=v.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),y=s!=null,E=s?g.indexOf(s.id):-1,S=c?g.indexOf(c.id):-1,w=v.useRef(g),T=!mct(g,w.current),A=S!==-1&&E===-1||T,R=gct(o);pa(()=>{T&&y&&u(g)},[T,g,y,u]),v.useEffect(()=>{w.current=g},[g]);const _=v.useMemo(()=>({activeIndex:E,containerId:f,disabled:R,disableTransforms:A,items:g,overIndex:S,useDragOverlay:h,sortedRects:hct(g,l),strategy:i}),[E,f,R.draggable,R.droppable,A,g,S,l,h,i]);return be.createElement(que.Provider,{value:_},t)}const yct=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return YS(n,r,i).indexOf(t)},vct=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},xct={duration:200,easing:"ease"},Wue="transform",Ect=Nu.Transition.toString({property:Wue,duration:0,easing:"linear"}),Sct={roleDescription:"sortable"};function wct(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=v.useState(null),a=v.useRef(n);return pa(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=vm(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),v.useEffect(()=>{o&&s(null)},[o]),o}function Cct(e){let{animateLayoutChanges:t=vct,attributes:n,disabled:r,data:i,getNewIndex:o=yct,id:s,strategy:a,resizeObserverConfig:l,transition:c=xct}=e;const{items:u,containerId:f,activeIndex:h,disabled:g,disableTransforms:y,sortedRects:E,overIndex:S,useDragOverlay:w,strategy:T}=v.useContext(que),A=Tct(r,g),R=u.indexOf(s),_=v.useMemo(()=>({sortable:{containerId:f,index:R,items:u},...i}),[f,i,R,u]),D=v.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:I,node:M,isOver:H,setNodeRef:F}=zue({id:s,data:_,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...l}}),{active:B,activatorEvent:z,activeNodeRect:X,attributes:U,setNodeRef:K,listeners:G,isDragging:Q,over:J,setActivatorNodeRef:re,transform:j}=Qlt({id:s,data:_,attributes:{...Sct,...n},disabled:A.draggable}),Z=Bat(F,K),V=!!B,P=V&&!y&&Zv(h)&&Zv(S),se=!w&&Q,ae=se&&P?j:null,ie=P?ae??(a??T)({rects:E,activeNodeRect:X,activeIndex:h,overIndex:S,index:R}):null,te=Zv(h)&&Zv(S)?o({id:s,items:u,activeIndex:h,overIndex:S}):R,fe=B?.id,Ce=v.useRef({activeId:fe,items:u,newIndex:te,containerId:f}),Oe=u!==Ce.current.items,ve=t({active:B,containerId:f,isDragging:Q,isSorting:V,id:s,index:R,items:u,newIndex:Ce.current.newIndex,previousItems:Ce.current.items,previousContainerId:Ce.current.containerId,transition:c,wasDragging:Ce.current.activeId!=null}),tt=wct({disabled:!ve,index:R,node:M,rect:I});return v.useEffect(()=>{V&&Ce.current.newIndex!==te&&(Ce.current.newIndex=te),f!==Ce.current.containerId&&(Ce.current.containerId=f),u!==Ce.current.items&&(Ce.current.items=u)},[V,te,f,u]),v.useEffect(()=>{if(fe===Ce.current.activeId)return;if(fe!=null&&Ce.current.activeId==null){Ce.current.activeId=fe;return}const Fe=setTimeout(()=>{Ce.current.activeId=fe},50);return()=>clearTimeout(Fe)},[fe]),{active:B,activeIndex:h,attributes:U,data:_,rect:I,index:R,newIndex:te,items:u,isOver:H,isSorting:V,isDragging:Q,listeners:G,node:M,overIndex:S,over:J,setNodeRef:Z,setActivatorNodeRef:re,setDroppableNodeRef:F,setDraggableNodeRef:K,transform:tt??ie,transition:nt()};function nt(){if(tt||Oe&&Ce.current.newIndex===R)return Ect;if(!(se&&!rT(z)||!c)&&(V||ve))return Nu.Transition.toString({...c,property:Wue})}}function Tct(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}Cn.Down,Cn.Right,Cn.Up,Cn.Left;const kct={},RW=e=>{let t;const n=new Set,r=(u,f)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(y=>y(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(kct?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,i,l);return l},Act=e=>e?RW(e):RW,Yue={},{useDebugValue:Nct}=be,{useSyncExternalStoreWithSelector:_ct}=cYe;let DW=!1;const Rct=e=>e;function Dct(e,t=Rct,n){(Yue?"production":void 0)!=="production"&&n&&!DW&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),DW=!0);const r=_ct(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Nct(r),r}const IW=e=>{(Yue?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Act(e):e,n=(r,i)=>Dct(t,r,i);return Object.assign(n,t),n},Ict=e=>e?IW(e):IW;var OW,MW;const LW=typeof window<"u"&&((OW=window.document)!=null&&OW.createElement||((MW=window.navigator)==null?void 0:MW.product)==="ReactNative")?be.useLayoutEffect:be.useEffect;function Oct(){const e=Ict(t=>({current:new Array,version:0,set:t}));return{In:({children:t})=>{const n=e(i=>i.set),r=e(i=>i.version);return LW(()=>{n(i=>({version:i.version+1}))},[]),LW(()=>(n(({current:i})=>({current:[...i,t]})),()=>n(({current:i})=>({current:i.filter(o=>o!==t)}))),[t,r]),null},Out:()=>{const t=e(n=>n.current);return be.createElement(be.Fragment,null,t)}}}const i_=768;function sT(){const[e,t]=v.useState(void 0);return v.useEffect(()=>{const n=window.matchMedia(`(max-width: ${i_-1}px)`),r=()=>{t(window.innerWidth<i_)};return n.addEventListener("change",r),t(window.innerWidth<i_),()=>n.removeEventListener("change",r)},[]),!!e}const Kue=Oct(),kF=v.createContext({columns:[],data:[],activeCardId:null}),Mct=({id:e,children:t,className:n})=>{const{isOver:r,setNodeRef:i}=zue({id:e});return m.jsx("div",{className:Re("flex min-h-40 flex-col divide-y overflow-hidden rounded-md border bg-secondary text-xs shadow-sm ring-2 transition-all shrink-0",r?"ring-primary":"ring-transparent",n),ref:i,children:t})},Lct=({id:e,name:t,children:n,className:r})=>{const{attributes:i,listeners:o,setNodeRef:s,transition:a,transform:l,isDragging:c}=Cct({id:e}),{activeCardId:u}=v.useContext(kF),f={transition:a,transform:Nu.Transform.toString(l)};return m.jsxs(m.Fragment,{children:[m.jsx("div",{style:f,...o,...i,ref:s,children:m.jsx(Bd,{className:Re("cursor-grab gap-4 rounded-md p-3 shadow-sm",c&&"pointer-events-none cursor-grabbing opacity-30",r),children:n??m.jsx("p",{className:"m-0 font-medium text-sm",children:t})})}),u===e&&m.jsx(Kue.In,{children:m.jsx(Bd,{className:Re("cursor-grab gap-4 rounded-md p-3 shadow-sm ring-2 ring-primary",c&&"cursor-grabbing",r),children:n??m.jsx("p",{className:"m-0 font-medium text-sm",children:t})})})]})},Pct=({children:e,className:t,...n})=>{const{data:r}=v.useContext(kF),i=r.filter(s=>s.column===n.id),o=i.map(s=>s.id);return m.jsxs(Yi,{className:"overflow-hidden flex-1",children:[m.jsx(bct,{items:o,children:m.jsx("div",{className:Re("flex flex-grow flex-col gap-2 p-2",t),...n,children:i.map(e)})}),m.jsx(uw,{orientation:"vertical"})]})},Fct=({className:e,...t})=>m.jsx("div",{className:Re("m-0 p-2 font-semibold text-sm",e),...t}),Bct=e=>t=>{const{droppableRects:n,droppableContainers:r,pointerCoordinates:i}=t,o=y=>!e.includes(y),s=y=>e.includes(y),a=olt(t),l=a.filter(y=>o(y.id)),c=a.filter(y=>s(y.id));if(l.length>0){const E=yW(t).filter(S=>o(S.id));return E.length>0?[E[0]]:[l[0]]}if(c.length>0)return[c[0]];const u=wue(t),f=u.filter(y=>o(y.id)),h=u.filter(y=>s(y.id));if(f.length>0){const E=nlt(t).filter(S=>o(S.id));return E.length>0?[E[0]]:[f[0]]}if(h.length>0)return[h[0]];if(i){let y=null;for(const E of e){const S=n.get(E);if(!S)continue;const w=S.left+S.width/2,T=S.top+S.height/2,A=Math.sqrt(Math.pow(i.x-w,2)+Math.pow(i.y-T,2)),R={left:S.left-150,right:S.right+150,top:S.top-50,bottom:S.bottom+50};i.x>=R.left&&i.x<=R.right&&i.y>=R.top&&i.y<=R.bottom&&(!y||A<y.distance)&&(y={id:E,distance:A})}if(y)return[{id:y.id}]}const g=yW(t);if(g.length>0){const y=g.find(E=>s(E.id));return y?[y]:[g[0]]}return[]},jct=({children:e,onDragStart:t,onDragEnd:n,onDragOver:r,className:i,columns:o,data:s,onDataChange:a,...l})=>{const[c,u]=v.useState(null),f=sT(),h=v.useMemo(()=>o.map(A=>A.id),[o]),g=v.useMemo(()=>Bct(h),[h]),y=Qat(e_(Lue,{activationConstraint:{distance:8}}),e_(Pue,{activationConstraint:{delay:150,tolerance:8}}),e_(wF)),E=A=>{s.find(_=>_.id===A.active.id)&&u(A.active.id),t?.(A)},S=A=>{const{active:R,over:_}=A;if(!_)return;const D=s.find(B=>B.id===R.id),I=s.find(B=>B.id===_.id);if(!D)return;const M=D.column,F=o.some(B=>B.id===_.id)?_.id:I?.column||M;if(M!==F){let B=[...s];const z=B.findIndex(X=>X.id===R.id);if(B[z]={...B[z],column:F},I){const X=B.findIndex(U=>U.id===_.id);B=YS(B,z,X)}a?.(B)}r?.(A)},w=A=>{u(null),n?.(A);const{active:R,over:_}=A;if(!_||R.id===_.id)return;if(o.some(F=>F.id===_.id)){const F=s.find(B=>B.id===R.id);if(F&&F.column!==_.id){let B=[...s];const z=B.findIndex(X=>X.id===R.id);B[z]={...B[z],column:_.id},a?.(B)}return}let I=[...s];const M=I.findIndex(F=>F.id===R.id),H=I.findIndex(F=>F.id===_.id);M!==-1&&H!==-1&&(I=YS(I,M,H),a?.(I))},T={onDragStart({active:A}){const{name:R,column:_}=s.find(D=>D.id===A.id)??{};return`Picked up the card "${R}" from the "${_}" column`},onDragOver({active:A,over:R}){const{name:_}=s.find(I=>I.id===A.id)??{},D=o.find(I=>I.id===R?.id)?.name;return`Dragged the card "${_}" over the "${D}" column`},onDragEnd({active:A,over:R}){const{name:_}=s.find(I=>I.id===A.id)??{},D=o.find(I=>I.id===R?.id)?.name;return`Dropped the card "${_}" into the "${D}" column`},onDragCancel({active:A}){const{name:R}=s.find(_=>_.id===A.id)??{};return`Cancelled dragging the card "${R}"`}};return m.jsx(kF.Provider,{value:{columns:o,data:s,activeCardId:c},children:m.jsxs(Klt,{accessibility:{announcements:T},collisionDetection:g,onDragEnd:w,onDragOver:S,onDragStart:E,sensors:y,...l,children:[m.jsx("div",{className:Re("flex gap-4",f&&"flex-col",i),children:o.map(A=>e(A))}),typeof window<"u"&&Yr.createPortal(m.jsx(pct,{children:m.jsx(Kue.Out,{})}),document.body)]})})},PW={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold"};function qg(e){return PW[e]?PW[e]:e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function $ct({tasks:e,loading:t,onTasksUpdate:n}){const{config:r,updateConfig:i}=sf(),[o,s]=v.useState(new Set),[a,l]=v.useState(!1),c=sT(),u=r?.statuses||["todo","in-progress","in-review","done","blocked"],f=r?.statusColors||oO,h=v.useMemo(()=>u.filter(F=>o.has(F)).map(F=>({id:F,name:qg(F),color:f[F]||"gray"})),[u,o,f]),g={high:0,medium:1,low:2},y=v.useMemo(()=>[...e].sort((B,z)=>{const X=g[B.priority]??2,U=g[z.priority]??2;return X!==U?X-U:new Date(z.updatedAt).getTime()-new Date(B.updatedAt).getTime()}).map(B=>({id:B.id,name:B.title,column:B.status,task:B})),[e]),E=()=>{const B=window.location.hash.slice(1).match(/^\/kanban\/([^?]+)/);if(!B)return null;const z=B[1];return e.find(X=>X.id===z)||null},[S,w]=v.useState(E());v.useEffect(()=>{const F=()=>{w(E())};return w(E()),window.addEventListener("hashchange",F),()=>window.removeEventListener("hashchange",F)},[e]),v.useEffect(()=>{r?.visibleColumns?s(new Set(r.visibleColumns)):s(new Set(u))},[r?.visibleColumns,u.join(",")]);const T=async F=>{try{await i({visibleColumns:[...F]})}catch(B){console.error("Failed to save config:",B)}},A=F=>{s(B=>{const z=new Set(B);return z.has(F)?z.delete(F):z.add(F),T(z),z})},R=async F=>{const B=F.filter(X=>{const U=e.find(K=>K.id===X.id);return U&&U.status!==X.column}),z=e.map(X=>{const U=F.find(K=>K.id===X.id);return U&&U.column!==X.status?{...X,status:U.column}:X});n(z);for(const X of B)try{await ta.updateTask(X.id,{status:X.column}),jl.success("Status updated",{description:`#${X.id} moved to ${qg(X.column)}`})}catch(U){console.error("Failed to update task:",U),jl.error("Failed to update status",{description:U instanceof Error?U.message:"Unknown error"}),ta.getTasks().then(n).catch(console.error);break}};if(t)return m.jsx("div",{className:"flex items-center justify-center h-64",children:m.jsxs("div",{className:"text-center",children:[m.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary"}),m.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading tasks..."})]})});const _=F=>{window.location.hash=`/kanban/${F.id}`},D=()=>{window.location.hash="/"},I=F=>{n(e.map(B=>B.id===F.id?F:B))},M=F=>{window.location.hash=`/kanban/${F}`},H=async F=>{try{await ta.archiveTask(F),n(e.filter(B=>B.id!==F)),D()}catch(B){console.error("Failed to archive task:",B)}};return m.jsxs("div",{className:"flex flex-col h-full",children:[c?m.jsxs(hue,{open:a,onOpenChange:l,className:"shrink-0 bg-card rounded-lg mb-4 border border-border",children:[m.jsxs(mue,{className:"flex items-center justify-between w-full p-3",children:[m.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Show Columns (",o.size,"/",u.length,")"]}),a?m.jsx(eY,{className:"w-4 h-4 text-muted-foreground"}):m.jsx(uu,{className:"w-4 h-4 text-muted-foreground"})]}),m.jsx(gue,{children:m.jsx("div",{className:"flex flex-wrap gap-2 px-3 pb-3",children:u.map(F=>{const B=o.has(F),z=e.filter(X=>X.status===F).length;return m.jsxs("button",{type:"button",onClick:()=>A(F),className:Re("flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-colors text-xs",B?"bg-primary/10 text-primary dark:bg-primary/20":"bg-muted text-muted-foreground"),children:[B?m.jsx(g_,{className:"w-3.5 h-3.5"}):m.jsx(m_,{className:"w-3.5 h-3.5"}),m.jsxs("span",{className:"font-medium",children:[qg(F)," (",z,")"]})]},F)})})})]}):m.jsx("div",{className:"shrink-0 bg-card rounded-lg p-4 mb-4 border border-border",children:m.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[m.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Show Columns:"}),u.map(F=>{const B=o.has(F),z=e.filter(X=>X.status===F).length;return m.jsxs("button",{type:"button",onClick:()=>A(F),className:Re("flex items-center gap-2 px-3 py-1.5 rounded-lg transition-colors",B?"bg-primary/10 text-primary dark:bg-primary/20":"bg-muted text-muted-foreground"),children:[B?m.jsx(g_,{className:"w-4 h-4"}):m.jsx(m_,{className:"w-4 h-4"}),m.jsxs("span",{className:"text-sm font-medium",children:[qg(F)," (",z,")"]})]},F)})]})}),m.jsxs(Yi,{className:"flex-1",children:[o.size>0?m.jsx(jct,{columns:h,data:y,onDataChange:R,className:"min-h-full pb-4",children:F=>{const B=ASe(F.id,f),z=y.filter(X=>X.column===F.id).length;return m.jsxs(Mct,{id:F.id,className:Re("min-w-[320px] max-w-[380px]",c&&"min-w-0 max-w-none w-full",B.bg,B.border),children:[m.jsxs(Fct,{className:"flex items-center justify-between",children:[m.jsx("span",{className:"font-bold text-sm uppercase tracking-wide text-foreground",children:F.name}),m.jsx("span",{className:"text-xs rounded-full px-2 py-1 font-medium text-muted-foreground bg-background",children:z})]}),m.jsx(Pct,{id:F.id,children:X=>m.jsx(Uct,{item:X,statusColors:f,onClick:()=>_(X.task)},X.id)})]},F.id)}}):m.jsx("div",{className:"text-center py-12",children:m.jsx("p",{className:"text-lg text-muted-foreground",children:"No columns visible. Please select at least one column to display."})}),m.jsx(uw,{orientation:"horizontal"})]}),m.jsx(vue,{task:S,allTasks:e,onClose:D,onUpdate:I,onArchive:H,onNavigateToTask:M})]})}function Uct({item:e,statusColors:t,onClick:n}){const{task:r}=e,i=uh(r.status,t),o=r.acceptanceCriteria.filter(a=>a.completed).length,s=r.acceptanceCriteria.length;return m.jsx(Lct,{id:e.id,name:e.name,column:e.column,className:"w-full",children:m.jsxs("div",{onClick:n,onKeyDown:a=>a.key==="Enter"&&n(),role:"button",tabIndex:0,className:"cursor-pointer",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[m.jsxs("span",{className:"text-xs font-mono shrink-0 text-muted-foreground",children:["#",r.id]}),m.jsxs("div",{className:"flex items-center gap-1 flex-wrap justify-end",children:[m.jsx("span",{className:Re("text-xs px-1.5 py-0.5 rounded font-medium",i),children:qg(r.status)}),r.priority==="high"&&m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-destructive/10 text-destructive dark:bg-destructive/20",children:"HIGH"}),r.priority==="medium"&&m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",children:"MED"})]})]}),m.jsx("h3",{className:"font-medium text-sm mb-2 line-clamp-2 text-foreground",children:r.title}),s>0&&m.jsxs("div",{className:"flex items-center gap-2 text-xs mb-2 text-muted-foreground",children:[m.jsx(nY,{className:"w-3 h-3","aria-hidden":"true"}),m.jsxs("span",{children:[o,"/",s]})]}),r.labels.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:r.labels.map(a=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-secondary text-secondary-foreground",children:a},a))}),r.assignee&&m.jsxs("div",{className:"flex items-center gap-1.5 text-xs mt-2 text-muted-foreground",children:[m.jsx(k0,{name:r.assignee,size:"sm"}),m.jsx("span",{children:r.assignee})]})]})})}const FW=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],BW={low:"bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-400",medium:"bg-amber-100 dark:bg-amber-900 text-amber-700 dark:text-amber-300",high:"bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300"};function Hct({isOpen:e,allTasks:t,onClose:n,onCreated:r}){const{currentUser:i}=QX(),{config:o}=sf(),s=v.useRef(null),a=v.useRef(null),l=v.useMemo(()=>{const O=o.statuses||["todo","in-progress","in-review","done","blocked"];return rZ(O)},[o.statuses]),c=o.statusColors||{},[u,f]=v.useState(""),[h,g]=v.useState(""),[y,E]=v.useState("todo"),[S,w]=v.useState("medium"),[T,A]=v.useState(""),[R,_]=v.useState([]),[D,I]=v.useState(""),[M,H]=v.useState([]),[F,B]=v.useState(""),[z,X]=v.useState(""),[U,K]=v.useState(!1),[G,Q]=v.useState(null),[J,re]=v.useState(!1),[j,Z]=v.useState(""),[V,P]=v.useState(!1),[se,ae]=v.useState(""),[W,ie]=v.useState(!1),[te,fe]=v.useState(!1),{preferences:Ce,toggleTaskCreateLayout:Oe}=tZ(),ve=Ce.taskCreateLayout==="maximized",tt=v.useRef(null),nt={hidden:{opacity:0,y:20,scale:.98},visible:{opacity:1,y:0,scale:1,transition:{duration:.2,ease:"easeOut"}},exit:{opacity:0,y:10,scale:.98,transition:{duration:.15,ease:"easeIn"}}};v.useEffect(()=>{e||(f(""),g(""),E("todo"),w("medium"),A(""),_([]),I(""),H([]),B(""),X(""),Q(null),re(!1),Z(""),P(!1),ae(""),ie(!1),fe(!1))},[e]),v.useEffect(()=>{e&&setTimeout(()=>s.current?.focus(),100)},[e,ve]),v.useEffect(()=>{V&&tt.current&&tt.current.focus()},[V]);const Fe=v.useCallback(()=>{j.trim()&&(H(O=>[...O,{id:crypto.randomUUID(),text:j.trim()}]),Z(""),P(!1))},[j]),wt=v.useCallback(O=>{H($=>$.filter(ne=>ne.id!==O))},[]),Ge=v.useCallback(()=>{se.trim()&&(R.includes(se.trim())||_(O=>[...O,se.trim()]),ae(""),ie(!1))},[se,R]),Ct=v.useCallback(O=>{_($=>$.filter(ne=>ne!==O))},[]),Ot=async O=>{if(O.preventDefault(),Q(null),!u.trim()){Q("Title is required");return}K(!0);try{const $={title:u.trim(),description:h.trim()||void 0,status:y,priority:S,labels:R,assignee:T.trim()||void 0,parent:D||void 0,acceptanceCriteria:M.map(ne=>({text:ne.text,completed:!1})),implementationPlan:F.trim()||void 0,implementationNotes:z.trim()||void 0};await Xpe($),re(!0),jl.success("Task created successfully",{description:u.trim()}),setTimeout(()=>{r(),n()},800)}catch($){const ne=$ instanceof Error?$.message:"Failed to create task";Q(ne),jl.error("Failed to create task",{description:ne})}finally{K(!1)}},it=D?t.find(O=>O.id===D):null,le=m.jsxs("div",{className:"flex items-center justify-between gap-2 p-4 border-b bg-green-700",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"text-green-100 text-xs font-medium uppercase tracking-wide",children:"New Task"}),m.jsx("input",{ref:s,type:"text",value:u,onChange:O=>f(O.target.value),placeholder:"Enter task title...",className:"w-full text-lg font-semibold bg-white/20 text-white placeholder-white/60 border-0 rounded px-2 py-1 mt-1 focus:outline-none focus:ring-2 focus:ring-white/50",disabled:U})]}),m.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[m.jsx(Qe,{variant:"ghost",size:"icon",onClick:Oe,className:"h-8 w-8 text-foreground hover:text-foreground",title:ve?"Minimize":"Maximize",children:ve?m.jsx(lY,{className:"w-4 h-4"}):m.jsx(aY,{className:"w-4 h-4"})}),m.jsx(Qe,{variant:"ghost",size:"icon",onClick:n,className:"h-8 w-8 text-foreground hover:text-foreground",title:"Close",children:m.jsx(Ho,{className:"w-4 h-4"})})]})]}),he=(J||G)&&m.jsxs("div",{className:"px-4 pt-4",children:[J&&m.jsx("div",{className:"bg-green-50 dark:bg-green-900/50 border border-green-200 dark:border-green-700 text-green-700 dark:text-green-300 px-4 py-2 rounded-lg text-sm",children:"Task created successfully!"}),G&&m.jsx("div",{className:"bg-red-50 dark:bg-red-900/50 border border-red-200 dark:border-red-700 text-red-700 dark:text-red-300 px-4 py-2 rounded-lg text-sm",children:G})]}),ge=m.jsxs("div",{className:"p-6 space-y-6",children:[m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(uY,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Description"})]}),m.jsx(au,{markdown:h,onChange:g,placeholder:"Add a more detailed description...",readOnly:U})]}),m.jsxs("section",{children:[m.jsx("div",{className:"flex items-center justify-between mb-3",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(of,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Acceptance Criteria"}),M.length>0&&m.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",M.length,")"]})]})}),m.jsx("div",{className:"space-y-2",children:M.map(O=>m.jsxs("div",{className:"flex items-start gap-2 bg-muted/50 rounded-lg px-3 py-2 group hover:shadow-sm transition-shadow",children:[m.jsx("input",{type:"checkbox",checked:!1,disabled:!0,className:"mt-1 w-4 h-4 rounded cursor-not-allowed opacity-50"}),m.jsx("span",{className:"flex-1 text-sm",children:O.text}),m.jsx("button",{type:"button",onClick:()=>wt(O.id),className:"opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-red-500 p-1 transition-all",title:"Delete",children:m.jsx(Pd,{className:"w-4 h-4"})})]},O.id))}),V?m.jsxs("div",{className:"mt-2 bg-muted/50 rounded-lg px-3 py-2",children:[m.jsx("input",{ref:tt,type:"text",value:j,onChange:O=>Z(O.target.value),onKeyDown:O=>{O.key==="Enter"&&j.trim()&&(O.preventDefault(),Fe()),O.key==="Escape"&&(Z(""),P(!1))},placeholder:"Add an item...",className:"w-full border border-input rounded px-2 py-1.5 text-sm bg-background focus:outline-none focus:ring-2 focus:ring-green-500",disabled:U}),m.jsxs("div",{className:"flex gap-2 mt-2",children:[m.jsx(Qe,{type:"button",size:"sm",onClick:Fe,disabled:!j.trim()||U,className:"bg-green-700 hover:bg-green-800 text-white",children:"Add"}),m.jsx(Qe,{type:"button",variant:"ghost",size:"sm",onClick:()=>{Z(""),P(!1)},children:"Cancel"})]})]}):m.jsxs("button",{type:"button",onClick:()=>P(!0),className:"mt-2 flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground hover:bg-muted px-3 py-2 rounded-lg transition-colors w-full",disabled:U,children:[m.jsx(Cs,{className:"w-4 h-4"}),m.jsx("span",{children:"Add an item"})]})]}),m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Vo,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Implementation Plan"}),m.jsx("span",{className:"text-xs text-muted-foreground",children:"(optional)"})]}),m.jsx(au,{markdown:F,onChange:B,placeholder:"Describe how you plan to implement this task...",readOnly:U})]}),m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Fme,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Implementation Notes"}),m.jsx("span",{className:"text-xs text-muted-foreground",children:"(optional)"})]}),m.jsx(au,{markdown:z,onChange:X,placeholder:"Add notes, observations, or any other relevant information...",readOnly:U})]})]}),Ae=m.jsxs("div",{className:"p-4 space-y-6",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Status"}),m.jsxs(qi,{value:y,onValueChange:O=>E(O),disabled:U,children:[m.jsx(Mi,{className:Re("w-full",uh(y,c)),children:m.jsx(Wi,{})}),m.jsx(Li,{children:l.map(O=>m.jsx(Tn,{value:O.value,children:O.label},O.value))})]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Priority"}),m.jsxs(qi,{value:S,onValueChange:O=>w(O),disabled:U,children:[m.jsx(Mi,{className:Re("w-full",BW[S]),children:m.jsx(Wi,{})}),m.jsx(Li,{children:FW.map(O=>m.jsx(Tn,{value:O.value,children:O.label},O.value))})]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Assignee"}),m.jsx(jS,{value:T,onChange:A,showGrabButton:!1,currentUser:i,container:a.current})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Labels"}),m.jsx("div",{className:"flex flex-wrap gap-1",children:R.map(O=>m.jsxs(Yl,{variant:"secondary",className:"gap-1 pr-1",children:[O,m.jsx("button",{type:"button",onClick:()=>Ct(O),className:"ml-1 hover:text-destructive",children:m.jsx(Ho,{className:"w-3 h-3"})})]},O))}),W?m.jsxs("div",{className:"space-y-2",children:[m.jsx(Wr,{value:se,onChange:O=>ae(O.target.value),onKeyDown:O=>{O.key==="Enter"&&se.trim()&&(O.preventDefault(),Ge()),O.key==="Escape"&&(ae(""),ie(!1))},placeholder:"Label name",disabled:U,autoFocus:!0}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(Qe,{size:"sm",onClick:Ge,disabled:!se.trim()||U,children:"Add"}),m.jsx(Qe,{size:"sm",variant:"ghost",onClick:()=>{ae(""),ie(!1)},children:"Cancel"})]})]}):m.jsxs(Qe,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground",onClick:()=>ie(!0),disabled:U,children:[m.jsx(Cs,{className:"w-4 h-4 mr-2"}),"Add label"]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Parent Task"}),m.jsxs(E0,{open:te,onOpenChange:fe,children:[m.jsx(S0,{asChild:!0,children:m.jsxs(Qe,{variant:"outline",role:"combobox","aria-expanded":te,className:"w-full justify-between h-auto min-h-10 py-2",disabled:U,title:it?`#${it.id} - ${it.title}`:void 0,children:[it?m.jsxs("div",{className:"flex items-center gap-2 text-left overflow-hidden min-w-0 flex-1",children:[m.jsx(oh,{className:"w-4 h-4 shrink-0 text-muted-foreground"}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",it.id]}),m.jsx("p",{className:"truncate text-sm",children:it.title})]})]}):m.jsx("span",{className:"text-muted-foreground",children:"Select parent task..."}),m.jsx(jx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(Dh,{className:"w-[400px] p-0",align:"start",children:m.jsxs(Ih,{children:[m.jsx(Oh,{placeholder:"Search tasks..."}),m.jsxs(Mh,{children:[m.jsx(Lh,{children:"No task found."}),m.jsxs(Va,{children:[m.jsxs(zo,{value:"none",onSelect:()=>{I(""),fe(!1)},children:[m.jsx(Ss,{className:Re("mr-2 h-4 w-4 shrink-0",D?"opacity-0":"opacity-100")}),m.jsx("span",{className:"text-muted-foreground",children:"None"})]}),t.map(O=>m.jsxs(zo,{value:`${O.id} ${O.title}`,onSelect:()=>{I(O.id),fe(!1)},title:`#${O.id} - ${O.title}`,children:[m.jsx(Ss,{className:Re("mr-2 h-4 w-4 shrink-0",D===O.id?"opacity-100":"opacity-0")}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",O.id]}),m.jsx("p",{className:"truncate text-sm",children:O.title})]})]},O.id))]})]})]})})]})]})]}),Le=m.jsxs("div",{className:"border-t px-6 py-4 bg-muted/30 flex justify-end gap-3",children:[m.jsx(Qe,{type:"button",variant:"ghost",onClick:n,disabled:U,children:"Cancel"}),m.jsx(Qe,{type:"button",onClick:Ot,className:"bg-green-700 hover:bg-green-800 text-white",disabled:U||J||!u.trim(),children:U?"Creating...":"Create Task"})]});return ve?m.jsx(Gx,{children:e&&m.jsx(JI,{open:e,onOpenChange:O=>!O&&n(),children:m.jsxs(aw,{className:"max-w-6xl w-[95vw] h-[90vh] p-0 gap-0 overflow-hidden flex flex-col",hideCloseButton:!0,children:[m.jsx(eO,{className:"sr-only",children:"Create New Task"}),m.jsxs(Kx.div,{ref:a,className:"flex flex-col h-full overflow-hidden",variants:nt,initial:"hidden",animate:"visible",exit:"exit",children:[le,he,m.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[m.jsx(Yi,{className:"flex-1",children:ge}),m.jsx("div",{className:"shrink-0 w-72 border-l bg-muted/20",children:m.jsx(Yi,{className:"h-full",children:Ae})})]}),Le]})]})})}):m.jsx(Gx,{children:e&&m.jsx(XI,{open:e,onOpenChange:O=>!O&&n(),children:m.jsx(sw,{side:"right",className:"w-full sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl p-0 flex flex-col gap-0",hideCloseButton:!0,children:m.jsxs(Kx.div,{ref:a,className:"flex flex-col h-full overflow-hidden",variants:nt,initial:"hidden",animate:"visible",exit:"exit",children:[le,he,m.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m.jsx("div",{className:"shrink-0 border-b bg-muted/20",children:m.jsxs("div",{className:"p-4 space-y-3",children:[m.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Status"}),m.jsxs(qi,{value:y,onValueChange:O=>E(O),disabled:U,children:[m.jsx(Mi,{className:Re("w-full h-9",uh(y,c)),children:m.jsx(Wi,{})}),m.jsx(Li,{children:l.map(O=>m.jsx(Tn,{value:O.value,children:O.label},O.value))})]})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Priority"}),m.jsxs(qi,{value:S,onValueChange:O=>w(O),disabled:U,children:[m.jsx(Mi,{className:Re("w-full h-9",BW[S]),children:m.jsx(Wi,{})}),m.jsx(Li,{children:FW.map(O=>m.jsx(Tn,{value:O.value,children:O.label},O.value))})]})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Assignee"}),m.jsx(jS,{value:T,onChange:A,showGrabButton:!1,currentUser:i,container:a.current})]})]}),m.jsxs("div",{className:"flex items-start gap-4 flex-wrap",children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground shrink-0",children:"Labels:"}),m.jsxs("div",{className:"flex flex-wrap gap-1 flex-1",children:[R.map(O=>m.jsxs(Yl,{variant:"secondary",className:"gap-1 pr-1 text-xs",children:[O,m.jsx("button",{type:"button",onClick:()=>Ct(O),className:"ml-0.5 hover:text-destructive",children:m.jsx(Ho,{className:"w-3 h-3"})})]},O)),!W&&m.jsxs(Qe,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs text-muted-foreground",onClick:()=>ie(!0),children:[m.jsx(Cs,{className:"w-3 h-3 mr-1"}),"Add"]})]}),W&&m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Wr,{value:se,onChange:O=>ae(O.target.value),onKeyDown:O=>{O.key==="Enter"&&se.trim()&&Ge(),O.key==="Escape"&&(ae(""),ie(!1))},placeholder:"Label",className:"h-7 w-24 text-xs",autoFocus:!0}),m.jsx(Qe,{size:"sm",className:"h-7 px-2",onClick:Ge,disabled:!se.trim(),children:"Add"}),m.jsx(Qe,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:()=>{ae(""),ie(!1)},children:m.jsx(Ho,{className:"w-3 h-3"})})]})]}),m.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[m.jsx(nr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground shrink-0",children:"Parent:"}),m.jsxs(E0,{open:te,onOpenChange:fe,children:[m.jsx(S0,{asChild:!0,children:m.jsxs(Qe,{variant:"outline",role:"combobox",size:"sm",className:"h-7 justify-between min-w-[120px] max-w-[250px]",disabled:U,title:it?`#${it.id} - ${it.title}`:void 0,children:[it?m.jsxs("span",{className:"truncate text-xs",children:["#",it.id," - ",it.title]}):m.jsx("span",{className:"text-muted-foreground text-xs",children:"None"}),m.jsx(jx,{className:"ml-1 h-3 w-3 shrink-0 opacity-50"})]})}),m.jsx(Dh,{className:"w-[400px] p-0",align:"end",children:m.jsxs(Ih,{children:[m.jsx(Oh,{placeholder:"Search tasks..."}),m.jsxs(Mh,{children:[m.jsx(Lh,{children:"No task found."}),m.jsxs(Va,{children:[m.jsxs(zo,{value:"none",onSelect:()=>{I(""),fe(!1)},children:[m.jsx(Ss,{className:Re("mr-2 h-4 w-4 shrink-0",D?"opacity-0":"opacity-100")}),m.jsx("span",{className:"text-muted-foreground",children:"None"})]}),t.map(O=>m.jsxs(zo,{value:`${O.id} ${O.title}`,onSelect:()=>{I(O.id),fe(!1)},title:`#${O.id} - ${O.title}`,children:[m.jsx(Ss,{className:Re("mr-2 h-4 w-4 shrink-0",D===O.id?"opacity-100":"opacity-0")}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",O.id]}),m.jsx("p",{className:"truncate text-sm",children:O.title})]})]},O.id))]})]})]})})]})]})]})]})}),m.jsx(Yi,{className:"flex-1",children:ge})]}),Le]})})})})}const zct=Ece,Vct=Sce,Gct=wce,Xue=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(art,{children:m.jsx(nF,{ref:r,sideOffset:t,className:Re("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));Xue.displayName=nF.displayName;const qct="sidebar_state",Wct=3600*24*7,Yct="16rem",Kct="18rem",Xct="3rem",Zct="b",Zue=v.createContext(null);function Fy(){const e=v.useContext(Zue);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Que=v.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:o,...s},a)=>{const l=sT(),[c,u]=v.useState(!1),[f,h]=v.useState(e),g=t??f,y=v.useCallback(T=>{const A=typeof T=="function"?T(g):T;n?n(A):h(A),document.cookie=`${qct}=${A}; path=/; max-age=${Wct}`},[n,g]),E=v.useCallback(()=>l?u(T=>!T):y(T=>!T),[l,y,u]);v.useEffect(()=>{const T=A=>{A.key===Zct&&(A.metaKey||A.ctrlKey)&&(A.preventDefault(),E())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[E]);const S=g?"expanded":"collapsed",w=v.useMemo(()=>({state:S,open:g,setOpen:y,isMobile:l,openMobile:c,setOpenMobile:u,toggleSidebar:E}),[S,g,y,l,c,u,E]);return m.jsx(Zue.Provider,{value:w,children:m.jsx(zct,{delayDuration:0,children:m.jsx("div",{style:{"--sidebar-width":Yct,"--sidebar-width-icon":Xct,...i},className:Re("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",r),ref:a,...s,children:o})})})});Que.displayName="SidebarProvider";const Jue=v.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:i,...o},s)=>{const{isMobile:a,state:l,openMobile:c,setOpenMobile:u}=Fy();return n==="none"?m.jsx("div",{className:Re("flex h-full w-[var(--sidebar-width)] flex-col bg-sidebar text-sidebar-foreground",r),ref:s,...o,children:i}):a?m.jsx(XI,{open:c,onOpenChange:u,...o,children:m.jsxs(sw,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[var(--sidebar-width)] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":Kct},side:e,children:[m.jsxs(ZI,{className:"sr-only",children:[m.jsx(QI,{children:"Sidebar"}),m.jsx(MX,{children:"Displays the mobile sidebar."})]}),m.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):m.jsxs("div",{ref:s,className:"group peer hidden text-sidebar-foreground md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":t,"data-side":e,children:[m.jsx("div",{className:Re("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),m.jsx("div",{className:Re("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...o,children:m.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:i})})]})});Jue.displayName="Sidebar";const ede=v.forwardRef(({className:e,onClick:t,...n},r)=>{const{toggleSidebar:i}=Fy();return m.jsxs(Qe,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Re("h-7 w-7",e),onClick:o=>{t?.(o),i()},...n,children:[m.jsx(Sme,{}),m.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});ede.displayName="SidebarTrigger";const tde=v.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:r}=Fy();return m.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:Re("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});tde.displayName="SidebarRail";const Qct=v.forwardRef(({className:e,...t},n)=>m.jsx("main",{ref:n,className:Re("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));Qct.displayName="SidebarInset";const Jct=v.forwardRef(({className:e,...t},n)=>m.jsx(Wr,{ref:n,"data-sidebar":"input",className:Re("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));Jct.displayName="SidebarInput";const nde=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"header",className:Re("flex flex-col gap-2 p-2",e),...t}));nde.displayName="SidebarHeader";const rde=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"footer",className:Re("flex flex-col gap-2 p-2",e),...t}));rde.displayName="SidebarFooter";const eut=v.forwardRef(({className:e,...t},n)=>m.jsx(T0,{ref:n,"data-sidebar":"separator",className:Re("mx-2 w-auto bg-sidebar-border",e),...t}));eut.displayName="SidebarSeparator";const ide=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"content",className:Re("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));ide.displayName="SidebarContent";const ode=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"group",className:Re("relative flex w-full min-w-0 flex-col p-2",e),...t}));ode.displayName="SidebarGroup";const sde=v.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const i=t?Du:"div";return m.jsx(i,{ref:r,"data-sidebar":"group-label",className:Re("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...n})});sde.displayName="SidebarGroupLabel";const tut=v.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const i=t?Du:"button";return m.jsx(i,{ref:r,"data-sidebar":"group-action",className:Re("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...n})});tut.displayName="SidebarGroupAction";const ade=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"group-content",className:Re("w-full text-sm",e),...t}));ade.displayName="SidebarGroupContent";const Lx=v.forwardRef(({className:e,...t},n)=>m.jsx("ul",{ref:n,"data-sidebar":"menu",className:Re("flex w-full min-w-0 flex-col gap-1",e),...t}));Lx.displayName="SidebarMenu";const Px=v.forwardRef(({className:e,...t},n)=>m.jsx("li",{ref:n,"data-sidebar":"menu-item",className:Re("group/menu-item relative",e),...t}));Px.displayName="SidebarMenuItem";const nut=Ql("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),Fx=v.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n="default",size:r="default",tooltip:i,className:o,...s},a)=>{const l=e?Du:"button",{isMobile:c,state:u}=Fy(),f=m.jsx(l,{ref:a,"data-sidebar":"menu-button","data-size":r,"data-active":t,className:Re(nut({variant:n,size:r}),o),...s});return i?(typeof i=="string"&&(i={children:i}),m.jsxs(Vct,{children:[m.jsx(Gct,{asChild:!0,children:f}),m.jsx(Xue,{side:"right",align:"center",hidden:u!=="collapsed"||c,...i})]})):f});Fx.displayName="SidebarMenuButton";const rut=v.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>{const o=t?Du:"button";return m.jsx(o,{ref:i,"data-sidebar":"menu-action",className:Re("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...r})});rut.displayName="SidebarMenuAction";const iut=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:Re("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));iut.displayName="SidebarMenuBadge";const out=v.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{const i=v.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return m.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:Re("flex h-8 items-center gap-2 rounded-md px-2",e),...n,children:[t&&m.jsx(Kq,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),m.jsx(Kq,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":i}})]})});out.displayName="SidebarMenuSkeleton";const sut=v.forwardRef(({className:e,...t},n)=>m.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:Re("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));sut.displayName="SidebarMenuSub";const aut=v.forwardRef(({...e},t)=>m.jsx("li",{ref:t,...e}));aut.displayName="SidebarMenuSubItem";const lut=v.forwardRef(({asChild:e=!1,size:t="md",isActive:n,className:r,...i},o)=>{const s=e?Du:"a";return m.jsx(s,{ref:o,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:Re("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",r),...i})});lut.displayName="SidebarMenuSubButton";const cut=[{id:"kanban",label:"Kanban",icon:lme,href:"#/"},{id:"tasks",label:"Tasks",icon:oY,href:"#/tasks"},{id:"docs",label:"Docs",icon:Vo,href:"#/docs"}];function uut({currentPage:e,onSearchClick:t}){const{state:n}=Fy(),r=sT(),i=n==="expanded";return m.jsxs(Jue,{collapsible:"icon",variant:r?"floating":"sidebar",children:[m.jsxs(nde,{children:[m.jsx(Lx,{children:m.jsx(Px,{children:m.jsx(Fx,{size:"lg",asChild:!0,children:m.jsxs("a",{href:"#/",children:[m.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:m.jsx("span",{className:"text-lg font-bold",children:"◆"})}),m.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[m.jsx("span",{className:"truncate font-semibold",children:"Knowns.dev"}),m.jsx("span",{className:"truncate text-xs",children:"Task Management"})]})]})})})}),i&&m.jsx("div",{className:"px-2 pb-2",children:m.jsxs("button",{type:"button",onClick:t,className:"flex w-full items-center gap-2 rounded-lg border bg-background px-3 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[m.jsx(KS,{className:"h-4 w-4"}),m.jsx("span",{children:"Search..."}),m.jsxs("kbd",{className:"ml-auto pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100",children:[m.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]})})]}),m.jsx(ide,{children:m.jsxs(ode,{children:[m.jsx(sde,{children:"Navigation"}),m.jsx(ade,{children:m.jsx(Lx,{children:cut.map(o=>{const s=e===o.id;return m.jsx(Px,{children:m.jsx(Fx,{asChild:!0,isActive:s,tooltip:o.label,children:m.jsxs("a",{href:o.href,children:[m.jsx(o.icon,{}),m.jsx("span",{children:o.label})]})})},o.id)})})})]})}),m.jsxs(rde,{children:[m.jsx(Lx,{children:m.jsx(Px,{children:m.jsx(Fx,{asChild:!0,isActive:e==="config",tooltip:"Settings",children:m.jsxs("a",{href:"#/config",children:[m.jsx(lI,{}),m.jsx("span",{children:"Settings"})]})})})}),i&&m.jsx("div",{className:"px-3 py-2 text-xs text-sidebar-foreground/50",children:m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("a",{href:"https://github.com/knowns-dev/knowns",target:"_blank",rel:"noopener noreferrer",className:"hover:text-sidebar-foreground transition-colors",children:"Knowns"}),m.jsx("span",{className:"font-mono",children:"0.8.2"})]})})]}),m.jsx(tde,{})]})}const dut=[{value:"all",label:"All"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"content",label:"Content"}];function fut(e){const t=e.changes;if(t.length===0)return"Updated";const n=t.find(s=>s.field==="status");if(n){const s=String(n.newValue);return s==="done"?"Completed":s==="in-progress"?"Started working on":s==="in-review"?"Submitted for review":s==="blocked"?"Blocked":`Changed status to ${s}`}const r=t.find(s=>s.field==="assignee");if(r){const s=r.newValue;return s?`Assigned to ${s}`:"Unassigned"}if(t.find(s=>s.field==="title"))return"Updated title";const o=t.find(s=>s.field==="priority");return o?`Set priority to ${o.newValue}`:t.some(s=>s.field==="description")?"Updated description":t.some(s=>s.field==="acceptanceCriteria")?"Updated acceptance criteria":t.some(s=>s.field==="implementationPlan")?"Updated plan":t.some(s=>s.field==="implementationNotes")?"Updated notes":t.some(s=>s.field==="labels")?"Updated labels":`Updated ${t.length} field(s)`}function put(e){const n=new Date().getTime()-e.getTime(),r=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return r<1?"just now":r<60?`${r}m ago`:i<24?`${i}h ago`:o<7?`${o}d ago`:e.toLocaleDateString()}function hut(e){return e.some(t=>t.field==="status"&&t.newValue==="done")?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":e.some(t=>t.field==="status"&&t.newValue==="in-progress")?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400":e.some(t=>t.field==="status"&&t.newValue==="blocked")?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":e.some(t=>t.field==="assignee")?"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400":"bg-muted text-muted-foreground"}function mut({limit:e=20,showFilter:t=!0,onTaskClick:n}){const[r,i]=v.useState([]),[o,s]=v.useState(!0),[a,l]=v.useState("all"),[c,u]=v.useState(!1),f=v.useCallback(async()=>{try{const y=a==="all"?void 0:a,E=await ta.getActivities({limit:e,type:y});i(E)}catch(y){console.error("Failed to load activities:",y)}finally{s(!1),u(!1)}},[e,a]);v.useEffect(()=>{f()},[f]),cu("tasks:updated",()=>{f()},[f]);const h=()=>{u(!0),f()},g=y=>{n?n(y):window.location.hash=`/kanban/${y}`};return m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(O7,{className:"w-5 h-5"}),m.jsx("h3",{className:"font-semibold",children:"Recent Activity"})]}),m.jsx(Qe,{variant:"ghost",size:"icon",onClick:h,disabled:c,className:"h-8 w-8",children:m.jsx(aI,{className:`w-4 h-4 ${c?"animate-spin":""}`})})]}),t&&m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(sI,{className:"w-4 h-4 text-muted-foreground"}),m.jsx("select",{value:a,onChange:y=>l(y.target.value),className:"text-sm rounded px-2 py-1 bg-card border flex-1",children:dut.map(y=>m.jsx("option",{value:y.value,children:y.label},y.value))})]}),m.jsx(Yi,{className:"flex-1",children:m.jsx("div",{className:"space-y-1.5 pr-3",children:o?m.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"Loading activities..."}):r.length===0?m.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"No recent activity"}):r.map((y,E)=>m.jsx("div",{role:"button",tabIndex:0,onClick:S=>{S.preventDefault(),S.stopPropagation(),g(y.taskId)},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),g(y.taskId))},className:"w-full bg-card rounded p-2 text-left hover:bg-accent transition-colors border cursor-pointer select-none",children:m.jsxs("div",{className:"flex items-center gap-2",children:[y.author?m.jsx(k0,{name:y.author,size:"xs"}):m.jsx("div",{className:`w-5 h-5 rounded-full flex items-center justify-center shrink-0 ${hut(y.changes)}`,children:m.jsx(O7,{className:"w-2.5 h-2.5"})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-xs font-medium truncate",children:fut(y)}),m.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:put(y.timestamp)})]}),m.jsxs("div",{className:"text-[11px] text-muted-foreground truncate",children:[m.jsxs("span",{className:"font-medium",children:["#",y.taskId]})," ",y.taskTitle]})]})]})},`${y.taskId}-${y.version}-${E}`))})})]})}function gut(){const[e,t]=v.useState(!1),[n,r]=v.useState(!1),[i,o]=v.useState(()=>{const l=localStorage.getItem("knowns-last-activity-check");return l?new Date(l):new Date}),s=v.useCallback(async()=>{try{const l=await ta.getActivities({limit:1});l.length>0&&new Date(l[0].timestamp)>i&&t(!0)}catch(l){console.error("Failed to check activities:",l)}},[i]);v.useEffect(()=>{s()},[s]),cu("tasks:updated",()=>{n||t(!0)},[n]);const a=l=>{if(r(l),l){t(!1);const c=new Date;o(c),localStorage.setItem("knowns-last-activity-check",c.toISOString())}};return m.jsxs(E0,{open:n,onOpenChange:a,children:[m.jsx(S0,{asChild:!0,children:m.jsxs(Qe,{variant:"ghost",size:"icon",className:"relative h-8 w-8","aria-label":"Notifications",children:[m.jsx(yhe,{className:"h-4 w-4"}),e&&m.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-blue-500 animate-pulse"})]})}),m.jsx(Dh,{className:"w-80 p-0",align:"end",sideOffset:8,children:m.jsxs("div",{className:"flex flex-col h-[400px]",children:[m.jsx("div",{className:"px-4 py-3 border-b",children:m.jsx("h3",{className:"font-semibold text-sm",children:"Recent Activity"})}),m.jsx("div",{className:"flex-1 overflow-hidden p-2",children:m.jsx(mut,{limit:20,showFilter:!1,onTaskClick:l=>{r(!1),window.location.hash=`/kanban/${l}`}})})]})})]})}const jW={todo:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300","in-progress":"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300","in-review":"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",done:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",blocked:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300","on-hold":"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300"},but={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold"};function yut({open:e,onOpenChange:t,onTaskSelect:n,onDocSelect:r}){const[i,o]=v.useState(""),[s,a]=v.useState({tasks:[],docs:[]}),[l,c]=v.useState(!1);v.useEffect(()=>{if(!e){o(""),a({tasks:[],docs:[]});return}if(!i.trim()){a({tasks:[],docs:[]});return}c(!0);const h=setTimeout(()=>{fetch(`/api/search?q=${encodeURIComponent(i)}`).then(g=>g.json()).then(g=>{a({tasks:g.tasks||[],docs:g.docs||[]})}).catch(g=>{console.error("Search failed:",g),a({tasks:[],docs:[]})}).finally(()=>{c(!1)})},300);return()=>clearTimeout(h)},[i,e]);const u=h=>{n(h),t(!1),o("")},f=h=>{r(h),t(!1),o("")};return m.jsx(JI,{open:e,onOpenChange:t,children:m.jsx(aw,{className:"overflow-hidden p-0 max-w-2xl",hideClose:!0,children:m.jsxs(Ih,{shouldFilter:!1,children:[m.jsx(Oh,{placeholder:"Search tasks and docs...",value:i,onValueChange:o}),m.jsxs(Mh,{children:[m.jsx(Lh,{children:l?"Searching...":i?"No results found.":"Type to search..."}),s.tasks.length>0&&m.jsx(Va,{heading:"Tasks",children:s.tasks.slice(0,8).map(h=>{const g=jW[h.status]||jW.todo,y=but[h.status]||h.status;return m.jsxs(zo,{value:`task-${h.id}`,onSelect:()=>u(h),children:[m.jsx(oY,{className:"mr-2 h-4 w-4 shrink-0"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:["#",h.id]}),m.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${g}`,children:y})]}),m.jsx("div",{className:"font-medium truncate",children:h.title})]})]},h.id)})}),s.tasks.length>0&&s.docs.length>0&&m.jsx(PS,{}),s.docs.length>0&&m.jsx(Va,{heading:"Documentation",children:s.docs.slice(0,8).map(h=>{const g=h.metadata?.title||h.filename;return m.jsxs(zo,{value:`doc-${h.path}`,onSelect:()=>f(h),children:[m.jsx(Vo,{className:"mr-2 h-4 w-4 shrink-0"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"font-medium truncate mb-1",children:g}),m.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:m.jsx("span",{className:"truncate",children:h.path})})]})]},h.path)})})]})]})})})}const lde={description:{begin:"<!-- SECTION:DESCRIPTION:BEGIN -->",end:"<!-- SECTION:DESCRIPTION:END -->"},plan:{begin:"<!-- SECTION:PLAN:BEGIN -->",end:"<!-- SECTION:PLAN:END -->"},notes:{begin:"<!-- SECTION:NOTES:BEGIN -->",end:"<!-- SECTION:NOTES:END -->"},ac:{begin:"<!-- AC:BEGIN -->",end:"<!-- AC:END -->"}};function vut(e,t){const n=lde[t];if(!n)return e;const r=e.indexOf(n.begin),i=e.indexOf(n.end);return r===-1||i===-1?e:e.substring(r+n.begin.length,i).trim()}function xut(e,t){const n=lde[t];return n?e.includes(n.begin)&&e.includes(n.end):!1}function Eut(e){return e.replace(/<!--[\s\S]*?-->/g,"")}function Sut(e,t){return e?t&&xut(e,t)?vut(e,t):e:""}const wut="inline-flex items-center gap-1 px-1 py-1 rounded-md text-sm font-medium transition-all hover:scale-105 bg-green-100/50 border border-green-500/30 text-green-700 hover:bg-green-100 hover:border-green-500/50 dark:bg-green-900/20 dark:text-green-300 dark:hover:bg-green-900/30",Cut="inline-flex items-center gap-1 px-1 py-1 rounded-md text-sm font-medium transition-all hover:scale-105 bg-blue-100/50 border border-blue-500/30 text-blue-700 hover:bg-blue-100 hover:border-blue-500/50 dark:bg-blue-900/20 dark:text-blue-300 dark:hover:bg-blue-900/30",Tut=v.forwardRef(({markdown:e,className:t="",sectionType:n,enableGFM:r=!0,onDocLinkClick:i},o)=>{if(!e)return null;const s=Eut(Sut(e,n)),a=({href:l,children:c})=>{if(l&&/^(task-)?\d+(\.\d+)?(\.md)?$/.test(l)){const u=l.replace(/^task-/,"").replace(/\.md$/,""),f=`#/tasks/${u}`;return m.jsxs("a",{href:f,className:wut,"data-task-id":u,children:[m.jsx(of,{className:"w-4 h-4 shrink-0"}),c]})}if(l&&(l.endsWith(".md")||l.includes(".md#"))){const u=l.replace(/^\.\//,""),f=`#/docs/${u}`;return m.jsxs("a",{href:f,className:Cut,"data-doc-path":u,onClick:h=>{i&&(h.preventDefault(),i(u))},children:[m.jsx(Vo,{className:"w-4 h-4 shrink-0"}),c]})}return m.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-600 underline",children:c})};return m.jsx("div",{ref:o,className:`prose prose-sm max-w-none dark:prose-invert ${t}`,children:m.jsx(iJ,{remarkPlugins:r?[Vw]:[],components:{a,code:({className:l,children:c,...u})=>l?m.jsx("code",{className:l,...u,children:c}):m.jsx("code",{className:"px-1.5 py-0.5 rounded text-sm bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200",...u,children:c}),pre:({children:l})=>m.jsx("pre",{className:"overflow-x-auto rounded-lg p-4 text-sm bg-gray-100 dark:bg-gray-900",children:l}),table:({children:l})=>m.jsx("div",{className:"overflow-x-auto my-4",children:m.jsx("table",{className:"min-w-full border-collapse",children:l})}),th:({children:l})=>m.jsx("th",{className:"px-4 py-2 text-left font-semibold border bg-gray-100 text-gray-900 border-gray-200 dark:bg-gray-700 dark:text-gray-100 dark:border-gray-600",children:l}),td:({children:l})=>m.jsx("td",{className:"px-4 py-2 border border-gray-200 text-gray-700 dark:border-gray-600 dark:text-gray-200",children:l}),input:({type:l,checked:c,...u})=>l==="checkbox"?m.jsx("input",{type:"checkbox",checked:c,readOnly:!0,className:"mr-2 accent-blue-600",...u}):m.jsx("input",{type:l,...u})},children:s})})});Tut.displayName="MarkdownRenderer";function nu(e,t){return typeof e=="function"?e(t):e}function Xo(e,t){return n=>{t.setState(r=>({...r,[e]:nu(n,r[e])}))}}function aT(e){return e instanceof Function}function kut(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Aut(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const s=t(o);s!=null&&s.length&&r(s)})};return r(e),n}function vt(e,t,n){let r=[],i;return o=>{let s;n.key&&n.debug&&(s=Date.now());const a=e(o);if(!(a.length!==r.length||a.some((u,f)=>r[f]!==u)))return i;r=a;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...a),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const u=Math.round((Date.now()-s)*100)/100,f=Math.round((Date.now()-c)*100)/100,h=f/16,g=(y,E)=>{for(y=String(y);y.length<E;)y=" "+y;return y};console.info(`%c⏱ ${g(f,5)} /${g(u,5)} ms`,`
|
|
311
311
|
font-size: .6rem;
|
|
312
312
|
font-weight: bold;
|
|
313
313
|
color: hsl(${Math.max(0,Math.min(120-120*h,120))}deg 100% 31%);`,n?.key)}return i}}function xt(e,t,n,r){return{debug:()=>{var i;return(i=e?.debugAll)!=null?i:e[t]},key:!1,onChange:r}}function Nut(e,t,n,r){const i=()=>{var s;return(s=o.getValue())!=null?s:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:vt(()=>[e,n,t,o],(s,a,l,c)=>({table:s,column:a,row:l,cell:c,getValue:c.getValue,renderValue:c.renderValue}),xt(e.options,"debugCells"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(o,n,t,e)},{}),o}function _ut(e,t,n,r){var i,o;const a={...e._getDefaultColumnDef(),...t},l=a.accessorKey;let c=(i=(o=a.id)!=null?o:l?typeof String.prototype.replaceAll=="function"?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)!=null?i:typeof a.header=="string"?a.header:void 0,u;if(a.accessorFn?u=a.accessorFn:l&&(l.includes(".")?u=h=>{let g=h;for(const E of l.split(".")){var y;g=(y=g)==null?void 0:y[E]}return g}:u=h=>h[a.accessorKey]),!c)throw new Error;let f={id:`${String(c)}`,accessorFn:u,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:vt(()=>[!0],()=>{var h;return[f,...(h=f.columns)==null?void 0:h.flatMap(g=>g.getFlatColumns())]},xt(e.options,"debugColumns")),getLeafColumns:vt(()=>[e._getOrderColumnsFn()],h=>{var g;if((g=f.columns)!=null&&g.length){let y=f.columns.flatMap(E=>E.getLeafColumns());return h(y)}return[f]},xt(e.options,"debugColumns"))};for(const h of e._features)h.createColumn==null||h.createColumn(f,e);return f}const Ri="debugHeaders";function $W(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const s=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),s.push(l)};return a(o),s},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(o,e)}),o}const Rut={createTable:e=>{e.getHeaderGroups=vt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,s;const a=(o=r?.map(f=>n.find(h=>h.id===f)).filter(Boolean))!=null?o:[],l=(s=i?.map(f=>n.find(h=>h.id===f)).filter(Boolean))!=null?s:[],c=n.filter(f=>!(r!=null&&r.includes(f.id))&&!(i!=null&&i.includes(f.id)));return Qv(t,[...a,...c,...l],e)},xt(e.options,Ri)),e.getCenterHeaderGroups=vt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),Qv(t,n,e,"center")),xt(e.options,Ri)),e.getLeftHeaderGroups=vt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r?.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?i:[];return Qv(t,o,e,"left")},xt(e.options,Ri)),e.getRightHeaderGroups=vt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r?.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?i:[];return Qv(t,o,e,"right")},xt(e.options,Ri)),e.getFooterGroups=vt(()=>[e.getHeaderGroups()],t=>[...t].reverse(),xt(e.options,Ri)),e.getLeftFooterGroups=vt(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),xt(e.options,Ri)),e.getCenterFooterGroups=vt(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),xt(e.options,Ri)),e.getRightFooterGroups=vt(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),xt(e.options,Ri)),e.getFlatHeaders=vt(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Ri)),e.getLeftFlatHeaders=vt(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Ri)),e.getCenterFlatHeaders=vt(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Ri)),e.getRightFlatHeaders=vt(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Ri)),e.getCenterLeafHeaders=vt(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),xt(e.options,Ri)),e.getLeftLeafHeaders=vt(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),xt(e.options,Ri)),e.getRightLeafHeaders=vt(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),xt(e.options,Ri)),e.getLeafHeaders=vt(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,s,a,l,c;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(s=(a=n[0])==null?void 0:a.headers)!=null?s:[],...(l=(c=r[0])==null?void 0:c.headers)!=null?l:[]].map(u=>u.getLeafHeaders()).flat()},xt(e.options,Ri))}};function Qv(e,t,n,r){var i,o;let s=0;const a=function(h,g){g===void 0&&(g=1),s=Math.max(s,g),h.filter(y=>y.getIsVisible()).forEach(y=>{var E;(E=y.columns)!=null&&E.length&&a(y.columns,g+1)},0)};a(e);let l=[];const c=(h,g)=>{const y={depth:g,id:[r,`${g}`].filter(Boolean).join("_"),headers:[]},E=[];h.forEach(S=>{const w=[...E].reverse()[0],T=S.column.depth===y.depth;let A,R=!1;if(T&&S.column.parent?A=S.column.parent:(A=S.column,R=!0),w&&w?.column===A)w.subHeaders.push(S);else{const _=$W(n,A,{id:[r,g,A.id,S?.id].filter(Boolean).join("_"),isPlaceholder:R,placeholderId:R?`${E.filter(D=>D.column===A).length}`:void 0,depth:g,index:E.length});_.subHeaders.push(S),E.push(_)}y.headers.push(S),S.headerGroup=y}),l.push(y),g>0&&c(E,g-1)},u=t.map((h,g)=>$W(n,h,{depth:s,index:g}));c(u,s-1),l.reverse();const f=h=>h.filter(y=>y.column.getIsVisible()).map(y=>{let E=0,S=0,w=[0];y.subHeaders&&y.subHeaders.length?(w=[],f(y.subHeaders).forEach(A=>{let{colSpan:R,rowSpan:_}=A;E+=R,w.push(_)})):E=1;const T=Math.min(...w);return S=S+T,y.colSpan=E,y.rowSpan=S,{colSpan:E,rowSpan:S}});return f((i=(o=l[0])==null?void 0:o.headers)!=null?i:[]),l}const AF=(e,t,n,r,i,o,s)=>{let a={id:t,index:r,original:n,depth:i,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];const c=e.getColumn(l);if(c!=null&&c.accessorFn)return a._valuesCache[l]=c.accessorFn(a.original,r),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];const c=e.getColumn(l);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=c.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var c;return(c=a.getValue(l))!=null?c:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Aut(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],c=a;for(;;){const u=c.getParentRow();if(!u)break;l.push(u),c=u}return l.reverse()},getAllCells:vt(()=>[e.getAllLeafColumns()],l=>l.map(c=>Nut(e,a,c,c.id)),xt(e.options,"debugRows")),_getAllCellsByColumnId:vt(()=>[a.getAllCells()],l=>l.reduce((c,u)=>(c[u.column.id]=u,c),{}),xt(e.options,"debugRows"))};for(let l=0;l<e._features.length;l++){const c=e._features[l];c==null||c.createRow==null||c.createRow(a,e)}return a},Dut={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},cde=(e,t,n)=>{var r,i;const o=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(o))};cde.autoRemove=e=>sa(e);const ude=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};ude.autoRemove=e=>sa(e);const dde=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};dde.autoRemove=e=>sa(e);const fde=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};fde.autoRemove=e=>sa(e);const pde=(e,t,n)=>!n.some(r=>{var i;return!((i=e.getValue(t))!=null&&i.includes(r))});pde.autoRemove=e=>sa(e)||!(e!=null&&e.length);const hde=(e,t,n)=>n.some(r=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)});hde.autoRemove=e=>sa(e)||!(e!=null&&e.length);const mde=(e,t,n)=>e.getValue(t)===n;mde.autoRemove=e=>sa(e);const gde=(e,t,n)=>e.getValue(t)==n;gde.autoRemove=e=>sa(e);const NF=(e,t,n)=>{let[r,i]=n;const o=e.getValue(t);return o>=r&&o<=i};NF.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,s=n===null||Number.isNaN(i)?1/0:i;if(o>s){const a=o;o=s,s=a}return[o,s]};NF.autoRemove=e=>sa(e)||sa(e[0])&&sa(e[1]);const Ll={includesString:cde,includesStringSensitive:ude,equalsString:dde,arrIncludes:fde,arrIncludesAll:pde,arrIncludesSome:hde,equals:mde,weakEquals:gde,inNumberRange:NF};function sa(e){return e==null||e===""}const Iut={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Xo("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);return typeof r=="string"?Ll.includesString:typeof r=="number"?Ll.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?Ll.equals:Array.isArray(r)?Ll.arrIncludes:Ll.weakEquals},e.getFilterFn=()=>{var n,r;return aT(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:Ll[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const i=e.getFilterFn(),o=r?.find(u=>u.id===e.id),s=nu(n,o?o.value:void 0);if(UW(i,s,e)){var a;return(a=r?.filter(u=>u.id!==e.id))!=null?a:[]}const l={id:e.id,value:s};if(o){var c;return(c=r?.map(u=>u.id===e.id?l:u))!=null?c:[]}return r!=null&&r.length?[...r,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=i=>{var o;return(o=nu(t,i))==null?void 0:o.filter(s=>{const a=n.find(l=>l.id===s.id);if(a){const l=a.getFilterFn();if(UW(l,s.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function UW(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const Out=(e,t,n)=>n.reduce((r,i)=>{const o=i.getValue(e);return r+(typeof o=="number"?o:0)},0),Mut=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},Lut=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r<o||r===void 0&&o>=o)&&(r=o)}),r},Put=(e,t,n)=>{let r,i;return n.forEach(o=>{const s=o.getValue(e);s!=null&&(r===void 0?s>=s&&(r=i=s):(r>s&&(r=s),i<s&&(i=s)))}),[r,i]},Fut=(e,t)=>{let n=0,r=0;if(t.forEach(i=>{let o=i.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},But=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!kut(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((o,s)=>o-s);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},jut=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),$ut=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,Uut=(e,t)=>t.length,o_={sum:Out,min:Mut,max:Lut,extent:Put,mean:Fut,median:But,unique:jut,uniqueCount:$ut,count:Uut},Hut={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Xo("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);if(typeof r=="number")return o_.sum;if(Object.prototype.toString.call(r)==="[object Date]")return o_.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return aT(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:o_[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function zut(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(s=>s.id===o)).filter(Boolean),...r]}const Vut={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Xo("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=vt(n=>[Tb(t,n)],n=>n.findIndex(r=>r.id===e.id),xt(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=Tb(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const i=Tb(t,n);return((r=i[i.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=vt(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>i=>{let o=[];if(!(t!=null&&t.length))o=i;else{const s=[...t],a=[...i];for(;a.length&&s.length;){const l=s.shift(),c=a.findIndex(u=>u.id===l);c>-1&&o.push(a.splice(c,1)[0])}o=[...o,...a]}return zut(o,n,r)},xt(e.options,"debugTable"))}},s_=()=>({left:[],right:[]}),Gut={getInitialState:e=>({columnPinning:s_(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Xo("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var o,s;if(n==="right"){var a,l;return{left:((a=i?.left)!=null?a:[]).filter(f=>!(r!=null&&r.includes(f))),right:[...((l=i?.right)!=null?l:[]).filter(f=>!(r!=null&&r.includes(f))),...r]}}if(n==="left"){var c,u;return{left:[...((c=i?.left)!=null?c:[]).filter(f=>!(r!=null&&r.includes(f))),...r],right:((u=i?.right)!=null?u:[]).filter(f=>!(r!=null&&r.includes(f)))}}return{left:((o=i?.left)!=null?o:[]).filter(f=>!(r!=null&&r.includes(f))),right:((s=i?.right)!=null?s:[]).filter(f=>!(r!=null&&r.includes(f)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var i,o,s;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((o=(s=t.options.enableColumnPinning)!=null?s:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(a=>a.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(a=>r?.includes(a)),s=n.some(a=>i?.includes(a));return o?"left":s?"right":!1},e.getPinnedIndex=()=>{var n,r;const i=e.getIsPinned();return i?(n=(r=t.getState().columnPinning)==null||(r=r[i])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=vt(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,i)=>{const o=[...r??[],...i??[]];return n.filter(s=>!o.includes(s.column.id))},xt(t.options,"debugRows")),e.getLeftVisibleCells=vt(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(o=>n.find(s=>s.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),xt(t.options,"debugRows")),e.getRightVisibleCells=vt(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(s=>s.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),xt(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?s_():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:s_())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var i,o;return!!((i=r.left)!=null&&i.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=vt(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),xt(e.options,"debugColumns")),e.getRightLeafColumns=vt(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),xt(e.options,"debugColumns")),e.getCenterLeafColumns=vt(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(o=>!i.includes(o.id))},xt(e.options,"debugColumns"))}};function qut(e){return e||(typeof document<"u"?document:null)}const Jv={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},a_=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Wut={getDefaultColumnDef:()=>Jv,getInitialState:e=>({columnSizing:{},columnSizingInfo:a_(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Xo("columnSizing",e),onColumnSizingInfoChange:Xo("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,i;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Jv.minSize,(r=o??e.columnDef.size)!=null?r:Jv.size),(i=e.columnDef.maxSize)!=null?i:Jv.maxSize)},e.getStart=vt(n=>[n,Tb(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((i,o)=>i+o.getSize(),0),xt(t.options,"debugColumns")),e.getAfter=vt(n=>[n,Tb(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((i,o)=>i+o.getSize(),0),xt(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...i}=n;return i})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var o;n+=(o=i.column.getSize())!=null?o:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),i=r?.getCanResize();return o=>{if(!r||!i||(o.persist==null||o.persist(),l_(o)&&o.touches&&o.touches.length>1))return;const s=e.getSize(),a=e?e.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[r.id,r.getSize()]],l=l_(o)?Math.round(o.touches[0].clientX):o.clientX,c={},u=(w,T)=>{typeof T=="number"&&(t.setColumnSizingInfo(A=>{var R,_;const D=t.options.columnResizeDirection==="rtl"?-1:1,I=(T-((R=A?.startOffset)!=null?R:0))*D,M=Math.max(I/((_=A?.startSize)!=null?_:0),-.999999);return A.columnSizingStart.forEach(H=>{let[F,B]=H;c[F]=Math.round(Math.max(B+B*M,0)*100)/100}),{...A,deltaOffset:I,deltaPercentage:M}}),(t.options.columnResizeMode==="onChange"||w==="end")&&t.setColumnSizing(A=>({...A,...c})))},f=w=>u("move",w),h=w=>{u("end",w),t.setColumnSizingInfo(T=>({...T,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g=qut(n),y={moveHandler:w=>f(w.clientX),upHandler:w=>{g?.removeEventListener("mousemove",y.moveHandler),g?.removeEventListener("mouseup",y.upHandler),h(w.clientX)}},E={moveHandler:w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),f(w.touches[0].clientX),!1),upHandler:w=>{var T;g?.removeEventListener("touchmove",E.moveHandler),g?.removeEventListener("touchend",E.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),h((T=w.touches[0])==null?void 0:T.clientX)}},S=Yut()?{passive:!1}:!1;l_(o)?(g?.addEventListener("touchmove",E.moveHandler,S),g?.addEventListener("touchend",E.upHandler,S)):(g?.addEventListener("mousemove",y.moveHandler,S),g?.addEventListener("mouseup",y.upHandler,S)),t.setColumnSizingInfo(w=>({...w,startOffset:l,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?a_():(n=e.initialState.columnSizingInfo)!=null?n:a_())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0}}};let ex=null;function Yut(){if(typeof ex=="boolean")return ex;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return ex=e,ex}function l_(e){return e.type==="touchstart"}const Kut={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Xo("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const i=e.columns;return(n=i.length?i.some(o=>o.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=vt(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),xt(t.options,"debugRows")),e.getVisibleCells=vt(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],xt(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>vt(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),xt(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,o)=>({...i,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function Tb(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Xut={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Zut={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Xo("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,i,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Ll.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return aT(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:Ll[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},Qut={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Xo("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var i,o;e.setExpanded(r?{}:(i=(o=e.initialState)==null?void 0:o.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const s=o.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var i;const o=r===!0?!0:!!(r!=null&&r[e.id]);let s={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(a=>{s[a]=!0}):s=r,n=(i=n)!=null?i:!o,!o&&n)return{...s,[e.id]:!0};if(o&&!n){const{[e.id]:a,...l}=s;return l}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r?.[e.id])},e.getCanExpand=()=>{var n,r,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},JD=0,eI=10,c_=()=>({pageIndex:JD,pageSize:eI}),Jut={getInitialState:e=>({...e,pagination:{...c_(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Xo("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const i=o=>nu(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=r=>{var i;e.setPagination(r?c_():(i=e.initialState.pagination)!=null?i:c_())},e.setPageIndex=r=>{e.setPagination(i=>{let o=nu(r,i.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,s)),{...i,pageIndex:o}})},e.resetPageIndex=r=>{var i,o;e.setPageIndex(r?JD:(i=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?i:JD)},e.resetPageSize=r=>{var i,o;e.setPageSize(r?eI:(i=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?i:eI)},e.setPageSize=r=>{e.setPagination(i=>{const o=Math.max(1,nu(r,i.pageSize)),s=i.pageSize*i.pageIndex,a=Math.floor(s/o);return{...i,pageIndex:a,pageSize:o}})},e.setPageCount=r=>e.setPagination(i=>{var o;let s=nu(r,(o=e.options.pageCount)!=null?o:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...i,pageCount:s}}),e.getPageOptions=vt(()=>[e.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((o,s)=>s)),i},xt(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:r<i-1},e.previousPage=()=>e.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},u_=()=>({top:[],bottom:[]}),edt={getInitialState:e=>({rowPinning:u_(),...e}),getDefaultOptions:e=>({onRowPinningChange:Xo("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{const o=r?e.getLeafRows().map(l=>{let{id:c}=l;return c}):[],s=i?e.getParentRows().map(l=>{let{id:c}=l;return c}):[],a=new Set([...s,e.id,...o]);t.setRowPinning(l=>{var c,u;if(n==="bottom"){var f,h;return{top:((f=l?.top)!=null?f:[]).filter(E=>!(a!=null&&a.has(E))),bottom:[...((h=l?.bottom)!=null?h:[]).filter(E=>!(a!=null&&a.has(E))),...Array.from(a)]}}if(n==="top"){var g,y;return{top:[...((g=l?.top)!=null?g:[]).filter(E=>!(a!=null&&a.has(E))),...Array.from(a)],bottom:((y=l?.bottom)!=null?y:[]).filter(E=>!(a!=null&&a.has(E)))}}return{top:((c=l?.top)!=null?c:[]).filter(E=>!(a!=null&&a.has(E))),bottom:((u=l?.bottom)!=null?u:[]).filter(E=>!(a!=null&&a.has(E)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:i}=t.options;return typeof r=="function"?r(e):(n=r??i)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,o=n.some(a=>r?.includes(a)),s=n.some(a=>i?.includes(a));return o?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const i=e.getIsPinned();if(!i)return-1;const o=(n=i==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(s=>{let{id:a}=s;return a});return(r=o?.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?u_():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:u_())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var i,o;return!!((i=r.top)!=null&&i.length||(o=r.bottom)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(n??[]).map(s=>{const a=e.getRow(s,!0);return a.getIsAllParentsExpanded()?a:null}):(n??[]).map(s=>t.find(a=>a.id===s))).filter(Boolean).map(s=>({...s,position:r}))},e.getTopRows=vt(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),xt(e.options,"debugRows")),e.getBottomRows=vt(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),xt(e.options,"debugRows")),e.getCenterRows=vt(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const i=new Set([...n??[],...r??[]]);return t.filter(o=>!i.has(o.id))},xt(e.options,"debugRows"))}},tdt={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Xo("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):i.forEach(o=>{delete r[o.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(o=>{tI(i,o.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=vt(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?d_(e,n):{rows:[],flatRows:[],rowsById:{}},xt(e.options,"debugTable")),e.getFilteredSelectedRowModel=vt(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?d_(e,n):{rows:[],flatRows:[],rowsById:{}},xt(e.options,"debugTable")),e.getGroupedSelectedRowModel=vt(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?d_(e,n):{rows:[],flatRows:[],rowsById:{}},xt(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(i=>!n[i.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const i=e.getIsSelected();t.setRowSelection(o=>{var s;if(n=typeof n<"u"?n:!i,e.getCanSelect()&&i===n)return o;const a={...o};return tI(a,e.id,n,(s=r?.selectChildren)!=null?s:!0,t),a})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return _F(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return nI(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return nI(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var i;n&&e.toggleSelected((i=r.target)==null?void 0:i.checked)}}}},tI=(e,t,n,r,i)=>{var o;const s=i.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(o=s.subRows)!=null&&o.length&&s.getCanSelectSubRows()&&s.subRows.forEach(a=>tI(e,a.id,n,r,i))};function d_(e,t){const n=e.getState().rowSelection,r=[],i={},o=function(s,a){return s.map(l=>{var c;const u=_F(l,n);if(u&&(r.push(l),i[l.id]=l),(c=l.subRows)!=null&&c.length&&(l={...l,subRows:o(l.subRows)}),u)return l}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function _F(e,t){var n;return(n=t[e.id])!=null?n:!1}function nI(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,o=!1;return e.subRows.forEach(s=>{if(!(o&&!i)&&(s.getCanSelect()&&(_F(s,t)?o=!0:i=!1),s.subRows&&s.subRows.length)){const a=nI(s,t);a==="all"?o=!0:(a==="some"&&(o=!0),i=!1)}}),i?"all":o?"some":!1}const rI=/([0-9]+)/gm,ndt=(e,t,n)=>bde(_u(e.getValue(n)).toLowerCase(),_u(t.getValue(n)).toLowerCase()),rdt=(e,t,n)=>bde(_u(e.getValue(n)),_u(t.getValue(n))),idt=(e,t,n)=>RF(_u(e.getValue(n)).toLowerCase(),_u(t.getValue(n)).toLowerCase()),odt=(e,t,n)=>RF(_u(e.getValue(n)),_u(t.getValue(n))),sdt=(e,t,n)=>{const r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},adt=(e,t,n)=>RF(e.getValue(n),t.getValue(n));function RF(e,t){return e===t?0:e>t?1:-1}function _u(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function bde(e,t){const n=e.split(rI).filter(Boolean),r=t.split(rI).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),o=r.shift(),s=parseInt(i,10),a=parseInt(o,10),l=[s,a].sort();if(isNaN(l[0])){if(i>o)return 1;if(o>i)return-1;continue}if(isNaN(l[1]))return isNaN(s)?-1:1;if(s>a)return 1;if(a>s)return-1}return n.length-r.length}const Lg={alphanumeric:ndt,alphanumericCaseSensitive:rdt,text:idt,textCaseSensitive:odt,datetime:sdt,basic:adt},ldt={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Xo("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const o=i?.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Lg.datetime;if(typeof o=="string"&&(r=!0,o.split(rI).length>1))return Lg.alphanumeric}return r?Lg.text:Lg.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof n?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return aT(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Lg[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const i=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(s=>{const a=s?.find(g=>g.id===e.id),l=s?.findIndex(g=>g.id===e.id);let c=[],u,f=o?n:i==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?a?u="toggle":u="add":s!=null&&s.length&&l!==s.length-1?u="replace":a?u="toggle":u="replace",u==="toggle"&&(o||i||(u="remove")),u==="add"){var h;c=[...s,{id:e.id,desc:f}],c.splice(0,c.length-((h=t.options.maxMultiSortColCount)!=null?h:Number.MAX_SAFE_INTEGER))}else u==="toggle"?c=s.map(g=>g.id===e.id?{...g,desc:f}:g):u==="remove"?c=s.filter(g=>g.id!==e.id):c=[{id:e.id,desc:f}];return c})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,i;const o=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:s==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},cdt=[Rut,Kut,Vut,Gut,Dut,Iut,Xut,Zut,ldt,Hut,Qut,Jut,edt,tdt,Wut];function udt(e){var t,n;const r=[...cdt,...(t=e._features)!=null?t:[]];let i={_features:r};const o=i._features.reduce((h,g)=>Object.assign(h,g.getDefaultOptions==null?void 0:g.getDefaultOptions(i)),{}),s=h=>i.options.mergeOptions?i.options.mergeOptions(o,h):{...o,...h};let l={...{},...(n=e.initialState)!=null?n:{}};i._features.forEach(h=>{var g;l=(g=h.getInitialState==null?void 0:h.getInitialState(l))!=null?g:l});const c=[];let u=!1;const f={_features:r,options:{...o,...e},initialState:l,_queue:h=>{c.push(h),u||(u=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();u=!1}).catch(g=>setTimeout(()=>{throw g})))},reset:()=>{i.setState(i.initialState)},setOptions:h=>{const g=nu(h,i.options);i.options=s(g)},getState:()=>i.options.state,setState:h=>{i.options.onStateChange==null||i.options.onStateChange(h)},_getRowId:(h,g,y)=>{var E;return(E=i.options.getRowId==null?void 0:i.options.getRowId(h,g,y))!=null?E:`${y?[y.id,g].join("."):g}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(h,g)=>{let y=(g?i.getPrePaginationRowModel():i.getRowModel()).rowsById[h];if(!y&&(y=i.getCoreRowModel().rowsById[h],!y))throw new Error;return y},_getDefaultColumnDef:vt(()=>[i.options.defaultColumn],h=>{var g;return h=(g=h)!=null?g:{},{header:y=>{const E=y.header.column.columnDef;return E.accessorKey?E.accessorKey:E.accessorFn?E.id:null},cell:y=>{var E,S;return(E=(S=y.renderValue())==null||S.toString==null?void 0:S.toString())!=null?E:null},...i._features.reduce((y,E)=>Object.assign(y,E.getDefaultColumnDef==null?void 0:E.getDefaultColumnDef()),{}),...h}},xt(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:vt(()=>[i._getColumnDefs()],h=>{const g=function(y,E,S){return S===void 0&&(S=0),y.map(w=>{const T=_ut(i,w,S,E),A=w;return T.columns=A.columns?g(A.columns,T,S+1):[],T})};return g(h)},xt(e,"debugColumns")),getAllFlatColumns:vt(()=>[i.getAllColumns()],h=>h.flatMap(g=>g.getFlatColumns()),xt(e,"debugColumns")),_getAllFlatColumnsById:vt(()=>[i.getAllFlatColumns()],h=>h.reduce((g,y)=>(g[y.id]=y,g),{}),xt(e,"debugColumns")),getAllLeafColumns:vt(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(h,g)=>{let y=h.flatMap(E=>E.getLeafColumns());return g(y)},xt(e,"debugColumns")),getColumn:h=>i._getAllFlatColumnsById()[h]};Object.assign(i,f);for(let h=0;h<i._features.length;h++){const g=i._features[h];g==null||g.createTable==null||g.createTable(i)}return i}function ddt(){return e=>vt(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,o,s){o===void 0&&(o=0);const a=[];for(let c=0;c<i.length;c++){const u=AF(e,e._getRowId(i[c],c,s),i[c],c,o,void 0,s?.id);if(n.flatRows.push(u),n.rowsById[u.id]=u,a.push(u),e.options.getSubRows){var l;u.originalSubRows=e.options.getSubRows(i[c],c),(l=u.originalSubRows)!=null&&l.length&&(u.subRows=r(u.originalSubRows,o+1,u))}}return a};return n.rows=r(t),n},xt(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function fdt(e){const t=[],n=r=>{var i;t.push(r),(i=r.subRows)!=null&&i.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function yde(e,t,n){return n.options.filterFromLeafRows?pdt(e,t,n):hdt(e,t,n)}function pdt(e,t,n){var r;const i=[],o={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(l,c){c===void 0&&(c=0);const u=[];for(let h=0;h<l.length;h++){var f;let g=l[h];const y=AF(n,g.id,g.original,g.index,g.depth,void 0,g.parentId);if(y.columnFilters=g.columnFilters,(f=g.subRows)!=null&&f.length&&c<s){if(y.subRows=a(g.subRows,c+1),g=y,t(g)&&!y.subRows.length){u.push(g),o[g.id]=g,i.push(g);continue}if(t(g)||y.subRows.length){u.push(g),o[g.id]=g,i.push(g);continue}}else g=y,t(g)&&(u.push(g),o[g.id]=g,i.push(g))}return u};return{rows:a(e),flatRows:i,rowsById:o}}function hdt(e,t,n){var r;const i=[],o={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(l,c){c===void 0&&(c=0);const u=[];for(let h=0;h<l.length;h++){let g=l[h];if(t(g)){var f;if((f=g.subRows)!=null&&f.length&&c<s){const E=AF(n,g.id,g.original,g.index,g.depth,void 0,g.parentId);E.subRows=a(g.subRows,c+1),g=E}u.push(g),i.push(g),o[g.id]=g}}return u};return{rows:a(e),flatRows:i,rowsById:o}}function mdt(){return(e,t)=>vt(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,i)=>{if(!n.rows.length||!(r!=null&&r.length)&&!i)return n;const o=[...r.map(a=>a.id).filter(a=>a!==t),i?"__global__":void 0].filter(Boolean),s=a=>{for(let l=0;l<o.length;l++)if(a.columnFilters[o[l]]===!1)return!1;return!0};return yde(n.rows,s,e)},xt(e.options,"debugTable"))}function gdt(){return(e,t)=>vt(()=>{var n;return[(n=e.getColumn(t))==null?void 0:n.getFacetedRowModel()]},n=>{if(!n)return new Map;let r=new Map;for(let o=0;o<n.flatRows.length;o++){const s=n.flatRows[o].getUniqueValues(t);for(let a=0;a<s.length;a++){const l=s[a];if(r.has(l)){var i;r.set(l,((i=r.get(l))!=null?i:0)+1)}else r.set(l,1)}}return r},xt(e.options,"debugTable"))}function bdt(){return e=>vt(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let h=0;h<t.flatRows.length;h++)t.flatRows[h].columnFilters={},t.flatRows[h].columnFiltersMeta={};return t}const i=[],o=[];(n??[]).forEach(h=>{var g;const y=e.getColumn(h.id);if(!y)return;const E=y.getFilterFn();E&&i.push({id:h.id,filterFn:E,resolvedValue:(g=E.resolveFilterValue==null?void 0:E.resolveFilterValue(h.value))!=null?g:h.value})});const s=(n??[]).map(h=>h.id),a=e.getGlobalFilterFn(),l=e.getAllLeafColumns().filter(h=>h.getCanGlobalFilter());r&&a&&l.length&&(s.push("__global__"),l.forEach(h=>{var g;o.push({id:h.id,filterFn:a,resolvedValue:(g=a.resolveFilterValue==null?void 0:a.resolveFilterValue(r))!=null?g:r})}));let c,u;for(let h=0;h<t.flatRows.length;h++){const g=t.flatRows[h];if(g.columnFilters={},i.length)for(let y=0;y<i.length;y++){c=i[y];const E=c.id;g.columnFilters[E]=c.filterFn(g,E,c.resolvedValue,S=>{g.columnFiltersMeta[E]=S})}if(o.length){for(let y=0;y<o.length;y++){u=o[y];const E=u.id;if(u.filterFn(g,E,u.resolvedValue,S=>{g.columnFiltersMeta[E]=S})){g.columnFilters.__global__=!0;break}}g.columnFilters.__global__!==!0&&(g.columnFilters.__global__=!1)}}const f=h=>{for(let g=0;g<s.length;g++)if(h.columnFilters[s[g]]===!1)return!1;return!0};return yde(t.rows,f,e)},xt(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function ydt(e){return t=>vt(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:i,pageIndex:o}=n;let{rows:s,flatRows:a,rowsById:l}=r;const c=i*o,u=c+i;s=s.slice(c,u);let f;t.options.paginateExpandedRows?f={rows:s,flatRows:a,rowsById:l}:f=fdt({rows:s,flatRows:a,rowsById:l}),f.flatRows=[];const h=g=>{f.flatRows.push(g),g.subRows.length&&g.subRows.forEach(h)};return f.rows.forEach(h),f},xt(t.options,"debugTable"))}function vdt(){return e=>vt(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,i=[],o=r.filter(l=>{var c;return(c=e.getColumn(l.id))==null?void 0:c.getCanSort()}),s={};o.forEach(l=>{const c=e.getColumn(l.id);c&&(s[l.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});const a=l=>{const c=l.map(u=>({...u}));return c.sort((u,f)=>{for(let g=0;g<o.length;g+=1){var h;const y=o[g],E=s[y.id],S=E.sortUndefined,w=(h=y?.desc)!=null?h:!1;let T=0;if(S){const A=u.getValue(y.id),R=f.getValue(y.id),_=A===void 0,D=R===void 0;if(_||D){if(S==="first")return _?-1:1;if(S==="last")return _?1:-1;T=_&&D?0:_?S:-S}}if(T===0&&(T=E.sortingFn(u,f,y.id)),T!==0)return w&&(T*=-1),E.invertSorting&&(T*=-1),T}return u.index-f.index}),c.forEach(u=>{var f;i.push(u),(f=u.subRows)!=null&&f.length&&(u.subRows=a(u.subRows))}),c};return{rows:a(n.rows),flatRows:i,rowsById:n.rowsById}},xt(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function HW(e,t){return e?xdt(e)?v.createElement(e,t):e:null}function xdt(e){return Edt(e)||typeof e=="function"||Sdt(e)}function Edt(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Sdt(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function wdt(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:udt(t)})),[r,i]=v.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:s=>{i(s),e.onStateChange==null||e.onStateChange(s)}})),n.current}const vde=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{className:"relative w-full overflow-auto",children:m.jsx("table",{ref:n,className:Re("w-full caption-bottom text-sm",e),...t})}));vde.displayName="Table";const xde=v.forwardRef(({className:e,...t},n)=>m.jsx("thead",{ref:n,className:Re("[&_tr]:border-b",e),...t}));xde.displayName="TableHeader";const Ede=v.forwardRef(({className:e,...t},n)=>m.jsx("tbody",{ref:n,className:Re("[&_tr:last-child]:border-0",e),...t}));Ede.displayName="TableBody";const Cdt=v.forwardRef(({className:e,...t},n)=>m.jsx("tfoot",{ref:n,className:Re("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Cdt.displayName="TableFooter";const Bx=v.forwardRef(({className:e,...t},n)=>m.jsx("tr",{ref:n,className:Re("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Bx.displayName="TableRow";const Sde=v.forwardRef(({className:e,...t},n)=>m.jsx("th",{ref:n,className:Re("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Sde.displayName="TableHead";const iI=v.forwardRef(({className:e,...t},n)=>m.jsx("td",{ref:n,className:Re("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));iI.displayName="TableCell";const Tdt=v.forwardRef(({className:e,...t},n)=>m.jsx("caption",{ref:n,className:Re("mt-4 text-sm text-muted-foreground",e),...t}));Tdt.displayName="TableCaption";function kdt({table:e,showRowSelection:t=!0}){return m.jsxs("div",{className:"flex items-center justify-between px-2",children:[t&&m.jsxs("div",{className:"flex-1 text-sm text-muted-foreground",children:[e.getFilteredSelectedRowModel().rows.length," of"," ",e.getFilteredRowModel().rows.length," row(s) selected."]}),m.jsxs("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),m.jsxs(qi,{value:`${e.getState().pagination.pageSize}`,onValueChange:n=>{e.setPageSize(Number(n))},children:[m.jsx(Mi,{className:"h-8 w-[70px]",children:m.jsx(Wi,{placeholder:e.getState().pagination.pageSize})}),m.jsx(Li,{side:"top",children:[10,20,30,40,50].map(n=>m.jsx(Tn,{value:`${n}`,children:n},n))})]})]}),m.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",e.getState().pagination.pageIndex+1," of ",e.getPageCount()]}),m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsxs(Qe,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to first page"}),m.jsx(Nhe,{className:"h-4 w-4"})]}),m.jsxs(Qe,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to previous page"}),m.jsx(Che,{className:"h-4 w-4"})]}),m.jsxs(Qe,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to next page"}),m.jsx(sh,{className:"h-4 w-4"})]}),m.jsxs(Qe,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to last page"}),m.jsx(Rhe,{className:"h-4 w-4"})]})]})]})]})}function Adt({columns:e,data:t,toolbar:n,onRowClick:r,showPagination:i=!0,showRowSelection:o=!0,initialSorting:s=[],onSelectionChange:a}){const[l,c]=v.useState({}),[u,f]=v.useState({}),[h,g]=v.useState([]),[y,E]=v.useState(s),S=wdt({data:t,columns:e,state:{sorting:y,columnVisibility:u,rowSelection:l,columnFilters:h},enableRowSelection:!0,onRowSelectionChange:c,onSortingChange:E,onColumnFiltersChange:g,onColumnVisibilityChange:f,getCoreRowModel:ddt(),getFilteredRowModel:bdt(),getPaginationRowModel:ydt(),getSortedRowModel:vdt(),getFacetedRowModel:mdt(),getFacetedUniqueValues:gdt()});return v.useEffect(()=>{if(a){const w=S.getFilteredSelectedRowModel().rows.map(T=>T.original);a(w)}},[l,a,S]),m.jsxs("div",{className:"space-y-4",children:[n,m.jsx("div",{className:"rounded-md border",children:m.jsxs(vde,{children:[m.jsx(xde,{children:S.getHeaderGroups().map(w=>m.jsx(Bx,{children:w.headers.map(T=>m.jsx(Sde,{colSpan:T.colSpan,children:T.isPlaceholder?null:HW(T.column.columnDef.header,T.getContext())},T.id))},w.id))}),m.jsx(Ede,{children:S.getRowModel().rows?.length?S.getRowModel().rows.map(w=>m.jsx(Bx,{"data-state":w.getIsSelected()&&"selected",onClick:()=>r?.(w.original),className:r?"cursor-pointer":"",children:w.getVisibleCells().map(T=>m.jsx(iI,{children:HW(T.column.columnDef.cell,T.getContext())},T.id))},w.id)):m.jsx(Bx,{children:m.jsx(iI,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})}),i&&m.jsx(kdt,{table:S,showRowSelection:o})]})}const wde=Gae,Cde=qae,Ndt=v.forwardRef(({className:e,inset:t,children:n,...r},i)=>m.jsxs(HP,{ref:i,className:Re("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,m.jsx(sh,{className:"ml-auto"})]}));Ndt.displayName=HP.displayName;const _dt=v.forwardRef(({className:e,...t},n)=>m.jsx(zP,{ref:n,className:Re("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));_dt.displayName=zP.displayName;const DF=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(Yet,{children:m.jsx(PP,{ref:r,sideOffset:t,className:Re("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));DF.displayName=PP.displayName;const kb=v.forwardRef(({className:e,inset:t,...n},r)=>m.jsx(BP,{ref:r,className:Re("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));kb.displayName=BP.displayName;const Rdt=v.forwardRef(({className:e,children:t,checked:n,...r},i)=>m.jsxs(jP,{ref:i,className:Re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx($P,{children:m.jsx(Ss,{className:"h-4 w-4"})})}),t]}));Rdt.displayName=jP.displayName;const Ddt=v.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(Wae,{ref:r,className:Re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx($P,{children:m.jsx(tY,{className:"h-2 w-2 fill-current"})})}),t]}));Ddt.displayName=Wae.displayName;const Idt=v.forwardRef(({className:e,inset:t,...n},r)=>m.jsx(FP,{ref:r,className:Re("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Idt.displayName=FP.displayName;const Tde=v.forwardRef(({className:e,...t},n)=>m.jsx(UP,{ref:n,className:Re("-mx-1 my-1 h-px bg-muted",e),...t}));Tde.displayName=UP.displayName;function pd({column:e,title:t,className:n}){return e.getCanSort()?m.jsx("div",{className:Re("flex items-center space-x-2",n),children:m.jsxs(wde,{children:[m.jsx(Cde,{asChild:!0,children:m.jsxs(Qe,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[m.jsx("span",{children:t}),e.getIsSorted()==="desc"?m.jsx(h_,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?m.jsx(oh,{className:"ml-2 h-4 w-4"}):m.jsx(jx,{className:"ml-2 h-4 w-4"})]})}),m.jsxs(DF,{align:"start",children:[m.jsxs(kb,{onClick:()=>e.toggleSorting(!1),children:[m.jsx(oh,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),m.jsxs(kb,{onClick:()=>e.toggleSorting(!0),children:[m.jsx(h_,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),e.getCanHide()&&m.jsxs(m.Fragment,{children:[m.jsx(Tde,{}),m.jsxs(kb,{onClick:()=>e.toggleVisibility(!1),children:[m.jsx(m_,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})]})}):m.jsx("div",{className:Re(n),children:t})}const Odt=[{id:"select",header:({table:e})=>m.jsx(FS,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t),"aria-label":"Select all",className:"translate-y-[2px]",onClick:t=>t.stopPropagation()}),cell:({row:e})=>m.jsx(FS,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(!!t),"aria-label":"Select row",className:"translate-y-[2px]",onClick:t=>t.stopPropagation()}),enableSorting:!1,enableHiding:!1},{accessorKey:"id",header:({column:e})=>m.jsx(pd,{column:e,title:"ID"}),cell:({row:e})=>m.jsxs("div",{className:"w-[60px] font-mono text-xs text-muted-foreground",children:["#",e.getValue("id")]}),enableSorting:!0,enableHiding:!1},{accessorKey:"title",header:({column:e})=>m.jsx(pd,{column:e,title:"Title"}),cell:({row:e})=>{const t=e.original;return m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("span",{className:"font-medium line-clamp-1",children:t.title}),t.description&&m.jsx("span",{className:"text-xs text-muted-foreground line-clamp-1",children:t.description})]})},enableSorting:!0},{accessorKey:"status",header:({column:e})=>m.jsx(pd,{column:e,title:"Status"}),cell:({row:e})=>{const t=e.getValue("status");return m.jsx(aue,{status:t})},filterFn:(e,t,n)=>n.includes(e.getValue(t)),enableSorting:!0},{accessorKey:"priority",header:({column:e})=>m.jsx(pd,{column:e,title:"Priority"}),cell:({row:e})=>{const t=e.getValue("priority");return m.jsx(lue,{priority:t})},filterFn:(e,t,n)=>n.includes(e.getValue(t)),enableSorting:!0,sortingFn:(e,t)=>{const n={high:0,medium:1,low:2},r=n[e.getValue("priority")]??1,i=n[t.getValue("priority")]??1;return r-i}},{accessorKey:"assignee",header:({column:e})=>m.jsx(pd,{column:e,title:"Assignee"}),cell:({row:e})=>{const t=e.getValue("assignee");return t?m.jsx("span",{className:"text-sm font-mono",children:t}):m.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})},filterFn:(e,t,n)=>{const r=e.getValue(t);return r?n.includes(r):n.includes("unassigned")},enableSorting:!0},{accessorKey:"labels",header:({column:e})=>m.jsx(pd,{column:e,title:"Labels"}),cell:({row:e})=>{const t=e.getValue("labels");return t.length>0?m.jsx(cue,{labels:t,maxVisible:2}):m.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})},filterFn:(e,t,n)=>{const r=e.getValue(t);return n.some(i=>r.includes(i))},enableSorting:!1},{accessorKey:"acceptanceCriteria",header:({column:e})=>m.jsx(pd,{column:e,title:"Progress"}),cell:({row:e})=>{const t=e.original.acceptanceCriteria;if(t.length===0)return m.jsx("span",{className:"text-muted-foreground text-sm",children:"-"});const n=t.filter(o=>o.completed).length,r=t.length,i=Math.round(n/r*100);return m.jsxs("div",{className:"flex items-center gap-2 min-w-[80px]",children:[m.jsx("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:m.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${i}%`}})}),m.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[n,"/",r]})]})},enableSorting:!1}];function Mdt({globalFilter:e,setGlobalFilter:t,statusFilter:n,setStatusFilter:r,priorityFilter:i,setPriorityFilter:o,onNewTask:s}){const a=e||n!=="all"||i!=="all";return m.jsxs("div",{className:"flex items-center justify-between gap-4",children:[m.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[m.jsxs("div",{className:"relative w-[250px]",children:[m.jsx(KS,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),m.jsx(Wr,{placeholder:"Search tasks...",value:e,onChange:l=>t(l.target.value),className:"pl-8"})]}),m.jsxs(qi,{value:n,onValueChange:r,children:[m.jsx(Mi,{className:"w-[150px]",children:m.jsx(Wi,{placeholder:"Status"})}),m.jsxs(Li,{children:[m.jsx(Tn,{value:"all",children:"All Status"}),m.jsx(Tn,{value:"todo",children:"To Do"}),m.jsx(Tn,{value:"in-progress",children:"In Progress"}),m.jsx(Tn,{value:"in-review",children:"In Review"}),m.jsx(Tn,{value:"blocked",children:"Blocked"}),m.jsx(Tn,{value:"done",children:"Done"})]})]}),m.jsxs(qi,{value:i,onValueChange:o,children:[m.jsx(Mi,{className:"w-[150px]",children:m.jsx(Wi,{placeholder:"Priority"})}),m.jsxs(Li,{children:[m.jsx(Tn,{value:"all",children:"All Priority"}),m.jsx(Tn,{value:"high",children:"High"}),m.jsx(Tn,{value:"medium",children:"Medium"}),m.jsx(Tn,{value:"low",children:"Low"})]})]}),a&&m.jsxs(Qe,{variant:"ghost",onClick:()=>{t(""),r("all"),o("all")},className:"h-8 px-2 lg:px-3",children:["Reset",m.jsx(Ho,{className:"ml-2 h-4 w-4"})]})]}),s&&m.jsxs(Qe,{onClick:s,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Cs,{className:"mr-2 h-4 w-4"}),"New Task"]})]})}function Ldt({tasks:e,onTaskClick:t,onSelectionChange:n,onNewTask:r}){const[i,o]=v.useState(""),[s,a]=v.useState("all"),[l,c]=v.useState("all"),u=v.useMemo(()=>{let f=e;if(i){const h=i.toLowerCase();f=f.filter(g=>g.id.toLowerCase().includes(h)||g.title.toLowerCase().includes(h)||g.description?.toLowerCase().includes(h)||g.assignee?.toLowerCase().includes(h)||g.labels.some(y=>y.toLowerCase().includes(h)))}return s!=="all"&&(f=f.filter(h=>h.status===s)),l!=="all"&&(f=f.filter(h=>h.priority===l)),f},[e,i,s,l]);return m.jsx(Adt,{columns:Odt,data:u,onRowClick:t,onSelectionChange:n,showPagination:!0,showRowSelection:!0,initialSorting:[{id:"priority",desc:!1}],toolbar:m.jsx(Mdt,{table:null,globalFilter:i,setGlobalFilter:o,statusFilter:s,setStatusFilter:a,priorityFilter:l,setPriorityFilter:c,onNewTask:r})})}const f_=["todo","in-progress","in-review","done","blocked","on-hold","urgent"],Pdt=["gray","blue","green","yellow","red","purple","orange","pink","cyan","indigo"];function Fdt(){const{config:e,loading:t,updateConfig:n}=sf(),[r,i]=v.useState({}),[o,s]=v.useState(!1),[a,l]=v.useState(null),[c,u]=v.useState("form"),[f,h]=v.useState(""),[g,y]=v.useState(null),[E,S]=v.useState(""),[w,T]=v.useState(!1);v.useEffect(()=>{!t&&!w&&(i(e),h(JSON.stringify(e,null,2)),T(!0))},[e,t,w]);const A=r,R=i;v.useEffect(()=>{c==="form"&&h(JSON.stringify(A,null,2))},[A,c]);const _=async()=>{s(!0),l(null);try{let B=A;if(c==="json")try{B=JSON.parse(f),R(B),y(null)}catch{y("Invalid JSON syntax"),s(!1);return}await n(B),l({type:"success",text:"Configuration saved successfully!"}),setTimeout(()=>l(null),3e3)}catch(B){l({type:"error",text:B instanceof Error?B.message:"Failed to save config"})}finally{s(!1)}},D=()=>{if(!E.trim())return;const B=E.toLowerCase().replace(/\s+/g,"-"),z=A.statuses||f_;if(z.includes(B)){l({type:"error",text:"Status already exists"});return}R({...A,statuses:[...z,B],statusColors:{...A.statusColors||{},[B]:"gray"}}),S("")},I=B=>{const z=A.statuses||f_,X={...A.statusColors||{}};delete X[B],R({...A,statuses:z.filter(U=>U!==B),statusColors:X,visibleColumns:(A.visibleColumns||[]).filter(U=>U!==B)})},M=(B,z)=>{R({...A,statusColors:{...A.statusColors||{},[B]:z}})};if(t)return m.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:m.jsx("div",{className:"text-lg text-muted-foreground",children:"Loading configuration..."})});const H=A.statuses||f_,F=A.statusColors||{};return m.jsx(Yi,{className:"h-full",children:m.jsxs("div",{className:"p-6 max-w-3xl",children:[m.jsxs("div",{className:"mb-6 flex items-center justify-between shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(lI,{className:"w-6 h-6"}),m.jsx("h1",{className:"text-2xl font-bold",children:"Configuration"})]}),m.jsxs("div",{className:"flex rounded-lg border overflow-hidden",children:[m.jsxs("button",{type:"button",onClick:()=>u("form"),className:`px-3 py-1.5 text-sm flex items-center gap-1.5 transition-colors ${c==="form"?"bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:[m.jsx(Nme,{className:"w-4 h-4"}),"Form"]}),m.jsxs("button",{type:"button",onClick:()=>u("json"),className:`px-3 py-1.5 text-sm flex items-center gap-1.5 transition-colors ${c==="json"?"bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:[m.jsx(Uhe,{className:"w-4 h-4"}),"JSON"]})]})]}),a&&m.jsx("div",{className:`mb-6 p-4 rounded-lg ${a.type==="success"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-200"}`,children:a.text}),c==="json"?m.jsxs("div",{className:"bg-card rounded-lg border p-6 space-y-4",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"config.json"}),m.jsx("textarea",{value:f,onChange:B=>{h(B.target.value),y(null)},className:"w-full h-96 px-3 py-2 rounded-lg border bg-input font-mono text-sm focus:outline-none focus:ring-2 focus:ring-ring",spellCheck:!1}),g&&m.jsx("p",{className:"mt-2 text-sm text-destructive",children:g})]}),m.jsx("div",{className:"pt-4 border-t",children:m.jsxs(Qe,{onClick:_,disabled:o,children:[m.jsx(Ss,{className:"w-4 h-4 mr-2"}),o?"Saving...":"Save Configuration"]})})]}):m.jsxs("div",{className:"bg-card rounded-lg border p-6 space-y-6",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Project Name"}),m.jsx(Wr,{type:"text",value:A.name||"",onChange:B=>R({...A,name:B.target.value}),placeholder:"My Project"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Name of your project"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Assignee"}),m.jsx(Wr,{type:"text",value:A.defaultAssignee||"",onChange:B=>R({...A,defaultAssignee:B.target.value}),placeholder:"@username"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Default assignee for new tasks (e.g., @claude)"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Priority"}),m.jsxs("select",{value:A.defaultPriority||"medium",onChange:B=>R({...A,defaultPriority:B.target.value}),className:"w-full px-3 py-2 rounded-lg border bg-input focus:outline-none focus:ring-2 focus:ring-ring",children:[m.jsx("option",{value:"low",children:"Low"}),m.jsx("option",{value:"medium",children:"Medium"}),m.jsx("option",{value:"high",children:"High"})]}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Default priority for new tasks"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Labels"}),m.jsx(Wr,{type:"text",value:A.defaultLabels?.join(", ")||"",onChange:B=>R({...A,defaultLabels:B.target.value.split(",").map(z=>z.trim()).filter(Boolean)}),placeholder:"frontend, backend, ui"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Comma-separated list of default labels for new tasks"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Time Format"}),m.jsxs("select",{value:A.timeFormat||"24h",onChange:B=>R({...A,timeFormat:B.target.value}),className:"w-full px-3 py-2 rounded-lg border bg-input focus:outline-none focus:ring-2 focus:ring-ring",children:[m.jsx("option",{value:"12h",children:"12-hour (AM/PM)"}),m.jsx("option",{value:"24h",children:"24-hour"})]}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Time display format"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Editor"}),m.jsx(Wr,{type:"text",value:A.editor||"",onChange:B=>R({...A,editor:B.target.value}),placeholder:"code, vim, nano"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Default editor command for editing files"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Task Statuses"}),m.jsx("div",{className:"space-y-2 mb-3",children:H.map(B=>m.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-accent",children:[m.jsx("span",{className:"flex-1 font-mono text-sm",children:B}),m.jsx("select",{value:F[B]||"gray",onChange:z=>M(B,z.target.value),className:"px-2 py-1 rounded border bg-input text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:Pdt.map(z=>m.jsx("option",{value:z,children:z},z))}),m.jsx("button",{type:"button",onClick:()=>I(B),className:"p-1 text-destructive hover:text-destructive hover:bg-destructive/10 rounded transition-colors",title:"Remove status",children:m.jsx(Pd,{className:"w-4 h-4"})})]},B))}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(Wr,{type:"text",value:E,onChange:B=>S(B.target.value),placeholder:"new-status",className:"flex-1",onKeyDown:B=>B.key==="Enter"&&D()}),m.jsxs(Qe,{onClick:D,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Cs,{className:"w-4 h-4 mr-2"}),"Add"]})]}),m.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Define custom task statuses and their colors for the Kanban board"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Visible Kanban Columns"}),m.jsx("div",{className:"space-y-2",children:H.map(B=>{const z=A.visibleColumns?.includes(B)??!0,X=B.split("-").map(U=>U.charAt(0).toUpperCase()+U.slice(1)).join(" ");return m.jsxs("label",{className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity",children:[m.jsx("input",{type:"checkbox",checked:z,onChange:U=>{const K=A.visibleColumns||H,G=U.target.checked?[...K,B]:K.filter(Q=>Q!==B);R({...A,visibleColumns:G})},className:"w-4 h-4 rounded border-border text-primary focus:ring-primary"}),m.jsx("span",{children:X})]},B)})}),m.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Select which columns to show in the Kanban board"})]}),m.jsx("div",{className:"pt-4 border-t",children:m.jsxs(Qe,{onClick:_,disabled:o,children:[m.jsx(Ss,{className:"w-4 h-4 mr-2"}),o?"Saving...":"Save Configuration"]})})]})]})})}function Bdt(){const[e,t]=v.useState([]),[n,r]=v.useState(!0),[i,o]=v.useState(null),[s,a]=v.useState(!1),[l,c]=v.useState(""),[u,f]=v.useState(!1),[h,g]=v.useState(!1),[y,E]=v.useState(""),[S,w]=v.useState(""),[T,A]=v.useState(""),[R,_]=v.useState(""),[D,I]=v.useState(""),[M,H]=v.useState(!1),[F,B]=v.useState(new Set(["(root)"])),[z,X]=v.useState(!1),U=v.useRef(null);v.useEffect(()=>{G()},[]),cu("docs:updated",()=>{G()}),cu("docs:refresh",()=>{G()});const K=v.useCallback(()=>{if(e.length===0)return;const ie=window.location.hash.match(/^#\/docs\/(.+)$/);if(ie){const te=decodeURIComponent(ie[1]),fe=Qx(te).replace(/^\.\//,"").replace(/^\//,""),Ce=e.find(Oe=>{const ve=Qx(Oe.path);return ve===fe||ve.endsWith(`/${fe}`)||Oe.filename===fe});Ce&&Ce!==i&&(o(Ce),a(!1))}},[e,i]);v.useEffect(()=>{K()},[K]),v.useEffect(()=>{if(!i||!i.folder)return;const W=i.folder.split("/"),ie=[];let te="";for(const fe of W)te=te?`${te}/${fe}`:fe,ie.push(te);B(fe=>{const Ce=new Set(fe);for(const Oe of ie)Ce.add(Oe);return Ce})},[i]),v.useEffect(()=>(window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)),[K]),v.useEffect(()=>{const W=te=>{let fe=te.target;for(;fe&&fe.tagName!=="A"&&fe!==U.current;)fe=fe.parentElement;if(fe&&fe.tagName==="A"){const Oe=fe.getAttribute("href");if(Oe&&/^task-\d+(.md)?$/.test(Oe)){te.preventDefault();const ve=Oe.replace(".md","");window.location.hash=`/tasks?task=${ve}`;return}if(Oe&&(Oe.endsWith(".md")||Oe.includes(".md#"))){te.preventDefault();let ve=Oe.replace(/^\.\//,"").replace(/^\//,"");ve=ve.split("#")[0],window.location.hash=`/docs/${ve}`}}},ie=U.current;if(ie)return ie.addEventListener("click",W),()=>ie.removeEventListener("click",W)},[e,i]);const G=()=>{oI().then(W=>{t(W),r(!1)}).catch(W=>{console.error("Failed to load docs:",W),r(!1)})},Q=async()=>{if(!y.trim()){alert("Please enter a title");return}H(!0);try{const W=T.split(",").map(ie=>ie.trim()).filter(ie=>ie);await ehe({title:y,description:S,tags:W,folder:R,content:D}),E(""),w(""),A(""),_(""),I(""),g(!1),G()}catch(W){console.error("Failed to create doc:",W),alert("Failed to create document. Please try again.")}finally{H(!1)}},J=()=>{i&&(c(i.content),a(!0))},re=()=>{if(i){const ie=`@doc/${WA(i.path).replace(/\.md$/,"")}`;navigator.clipboard.writeText(ie).then(()=>{X(!0),setTimeout(()=>X(!1),2e3)})}},j=async()=>{if(i){f(!0);try{const W=await the(pEe(i.path),{content:l});t(ie=>ie.map(te=>te.path===i.path?{...te,content:l,metadata:{...te.metadata,updatedAt:new Date().toISOString()}}:te)),o(ie=>ie&&{...ie,content:l}),a(!1)}catch(W){console.error("Failed to save doc:",W),alert(W instanceof Error?W.message:"Failed to save document")}finally{f(!1)}}},Z=()=>{a(!1),c("")},V=W=>{B(ie=>{const te=new Set(ie);return te.has(W)?te.delete(W):te.add(W),te})},P=()=>{const W={name:"(root)",path:"",docs:[],children:new Map};for(const ie of e)if(!ie.folder)W.docs.push(ie);else{const te=ie.folder.split("/");let fe=W;for(let Ce=0;Ce<te.length;Ce++){const Oe=te[Ce],ve=te.slice(0,Ce+1).join("/");fe.children.has(Oe)||fe.children.set(Oe,{name:Oe,path:ve,docs:[],children:new Map}),fe=fe.children.get(Oe)}fe.docs.push(ie)}return W},se=W=>{let ie=W.docs.length;for(const te of W.children.values())ie+=se(te);return ie},ae=(W,ie=0)=>{const te=[],fe=ie===0||F.has(W.path),Ce=`${ie*16}px`;if(ie>0){const Oe=se(W);te.push(m.jsxs("button",{type:"button",onClick:()=>V(W.path),className:"w-full flex items-center gap-2 px-3 py-2 hover:bg-accent text-foreground transition-colors",style:{paddingLeft:Ce},children:[fe?m.jsx(uu,{className:"w-4 h-4"}):m.jsx(sh,{className:"w-4 h-4"}),fe?m.jsx(Jhe,{className:"w-4 h-4"}):m.jsx(L7,{className:"w-4 h-4"}),m.jsx("span",{className:"text-sm font-medium",children:W.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",Oe,")"]})]},`folder-${W.path}`))}if(fe||ie===0){const Oe=Array.from(W.children.values()).sort((tt,nt)=>tt.name.localeCompare(nt.name));for(const tt of Oe)te.push(...ae(tt,ie+1));const ve=[...W.docs].sort((tt,nt)=>tt.metadata.title.localeCompare(nt.metadata.title));for(const tt of ve)te.push(m.jsxs("button",{type:"button",onClick:()=>{window.location.hash=`/docs/${WA(tt.path)}`},className:`w-full text-left px-3 py-2 flex items-center gap-2 hover:bg-accent text-foreground transition-colors ${i?.path===tt.path?"bg-accent":""}`,style:{paddingLeft:`${(ie+1)*16}px`},children:[m.jsx(Vo,{className:"w-5 h-5"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"text-sm font-medium truncate",children:tt.metadata.title}),tt.metadata.description&&m.jsx("div",{className:"text-xs text-muted-foreground truncate",children:tt.metadata.description})]})]},`doc-${tt.path}`))}return te};return n?m.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:m.jsx("div",{className:"text-lg text-muted-foreground",children:"Loading documentation..."})}):m.jsxs("div",{className:"p-6 h-full flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[m.jsx("h1",{className:"text-2xl font-bold",children:"Documentation"}),m.jsxs(Qe,{onClick:()=>g(!0),className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Cs,{className:"w-4 h-4 mr-2"}),"New Document"]})]}),m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 flex-1 min-h-0 overflow-hidden",children:[m.jsxs("div",{className:"lg:col-span-1 flex flex-col min-h-0 overflow-hidden",children:[m.jsxs("div",{className:"bg-card rounded-lg border overflow-hidden flex flex-col flex-1 min-h-0",children:[m.jsx("div",{className:"p-4 border-b shrink-0",children:m.jsxs("h2",{className:"font-semibold",children:["All Documents (",e.length,")"]})}),m.jsx(Yi,{className:"flex-1",children:ae(P())})]}),e.length===0&&m.jsxs("div",{className:"bg-card rounded-lg border p-8 text-center",children:[m.jsx(Vo,{className:"w-5 h-5"}),m.jsx("p",{className:"mt-2 text-muted-foreground",children:"No documentation found"}),m.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Create a doc with: ",m.jsx("code",{className:"font-mono",children:'knowns doc create "Title"'})]})]})]}),m.jsx("div",{className:"lg:col-span-2 flex flex-col min-h-0 overflow-hidden",children:i?m.jsxs("div",{className:"bg-card rounded-lg border overflow-hidden flex flex-col flex-1 min-h-0",children:[m.jsxs("div",{className:"p-6 border-b flex items-start justify-between shrink-0",children:[m.jsxs("div",{className:"flex-1",children:[m.jsx("h2",{className:"text-2xl font-bold mb-2",children:i.metadata.title}),i.metadata.description&&m.jsx("p",{className:"text-muted-foreground mb-2",children:i.metadata.description}),m.jsxs("button",{type:"button",onClick:re,className:"flex items-center gap-2 px-2 py-1 rounded text-xs text-blue-600 dark:text-blue-400 hover:bg-accent transition-colors group",title:"Click to copy reference",children:[m.jsx(L7,{className:"w-4 h-4"}),m.jsxs("span",{className:"font-mono",children:["@doc/",WA(i.path).replace(/\.md$/,"")]}),m.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:z?"✓ Copied!":m.jsx(Ghe,{className:"w-4 h-4"})})]}),m.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["Last updated: ",new Date(i.metadata.updatedAt).toLocaleString()]})]}),m.jsx("div",{className:"flex gap-2 ml-4",children:s?m.jsxs(m.Fragment,{children:[m.jsxs(Qe,{onClick:j,disabled:u,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Ss,{className:"w-4 h-4 mr-2"}),u?"Saving...":"Save"]}),m.jsxs(Qe,{variant:"secondary",onClick:Z,disabled:u,children:[m.jsx(Ho,{className:"w-4 h-4 mr-2"}),"Cancel"]})]}):m.jsxs(Qe,{onClick:J,children:[m.jsx(cY,{className:"w-4 h-4 mr-2"}),"Edit"]})})]}),s?m.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:m.jsx("div",{className:"flex-1 p-6 min-h-0",children:m.jsx(au,{markdown:l,onChange:c,placeholder:"Write your documentation here..."})})}):m.jsx(Yi,{className:"flex-1",children:m.jsx("div",{className:"p-6 prose prose-sm dark:prose-invert max-w-none",ref:U,children:m.jsx(Gw,{markdown:i.content||""})})})]}):m.jsxs("div",{className:"bg-card rounded-lg border p-12 text-center",children:[m.jsx(Vo,{className:"w-5 h-5"}),m.jsx("p",{className:"mt-4 text-muted-foreground",children:"Select a document to view its content"})]})})]}),h&&m.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:m.jsxs("div",{className:"bg-card rounded-lg shadow-xl max-w-4xl w-full h-[90vh] flex flex-col",children:[m.jsx("div",{className:"p-6 border-b shrink-0",children:m.jsx("h2",{className:"text-xl font-bold",children:"Create New Document"})}),m.jsxs("div",{className:"p-6 space-y-4 flex-1 flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Title *"}),m.jsx(Wr,{type:"text",value:y,onChange:W=>E(W.target.value),placeholder:"Document title"})]}),m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Description"}),m.jsx(Wr,{type:"text",value:S,onChange:W=>w(W.target.value),placeholder:"Brief description"})]}),m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Folder (optional)"}),m.jsx(Wr,{type:"text",value:R,onChange:W=>_(W.target.value),placeholder:"api/auth, guides, etc. (leave empty for root)"})]}),m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Tags (comma-separated)"}),m.jsx(Wr,{type:"text",value:T,onChange:W=>A(W.target.value),placeholder:"guide, tutorial, api"})]}),m.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Content"}),m.jsx("div",{className:"flex-1 min-h-[400px]",children:m.jsx(au,{markdown:D,onChange:I,placeholder:"Write your documentation here..."})})]})]}),m.jsxs("div",{className:"p-6 border-t flex justify-end gap-3 shrink-0",children:[m.jsx(Qe,{variant:"secondary",onClick:()=>{g(!1),E(""),w(""),A(""),_(""),I("")},disabled:M,children:"Cancel"}),m.jsx(Qe,{onClick:Q,disabled:M||!y.trim(),className:"bg-green-700 hover:bg-green-800 text-white",children:M?"Creating...":"Create Document"})]})]})})]})}const jdt=[{label:"1 hour ago",value:3600*1e3},{label:"1 day ago",value:1440*60*1e3},{label:"1 week ago",value:10080*60*1e3},{label:"1 month ago",value:720*60*60*1e3},{label:"3 months ago",value:2160*60*60*1e3}];function zW({tasks:e,loading:t,onTasksUpdate:n,onNewTask:r}){const i=s=>{const a=Date.now()-s;return e.filter(l=>l.status==="done"&&new Date(l.updatedAt).getTime()<a).length},o=async(s,a)=>{try{const l=await ta.batchArchiveTasks(s);if(l.count>0){const c=new Set(l.tasks.map(u=>u.id));n(e.filter(u=>!c.has(u.id))),jl.success(`Archived ${l.count} task${l.count>1?"s":""} done before ${a}`)}else jl.info(`No done tasks found before ${a}`)}catch(l){console.error("Failed to batch archive tasks:",l),jl.error("Failed to archive tasks")}};return m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.jsx("div",{className:"shrink-0 p-6 pb-0",children:m.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4",children:[m.jsx("h1",{className:"text-2xl font-bold",children:"Kanban Board"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs(wde,{children:[m.jsx(Cde,{asChild:!0,children:m.jsxs(Qe,{variant:"outline",size:"default",className:"gap-2",children:[m.jsx(p_,{className:"w-4 h-4"}),m.jsx("span",{className:"hidden sm:inline",children:"Batch Archive"}),m.jsx(uu,{className:"w-3 h-3"})]})}),m.jsx(DF,{align:"end",children:jdt.map(s=>{const a=i(s.value);return m.jsxs(kb,{onClick:()=>o(s.value,s.label),disabled:a===0,children:[m.jsxs("span",{className:"flex-1",children:["Done before ",s.label]}),m.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",a,")"]})]},s.value)})})]}),m.jsxs(Qe,{onClick:r,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Cs,{className:"w-4 h-4 mr-2"}),"New Task"]})]})]})}),m.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-6",children:m.jsx($ct,{tasks:e,loading:t,onTasksUpdate:n})})]})}const VW={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold",urgent:"Urgent"};function $dt(e){return VW[e]?VW[e]:e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Udt({tasks:e,onTaskClick:t,onNewTask:n}){const[r,i]=v.useState("all"),[o,s]=v.useState("all"),[a,l]=v.useState(new Set),c=e.filter(g=>g.subtasks&&g.subtasks.length>0);let u=r==="all"?e:e.filter(g=>g.status===r);o==="root"?u=u.filter(g=>!g.parent):o!=="all"&&(u=u.filter(g=>g.parent===o));const f={todo:[],"in-progress":[],"in-review":[],blocked:[],done:[]};for(const g of u)f[g.status]&&f[g.status].push(g);const h={high:0,medium:1,low:2};for(const g in f)f[g].sort((y,E)=>{const S=h[y.priority]-h[E.priority];return S!==0?S:y.id.localeCompare(E.id,void 0,{numeric:!0})});return m.jsxs("div",{className:"h-full flex flex-col",children:[m.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4",children:[m.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[m.jsx(sI,{className:"w-4 h-4 text-muted-foreground"}),m.jsxs(qi,{value:r,onValueChange:i,children:[m.jsx(Mi,{className:"w-[150px]",children:m.jsx(Wi,{placeholder:"Status"})}),m.jsxs(Li,{children:[m.jsx(Tn,{value:"all",children:"All Status"}),m.jsx(Tn,{value:"todo",children:"To Do"}),m.jsx(Tn,{value:"in-progress",children:"In Progress"}),m.jsx(Tn,{value:"in-review",children:"In Review"}),m.jsx(Tn,{value:"blocked",children:"Blocked"}),m.jsx(Tn,{value:"done",children:"Done"})]})]}),m.jsxs(qi,{value:o,onValueChange:s,children:[m.jsx(Mi,{className:"w-[200px]",children:m.jsx(Wi,{placeholder:"Parent"})}),m.jsxs(Li,{children:[m.jsx(Tn,{value:"all",children:"All Tasks"}),m.jsx(Tn,{value:"root",children:"Root Tasks Only"}),c.map(g=>{const y=`Subtasks of #${g.id}: ${g.title}`,E=y.length>40?y.substring(0,40)+"...":y;return m.jsx(Tn,{value:g.id,title:y,children:E},g.id)})]})]}),m.jsxs("span",{className:"text-muted-foreground text-sm",children:[u.length," ",u.length===1?"task":"tasks"]})]}),m.jsxs(Qe,{onClick:n,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Cs,{className:"mr-2 h-4 w-4"}),"New Task"]})]}),m.jsx(Yi,{className:"flex-1",children:m.jsxs("div",{className:"space-y-6 pr-4",children:[Object.entries(f).map(([g,y])=>y.length===0?null:m.jsxs("div",{children:[m.jsxs("h2",{className:"text-lg font-semibold mb-3",children:[$dt(g)," (",y.length,")"]}),m.jsx("div",{className:"space-y-2",children:y.map(E=>{const S=a.has(E.id),w=E.parent?e.find(T=>T.id===E.parent):null;return m.jsx("div",{className:"bg-card rounded-lg p-4 border transition-colors hover:bg-accent/50",children:m.jsxs("div",{className:"flex items-start gap-3",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["#",E.id]}),m.jsx(aue,{status:E.status}),m.jsx(lue,{priority:E.priority}),w&&m.jsxs("span",{className:"text-xs px-2 py-0.5 rounded bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400",children:["Subtask of #",w.id]}),E.subtasks&&E.subtasks.length>0&&m.jsxs("span",{className:"text-xs px-2 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",children:[E.subtasks.length," subtask",E.subtasks.length>1?"s":""]})]}),m.jsx("button",{type:"button",onClick:()=>t(E),className:"font-medium mb-1 hover:underline text-left w-full",children:E.title}),E.description&&m.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:[m.jsx("p",{className:S?"":"line-clamp-2",children:E.description}),E.description.length>100&&m.jsx("button",{type:"button",onClick:T=>{T.stopPropagation();const A=new Set(a);S?A.delete(E.id):A.add(E.id),l(A)},className:"text-xs text-primary hover:underline mt-1 font-medium",children:S?"Show less":"Show more"})]}),E.acceptanceCriteria.length>0&&m.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs text-muted-foreground",children:[m.jsx(nY,{className:"w-3 h-3"}),m.jsxs("span",{children:[E.acceptanceCriteria.filter(T=>T.completed).length,"/",E.acceptanceCriteria.length," criteria"]})]}),E.labels.length>0&&m.jsx("div",{className:"mt-2",children:m.jsx(cue,{labels:E.labels,maxVisible:3})})]}),E.assignee&&m.jsx("span",{className:"text-sm text-muted-foreground font-mono shrink-0",children:E.assignee})]})},E.id)})})]},g)),u.length===0&&m.jsx("div",{className:"text-center py-12",children:m.jsx("p",{className:"text-lg text-muted-foreground",children:"No tasks found"})})]})})]})}function Hdt({tasks:e,loading:t,onTasksUpdate:n,selectedTask:r,onTaskClose:i,onNewTask:o}){const[s,a]=v.useState("table"),[l,c]=v.useState(null),[u,f]=v.useState([]);v.useEffect(()=>{r&&c(r)},[r]);const h=y=>{window.location.hash=`/tasks/${y.id}`},g=y=>{window.location.hash=`/tasks/${y}`};return t?m.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:m.jsx("div",{className:"text-lg text-muted-foreground",children:"Loading tasks..."})}):m.jsxs("div",{className:"p-6 h-full flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[m.jsxs("div",{className:"flex items-center gap-4",children:[m.jsx("h1",{className:"text-2xl font-bold",children:"All Tasks"}),m.jsxs("span",{className:"text-muted-foreground",children:[e.length," ",e.length===1?"task":"tasks"]})]}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsxs("div",{className:"flex items-center border rounded-lg p-1",children:[m.jsxs(Qe,{variant:s==="table"?"secondary":"ghost",size:"sm",onClick:()=>a("table"),className:"h-8 px-3",children:[m.jsx(fme,{className:"h-4 w-4 mr-2"}),"Table"]}),m.jsxs(Qe,{variant:s==="grouped"?"secondary":"ghost",size:"sm",onClick:()=>a("grouped"),className:"h-8 px-3",children:[m.jsx(ume,{className:"h-4 w-4 mr-2"}),"Grouped"]})]})})]}),m.jsx("div",{className:"flex-1 overflow-hidden",children:s==="table"?m.jsx(Yi,{className:"h-full",children:m.jsx("div",{className:"pr-4",children:m.jsx(Ldt,{tasks:e,onTaskClick:h,onSelectionChange:f,onNewTask:o})})}):m.jsx(Udt,{tasks:e,onTaskClick:h,onNewTask:o})}),u.length>0&&m.jsxs("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 bg-primary text-primary-foreground px-4 py-2 rounded-lg shadow-lg flex items-center gap-4",children:[m.jsxs("span",{className:"text-sm font-medium",children:[u.length," task",u.length>1?"s":""," selected"]}),m.jsx(Qe,{variant:"secondary",size:"sm",onClick:()=>{console.log("Bulk action on:",u)},children:"Bulk Edit"})]}),m.jsx(vue,{task:l,allTasks:e,onClose:()=>{c(null),i&&i()},onUpdate:n,onNavigateToTask:g})]})}const kde=v.createContext({isDark:!1,toggle:()=>{}}),xm=()=>v.useContext(kde);function zdt(){const{config:e}=sf(),[t,n]=v.useState([]),[r,i]=v.useState(!0),[o,s]=v.useState(!1),[a,l]=v.useState(!1),[c,u]=v.useState(()=>{if(typeof window<"u"){const I=localStorage.getItem("theme");return I?I==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1}),f=()=>{const I=window.location.hash.slice(1);return I.startsWith("/tasks")?"tasks":I.startsWith("/docs")?"docs":I.startsWith("/config")?"config":(I.startsWith("/kanban")||I==="/"||I==="","kanban")},h=I=>{const M=window.location.hash.slice(1),H="(?:kanban|tasks)",F=M.match(new RegExp(`^/${H}/([^?]+)`))||M.match(/[?&]id=([^&]+)/);return F?F[1]:null},[g,y]=v.useState(f()),[E,S]=v.useState(window.location.hash);v.useEffect(()=>{const I=()=>{y(f()),S(window.location.hash)};return window.addEventListener("hashchange",I),()=>window.removeEventListener("hashchange",I)},[f]),v.useEffect(()=>{c?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))},[c]),v.useEffect(()=>{const I=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),l(H=>!H))};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[]),v.useEffect(()=>{ta.getTasks().then(I=>{n(I),i(!1)}).catch(I=>{console.error("Failed to load tasks:",I),i(!1)})},[]),cu("tasks:updated",({task:I})=>{n(M=>{const H=M.findIndex(F=>F.id===I.id);if(H>=0){const F=[...M];return F[H]=I,F}return[...M,I]})}),cu("tasks:refresh",()=>{ta.getTasks().then(n).catch(console.error)});const w=()=>{ta.getTasks().then(n).catch(console.error)},T=I=>{n(I)},A=async I=>{const M=!c;if(!document.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){u(M);return}const H=I.clientX,F=I.clientY,B=Math.hypot(Math.max(H,window.innerWidth-H),Math.max(F,window.innerHeight-F));await document.startViewTransition(()=>{u(M)}).ready,document.documentElement.animate({clipPath:[`circle(0px at ${H}px ${F}px)`,`circle(${B}px at ${H}px ${F}px)`]},{duration:400,easing:"ease-out",pseudoElement:"::view-transition-new(root)"})},R=I=>{window.location.hash=`/kanban/${I.id}`},_=I=>{I?.path?window.location.hash=`/docs/${I.path}`:I?.filename?window.location.hash=`/docs/${I.filename}`:window.location.hash="/docs"},D=()=>{switch(g){case"kanban":return m.jsx(zW,{tasks:t,loading:r,onTasksUpdate:T,onNewTask:()=>s(!0)});case"tasks":{const I=h(),M=I?t.find(H=>H.id===I):null;return m.jsx(Hdt,{tasks:t,loading:r,onTasksUpdate:w,selectedTask:M,onTaskClose:()=>{window.location.hash="/tasks"},onNewTask:()=>s(!0)})}case"docs":return m.jsx(Bdt,{});case"config":return m.jsx(Fdt,{});default:return m.jsx(zW,{tasks:t,loading:r,onTasksUpdate:T,onNewTask:()=>s(!0)})}};return m.jsxs(kde.Provider,{value:{isDark:c,toggle:A},children:[m.jsxs(Que,{children:[m.jsx(uut,{currentPage:g,onSearchClick:()=>l(!0)}),m.jsxs("main",{className:"flex flex-1 flex-col bg-background overflow-hidden",children:[m.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[m.jsx(ede,{className:"-ml-1"}),m.jsx(T0,{orientation:"vertical",className:"mr-2 h-4"}),m.jsx("div",{className:"flex flex-1 items-center gap-2 text-sm",children:m.jsx("span",{className:"font-semibold text-foreground",children:e.name||"Knowns"})}),m.jsx(Sst,{onTaskClick:I=>{window.location.hash=`/kanban/${I}`}}),m.jsx(vst,{isDark:c,onToggle:A,size:"sm"}),m.jsx(gut,{})]}),m.jsx("div",{className:"flex-1 w-full overflow-y-auto overflow-x-hidden",children:D()})]}),m.jsx(Hct,{isOpen:o,allTasks:t,onClose:()=>s(!1),onCreated:w}),m.jsx(yut,{open:a,onOpenChange:l,onTaskSelect:R,onDocSelect:_})]}),m.jsx(SSe,{})]})}function Vdt(){return m.jsx(Yme,{children:m.jsx(wSe,{children:m.jsx(TSe,{children:m.jsx(rhe,{children:m.jsx(ust,{children:m.jsx(zdt,{})})})})})})}const Ade=document.getElementById("root");if(!Ade)throw new Error("Root element not found");WW.createRoot(Ade).render(m.jsx(Vdt,{}));
|